qlogicagent 0.2.1 → 0.4.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 (226) hide show
  1. package/README.md +45 -45
  2. package/package.json +56 -42
  3. package/dist/agent/agent.d.ts +0 -43
  4. package/dist/agent/agent.js +0 -113
  5. package/dist/agent/tool-loop.d.ts +0 -64
  6. package/dist/agent/tool-loop.js +0 -575
  7. package/dist/agent/types.d.ts +0 -175
  8. package/dist/agent/types.js +0 -14
  9. package/dist/cli/main.d.ts +0 -11
  10. package/dist/cli/main.js +0 -23
  11. package/dist/cli/stdio-server.d.ts +0 -45
  12. package/dist/cli/stdio-server.js +0 -463
  13. package/dist/config/config.d.ts +0 -17
  14. package/dist/config/config.js +0 -21
  15. package/dist/contracts/hooks.d.ts +0 -120
  16. package/dist/contracts/hooks.js +0 -7
  17. package/dist/contracts/index.d.ts +0 -10
  18. package/dist/contracts/index.js +0 -10
  19. package/dist/contracts/planner.d.ts +0 -35
  20. package/dist/contracts/planner.js +0 -2
  21. package/dist/contracts/skill-candidate.d.ts +0 -63
  22. package/dist/contracts/skill-candidate.js +0 -195
  23. package/dist/contracts/todo.d.ts +0 -14
  24. package/dist/contracts/todo.js +0 -9
  25. package/dist/index.d.ts +0 -13
  26. package/dist/index.js +0 -15
  27. package/dist/llm/builtin-providers.d.ts +0 -10
  28. package/dist/llm/builtin-providers.js +0 -531
  29. package/dist/llm/index.d.ts +0 -15
  30. package/dist/llm/index.js +0 -14
  31. package/dist/llm/llm-client.d.ts +0 -43
  32. package/dist/llm/llm-client.js +0 -67
  33. package/dist/llm/model-catalog.d.ts +0 -53
  34. package/dist/llm/model-catalog.js +0 -191
  35. package/dist/llm/provider-def.d.ts +0 -59
  36. package/dist/llm/provider-def.js +0 -12
  37. package/dist/llm/provider-registry.d.ts +0 -54
  38. package/dist/llm/provider-registry.js +0 -147
  39. package/dist/llm/transport.d.ts +0 -62
  40. package/dist/llm/transport.js +0 -27
  41. package/dist/llm/transports/anthropic-messages.d.ts +0 -31
  42. package/dist/llm/transports/anthropic-messages.js +0 -293
  43. package/dist/llm/transports/openai-chat.d.ts +0 -36
  44. package/dist/llm/transports/openai-chat.js +0 -165
  45. package/dist/orchestration/agent-registry.d.ts +0 -41
  46. package/dist/orchestration/agent-registry.js +0 -116
  47. package/dist/orchestration/approval-aware-tool-plan.d.ts +0 -32
  48. package/dist/orchestration/approval-aware-tool-plan.js +0 -87
  49. package/dist/orchestration/context-compression.d.ts +0 -220
  50. package/dist/orchestration/context-compression.js +0 -583
  51. package/dist/orchestration/conversation-repair.d.ts +0 -61
  52. package/dist/orchestration/conversation-repair.js +0 -429
  53. package/dist/orchestration/curator-scheduler.d.ts +0 -119
  54. package/dist/orchestration/curator-scheduler.js +0 -135
  55. package/dist/orchestration/embedded-failover-policy.d.ts +0 -110
  56. package/dist/orchestration/embedded-failover-policy.js +0 -168
  57. package/dist/orchestration/error-classification.d.ts +0 -12
  58. package/dist/orchestration/error-classification.js +0 -77
  59. package/dist/orchestration/failover-classification.d.ts +0 -8
  60. package/dist/orchestration/failover-classification.js +0 -381
  61. package/dist/orchestration/failover-error.d.ts +0 -33
  62. package/dist/orchestration/failover-error.js +0 -198
  63. package/dist/orchestration/fork-subagent.d.ts +0 -100
  64. package/dist/orchestration/fork-subagent.js +0 -98
  65. package/dist/orchestration/index.d.ts +0 -120
  66. package/dist/orchestration/index.js +0 -267
  67. package/dist/orchestration/memory-flush-policy.d.ts +0 -57
  68. package/dist/orchestration/memory-flush-policy.js +0 -85
  69. package/dist/orchestration/memory-provider.d.ts +0 -14
  70. package/dist/orchestration/memory-provider.js +0 -2
  71. package/dist/orchestration/parallel-tool-calls.d.ts +0 -41
  72. package/dist/orchestration/parallel-tool-calls.js +0 -59
  73. package/dist/orchestration/prompt-cache-strategy.d.ts +0 -126
  74. package/dist/orchestration/prompt-cache-strategy.js +0 -228
  75. package/dist/orchestration/reactive-compact.d.ts +0 -73
  76. package/dist/orchestration/reactive-compact.js +0 -78
  77. package/dist/orchestration/retry-loop.d.ts +0 -22
  78. package/dist/orchestration/retry-loop.js +0 -24
  79. package/dist/orchestration/skill-candidate.d.ts +0 -52
  80. package/dist/orchestration/skill-candidate.js +0 -141
  81. package/dist/orchestration/skill-consolidation.d.ts +0 -123
  82. package/dist/orchestration/skill-consolidation.js +0 -220
  83. package/dist/orchestration/skill-improvement.d.ts +0 -59
  84. package/dist/orchestration/skill-improvement.js +0 -66
  85. package/dist/orchestration/skill-similarity.d.ts +0 -98
  86. package/dist/orchestration/skill-similarity.js +0 -131
  87. package/dist/orchestration/streaming-tool-executor.d.ts +0 -73
  88. package/dist/orchestration/streaming-tool-executor.js +0 -96
  89. package/dist/orchestration/team-orchestration.d.ts +0 -195
  90. package/dist/orchestration/team-orchestration.js +0 -369
  91. package/dist/orchestration/team-tool-loop-wiring.d.ts +0 -92
  92. package/dist/orchestration/team-tool-loop-wiring.js +0 -147
  93. package/dist/orchestration/tool-choice-policy.d.ts +0 -54
  94. package/dist/orchestration/tool-choice-policy.js +0 -164
  95. package/dist/orchestration/tool-loop-state.d.ts +0 -50
  96. package/dist/orchestration/tool-loop-state.js +0 -133
  97. package/dist/orchestration/tool-schema.d.ts +0 -39
  98. package/dist/orchestration/tool-schema.js +0 -297
  99. package/dist/orchestration/transcript-repair.d.ts +0 -42
  100. package/dist/orchestration/transcript-repair.js +0 -426
  101. package/dist/orchestration/turn-loop-guard.d.ts +0 -86
  102. package/dist/orchestration/turn-loop-guard.js +0 -92
  103. package/dist/orchestration/web-browser-policy.d.ts +0 -17
  104. package/dist/orchestration/web-browser-policy.js +0 -39
  105. package/dist/runtime/context-compression.d.ts +0 -61
  106. package/dist/runtime/context-compression.js +0 -274
  107. package/dist/runtime/hook-registry.d.ts +0 -12
  108. package/dist/runtime/hook-registry.js +0 -53
  109. package/dist/runtime/memory-hooks.d.ts +0 -23
  110. package/dist/runtime/memory-hooks.js +0 -65
  111. package/dist/runtime/tool-eligibility.d.ts +0 -59
  112. package/dist/runtime/tool-eligibility.js +0 -111
  113. package/dist/skills/index.d.ts +0 -108
  114. package/dist/skills/index.js +0 -82
  115. package/dist/skills/memory-extractor.d.ts +0 -64
  116. package/dist/skills/memory-extractor.js +0 -173
  117. package/dist/skills/memory-query-tool.d.ts +0 -43
  118. package/dist/skills/memory-query-tool.js +0 -127
  119. package/dist/skills/memory-store.d.ts +0 -66
  120. package/dist/skills/memory-store.js +0 -228
  121. package/dist/skills/memory-tool.d.ts +0 -67
  122. package/dist/skills/memory-tool.js +0 -192
  123. package/dist/skills/portable-tool.d.ts +0 -71
  124. package/dist/skills/portable-tool.js +0 -14
  125. package/dist/skills/qmemory-adapter.d.ts +0 -52
  126. package/dist/skills/qmemory-adapter.js +0 -165
  127. package/dist/skills/skill-frontmatter.d.ts +0 -19
  128. package/dist/skills/skill-frontmatter.js +0 -344
  129. package/dist/skills/skill-guard.d.ts +0 -23
  130. package/dist/skills/skill-guard.js +0 -229
  131. package/dist/skills/skill-loader.d.ts +0 -16
  132. package/dist/skills/skill-loader.js +0 -303
  133. package/dist/skills/skill-source.d.ts +0 -119
  134. package/dist/skills/skill-source.js +0 -126
  135. package/dist/skills/skill-types.d.ts +0 -199
  136. package/dist/skills/skill-types.js +0 -6
  137. package/dist/skills/think-tool.d.ts +0 -16
  138. package/dist/skills/think-tool.js +0 -59
  139. package/dist/skills/todo-tool.d.ts +0 -63
  140. package/dist/skills/todo-tool.js +0 -114
  141. package/dist/skills/tools/agent-tool.d.ts +0 -91
  142. package/dist/skills/tools/agent-tool.js +0 -142
  143. package/dist/skills/tools/apply-patch-tool.d.ts +0 -29
  144. package/dist/skills/tools/apply-patch-tool.js +0 -184
  145. package/dist/skills/tools/ask-user-tool.d.ts +0 -80
  146. package/dist/skills/tools/ask-user-tool.js +0 -121
  147. package/dist/skills/tools/brief-tool.d.ts +0 -74
  148. package/dist/skills/tools/brief-tool.js +0 -95
  149. package/dist/skills/tools/browser-tool.d.ts +0 -114
  150. package/dist/skills/tools/browser-tool.js +0 -155
  151. package/dist/skills/tools/checkpoint-tool.d.ts +0 -66
  152. package/dist/skills/tools/checkpoint-tool.js +0 -102
  153. package/dist/skills/tools/config-tool.d.ts +0 -63
  154. package/dist/skills/tools/config-tool.js +0 -143
  155. package/dist/skills/tools/cron-tool.d.ts +0 -116
  156. package/dist/skills/tools/cron-tool.js +0 -175
  157. package/dist/skills/tools/edit-tool.d.ts +0 -43
  158. package/dist/skills/tools/edit-tool.js +0 -70
  159. package/dist/skills/tools/exec-tool.d.ts +0 -102
  160. package/dist/skills/tools/exec-tool.js +0 -133
  161. package/dist/skills/tools/image-generate-tool.d.ts +0 -62
  162. package/dist/skills/tools/image-generate-tool.js +0 -67
  163. package/dist/skills/tools/instructions-tool.d.ts +0 -103
  164. package/dist/skills/tools/instructions-tool.js +0 -187
  165. package/dist/skills/tools/lsp-tool.d.ts +0 -153
  166. package/dist/skills/tools/lsp-tool.js +0 -227
  167. package/dist/skills/tools/mcp-client-types.d.ts +0 -269
  168. package/dist/skills/tools/mcp-client-types.js +0 -53
  169. package/dist/skills/tools/mcp-tool.d.ts +0 -249
  170. package/dist/skills/tools/mcp-tool.js +0 -503
  171. package/dist/skills/tools/memory-tool.d.ts +0 -74
  172. package/dist/skills/tools/memory-tool.js +0 -88
  173. package/dist/skills/tools/monitor-tool.d.ts +0 -113
  174. package/dist/skills/tools/monitor-tool.js +0 -131
  175. package/dist/skills/tools/music-generate-tool.d.ts +0 -55
  176. package/dist/skills/tools/music-generate-tool.js +0 -62
  177. package/dist/skills/tools/notify-tool.d.ts +0 -53
  178. package/dist/skills/tools/notify-tool.js +0 -62
  179. package/dist/skills/tools/patch-tool.d.ts +0 -45
  180. package/dist/skills/tools/patch-tool.js +0 -505
  181. package/dist/skills/tools/pdf-tool.d.ts +0 -66
  182. package/dist/skills/tools/pdf-tool.js +0 -88
  183. package/dist/skills/tools/plan-mode-tool.d.ts +0 -59
  184. package/dist/skills/tools/plan-mode-tool.js +0 -122
  185. package/dist/skills/tools/read-tool.d.ts +0 -51
  186. package/dist/skills/tools/read-tool.js +0 -84
  187. package/dist/skills/tools/repl-tool.d.ts +0 -70
  188. package/dist/skills/tools/repl-tool.js +0 -69
  189. package/dist/skills/tools/search-tool.d.ts +0 -112
  190. package/dist/skills/tools/search-tool.js +0 -225
  191. package/dist/skills/tools/send-message-tool.d.ts +0 -51
  192. package/dist/skills/tools/send-message-tool.js +0 -76
  193. package/dist/skills/tools/skill-list-tool.d.ts +0 -33
  194. package/dist/skills/tools/skill-list-tool.js +0 -54
  195. package/dist/skills/tools/skill-manage-tool.d.ts +0 -73
  196. package/dist/skills/tools/skill-manage-tool.js +0 -153
  197. package/dist/skills/tools/skill-view-tool.d.ts +0 -37
  198. package/dist/skills/tools/skill-view-tool.js +0 -72
  199. package/dist/skills/tools/sleep-tool.d.ts +0 -49
  200. package/dist/skills/tools/sleep-tool.js +0 -81
  201. package/dist/skills/tools/structured-output-tool.d.ts +0 -116
  202. package/dist/skills/tools/structured-output-tool.js +0 -176
  203. package/dist/skills/tools/task-tool.d.ts +0 -104
  204. package/dist/skills/tools/task-tool.js +0 -161
  205. package/dist/skills/tools/team-tool.d.ts +0 -89
  206. package/dist/skills/tools/team-tool.js +0 -105
  207. package/dist/skills/tools/tool-search-tool.d.ts +0 -51
  208. package/dist/skills/tools/tool-search-tool.js +0 -110
  209. package/dist/skills/tools/tts-tool.d.ts +0 -38
  210. package/dist/skills/tools/tts-tool.js +0 -45
  211. package/dist/skills/tools/video-edit-tool.d.ts +0 -69
  212. package/dist/skills/tools/video-edit-tool.js +0 -74
  213. package/dist/skills/tools/video-generate-tool.d.ts +0 -62
  214. package/dist/skills/tools/video-generate-tool.js +0 -66
  215. package/dist/skills/tools/video-merge-tool.d.ts +0 -105
  216. package/dist/skills/tools/video-merge-tool.js +0 -92
  217. package/dist/skills/tools/video-upscale-tool.d.ts +0 -45
  218. package/dist/skills/tools/video-upscale-tool.js +0 -52
  219. package/dist/skills/tools/web-fetch-tool.d.ts +0 -78
  220. package/dist/skills/tools/web-fetch-tool.js +0 -92
  221. package/dist/skills/tools/web-search-tool.d.ts +0 -57
  222. package/dist/skills/tools/web-search-tool.js +0 -86
  223. package/dist/skills/tools/worktree-tool.d.ts +0 -69
  224. package/dist/skills/tools/worktree-tool.js +0 -147
  225. package/dist/skills/tools/write-tool.d.ts +0 -45
  226. package/dist/skills/tools/write-tool.js +0 -81
@@ -1,108 +0,0 @@
1
- export type { PortableTool, PortableToolResult, ToolContentBlock, } from "./portable-tool.js";
2
- export { MEMORY_TOOL_NAME, MEMORY_TOOL_MAX_CONTENT_LENGTH, MEMORY_TOOL_ACTIONS, MEMORY_TOOL_SCHEMA, MEMORY_TOOL_DESCRIPTION, MEMORY_TOOL_LABEL, isMemoryContentSafe, executeMemoryTool, } from "./memory-tool.js";
3
- export type { MemoryToolAction, MemoryToolParams, MemoryToolResult, MemoryToolExecutorDeps, } from "./memory-tool.js";
4
- export { MemoryStore, MEMORY_ENTRY_DELIMITER, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_USER_CHAR_LIMIT, } from "./memory-store.js";
5
- export type { MemoryStoreTarget, MemoryStoreResult, MemoryStoreOptions, MemoryStoreSerialized, } from "./memory-store.js";
6
- export { createQMemoryAdapter } from "./qmemory-adapter.js";
7
- export type { QMemoryAdapterConfig, QMemoryHealthStatus, ExtractedMemoryItem } from "./qmemory-adapter.js";
8
- export { createMemoryExtractor } from "./memory-extractor.js";
9
- export type { ExtractedMemory, ProfileUpdate, ExtractionResult, ExtractionCompleteFn, MemoryExtractorOptions, } from "./memory-extractor.js";
10
- export { THINK_TOOL_NAME, THINK_TOOL_SCHEMA, createThinkTool } from "./think-tool.js";
11
- export type { ThinkToolParams } from "./think-tool.js";
12
- export { TODO_TOOL_NAME, TODO_TOOL_SCHEMA, createTodoTool } from "./todo-tool.js";
13
- export type { TodoToolParams, TodoToolOptions } from "./todo-tool.js";
14
- export { MEMORY_QUERY_TOOL_NAME, MEMORY_QUERY_TOOL_SCHEMA, createMemoryQueryTool, } from "./memory-query-tool.js";
15
- export type { MemoryQueryToolParams, MemoryQueryToolDeps, MediaPreferencesSummary, } from "./memory-query-tool.js";
16
- export { READ_TOOL_NAME, READ_TOOL_SCHEMA, createReadTool } from "./tools/read-tool.js";
17
- export type { ReadToolParams, ReadToolDeps, ReadResultType } from "./tools/read-tool.js";
18
- export { WRITE_TOOL_NAME, WRITE_TOOL_SCHEMA, createWriteTool } from "./tools/write-tool.js";
19
- export type { WriteToolParams, WriteToolDeps } from "./tools/write-tool.js";
20
- export { EDIT_TOOL_NAME, EDIT_TOOL_SCHEMA, createEditTool } from "./tools/edit-tool.js";
21
- export type { EditToolParams, EditToolDeps } from "./tools/edit-tool.js";
22
- export { APPLY_PATCH_TOOL_NAME, APPLY_PATCH_TOOL_SCHEMA, createApplyPatchTool } from "./tools/apply-patch-tool.js";
23
- export type { ApplyPatchToolParams, ApplyPatchToolDeps, ApplyPatchSummary } from "./tools/apply-patch-tool.js";
24
- export { PDF_TOOL_NAME, PDF_TOOL_SCHEMA, createPdfTool } from "./tools/pdf-tool.js";
25
- export type { PdfToolParams, PdfToolDeps } from "./tools/pdf-tool.js";
26
- export { EXEC_TOOL_NAME, EXEC_TOOL_SCHEMA, createExecTool } from "./tools/exec-tool.js";
27
- export type { ExecToolParams, ExecToolDeps, ExecResult, BackgroundExecResult } from "./tools/exec-tool.js";
28
- export { SEARCH_TOOL_NAME, SEARCH_TOOL_SCHEMA, createSearchTool } from "./tools/search-tool.js";
29
- export type { SearchToolParams, SearchToolDeps, SearchMode, SearchOutput, SearchFileResult, SearchContentResult, } from "./tools/search-tool.js";
30
- export { IMAGE_GENERATE_TOOL_NAME, IMAGE_GENERATE_TOOL_SCHEMA, createImageGenerateTool } from "./tools/image-generate-tool.js";
31
- export type { ImageGenerateToolParams, ImageGenerateToolDeps, ImageGenerateResult } from "./tools/image-generate-tool.js";
32
- export { VIDEO_GENERATE_TOOL_NAME, VIDEO_GENERATE_TOOL_SCHEMA, createVideoGenerateTool } from "./tools/video-generate-tool.js";
33
- export type { VideoGenerateToolParams, VideoGenerateToolDeps, VideoGenerateResult } from "./tools/video-generate-tool.js";
34
- export { VIDEO_MERGE_TOOL_NAME, VIDEO_MERGE_TOOL_SCHEMA, createVideoMergeTool } from "./tools/video-merge-tool.js";
35
- export type { VideoMergeToolParams, VideoMergeToolDeps, VideoMergeClip, VideoMergeResult } from "./tools/video-merge-tool.js";
36
- export { VIDEO_UPSCALE_TOOL_NAME, VIDEO_UPSCALE_TOOL_SCHEMA, createVideoUpscaleTool } from "./tools/video-upscale-tool.js";
37
- export type { VideoUpscaleToolParams, VideoUpscaleToolDeps, VideoUpscaleResult } from "./tools/video-upscale-tool.js";
38
- export { VIDEO_EDIT_TOOL_NAME, VIDEO_EDIT_TOOL_SCHEMA, createVideoEditTool } from "./tools/video-edit-tool.js";
39
- export type { VideoEditToolParams, VideoEditToolDeps, VideoEditResult } from "./tools/video-edit-tool.js";
40
- export { MUSIC_GENERATE_TOOL_NAME, MUSIC_GENERATE_TOOL_SCHEMA, createMusicGenerateTool } from "./tools/music-generate-tool.js";
41
- export type { MusicGenerateToolParams, MusicGenerateToolDeps, MusicGenerateResult } from "./tools/music-generate-tool.js";
42
- export { TTS_TOOL_NAME, TTS_TOOL_SCHEMA, createTtsTool } from "./tools/tts-tool.js";
43
- export type { TtsToolParams, TtsToolDeps, TtsResult } from "./tools/tts-tool.js";
44
- export { WEB_FETCH_TOOL_NAME, WEB_FETCH_TOOL_SCHEMA, createWebFetchTool } from "./tools/web-fetch-tool.js";
45
- export type { WebFetchToolParams, WebFetchToolDeps, WebFetchResult } from "./tools/web-fetch-tool.js";
46
- export { WEB_SEARCH_TOOL_NAME, WEB_SEARCH_TOOL_SCHEMA, createWebSearchTool } from "./tools/web-search-tool.js";
47
- export type { WebSearchToolParams, WebSearchToolDeps, WebSearchResult, WebSearchOutput } from "./tools/web-search-tool.js";
48
- export { ASK_USER_TOOL_NAME, ASK_USER_TOOL_SCHEMA, createAskUserTool } from "./tools/ask-user-tool.js";
49
- export type { AskUserToolParams, AskUserToolDeps, AskUserQuestion, AskUserOption, AskUserAnswer } from "./tools/ask-user-tool.js";
50
- export { BRIEF_TOOL_NAME, BRIEF_TOOL_SCHEMA, createBriefTool } from "./tools/brief-tool.js";
51
- export type { BriefToolParams, BriefToolDeps, BriefMessageStatus, BriefAttachment, BriefDeliveryResult, BriefModeConfig, } from "./tools/brief-tool.js";
52
- export { TOOL_SEARCH_TOOL_NAME, TOOL_SEARCH_TOOL_SCHEMA, createToolSearchTool } from "./tools/tool-search-tool.js";
53
- export type { ToolSearchToolParams, ToolSearchToolDeps, DeferredToolInfo, ToolSearchOutput } from "./tools/tool-search-tool.js";
54
- export { SKILL_LIST_TOOL_NAME, SKILL_LIST_TOOL_SCHEMA, createSkillListTool } from "./tools/skill-list-tool.js";
55
- export type { SkillListToolParams, SkillListToolDeps, SkillListItem, SkillListOutput } from "./tools/skill-list-tool.js";
56
- export { SKILL_VIEW_TOOL_NAME, SKILL_VIEW_TOOL_SCHEMA, createSkillViewTool } from "./tools/skill-view-tool.js";
57
- export type { SkillViewToolParams, SkillViewToolDeps, SkillViewOutput } from "./tools/skill-view-tool.js";
58
- export { SKILL_MANAGE_TOOL_NAME, SKILL_MANAGE_TOOL_SCHEMA, createSkillManageTool } from "./tools/skill-manage-tool.js";
59
- export type { SkillManageToolParams, SkillManageToolDeps, SkillManageResult, SkillManageAction } from "./tools/skill-manage-tool.js";
60
- export { PATCH_TOOL_NAME, PATCH_TOOL_SCHEMA, createPatchTool, fuzzyFind } from "./tools/patch-tool.js";
61
- export type { PatchToolParams, PatchToolDeps, PatchResult, MatchStrategy, MatchResult } from "./tools/patch-tool.js";
62
- export { AGENT_TOOL_NAME, AGENT_TOOL_SCHEMA, createAgentTool } from "./tools/agent-tool.js";
63
- export type { AgentToolParams, AgentToolDeps, AgentResult } from "./tools/agent-tool.js";
64
- export { TASK_TOOL_NAME, TASK_TOOL_SCHEMA, createTaskTool } from "./tools/task-tool.js";
65
- export type { TaskToolParams, TaskToolDeps, TaskInfo, TaskResult, TaskAction, TaskStatus } from "./tools/task-tool.js";
66
- export { REPL_TOOL_NAME, REPL_TOOL_SCHEMA, REPL_HIDES_TOOLS, createReplTool } from "./tools/repl-tool.js";
67
- export type { ReplToolParams, ReplToolDeps, ReplPrimitives, ReplExecResult } from "./tools/repl-tool.js";
68
- export { BROWSER_TOOL_NAME, BROWSER_TOOL_SCHEMA, createBrowserTool } from "./tools/browser-tool.js";
69
- export type { BrowserToolParams, BrowserToolDeps, BrowserAction, BrowserSnapshot, BrowserScreenshot } from "./tools/browser-tool.js";
70
- export { CRON_TOOL_NAME, CRON_TOOL_SCHEMA, MAX_CRON_JOBS, createCronTool } from "./tools/cron-tool.js";
71
- export type { CronToolParams, CronToolDeps, CronJob, CronResult, CronAction } from "./tools/cron-tool.js";
72
- export { MEMORY_SEARCH_TOOL_NAME, MEMORY_SEARCH_TOOL_SCHEMA, createMemorySearchTool } from "./tools/memory-tool.js";
73
- export type { MemorySearchToolParams, MemorySearchToolDeps, MemoryEntry, MemoryQueryOutput, MemorySource } from "./tools/memory-tool.js";
74
- export { CHECKPOINT_TOOL_NAME, CHECKPOINT_TOOL_SCHEMA, createCheckpointTool } from "./tools/checkpoint-tool.js";
75
- export type { CheckpointToolParams, CheckpointToolDeps, Checkpoint, CheckpointResult, CheckpointAction } from "./tools/checkpoint-tool.js";
76
- export { NOTIFY_TOOL_NAME, NOTIFY_TOOL_SCHEMA, createNotifyTool } from "./tools/notify-tool.js";
77
- export type { NotifyToolParams, NotifyToolDeps, NotifyResult } from "./tools/notify-tool.js";
78
- export { SEND_MESSAGE_TOOL_NAME, SEND_MESSAGE_TOOL_SCHEMA, createSendMessageTool } from "./tools/send-message-tool.js";
79
- export type { SendMessageToolParams, SendMessageToolDeps, SendMessageResult } from "./tools/send-message-tool.js";
80
- export { TEAM_TOOL_NAME, TEAM_TOOL_SCHEMA, createTeamTool } from "./tools/team-tool.js";
81
- export type { TeamToolParams, TeamToolDeps, TeamMember, Team, TeamResult, TeamAction } from "./tools/team-tool.js";
82
- export { LSP_TOOL_NAME, LSP_TOOL_SCHEMA, createLspTool } from "./tools/lsp-tool.js";
83
- export type { LspToolParams, LspToolDeps, LspOperation, LspLocation, LspSymbol, LspDiagnostic, LspHoverInfo, LspCompletion, LspRenameEdit, LspCodeAction, LspResult } from "./tools/lsp-tool.js";
84
- export { PLAN_MODE_TOOL_NAME, PLAN_MODE_TOOL_SCHEMA, PLAN_MODE_ALLOWED_TOOLS, createPlanModeTool } from "./tools/plan-mode-tool.js";
85
- export type { PlanModeToolParams, PlanModeToolDeps, PlanModeAction, PlanModeState, PlanModeResult } from "./tools/plan-mode-tool.js";
86
- export { WORKTREE_TOOL_NAME, WORKTREE_TOOL_SCHEMA, createWorktreeTool } from "./tools/worktree-tool.js";
87
- export type { WorktreeToolParams, WorktreeToolDeps, WorktreeAction, WorktreeInfo, WorktreeResult } from "./tools/worktree-tool.js";
88
- export { MCP_TOOL_NAME, MCP_TOOL_SCHEMA, createMcpTool, createMcpAuthProxy } from "./tools/mcp-tool.js";
89
- export { normalizeNameForMcp, buildMcpToolName, getMcpServerPrefix, parseMcpToolName, isMcpToolName, MCP_CONNECTION_TIMEOUT_MS, MCP_REQUEST_TIMEOUT_MS, MCP_TOOL_CALL_TIMEOUT_MS, MCP_MAX_RECONNECT_ATTEMPTS, MCP_MAX_DESCRIPTION_LENGTH, } from "./tools/mcp-tool.js";
90
- export type { McpToolParams, McpToolDeps, McpAction, McpManageAction, McpServer, McpToolInfo, McpResource, McpResourceContent, McpCallResult, McpAuthResult, McpPromptResult, McpManageResult, McpAuthProxyDeps, McpServerConfig, McpStdioConfig, McpSseConfig, McpHttpConfig, McpWsConfig, McpInProcessConfig, McpServerState, McpConnectionStatus, McpServerCapabilities, McpExternalTool, McpToolAnnotations, McpToolIdentifier, McpToolsChangedEvent, McpResourceDefinition, McpResourceTemplate, McpPersistedResourceContent, McpPromptDefinition, McpPromptMessage, McpPromptArgument, McpPromptContent, McpElicitResult, McpElicitRequest, McpOAuthConfig, McpOAuthTokens, McpAuthState, McpLogEntry, McpLogLevel, McpTransportType, } from "./tools/mcp-tool.js";
91
- export type { McpResourceContentItem, } from "./tools/mcp-client-types.js";
92
- export { CONFIG_TOOL_NAME, CONFIG_TOOL_SCHEMA, CONFIG_READONLY_KEYS, createConfigTool } from "./tools/config-tool.js";
93
- export type { ConfigToolParams, ConfigToolDeps, ConfigAction, ConfigSetting, ConfigResult } from "./tools/config-tool.js";
94
- export { SLEEP_TOOL_NAME, SLEEP_TOOL_SCHEMA, createSleepTool } from "./tools/sleep-tool.js";
95
- export type { SleepToolParams, SleepToolDeps, SleepResult } from "./tools/sleep-tool.js";
96
- export { MONITOR_TOOL_NAME, MONITOR_TOOL_SCHEMA, createMonitorTool } from "./tools/monitor-tool.js";
97
- export type { MonitorToolParams, MonitorToolDeps, MonitorSource, MonitorAction, MonitorCondition, MonitorInfo, MonitorResult, } from "./tools/monitor-tool.js";
98
- export { STRUCTURED_OUTPUT_TOOL_NAME, STRUCTURED_OUTPUT_TOOL_SCHEMA, STRUCTURED_OUTPUT_MAX_CHARS, createStructuredOutputTool, createConfiguredStructuredOutputTool, isStructuredOutputEnabled, } from "./tools/structured-output-tool.js";
99
- export type { StructuredOutputToolParams, StructuredOutputToolDeps, StructuredOutputResult, SchemaValidationError, ConfiguredToolResult, SchemaCompiler, } from "./tools/structured-output-tool.js";
100
- export { INSTRUCTIONS_LIST_TOOL_NAME, INSTRUCTIONS_LIST_SCHEMA, createInstructionsListTool, INSTRUCTIONS_READ_TOOL_NAME, INSTRUCTIONS_READ_SCHEMA, createInstructionsReadTool, INSTRUCTIONS_WRITE_TOOL_NAME, INSTRUCTIONS_WRITE_SCHEMA, createInstructionsWriteTool, INSTRUCTIONS_DELETE_TOOL_NAME, INSTRUCTIONS_DELETE_SCHEMA, createInstructionsDeleteTool, } from "./tools/instructions-tool.js";
101
- export type { InstructionFileInfo, InstructionFileContent, InstructionsToolDeps, InstructionsListParams, InstructionsReadParams, InstructionsWriteParams, InstructionsDeleteParams, } from "./tools/instructions-tool.js";
102
- export type { ParsedSkillFrontmatter, WorkspaceSkill, SkillInstallSpec, SkillMetadata, SkillInvocationPolicy, SkillEntry, SkillCommandDispatchSpec, SkillCommandSpec, SkillSnapshot, SkillScanSeverity, SkillScanFinding, SkillScanSummary, SkillScanOptions, SkillFsDeps, SkillPathDeps, SkillLoadLimits, SkillSearchPaths, SkillLoaderDeps, } from "./skill-types.js";
103
- export { parseFrontmatter, resolveSkillMetadata, resolveSkillInvocationPolicy, resolveSkillKey, } from "./skill-frontmatter.js";
104
- export { loadSkillEntries, filterSkillEntries, buildSkillSnapshot, } from "./skill-loader.js";
105
- export { scanSource, scanSkillDirectory, hasCriticalFindings, isScannable, } from "./skill-guard.js";
106
- export type { SkillGuardDeps } from "./skill-guard.js";
107
- export { installSkill, uninstallSkill, createEmptyLockfile, } from "./skill-source.js";
108
- export type { TrustLevel, ScanVerdict, SkillSourceDescriptor, SkillFetchResult, SkillFetchDeps, SkillStorageDeps, SkillLockEntry, SkillLockfile, SkillInstallResult, } from "./skill-source.js";
@@ -1,82 +0,0 @@
1
- // skills — public API barrel
2
- // ── Memory Tool (add/replace/remove/search) ────────────────
3
- export { MEMORY_TOOL_NAME, MEMORY_TOOL_MAX_CONTENT_LENGTH, MEMORY_TOOL_ACTIONS, MEMORY_TOOL_SCHEMA, MEMORY_TOOL_DESCRIPTION, MEMORY_TOOL_LABEL, isMemoryContentSafe, executeMemoryTool, } from "./memory-tool.js";
4
- // ── Memory Store (local MD notes) ───────────────────────────
5
- export { MemoryStore, MEMORY_ENTRY_DELIMITER, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_USER_CHAR_LIMIT, } from "./memory-store.js";
6
- // ── QMemory Adapter ─────────────────────────────────────────
7
- export { createQMemoryAdapter } from "./qmemory-adapter.js";
8
- // ── Memory Extractor (server-side LLM extraction) ─────────
9
- export { createMemoryExtractor } from "./memory-extractor.js";
10
- // ── Think Tool ──────────────────────────────────────────────
11
- export { THINK_TOOL_NAME, THINK_TOOL_SCHEMA, createThinkTool } from "./think-tool.js";
12
- // ── Todo Tool ───────────────────────────────────────────────
13
- export { TODO_TOOL_NAME, TODO_TOOL_SCHEMA, createTodoTool } from "./todo-tool.js";
14
- // ── Memory Query Tool ───────────────────────────────────────
15
- export { MEMORY_QUERY_TOOL_NAME, MEMORY_QUERY_TOOL_SCHEMA, createMemoryQueryTool, } from "./memory-query-tool.js";
16
- // ── Coding Tools ────────────────────────────────────────────
17
- export { READ_TOOL_NAME, READ_TOOL_SCHEMA, createReadTool } from "./tools/read-tool.js";
18
- export { WRITE_TOOL_NAME, WRITE_TOOL_SCHEMA, createWriteTool } from "./tools/write-tool.js";
19
- export { EDIT_TOOL_NAME, EDIT_TOOL_SCHEMA, createEditTool } from "./tools/edit-tool.js";
20
- export { APPLY_PATCH_TOOL_NAME, APPLY_PATCH_TOOL_SCHEMA, createApplyPatchTool } from "./tools/apply-patch-tool.js";
21
- // ── Document Tools ──────────────────────────────────────────
22
- export { PDF_TOOL_NAME, PDF_TOOL_SCHEMA, createPdfTool } from "./tools/pdf-tool.js";
23
- // ── System Tools ────────────────────────────────────────────
24
- export { EXEC_TOOL_NAME, EXEC_TOOL_SCHEMA, createExecTool } from "./tools/exec-tool.js";
25
- // ── Search Tools ────────────────────────────────────────────
26
- export { SEARCH_TOOL_NAME, SEARCH_TOOL_SCHEMA, createSearchTool } from "./tools/search-tool.js";
27
- // ── Media Tools ─────────────────────────────────────────────
28
- export { IMAGE_GENERATE_TOOL_NAME, IMAGE_GENERATE_TOOL_SCHEMA, createImageGenerateTool } from "./tools/image-generate-tool.js";
29
- export { VIDEO_GENERATE_TOOL_NAME, VIDEO_GENERATE_TOOL_SCHEMA, createVideoGenerateTool } from "./tools/video-generate-tool.js";
30
- export { VIDEO_MERGE_TOOL_NAME, VIDEO_MERGE_TOOL_SCHEMA, createVideoMergeTool } from "./tools/video-merge-tool.js";
31
- export { VIDEO_UPSCALE_TOOL_NAME, VIDEO_UPSCALE_TOOL_SCHEMA, createVideoUpscaleTool } from "./tools/video-upscale-tool.js";
32
- export { VIDEO_EDIT_TOOL_NAME, VIDEO_EDIT_TOOL_SCHEMA, createVideoEditTool } from "./tools/video-edit-tool.js";
33
- export { MUSIC_GENERATE_TOOL_NAME, MUSIC_GENERATE_TOOL_SCHEMA, createMusicGenerateTool } from "./tools/music-generate-tool.js";
34
- export { TTS_TOOL_NAME, TTS_TOOL_SCHEMA, createTtsTool } from "./tools/tts-tool.js";
35
- // ── Web Tools ───────────────────────────────────────────────
36
- export { WEB_FETCH_TOOL_NAME, WEB_FETCH_TOOL_SCHEMA, createWebFetchTool } from "./tools/web-fetch-tool.js";
37
- export { WEB_SEARCH_TOOL_NAME, WEB_SEARCH_TOOL_SCHEMA, createWebSearchTool } from "./tools/web-search-tool.js";
38
- // ── Interaction Tools ───────────────────────────────────────
39
- export { ASK_USER_TOOL_NAME, ASK_USER_TOOL_SCHEMA, createAskUserTool } from "./tools/ask-user-tool.js";
40
- // ── Brief Tool (SendUserMessage — chat/brief mode output) ───
41
- export { BRIEF_TOOL_NAME, BRIEF_TOOL_SCHEMA, createBriefTool } from "./tools/brief-tool.js";
42
- // ── Tool Discovery ──────────────────────────────────────────
43
- export { TOOL_SEARCH_TOOL_NAME, TOOL_SEARCH_TOOL_SCHEMA, createToolSearchTool } from "./tools/tool-search-tool.js";
44
- // ── Skill Management Tools ──────────────────────────────────
45
- export { SKILL_LIST_TOOL_NAME, SKILL_LIST_TOOL_SCHEMA, createSkillListTool } from "./tools/skill-list-tool.js";
46
- export { SKILL_VIEW_TOOL_NAME, SKILL_VIEW_TOOL_SCHEMA, createSkillViewTool } from "./tools/skill-view-tool.js";
47
- export { SKILL_MANAGE_TOOL_NAME, SKILL_MANAGE_TOOL_SCHEMA, createSkillManageTool } from "./tools/skill-manage-tool.js";
48
- // ── P2 Tools ────────────────────────────────────────────────
49
- export { PATCH_TOOL_NAME, PATCH_TOOL_SCHEMA, createPatchTool, fuzzyFind } from "./tools/patch-tool.js";
50
- export { AGENT_TOOL_NAME, AGENT_TOOL_SCHEMA, createAgentTool } from "./tools/agent-tool.js";
51
- export { TASK_TOOL_NAME, TASK_TOOL_SCHEMA, createTaskTool } from "./tools/task-tool.js";
52
- export { REPL_TOOL_NAME, REPL_TOOL_SCHEMA, REPL_HIDES_TOOLS, createReplTool } from "./tools/repl-tool.js";
53
- export { BROWSER_TOOL_NAME, BROWSER_TOOL_SCHEMA, createBrowserTool } from "./tools/browser-tool.js";
54
- export { CRON_TOOL_NAME, CRON_TOOL_SCHEMA, MAX_CRON_JOBS, createCronTool } from "./tools/cron-tool.js";
55
- export { MEMORY_SEARCH_TOOL_NAME, MEMORY_SEARCH_TOOL_SCHEMA, createMemorySearchTool } from "./tools/memory-tool.js";
56
- export { CHECKPOINT_TOOL_NAME, CHECKPOINT_TOOL_SCHEMA, createCheckpointTool } from "./tools/checkpoint-tool.js";
57
- export { NOTIFY_TOOL_NAME, NOTIFY_TOOL_SCHEMA, createNotifyTool } from "./tools/notify-tool.js";
58
- export { SEND_MESSAGE_TOOL_NAME, SEND_MESSAGE_TOOL_SCHEMA, createSendMessageTool } from "./tools/send-message-tool.js";
59
- export { TEAM_TOOL_NAME, TEAM_TOOL_SCHEMA, createTeamTool } from "./tools/team-tool.js";
60
- // ── P3 Tools ────────────────────────────────────────────────
61
- export { LSP_TOOL_NAME, LSP_TOOL_SCHEMA, createLspTool } from "./tools/lsp-tool.js";
62
- export { PLAN_MODE_TOOL_NAME, PLAN_MODE_TOOL_SCHEMA, PLAN_MODE_ALLOWED_TOOLS, createPlanModeTool } from "./tools/plan-mode-tool.js";
63
- export { WORKTREE_TOOL_NAME, WORKTREE_TOOL_SCHEMA, createWorktreeTool } from "./tools/worktree-tool.js";
64
- export { MCP_TOOL_NAME, MCP_TOOL_SCHEMA, createMcpTool, createMcpAuthProxy } from "./tools/mcp-tool.js";
65
- export { normalizeNameForMcp, buildMcpToolName, getMcpServerPrefix, parseMcpToolName, isMcpToolName, MCP_CONNECTION_TIMEOUT_MS, MCP_REQUEST_TIMEOUT_MS, MCP_TOOL_CALL_TIMEOUT_MS, MCP_MAX_RECONNECT_ATTEMPTS, MCP_MAX_DESCRIPTION_LENGTH, } from "./tools/mcp-tool.js";
66
- export { CONFIG_TOOL_NAME, CONFIG_TOOL_SCHEMA, CONFIG_READONLY_KEYS, createConfigTool } from "./tools/config-tool.js";
67
- // ── Autonomous / Proactive Tools ────────────────────────────
68
- export { SLEEP_TOOL_NAME, SLEEP_TOOL_SCHEMA, createSleepTool } from "./tools/sleep-tool.js";
69
- export { MONITOR_TOOL_NAME, MONITOR_TOOL_SCHEMA, createMonitorTool } from "./tools/monitor-tool.js";
70
- // ── Structured Output ───────────────────────────────────────
71
- export { STRUCTURED_OUTPUT_TOOL_NAME, STRUCTURED_OUTPUT_TOOL_SCHEMA, STRUCTURED_OUTPUT_MAX_CHARS, createStructuredOutputTool, createConfiguredStructuredOutputTool, isStructuredOutputEnabled, } from "./tools/structured-output-tool.js";
72
- // ── Skill System — Types ────────────────────────────────────
73
- // ── Instructions Tools (project instruction CRUD) ───────────
74
- export { INSTRUCTIONS_LIST_TOOL_NAME, INSTRUCTIONS_LIST_SCHEMA, createInstructionsListTool, INSTRUCTIONS_READ_TOOL_NAME, INSTRUCTIONS_READ_SCHEMA, createInstructionsReadTool, INSTRUCTIONS_WRITE_TOOL_NAME, INSTRUCTIONS_WRITE_SCHEMA, createInstructionsWriteTool, INSTRUCTIONS_DELETE_TOOL_NAME, INSTRUCTIONS_DELETE_SCHEMA, createInstructionsDeleteTool, } from "./tools/instructions-tool.js";
75
- // ── Skill System — Frontmatter ──────────────────────────────
76
- export { parseFrontmatter, resolveSkillMetadata, resolveSkillInvocationPolicy, resolveSkillKey, } from "./skill-frontmatter.js";
77
- // ── Skill System — Loader ───────────────────────────────────
78
- export { loadSkillEntries, filterSkillEntries, buildSkillSnapshot, } from "./skill-loader.js";
79
- // ── Skill System — Security Guard ───────────────────────────
80
- export { scanSource, scanSkillDirectory, hasCriticalFindings, isScannable, } from "./skill-guard.js";
81
- // ── Skill System — Source & Install ─────────────────────────
82
- export { installSkill, uninstallSkill, createEmptyLockfile, } from "./skill-source.js";
@@ -1,64 +0,0 @@
1
- export interface ExtractedMemory {
2
- text: string;
3
- category: string;
4
- importance: number;
5
- speaker: string;
6
- event_date?: string;
7
- tags?: string[];
8
- }
9
- export interface ProfileUpdate {
10
- category: string;
11
- key: string;
12
- value: string;
13
- confidence: number;
14
- }
15
- export interface ExtractionResult {
16
- memories: ExtractedMemory[];
17
- profileUpdates: ProfileUpdate[];
18
- }
19
- /**
20
- * Generic OpenAI-compatible chat completion function.
21
- * Consumer provides the actual HTTP transport (e.g. admin/new-api fetch).
22
- */
23
- export type ExtractionCompleteFn = (params: {
24
- model: string;
25
- messages: Array<{
26
- role: string;
27
- content: string;
28
- }>;
29
- tools: unknown[];
30
- tool_choice: unknown;
31
- temperature?: number;
32
- max_tokens?: number;
33
- }) => Promise<{
34
- choices?: Array<{
35
- message?: {
36
- tool_calls?: Array<{
37
- function?: {
38
- name?: string;
39
- arguments?: string;
40
- };
41
- }>;
42
- content?: string;
43
- };
44
- }>;
45
- }>;
46
- export interface MemoryExtractorOptions {
47
- /** Model to use for extraction (default: "deepseek-chat"). */
48
- model?: string;
49
- /** Timeout in ms for the LLM call (default: 30_000). */
50
- timeoutMs?: number;
51
- }
52
- /**
53
- * Create a memory extractor backed by an OpenAI-compatible LLM endpoint.
54
- *
55
- * The `complete` function is injected by the consumer so that
56
- * skills layer stays transport-agnostic (no admin/new-api dependency).
57
- */
58
- export declare function createMemoryExtractor(complete: ExtractionCompleteFn, options?: MemoryExtractorOptions): {
59
- /**
60
- * Extract structured memories from a conversation fragment.
61
- * Returns empty result if text is too short or LLM call fails.
62
- */
63
- extract(conversationText: string): Promise<ExtractionResult>;
64
- };
@@ -1,173 +0,0 @@
1
- // ============================================================
2
- // Memory Extractor — LLM-based fact extraction from conversation.
3
- //
4
- // Runs server-side via an OpenAI-compatible LLM endpoint (e.g.
5
- // admin/new-api). Ports qmemory's extraction prompt into a
6
- // reusable TypeScript module so extraction happens where the
7
- // LLM key lives, NOT on the local qmemory instance.
8
- // ============================================================
9
- // ── Extraction Tool Schema (matches qmemory extractor) ──────
10
- const EXTRACTION_TOOL = {
11
- type: "function",
12
- function: {
13
- name: "save_extraction",
14
- description: "Save all extracted memories and profile updates from the conversation.",
15
- parameters: {
16
- type: "object",
17
- properties: {
18
- memories: {
19
- type: "array",
20
- description: "Atomic facts extracted from both user and assistant. One per distinct fact.",
21
- items: {
22
- type: "object",
23
- properties: {
24
- text: { type: "string", description: "Self-contained fact (one sentence, no pronouns)" },
25
- category: { type: "string", enum: ["fact", "preference", "event", "plan", "opinion", "advice", "discussion"] },
26
- importance: { type: "number", description: "0-1 scale. Named entities>=0.5, facts with numbers>=0.4, preferences>=0.6, identity>=0.8" },
27
- speaker: { type: "string", enum: ["user", "assistant", "both"] },
28
- event_date: { type: "string", description: "ISO YYYY-MM-DD or null" },
29
- tags: { type: "array", items: { type: "string" }, maxItems: 3 },
30
- },
31
- required: ["text", "category", "importance", "speaker"],
32
- },
33
- },
34
- profile_updates: {
35
- type: "array",
36
- description: "User traits/preferences to track.",
37
- items: {
38
- type: "object",
39
- properties: {
40
- category: { type: "string", enum: ["preference", "fact", "habit", "style"] },
41
- key: { type: "string", description: "Short ID (e.g. job, location)" },
42
- value: { type: "string" },
43
- confidence: { type: "number" },
44
- },
45
- required: ["category", "key", "value"],
46
- },
47
- },
48
- },
49
- required: ["memories"],
50
- },
51
- },
52
- };
53
- // ── System Prompt (ported from qmemory extractor.py) ────────
54
- function buildSystemPrompt(today, isChinese) {
55
- const base = `You are a memory extraction engine. Today's date: ${today}.
56
-
57
- Extract from the conversation below by calling the save_extraction tool with ALL results at once.
58
-
59
- Rules:
60
- - **LANGUAGE**: Write in the SAME language as the conversation. NEVER translate.
61
- - Extract ALL meaningful facts from BOTH [User] and [Assistant] lines. Skip greetings/filler.
62
- - **BE THOROUGH**: Extract EVERY named person+role, activity+details, financial/numeric detail, temporal event, relationship, item owned, change over time, and assistant's recommendations.
63
- - **ANTI-SUMMARIZATION**: Keep exact numbers, locations, dates, names, metrics.
64
- - For event_date: convert relative dates using today (${today}).
65
- - Set speaker="assistant" for assistant-originated facts.
66
- - **IMPORTANCE SCORING**:
67
- 0.9-1.0: Core identity (name, DOB, nationality)
68
- 0.7-0.9: Key relationships, major life events, career facts
69
- 0.5-0.7: Specific facts with names/numbers/dates, preferences, hobbies
70
- 0.3-0.5: Casual mentions, assistant recommendations, general opinions
71
- NEVER assign importance < 0.2 to any memory containing proper nouns, numbers, dates, or specific entities.`;
72
- if (isChinese) {
73
- return base + `\n- Extract EVERY number/price/measurement as separate memories with exact figures.\n- Minimum density: ~2-3 memories per 200 tokens of conversation.`;
74
- }
75
- return base;
76
- }
77
- function isChinese(text) {
78
- let cn = 0;
79
- for (const c of text) {
80
- if (c >= "\u4e00" && c <= "\u9fff")
81
- cn++;
82
- }
83
- return cn / (text.length || 1) > 0.15;
84
- }
85
- // ── Parser ──────────────────────────────────────────────────
86
- function parseToolCallResult(argsJson) {
87
- let parsed;
88
- try {
89
- parsed = JSON.parse(argsJson);
90
- }
91
- catch {
92
- return { memories: [], profileUpdates: [] };
93
- }
94
- const rawMemories = Array.isArray(parsed.memories) ? parsed.memories : [];
95
- const rawProfiles = Array.isArray(parsed.profile_updates) ? parsed.profile_updates : [];
96
- const memories = rawMemories
97
- .filter((m) => !!m && typeof m === "object")
98
- .filter((m) => typeof m.text === "string" && m.text.trim())
99
- .map((m) => ({
100
- text: String(m.text).trim(),
101
- category: typeof m.category === "string" ? m.category : "fact",
102
- importance: typeof m.importance === "number" ? Math.max(0, Math.min(1, m.importance)) : 0.5,
103
- speaker: typeof m.speaker === "string" ? m.speaker : "user",
104
- ...(typeof m.event_date === "string" && m.event_date ? { event_date: m.event_date } : {}),
105
- ...(Array.isArray(m.tags) ? { tags: m.tags.filter((t) => typeof t === "string") } : {}),
106
- }));
107
- const profileUpdates = rawProfiles
108
- .filter((p) => !!p && typeof p === "object")
109
- .filter((p) => typeof p.key === "string" && typeof p.value === "string")
110
- .map((p) => ({
111
- category: typeof p.category === "string" ? p.category : "fact",
112
- key: String(p.key).trim(),
113
- value: String(p.value).trim(),
114
- confidence: typeof p.confidence === "number" ? Math.max(0, Math.min(1, p.confidence)) : 0.5,
115
- }));
116
- return { memories, profileUpdates };
117
- }
118
- // ── Factory ─────────────────────────────────────────────────
119
- const DEFAULT_MODEL = "deepseek-chat";
120
- const MIN_TEXT_LENGTH = 20;
121
- /**
122
- * Create a memory extractor backed by an OpenAI-compatible LLM endpoint.
123
- *
124
- * The `complete` function is injected by the consumer so that
125
- * skills layer stays transport-agnostic (no admin/new-api dependency).
126
- */
127
- export function createMemoryExtractor(complete, options) {
128
- const model = options?.model ?? DEFAULT_MODEL;
129
- return {
130
- /**
131
- * Extract structured memories from a conversation fragment.
132
- * Returns empty result if text is too short or LLM call fails.
133
- */
134
- async extract(conversationText) {
135
- const trimmed = conversationText.trim();
136
- if (trimmed.length < MIN_TEXT_LENGTH) {
137
- return { memories: [], profileUpdates: [] };
138
- }
139
- const today = new Date().toISOString().slice(0, 10);
140
- const systemPrompt = buildSystemPrompt(today, isChinese(trimmed));
141
- try {
142
- const response = await complete({
143
- model,
144
- messages: [
145
- { role: "system", content: systemPrompt },
146
- { role: "user", content: `Conversation:\n${trimmed}` },
147
- ],
148
- tools: [EXTRACTION_TOOL],
149
- tool_choice: { type: "function", function: { name: "save_extraction" } },
150
- temperature: 0.1,
151
- max_tokens: 4000,
152
- });
153
- const toolCalls = response.choices?.[0]?.message?.tool_calls;
154
- if (!toolCalls?.length) {
155
- return { memories: [], profileUpdates: [] };
156
- }
157
- // Merge results from all tool calls (usually just one)
158
- const merged = { memories: [], profileUpdates: [] };
159
- for (const tc of toolCalls) {
160
- if (tc.function?.name === "save_extraction" && tc.function.arguments) {
161
- const partial = parseToolCallResult(tc.function.arguments);
162
- merged.memories.push(...partial.memories);
163
- merged.profileUpdates.push(...partial.profileUpdates);
164
- }
165
- }
166
- return merged;
167
- }
168
- catch {
169
- return { memories: [], profileUpdates: [] };
170
- }
171
- },
172
- };
173
- }
@@ -1,43 +0,0 @@
1
- import type { PortableTool } from "./portable-tool.js";
2
- export declare const MEMORY_QUERY_TOOL_NAME: "memory_query";
3
- export declare const MEMORY_QUERY_TOOL_SCHEMA: {
4
- readonly type: "object";
5
- readonly properties: {
6
- readonly query: {
7
- readonly type: "string";
8
- readonly description: string;
9
- };
10
- readonly category: {
11
- readonly type: "string";
12
- readonly description: string;
13
- };
14
- };
15
- readonly required: readonly ["query"];
16
- };
17
- export interface MediaPreferencesSummary {
18
- imageStyle?: string;
19
- videoStyle?: string;
20
- musicGenre?: string;
21
- musicMood?: string;
22
- primaryPurpose?: string;
23
- colorPreference?: string;
24
- }
25
- /**
26
- * Dependency-injected callbacks for memory query.
27
- * Consumers provide these from their own memory system.
28
- */
29
- export interface MemoryQueryToolDeps {
30
- /** Query recalled facts/memories by natural language. */
31
- queryGraph?: (query: string, userId: string) => string[];
32
- /** Retrieve user profile summary. */
33
- getProfileSummary?: (userId: string) => string | null;
34
- /** Retrieve media preferences. */
35
- getMediaPreferences?: (userId: string) => MediaPreferencesSummary | null;
36
- /** User ID for this session. */
37
- userId?: string;
38
- }
39
- export interface MemoryQueryToolParams {
40
- query: string;
41
- category?: string;
42
- }
43
- export declare function createMemoryQueryTool(deps?: MemoryQueryToolDeps): PortableTool<MemoryQueryToolParams>;
@@ -1,127 +0,0 @@
1
- // ============================================================
2
- // Memory Query Tool — explicit agent-initiated memory recall.
3
- //
4
- // Allows the LLM to actively query recalled memories and user
5
- // profile when it determines that the current context is
6
- // insufficient for a good response.
7
- // ============================================================
8
- export const MEMORY_QUERY_TOOL_NAME = "memory_query";
9
- // ── Schema ──────────────────────────────────────────────────
10
- export const MEMORY_QUERY_TOOL_SCHEMA = {
11
- type: "object",
12
- properties: {
13
- query: {
14
- type: "string",
15
- description: [
16
- "The memory query — a natural language description of what you want to recall.",
17
- "Examples:",
18
- "• '用户的编程语言偏好' → searches tech preferences",
19
- "• '用户之前提到的项目' → searches project history",
20
- "• '上次画图的风格' → searches media generation history",
21
- "• 'user's name and location' → searches personal facts",
22
- "Be specific: '用户喜欢什么图片风格' is better than '用户偏好'.",
23
- ].join("\n"),
24
- },
25
- category: {
26
- type: "string",
27
- description: [
28
- "Optional: narrow the search to a specific category.",
29
- "• 'profile' — user preferences, expertise, communication style",
30
- "• 'facts' — recalled long-term memories",
31
- "• 'media' — media generation preferences (image style, music genre, etc.)",
32
- "• 'projects' — project context and tech stack",
33
- "If omitted, searches across all categories.",
34
- ].join("\n"),
35
- },
36
- },
37
- required: ["query"],
38
- };
39
- // ── Tool factory ────────────────────────────────────────────
40
- export function createMemoryQueryTool(deps) {
41
- return {
42
- name: MEMORY_QUERY_TOOL_NAME,
43
- label: "Memory Query",
44
- description: [
45
- "Query your memory about this user to recall facts, preferences, or history.",
46
- "Use this when you need information that might have been shared in previous conversations.",
47
- "",
48
- "Call this tool when:",
49
- "- You want to personalize a response based on user preferences",
50
- "- You recall the user mentioned something relevant but it's not in the current context",
51
- "- You need to check media preferences before generating images/music/video",
52
- "- You want to reference the user's project context or tech stack",
53
- "",
54
- "This tool searches recalled memories and the user profile.",
55
- "It does NOT search the current conversation — that's already in your context.",
56
- "Results may be empty if no relevant memories exist.",
57
- ].join("\n"),
58
- parameters: MEMORY_QUERY_TOOL_SCHEMA,
59
- execute: async (_toolCallId, params) => {
60
- const query = params.query?.trim();
61
- if (!query) {
62
- return {
63
- content: [{ type: "text", text: "query parameter is required." }],
64
- details: { type: "memory_query", found: false, errorCode: "empty_query" },
65
- };
66
- }
67
- const category = params.category?.trim() || undefined;
68
- const userId = deps?.userId ?? "user";
69
- const sections = [];
70
- // 1. Memory recall search
71
- if (!category || category === "facts" || category === "projects") {
72
- try {
73
- const facts = deps?.queryGraph?.(query, userId) ?? [];
74
- if (facts.length > 0) {
75
- sections.push("## Recalled Memories\n" + facts.map((f) => `• ${f}`).join("\n"));
76
- }
77
- }
78
- catch { /* degrade gracefully */ }
79
- }
80
- // 2. User Profile summary
81
- if (!category || category === "profile" || category === "projects") {
82
- try {
83
- const profileText = deps?.getProfileSummary?.(userId) ?? null;
84
- if (profileText) {
85
- sections.push("## User Profile\n" + profileText);
86
- }
87
- }
88
- catch { /* degrade gracefully */ }
89
- }
90
- // 3. Media Preferences
91
- if (!category || category === "media") {
92
- try {
93
- const mediaPrefs = deps?.getMediaPreferences?.(userId) ?? null;
94
- if (mediaPrefs) {
95
- const lines = [];
96
- if (mediaPrefs.imageStyle)
97
- lines.push(`• Image style: ${mediaPrefs.imageStyle}`);
98
- if (mediaPrefs.videoStyle)
99
- lines.push(`• Video style: ${mediaPrefs.videoStyle}`);
100
- if (mediaPrefs.musicGenre)
101
- lines.push(`• Music genre: ${mediaPrefs.musicGenre}`);
102
- if (mediaPrefs.musicMood)
103
- lines.push(`• Music mood: ${mediaPrefs.musicMood}`);
104
- if (mediaPrefs.primaryPurpose)
105
- lines.push(`• Primary purpose: ${mediaPrefs.primaryPurpose}`);
106
- if (mediaPrefs.colorPreference)
107
- lines.push(`• Color preference: ${mediaPrefs.colorPreference}`);
108
- if (lines.length > 0) {
109
- sections.push("## Media Preferences\n" + lines.join("\n"));
110
- }
111
- }
112
- }
113
- catch { /* degrade gracefully */ }
114
- }
115
- if (sections.length === 0) {
116
- return {
117
- content: [{ type: "text", text: "No relevant memories found for this query. The user may not have shared this information yet." }],
118
- details: { type: "memory_query", found: false, query },
119
- };
120
- }
121
- return {
122
- content: [{ type: "text", text: sections.join("\n\n") }],
123
- details: { type: "memory_query", found: true, query, category: category ?? "all", sectionCount: sections.length },
124
- };
125
- },
126
- };
127
- }