qlogicagent 2.10.21 → 2.10.23

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 (262) hide show
  1. package/README.md +29 -4
  2. package/dist/agent.js +11 -11
  3. package/dist/cli.js +701 -604
  4. package/dist/index.js +700 -603
  5. package/dist/permissions.js +1 -0
  6. package/dist/protocol.js +1 -1
  7. package/dist/types/agent/tool-access.d.ts +1 -30
  8. package/dist/types/agent/tunable-defaults.d.ts +1 -249
  9. package/dist/types/agent/types.d.ts +7 -0
  10. package/dist/types/cli/acp-extended-handlers.d.ts +41 -0
  11. package/dist/types/cli/acp-extended-host-adapter.d.ts +28 -0
  12. package/dist/types/cli/acp-extended-host-adapter.test.d.ts +1 -0
  13. package/dist/types/cli/acp-session-handlers.d.ts +39 -0
  14. package/dist/types/cli/acp-session-handlers.test.d.ts +1 -0
  15. package/dist/types/cli/agent-config-coordinator.d.ts +13 -0
  16. package/dist/types/cli/agent-config-runtime.d.ts +11 -0
  17. package/dist/types/cli/agent-runner-factory.d.ts +2 -0
  18. package/dist/types/cli/agent-runtime-bootstrap.d.ts +64 -0
  19. package/dist/types/cli/agent-status-notifier.d.ts +11 -0
  20. package/dist/types/cli/agent-status-notifier.test.d.ts +1 -0
  21. package/dist/types/cli/base-tool-bootstrap.d.ts +7 -0
  22. package/dist/types/cli/cli-acp-request-handler.d.ts +9 -0
  23. package/dist/types/cli/cli-acp-request-handler.test.d.ts +1 -0
  24. package/dist/types/cli/cli-agent-builder.d.ts +35 -0
  25. package/dist/types/cli/community-skill-installer.d.ts +12 -0
  26. package/dist/types/cli/community-skill-installer.test.d.ts +1 -0
  27. package/dist/types/cli/core-tool-coordinator.d.ts +30 -0
  28. package/dist/types/cli/core-tools/agent-tool-bootstrap.d.ts +10 -0
  29. package/dist/types/cli/core-tools/agent-tool-service.d.ts +18 -0
  30. package/dist/types/cli/core-tools/checkpoint-tool-bootstrap.d.ts +7 -0
  31. package/dist/types/cli/core-tools/checkpoint-tool-service.d.ts +7 -0
  32. package/dist/types/cli/core-tools/config-tool-bootstrap.d.ts +7 -0
  33. package/dist/types/cli/core-tools/config-tool-service.d.ts +7 -0
  34. package/dist/types/cli/core-tools/cron-tool-bootstrap.d.ts +7 -0
  35. package/dist/types/cli/core-tools/cron-tool-service.d.ts +22 -0
  36. package/dist/types/cli/core-tools/cron-tool-service.test.d.ts +1 -0
  37. package/dist/types/cli/core-tools/monitor-tool-bootstrap.d.ts +5 -0
  38. package/dist/types/cli/core-tools/monitor-tool-service.d.ts +6 -0
  39. package/dist/types/cli/core-tools/registry.d.ts +9 -0
  40. package/dist/types/cli/core-tools/team-tool-bootstrap.d.ts +7 -0
  41. package/dist/types/cli/core-tools/team-tool-service.d.ts +21 -0
  42. package/dist/types/cli/core-tools/utility-tool-bootstrap.d.ts +8 -0
  43. package/dist/types/cli/default-project-bootstrap.d.ts +8 -0
  44. package/dist/types/cli/dev-tool-bootstrap.d.ts +4 -0
  45. package/dist/types/cli/dev-tools/lsp-tool-service.d.ts +5 -0
  46. package/dist/types/cli/dev-tools/repl-lsp-tool-services.test.d.ts +1 -0
  47. package/dist/types/cli/dev-tools/repl-tool-service.d.ts +5 -0
  48. package/dist/types/cli/dream-host-adapter.d.ts +19 -0
  49. package/dist/types/cli/handlers/agents-handler.d.ts +28 -14
  50. package/dist/types/cli/handlers/community-handler.d.ts +25 -0
  51. package/dist/types/cli/handlers/community-handler.test.d.ts +1 -0
  52. package/dist/types/cli/handlers/config-handler.d.ts +15 -9
  53. package/dist/types/cli/handlers/config-handler.test.d.ts +1 -0
  54. package/dist/types/cli/handlers/control-handler.d.ts +23 -0
  55. package/dist/types/cli/handlers/dream-handler.d.ts +21 -1
  56. package/dist/types/cli/handlers/files-handler.d.ts +15 -9
  57. package/dist/types/cli/handlers/files-handler.instructions.test.d.ts +1 -0
  58. package/dist/types/cli/handlers/media-handler.d.ts +10 -4
  59. package/dist/types/cli/handlers/media-handler.test.d.ts +1 -0
  60. package/dist/types/cli/handlers/memory-handler.d.ts +39 -12
  61. package/dist/types/cli/handlers/pet-confirm-handler.d.ts +7 -0
  62. package/dist/types/cli/handlers/pet-handler.d.ts +29 -4
  63. package/dist/types/cli/handlers/pet-handler.test.d.ts +1 -0
  64. package/dist/types/cli/handlers/product-handler.d.ts +40 -14
  65. package/dist/types/cli/handlers/project-handler.d.ts +23 -14
  66. package/dist/types/cli/handlers/session-handler.d.ts +36 -17
  67. package/dist/types/cli/handlers/session-handler.resume.test.d.ts +1 -0
  68. package/dist/types/cli/handlers/settings-handler.d.ts +16 -12
  69. package/dist/types/cli/handlers/skills-handler.d.ts +19 -10
  70. package/dist/types/cli/handlers/skills-handler.profile.test.d.ts +1 -0
  71. package/dist/types/cli/handlers/solo-handler.d.ts +31 -9
  72. package/dist/types/cli/handlers/turn-handler.approval.test.d.ts +1 -0
  73. package/dist/types/cli/handlers/turn-handler.d.ts +17 -11
  74. package/dist/types/cli/idle-dream-coordinator.d.ts +46 -0
  75. package/dist/types/cli/idle-dream-coordinator.test.d.ts +1 -0
  76. package/dist/types/cli/mcp-plugin-bootstrap.d.ts +27 -0
  77. package/dist/types/cli/mcp-plugin-bootstrap.test.d.ts +1 -0
  78. package/dist/types/cli/mcp-tool-proxy.d.ts +7 -0
  79. package/dist/types/cli/media-file-api-service.d.ts +73 -0
  80. package/dist/types/cli/media-file-api-service.test.d.ts +1 -0
  81. package/dist/types/cli/media-file-tool-service.d.ts +13 -0
  82. package/dist/types/cli/memory-coordinator.d.ts +36 -0
  83. package/dist/types/cli/model-client-resolver.d.ts +22 -0
  84. package/dist/types/cli/multi-agent-handler-host.d.ts +27 -0
  85. package/dist/types/cli/multi-agent-handler-host.test.d.ts +1 -0
  86. package/dist/types/cli/multi-agent-state-coordinator.d.ts +11 -0
  87. package/dist/types/cli/permission-bootstrap.d.ts +33 -0
  88. package/dist/types/cli/permission-bootstrap.test.d.ts +1 -0
  89. package/dist/types/cli/permission-settings-store.d.ts +2 -0
  90. package/dist/types/cli/permission-settings-store.test.d.ts +1 -0
  91. package/dist/types/cli/pet-confirm-coordinator.d.ts +20 -0
  92. package/dist/types/cli/pet-confirm-coordinator.test.d.ts +1 -0
  93. package/dist/types/cli/pet-runtime.d.ts +34 -0
  94. package/dist/types/cli/pet-runtime.test.d.ts +1 -0
  95. package/dist/types/cli/project-context.d.ts +1 -0
  96. package/dist/types/cli/project-memory-store-factory.d.ts +2 -0
  97. package/dist/types/cli/project-template-seeder.d.ts +5 -0
  98. package/dist/types/cli/provider-core-facade.d.ts +27 -0
  99. package/dist/types/cli/rpc-registry.community.test.d.ts +1 -0
  100. package/dist/types/cli/rpc-registry.d.ts +8 -0
  101. package/dist/types/cli/runtime-hook-bootstrap.d.ts +34 -0
  102. package/dist/types/cli/runtime-watcher-bootstrap.d.ts +15 -0
  103. package/dist/types/cli/session-coordinator.d.ts +10 -0
  104. package/dist/types/cli/session-coordinator.test.d.ts +1 -0
  105. package/dist/types/cli/session-history-coordinator.d.ts +11 -0
  106. package/dist/types/cli/session-history-coordinator.test.d.ts +1 -0
  107. package/dist/types/cli/skill-meta-tool-bootstrap.d.ts +25 -0
  108. package/dist/types/cli/skill-meta-tool-bootstrap.test.d.ts +1 -0
  109. package/dist/types/cli/stdio-server.d.ts +17 -134
  110. package/dist/types/cli/tool-bootstrap.d.ts +1 -4
  111. package/dist/types/cli/tool-bootstrap.instructions.test.d.ts +1 -0
  112. package/dist/types/cli/tool-bootstrap.media-provider-alias.test.d.ts +1 -0
  113. package/dist/types/cli/tool-catalog.d.ts +2 -0
  114. package/dist/types/cli/tool-invoker-factory.d.ts +10 -0
  115. package/dist/types/cli/tool-result-processor.d.ts +14 -0
  116. package/dist/types/cli/transport.d.ts +2 -12
  117. package/dist/types/cli/turn-ask-user-setup.d.ts +9 -0
  118. package/dist/types/cli/turn-event-forwarder.d.ts +10 -0
  119. package/dist/types/cli/turn-lifecycle.d.ts +19 -0
  120. package/dist/types/cli/turn-lifecycle.test.d.ts +1 -0
  121. package/dist/types/cli/turn-media-setup.d.ts +16 -0
  122. package/dist/types/cli/turn-permission-sync.d.ts +7 -0
  123. package/dist/types/cli/turn-permission-sync.test.d.ts +1 -0
  124. package/dist/types/cli/turn-project-router.d.ts +22 -0
  125. package/dist/types/cli/turn-project-router.test.d.ts +1 -0
  126. package/dist/types/cli/turn-skill-autopersist.d.ts +47 -0
  127. package/dist/types/cli/turn-skill-autopersist.test.d.ts +1 -0
  128. package/dist/types/cli/turn-suggestion-generator.d.ts +15 -0
  129. package/dist/types/orchestration/agent-instance.d.ts +1 -1
  130. package/dist/types/orchestration/dag-scheduler.d.ts +135 -86
  131. package/dist/types/orchestration/index.d.ts +2 -2
  132. package/dist/types/orchestration/product-budget.d.ts +1 -1
  133. package/dist/types/orchestration/product-persistence.d.ts +3 -12
  134. package/dist/types/orchestration/product-planner.d.ts +1 -1
  135. package/dist/types/orchestration/skill-improvement.d.ts +1 -1
  136. package/dist/types/orchestration/solo-evaluator.d.ts +1 -1
  137. package/dist/types/orchestration/solo-persistence.d.ts +1 -1
  138. package/dist/types/orchestration/subagent/fork-subagent.d.ts +1 -1
  139. package/dist/types/orchestration/subagent/task-types.d.ts +1 -146
  140. package/dist/types/orchestration/tool-cascade.d.ts +2 -2
  141. package/dist/types/orchestration/workflow/budget-permission-gate.d.ts +85 -0
  142. package/dist/types/orchestration/workflow/builtin-executors.d.ts +12 -0
  143. package/dist/types/orchestration/workflow/cron-schedule.d.ts +37 -0
  144. package/dist/types/orchestration/workflow/data-item.d.ts +39 -0
  145. package/dist/types/orchestration/workflow/expression.d.ts +52 -0
  146. package/dist/types/orchestration/workflow/host-executors.d.ts +15 -0
  147. package/dist/types/orchestration/workflow/n8n-import.d.ts +35 -0
  148. package/dist/types/orchestration/workflow/node-registry.d.ts +19 -0
  149. package/dist/types/orchestration/workflow/node-schema.d.ts +119 -0
  150. package/dist/types/orchestration/workflow/run-checkpoint-store.d.ts +53 -0
  151. package/dist/types/orchestration/workflow/trigger-validation.d.ts +22 -0
  152. package/dist/types/orchestration/workflow/workflow-controller.d.ts +143 -0
  153. package/dist/types/orchestration/workflow/workflow-patch.d.ts +101 -0
  154. package/dist/types/orchestration/workflow/workflow-render.d.ts +41 -0
  155. package/dist/types/orchestration/workflow/workflow-runtime.d.ts +127 -0
  156. package/dist/types/orchestration/workflow/workflow-scheduler.d.ts +83 -0
  157. package/dist/types/orchestration/workflow/workflow-store.d.ts +40 -0
  158. package/dist/types/orchestration/workflow/workflow-trigger.d.ts +14 -0
  159. package/dist/types/permissions.d.ts +2 -0
  160. package/dist/types/permissions.public-api.test.d.ts +1 -0
  161. package/dist/types/protocol/methods.d.ts +262 -11
  162. package/dist/types/{runtime/infra/acp-types.d.ts → protocol/wire/acp-agent-management.d.ts} +3 -3
  163. package/dist/types/protocol/wire/agent-methods.d.ts +15 -11
  164. package/dist/types/protocol/wire/agent-rpc.d.ts +11 -0
  165. package/dist/types/protocol/wire/chat-types.d.ts +9 -0
  166. package/dist/types/protocol/wire/gateway-rpc.d.ts +13 -0
  167. package/dist/types/protocol/wire/index.d.ts +2 -1
  168. package/dist/types/protocol/wire/notification-payloads.d.ts +18 -3
  169. package/dist/types/runtime/community/community-consent-client.d.ts +117 -0
  170. package/dist/types/runtime/community/community-consent-client.test.d.ts +1 -0
  171. package/dist/types/runtime/community/community-desensitization-red-team-cli.d.ts +7 -0
  172. package/dist/types/runtime/community/community-desensitization-red-team-cli.test.d.ts +1 -0
  173. package/dist/types/runtime/community/community-desensitization.d.ts +29 -0
  174. package/dist/types/runtime/community/community-desensitization.test.d.ts +1 -0
  175. package/dist/types/runtime/community/community-telemetry-recorder.d.ts +6 -0
  176. package/dist/types/runtime/config/tunable-defaults.d.ts +249 -0
  177. package/dist/types/runtime/execution/dream-agent.d.ts +4 -2
  178. package/dist/types/runtime/execution/dream-category-context.d.ts +1 -1
  179. package/dist/types/runtime/execution/forked-agent.d.ts +3 -1
  180. package/dist/types/runtime/execution/streaming-tool-executor.d.ts +4 -2
  181. package/dist/types/runtime/execution/tool-eligibility.d.ts +1 -1
  182. package/dist/types/runtime/hooks/context-compression.d.ts +2 -2
  183. package/dist/types/runtime/hooks/memory-hooks.d.ts +6 -6
  184. package/dist/types/runtime/infra/acp-detector.d.ts +2 -2
  185. package/dist/types/runtime/infra/acp-protocol-adapter.d.ts +1 -1
  186. package/dist/types/runtime/infra/acp-usage-tracker.d.ts +1 -1
  187. package/dist/types/runtime/infra/agent-config-store.d.ts +2 -2
  188. package/dist/types/runtime/infra/agent-paths.d.ts +14 -10
  189. package/dist/types/runtime/infra/agent-paths.test.d.ts +1 -0
  190. package/dist/types/runtime/infra/agent-process.d.ts +2 -2
  191. package/dist/types/runtime/infra/checkpoint-backend.d.ts +2 -2
  192. package/dist/types/runtime/infra/index.d.ts +1 -1
  193. package/dist/types/runtime/infra/llmrouter-catalog.d.ts +10 -0
  194. package/dist/types/runtime/infra/mcp-bridge.d.ts +1 -1
  195. package/dist/types/runtime/infra/model-registry.d.ts +3 -0
  196. package/dist/types/runtime/infra/profile-storage.test.d.ts +1 -0
  197. package/dist/types/runtime/infra/skill-injector.d.ts +3 -2
  198. package/dist/types/runtime/infra/skill-injector.test.d.ts +1 -0
  199. package/dist/types/runtime/infra/task-runtime.d.ts +1 -1
  200. package/dist/types/runtime/infra/worktree-backend.d.ts +2 -2
  201. package/dist/types/runtime/memory/categories.d.ts +5 -0
  202. package/dist/types/runtime/memory/find-relevant-memories.d.ts +70 -0
  203. package/dist/types/runtime/memory/implicit-extraction.d.ts +58 -0
  204. package/dist/types/runtime/memory/recall-category-filter.d.ts +54 -0
  205. package/dist/types/runtime/pet/index.d.ts +1 -1
  206. package/dist/types/runtime/pet/pet-growth-engine.d.ts +10 -9
  207. package/dist/types/runtime/pet/pet-growth-engine.test.d.ts +1 -0
  208. package/dist/types/runtime/pet/pet-soul-service.d.ts +1 -2
  209. package/dist/types/runtime/pet/pet-soul-service.test.d.ts +1 -0
  210. package/dist/types/runtime/ports/agent-execution-contracts.d.ts +182 -0
  211. package/dist/types/runtime/ports/checkpoint-contracts.d.ts +19 -0
  212. package/dist/types/runtime/ports/index.d.ts +13 -0
  213. package/dist/types/runtime/ports/memory-provider.d.ts +146 -0
  214. package/dist/types/runtime/ports/memory-recall-source.d.ts +3 -0
  215. package/dist/types/runtime/ports/memory-writer.d.ts +21 -0
  216. package/dist/types/runtime/ports/path-service.d.ts +5 -0
  217. package/dist/types/runtime/ports/permission-contracts.d.ts +107 -0
  218. package/dist/types/runtime/ports/project-memory-store.d.ts +44 -0
  219. package/dist/types/runtime/ports/tool-call-contracts.d.ts +16 -0
  220. package/dist/types/runtime/ports/tool-contracts.d.ts +23 -0
  221. package/dist/types/runtime/ports/web-search-contracts.d.ts +17 -0
  222. package/dist/types/runtime/ports/worktree-contracts.d.ts +22 -0
  223. package/dist/types/runtime/prompt/environment-context.test.d.ts +1 -0
  224. package/dist/types/runtime/prompt/fresh-workspace-evidence.d.ts +19 -0
  225. package/dist/types/runtime/prompt/fresh-workspace-evidence.test.d.ts +1 -0
  226. package/dist/types/runtime/prompt/instruction-loader.d.ts +9 -3
  227. package/dist/types/runtime/prompt/instruction-loader.test.d.ts +1 -0
  228. package/dist/types/runtime/session/session-persistence.test.d.ts +1 -0
  229. package/dist/types/runtime/tasks/task-types.d.ts +146 -0
  230. package/dist/types/skills/index.d.ts +2 -2
  231. package/dist/types/skills/mcp/mcp-http-client.d.ts +2 -0
  232. package/dist/types/skills/mcp/mcp-manager.d.ts +7 -4
  233. package/dist/types/skills/mcp/mcp-stdio-client.d.ts +2 -0
  234. package/dist/types/skills/mcp/mcp-tool-metadata.d.ts +18 -0
  235. package/dist/types/skills/memory/categories.d.ts +1 -5
  236. package/dist/types/skills/memory/find-relevant-memories.d.ts +1 -70
  237. package/dist/types/skills/memory/implicit-extraction.d.ts +1 -58
  238. package/dist/types/skills/memory/local-memory-provider.d.ts +4 -10
  239. package/dist/types/skills/memory/local-store.d.ts +4 -4
  240. package/dist/types/skills/memory/memory-consolidation.d.ts +9 -1
  241. package/dist/types/skills/memory/memory-provider-factory.d.ts +2 -0
  242. package/dist/types/skills/memory/memory-tool.d.ts +4 -6
  243. package/dist/types/skills/memory/recall-category-filter.d.ts +1 -54
  244. package/dist/types/skills/permissions/community-sandbox-policy.d.ts +3 -0
  245. package/dist/types/skills/permissions/community-sandbox-red-team-cli.d.ts +7 -0
  246. package/dist/types/skills/permissions/community-sandbox-red-team.d.ts +30 -0
  247. package/dist/types/skills/permissions/hook-runner.d.ts +15 -2
  248. package/dist/types/skills/permissions/settings-watcher.d.ts +2 -0
  249. package/dist/types/skills/permissions/types.d.ts +2 -113
  250. package/dist/types/skills/portable-tool.d.ts +22 -0
  251. package/dist/types/skills/skill-system/skill-lifecycle.d.ts +5 -0
  252. package/dist/types/skills/skill-system/skill-source.d.ts +2 -148
  253. package/dist/types/skills/tool-access.d.ts +30 -0
  254. package/dist/types/skills/tools/skill-tool.d.ts +2 -10
  255. package/dist/types/skills/tools/web-search-tool.d.ts +3 -20
  256. package/dist/types/skills/tools.d.ts +1 -1
  257. package/dist/types/transport/acp-server.d.ts +1 -1
  258. package/dist/types/transport/index.d.ts +1 -0
  259. package/dist/types/transport/io-transport.d.ts +19 -0
  260. package/package.json +93 -80
  261. package/dist/types/llm/index.d.ts +0 -1
  262. /package/dist/types/{orchestration/context/context-compression.d.ts → runtime/context/context-compression-strategies.d.ts} +0 -0
@@ -17,7 +17,7 @@
17
17
  *
18
18
  * Reference: claude-code src/utils/forkedAgent.ts
19
19
  */
20
- import type { AgentLogger, ChatMessage, ToolDefinition, ToolInvoker, TokenUsage, TurnEvent, HookRegistry } from "../../agent/types.js";
20
+ import type { AgentLogger, ChatMessage, ToolDefinition, ToolInvoker, TokenUsage, TurnEvent, HookRegistry, ForkedAgentRunnerFactory } from "../ports/agent-execution-contracts.js";
21
21
  import type { LLMTransport } from "@xiaozhiclaw/provider-core";
22
22
  import type { AgentProgress } from "./progress-tracker.js";
23
23
  /**
@@ -49,6 +49,8 @@ export interface ForkedAgentParams {
49
49
  transport: LLMTransport;
50
50
  /** Tool invoker for tool execution */
51
51
  toolInvoker: ToolInvoker;
52
+ /** Factory for the concrete agent runner. Injected to keep runtime independent from agent/. */
53
+ createAgentRunner: ForkedAgentRunnerFactory;
52
54
  /** API key */
53
55
  apiKey: string;
54
56
  /** Model name */
@@ -10,8 +10,8 @@
10
10
  *
11
11
  * Reference: claude-code src/services/tools/StreamingToolExecutor.ts
12
12
  */
13
- import type { ToolInvoker, AgentLogger, HookRegistry } from "../../agent/types.js";
14
- import { type OpenAiToolCall } from "../../orchestration/index.js";
13
+ import type { ToolInvoker, AgentLogger, HookRegistry } from "../ports/agent-execution-contracts.js";
14
+ import { type OpenAiToolCall } from "../ports/tool-call-contracts.js";
15
15
  export type ToolStatus = "queued" | "executing" | "completed" | "yielded";
16
16
  export interface ToolExecutionResult {
17
17
  callId: string;
@@ -20,6 +20,8 @@ export interface ToolExecutionResult {
20
20
  error?: string;
21
21
  blocked?: boolean;
22
22
  blockReason?: string;
23
+ durationMs?: number;
24
+ details?: Record<string, unknown>;
23
25
  message: unknown;
24
26
  }
25
27
  export interface StreamingToolExecutorConfig {
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * Zero imports from express/pg/ioredis/ws.
15
15
  */
16
- import type { ToolDefinition } from "../../agent/types.js";
16
+ import type { ToolDefinition } from "../ports/agent-execution-contracts.js";
17
17
  /**
18
18
  * Tool permission levels aligned with Claude Code's permission model:
19
19
  *
@@ -1,4 +1,4 @@
1
- import { ContextEngineRegistry, type CompressibleMessage, type CompressionResult, type CompressionStrategy, type AsyncCompressionStrategy, type SummarizeFn } from "../../orchestration/index.js";
1
+ import { ContextEngineRegistry, type CompressibleMessage, type CompressionResult, type CompressionStrategy, type AsyncCompressionStrategy, type SummarizeFn } from "../context/context-compression-strategies.js";
2
2
  import type { HookRegistry } from "./hook-registry.js";
3
3
  import type { RuntimeLogger } from "./hook-registry.js";
4
4
  import type { LLMTransport } from "@xiaozhiclaw/provider-core";
@@ -6,7 +6,7 @@ import type { LLMTransport } from "@xiaozhiclaw/provider-core";
6
6
  export declare function estimateTokens(msg: CompressibleMessage): number;
7
7
  /** Estimate total tokens for a message array. */
8
8
  export declare function estimateTotalTokens(messages: CompressibleMessage[]): number;
9
- export declare function getCompressionMetrics(): import("../../orchestration/index.js").CompressionMetricsSnapshot;
9
+ export declare function getCompressionMetrics(): import("../context/context-compression-strategies.js").CompressionMetricsSnapshot;
10
10
  export declare function getContextEngineRegistry(): ContextEngineRegistry;
11
11
  /**
12
12
  * Create a summarization callback using an injected LLM transport.
@@ -1,7 +1,7 @@
1
1
  import type { HookRegistry } from "../../contracts/hooks.js";
2
- import type { MemoryProvider } from "../../protocol/wire/index.js";
3
- import type { LocalMemoryProvider } from "../../skills/memory/local-memory-provider.js";
4
- import type { Memdir } from "../../skills/memory/memdir.js";
2
+ import type { MemoryProvider } from "../ports/memory-provider.js";
3
+ import type { MemoryWriter } from "../ports/memory-writer.js";
4
+ import type { MemoryRecallSource } from "../ports/memory-recall-source.js";
5
5
  export declare const MEMORY_PREFETCH_CONFIG: {
6
6
  readonly MAX_SESSION_BYTES: number;
7
7
  readonly LIMIT_PER_RECALL: 10;
@@ -11,7 +11,7 @@ export interface MemoryHooksDeps {
11
11
  /** QMemory adapter (MemoryProvider with search/health). */
12
12
  memoryProvider?: MemoryProvider;
13
13
  /** Local memory provider for direct writes (auto-extract). */
14
- localMemoryProvider?: LocalMemoryProvider;
14
+ localMemoryProvider?: MemoryWriter;
15
15
  /** User ID for memory lookups. */
16
16
  userId: string;
17
17
  /** Logger. */
@@ -55,8 +55,8 @@ export declare function registerMemoryHooks(hooks: HookRegistry, deps: MemoryHoo
55
55
  /** Shared statepass the same object across hook re-registrations in a session. */
56
56
  prefetchState?: MemoryPrefetchState): () => void;
57
57
  export interface MemdirRecallHookDeps {
58
- /** MEMDIR instance (lazy: may be null at registration time). */
59
- getMemdir: () => Memdir | null;
58
+ /** Project memory recall source (lazy: may be null at registration time). */
59
+ getMemorySource: () => MemoryRecallSource | null;
60
60
  /** Logger. */
61
61
  log: {
62
62
  debug(msg: string): void;
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * Reference: AionUI AcpDetector + ACP_BACKENDS_ALL registry.
8
8
  */
9
- import type { AcpBackendConfig, AgentDescriptor, AgentConfigStoreData } from "./acp-types.js";
9
+ import type { AcpBackendConfig, AgentDescriptor, AgentConfigStoreData } from "../../protocol/wire/acp-agent-management.js";
10
10
  export declare const ACP_BACKENDS: Record<string, AcpBackendConfig>;
11
11
  export declare class AcpDetector {
12
12
  private cache;
@@ -32,5 +32,5 @@ export declare class AcpDetector {
32
32
  * Build an ExternalAgentDescriptor suitable for AgentProcessManager.spawn().
33
33
  * Returns null if the agent is not available.
34
34
  */
35
- buildExternalDescriptor(agentId: string): import("./acp-types.js").ExternalAgentDescriptor | null;
35
+ buildExternalDescriptor(agentId: string): import("../../protocol/wire/acp-agent-management.js").ExternalAgentDescriptor | null;
36
36
  }
@@ -16,7 +16,7 @@
16
16
  * terminal/wait_for_exit, terminal/kill
17
17
  */
18
18
  import type { ChildProcess } from "node:child_process";
19
- import type { AcpInitializeResult, AcpSessionResult, AcpPromptResponse, McpServerConfig } from "./acp-types.js";
19
+ import type { AcpInitializeResult, AcpSessionResult, AcpPromptResponse, McpServerConfig } from "../../protocol/wire/acp-agent-management.js";
20
20
  /**
21
21
  * Handler for agent→host requests (fs, terminal, permission, elicitation).
22
22
  * Host implementations should implement the methods they support.
@@ -8,7 +8,7 @@
8
8
  * The tracker prevents double-counting when an agent sends both
9
9
  * usage_update notifications AND prompt response usage.
10
10
  */
11
- import type { AcpUsageUpdatePayload, AcpPromptResponseUsage } from "./acp-types.js";
11
+ import type { AcpUsageUpdatePayload, AcpPromptResponseUsage } from "../../protocol/wire/acp-agent-management.js";
12
12
  export interface AccumulatedUsage {
13
13
  inputTokens: number;
14
14
  outputTokens: number;
@@ -3,12 +3,12 @@
3
3
  *
4
4
  * Storage paths:
5
5
  * - Project-level: `<cwd>/.qlogicagent/agent-configs.json`
6
- * - User-level: `~/.qlogicagent/agent-configs.json`
6
+ * - User-level: `~/.qlogicagent/profiles/<owner>/agent-configs.json`
7
7
  *
8
8
  * Merge strategy: project-level overrides take precedence.
9
9
  * Sensitive fields (apiKey) use file permissions 0o600 on Unix.
10
10
  */
11
- import type { AgentConfig, AgentConfigStoreData, CustomAgentDef } from "./acp-types.js";
11
+ import type { AgentConfig, AgentConfigStoreData, CustomAgentDef } from "../../protocol/wire/acp-agent-management.js";
12
12
  export declare class AgentConfigStore {
13
13
  private data;
14
14
  private cwd;
@@ -9,35 +9,39 @@
9
9
  export declare const AGENT_DOT_DIR = ".qlogicagent";
10
10
  /** `~/.qlogicagent/` (or QLOGICAGENT_HOME override) */
11
11
  export declare function getUserAgentHome(): string;
12
+ export declare function resolveActiveOwnerUserId(): string;
13
+ export declare function encodeOwnerProfileSegment(ownerUserId: string): string;
14
+ export declare function getOwnerProfileDir(ownerUserId?: string): string;
15
+ export declare function getProfileMemoryDir(ownerUserId?: string): string;
12
16
  /**
13
17
  * Ensure the user agent home directory exists and is writable.
14
18
  * Returns the path if accessible, throws with a friendly message otherwise.
15
19
  * Call this once at startup rather than on every path resolution.
16
20
  */
17
21
  export declare function ensureUserAgentHome(): string;
18
- /** `~/.qlogicagent/.credentials.json` */
22
+ /** `~/.qlogicagent/profiles/<owner>/.credentials.json` */
19
23
  export declare function getUserCredentialsPath(): string;
20
- /** `~/.qlogicagent/plugins/` */
24
+ /** `~/.qlogicagent/profiles/<owner>/plugins/` */
21
25
  export declare function getUserPluginsDir(): string;
22
- /** `~/.qlogicagent/skills/` */
26
+ /** `~/.qlogicagent/profiles/<owner>/skills/` */
23
27
  export declare function getUserSkillsDir(): string;
24
- /** `~/.qlogicagent/settings.json` */
28
+ /** `~/.qlogicagent/profiles/<owner>/settings.json` */
25
29
  export declare function getUserSettingsPath(): string;
26
30
  /** `~/.qlogicagent/cache/` */
27
31
  export declare function getUserCacheDir(): string;
28
32
  /** `~/.qlogicagent/debug-logs/` */
29
33
  export declare function getUserDebugLogsDir(): string;
30
- /** `~/.qlogicagent/plugin-cache/` */
34
+ /** `~/.qlogicagent/profiles/<owner>/plugin-cache/` */
31
35
  export declare function getUserPluginCacheDir(): string;
32
- /** `~/.qlogicagent/mcp.json` */
36
+ /** `~/.qlogicagent/profiles/<owner>/mcp.json` */
33
37
  export declare function getUserMcpConfigPath(): string;
34
- /** `~/.qlogicagent/marketplace.json` */
38
+ /** `~/.qlogicagent/profiles/<owner>/marketplace.json` */
35
39
  export declare function getUserMarketplaceConfigPath(): string;
36
- /** `~/.qlogicagent/workflows/` */
40
+ /** `~/.qlogicagent/profiles/<owner>/workflows/` */
37
41
  export declare function getUserWorkflowsDir(): string;
38
- /** `~/.qlogicagent/INSTRUCTIONS.md` */
42
+ /** `~/.qlogicagent/profiles/<owner>/INSTRUCTIONS.md` */
39
43
  export declare function getUserInstructionsPath(): string;
40
- /** `~/.qlogicagent/rules/` */
44
+ /** `~/.qlogicagent/profiles/<owner>/rules/` */
41
45
  export declare function getUserRulesDir(): string;
42
46
  /** `<cwd>/.qlogicagent/` */
43
47
  export declare function getProjectAgentDir(cwd: string): string;
@@ -0,0 +1 @@
1
+ export {};
@@ -13,8 +13,8 @@
13
13
  * Reference: claude-code-haha/src/utils/swarm/spawnMultiAgent.ts
14
14
  * Reference: claude-code-haha/src/utils/swarm/spawnUtils.ts
15
15
  */
16
- import type { ExternalAgentDescriptor, McpServerConfig } from "./acp-types.js";
17
- import type { AgentConfig } from "./acp-types.js";
16
+ import type { ExternalAgentDescriptor, McpServerConfig } from "../../protocol/wire/acp-agent-management.js";
17
+ import type { AgentConfig } from "../../protocol/wire/acp-agent-management.js";
18
18
  import { AcpUsageTracker } from "./acp-usage-tracker.js";
19
19
  export interface AgentProcessConfig {
20
20
  /** Unique member ID (e.g. "team-research-coder"). */
@@ -4,5 +4,5 @@
4
4
  * Creates and manages checkpoint snapshots in `<project>/.qlogicagent/checkpoints/<sessionId>/`
5
5
  * using a shadow git repository independent of the user's project .git.
6
6
  */
7
- import type { CheckpointToolDeps } from "../../skills/tools/checkpoint-tool.js";
8
- export declare function createLocalCheckpointBackend(projectRoot: string, sessionId: string): CheckpointToolDeps;
7
+ import type { CheckpointBackend } from "../ports/checkpoint-contracts.js";
8
+ export declare function createLocalCheckpointBackend(projectRoot: string, sessionId: string): CheckpointBackend;
@@ -15,5 +15,5 @@ export { ModelIdTranslator } from "./model-id-translator.js";
15
15
  export { SkillInjector } from "./skill-injector.js";
16
16
  export { ACP_FAULT_LEVEL, type AcpFaultLevel, buildLlmEnvForTeammate } from "./agent-process.js";
17
17
  export { McpBridge, MCP_BRIDGE_TOOLS } from "./mcp-bridge.js";
18
- export type { AgentCategory, AgentProtocol, AgentStatus, AcpBackendConfig, AgentDescriptor, ExternalAgentDescriptor, CustomAgentDef, AgentConfig, AgentConfigStoreData, AgentCapabilities, AcpInitializeResult, AcpSessionResult, AcpPromptResponse, AcpPromptResponseUsage, AcpStopReason, AcpUsageUpdatePayload, McpServerConfig, AgentsScanParams, AgentsConfigParams, AgentsSetConfigParams, AgentsGetConfigParams, AgentsRemoveConfigParams, AgentsSetGatewayParams, SoloState, SoloAgentState, SoloAgentResult, SoloEvaluation, SoloStatus, SoloStartParams, SoloIdParams, SoloSelectParams, ProductPhase, ProductInstanceState, ProductTaskStatus, ProductBudget, ProductInstanceDef, ProductTaskDef, ProductCreateParams, ProductIdParams, ProductInstanceStatus, ProductTaskState, ProductStatus, ProductSummary, AgentsGetGatewayResult, AgentsListConfiguredItem, AgentsProcessInfo, AgentsKillParams, AgentsGetLogParams, AgentsGetLogResult, AgentsTestConnectionParams, AgentsTestConnectionResult, SoloDeleteParams, ProductDeleteParams, AgentSource, } from "./acp-types.js";
18
+ export type { AgentCategory, AgentProtocol, AgentStatus, AcpBackendConfig, AgentDescriptor, ExternalAgentDescriptor, CustomAgentDef, AgentConfig, AgentConfigStoreData, AgentCapabilities, AcpInitializeResult, AcpSessionResult, AcpPromptResponse, AcpPromptResponseUsage, AcpStopReason, AcpUsageUpdatePayload, McpServerConfig, AgentsScanParams, AgentsConfigParams, AgentsSetConfigParams, AgentsGetConfigParams, AgentsRemoveConfigParams, AgentsSetGatewayParams, SoloState, SoloAgentState, SoloAgentResult, SoloEvaluation, SoloStatus, SoloStartParams, SoloIdParams, SoloSelectParams, ProductPhase, ProductInstanceState, ProductTaskStatus, ProductBudget, ProductInstanceDef, ProductTaskDef, ProductCreateParams, ProductIdParams, ProductInstanceStatus, ProductTaskState, ProductStatus, ProductSummary, AgentsGetGatewayResult, AgentsListConfiguredItem, AgentsProcessInfo, AgentsKillParams, AgentsGetLogParams, AgentsGetLogResult, AgentsTestConnectionParams, AgentsTestConnectionResult, SoloDeleteParams, ProductDeleteParams, AgentSource, } from "../../protocol/wire/acp-agent-management.js";
19
19
  export type { AgentsStatusNotification, AgentsErrorNotification, SoloProgressNotification, SoloEvaluationNotification, SoloAgentDeltaNotification, ProductTaskStartedNotification, ProductTaskCompletedNotification, ProductTaskFailedNotification, ProductCheckpointedNotification, ProductBudgetWarningNotification, ProductCompletedNotification, } from "../../protocol/notifications.js";
@@ -1,5 +1,7 @@
1
1
  import type { ModelEntry, ModelRegistry } from "./model-registry.js";
2
2
  export declare const LLMROUTER_CATALOG_UNAVAILABLE_MESSAGE = "\u65E0\u6CD5\u8FDE\u63A5 llmrouter \u6A21\u578B\u76EE\u5F55";
3
+ export declare const LLMROUTER_PROVIDER_ID = "llmrouter";
4
+ export declare const LLMROUTER_PROVIDER_NAME = "LLMRouter";
3
5
  export declare class LlmrouterCatalogUnavailableError extends Error {
4
6
  constructor(message?: string);
5
7
  }
@@ -40,10 +42,18 @@ export interface LlmrouterCatalogModel {
40
42
  capabilities?: string[];
41
43
  pricing?: Record<string, unknown>;
42
44
  }
45
+ export declare function getLlmrouterBaseUrl(): string;
46
+ export declare function getLlmrouterModelsUrl(baseUrl: string): string;
43
47
  export declare function listLlmrouterCatalogProviders(): Promise<LlmrouterCatalogProvider[]>;
44
48
  export declare function listLlmrouterCatalogModels(): Promise<LlmrouterCatalogModel[]>;
49
+ export declare function listLlmrouterModelsByApiKey(baseUrl: string, apiKey: string): Promise<LlmrouterCatalogModel[]>;
45
50
  export declare function providerDisplayName(provider: LlmrouterCatalogProvider): string;
46
51
  export declare function providerBaseUrl(provider: LlmrouterCatalogProvider): string | undefined;
47
52
  export declare function getLlmrouterCatalogProvider(providerId: string): Promise<LlmrouterCatalogProvider | null>;
48
53
  export declare function refreshRegistryFromLlmrouterCatalog(registry: ModelRegistry): Promise<ModelEntry[]>;
54
+ export declare function refreshRegistryFromLlmrouterApiKey(registry: ModelRegistry, options: {
55
+ baseUrl: string;
56
+ apiKey: string;
57
+ }): Promise<ModelEntry[]>;
49
58
  export declare function toModelEntry(model: LlmrouterCatalogModel): ModelEntry | null;
59
+ export declare function toModelEntries(model: LlmrouterCatalogModel): ModelEntry[];
@@ -13,7 +13,7 @@
13
13
  * The bridge server runs as a stdio child process. Each external agent
14
14
  * session gets its own MCP bridge server instance.
15
15
  */
16
- import type { McpServerConfig, AgentCapabilities } from "./acp-types.js";
16
+ import type { McpServerConfig, AgentCapabilities } from "../../protocol/wire/acp-agent-management.js";
17
17
  /**
18
18
  * Tools exported via MCP bridge.
19
19
  * These represent qlogicagent capabilities that external agents can call.
@@ -88,6 +88,7 @@ export declare class ModelRegistry {
88
88
  id?: string;
89
89
  }): string;
90
90
  replaceCatalogModels(entries: ModelEntry[]): void;
91
+ replaceProviderModels(providerId: string, entries: ModelEntry[]): void;
91
92
  migrateModelIds(aliasToNative: Map<string, string>): void;
92
93
  removeModel(id: string): void;
93
94
  enableModel(id: string): void;
@@ -113,6 +114,7 @@ export declare class ModelRegistry {
113
114
  hasConfiguredKeyForProviderVariant(providerId: string): boolean;
114
115
  hasAvailableKeyForProviderVariant(providerId: string): boolean;
115
116
  listProviderDefs(): ProviderDef[];
117
+ getKnownProviderDef(providerId: string): ProviderDef | null;
116
118
  resolveProviderApiKey(providerId: string): string | undefined;
117
119
  onChange(callback: RegistryChangeCallback): () => void;
118
120
  getKeyForProvider(providerId: string): string | null;
@@ -122,6 +124,7 @@ export declare class ModelRegistry {
122
124
  private resolveTechnicalVariant;
123
125
  private providerVariantKeyCandidates;
124
126
  private loadModelState;
127
+ private hydrateCatalogModels;
125
128
  private exportModelState;
126
129
  private emitChange;
127
130
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -11,9 +11,10 @@
11
11
  * directory support, prepend skill instructions text to the first prompt.
12
12
  * Subject to a token budget to prevent context bloat.
13
13
  */
14
- import type { AgentCapabilities } from "./acp-types.js";
15
- import { SKILL_INJECTION_MAX_CHARS, SKILL_INJECTION_MAX_COUNT } from "../../agent/tunable-defaults.js";
14
+ import type { AgentCapabilities } from "../../protocol/wire/acp-agent-management.js";
15
+ import { SKILL_INJECTION_MAX_CHARS, SKILL_INJECTION_MAX_COUNT } from "../config/tunable-defaults.js";
16
16
  export { SKILL_INJECTION_MAX_CHARS, SKILL_INJECTION_MAX_COUNT };
17
+ export declare function isSystemGeneratedSkillName(name: string): boolean;
17
18
  export declare class SkillInjector {
18
19
  /**
19
20
  * Synchronize skills to an agent's native skill directory.
@@ -0,0 +1 @@
1
+ export {};
@@ -9,7 +9,7 @@
9
9
  * Architecture note: CC uses React-style setAppState(prev => next). We use
10
10
  * a simple Map-based store since we're in a subprocess (no React).
11
11
  */
12
- import type { TaskState, TaskType, TaskLifecycle, PermissionRole, IsolationMode, LocalAgentTaskState, LocalBashTaskState } from "../../orchestration/subagent/task-types.js";
12
+ import type { TaskState, TaskType, TaskLifecycle, PermissionRole, IsolationMode, LocalAgentTaskState, LocalBashTaskState } from "../tasks/task-types.js";
13
13
  import type { HookRegistry } from "../../contracts/hooks.js";
14
14
  /** Polling interval for running tasks (ms) */
15
15
  export declare const POLL_INTERVAL_MS = 1000;
@@ -17,7 +17,7 @@
17
17
  *
18
18
  * Security: validateWorktreeSlug() prevents path traversal.
19
19
  */
20
- import type { WorktreeToolDeps } from "../../skills/tools/worktree-tool.js";
20
+ import type { WorktreeBackend } from "../ports/worktree-contracts.js";
21
21
  interface WorktreeSession {
22
22
  originalCwd: string;
23
23
  worktreePath: string;
@@ -82,5 +82,5 @@ export interface WorktreeBackendOptions {
82
82
  /** Sparse-checkout paths (CC settings.worktree.sparsePaths parity). */
83
83
  sparsePaths?: string[];
84
84
  }
85
- export declare function createWorktreeBackend(opts: WorktreeBackendOptions): WorktreeToolDeps;
85
+ export declare function createWorktreeBackend(opts: WorktreeBackendOptions): WorktreeBackend;
86
86
  export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Memory categories for QMemory writes.
3
+ * Each has different value thresholds and retention policies.
4
+ */
5
+ export type QMemoryCategory = "lesson" | "preference" | "pattern" | "fact" | "decision" | "skill-learning";
@@ -0,0 +1,70 @@
1
+ export declare const RELEVANT_MEMORIES_CONFIG: {
2
+ /** Max topic files to consider during scan. */
3
+ readonly MAX_SCAN_FILES: 100;
4
+ /** Max files to surface per turn. */
5
+ readonly MAX_SELECTED: 5;
6
+ /** Max bytes per surfaced file (CC: 4096). */
7
+ readonly MAX_FILE_BYTES: 4096;
8
+ /** Max total bytes for all surfaced files combined. */
9
+ readonly MAX_TOTAL_BYTES: number;
10
+ /** Minimum score to be selected (0.0-1.0). */
11
+ readonly MIN_SCORE: 0.2;
12
+ /** Lines to read for header/description extraction. */
13
+ readonly HEADER_LINES: 10;
14
+ /** Recency boost: files modified within this many days get a bonus. */
15
+ readonly RECENCY_DAYS: 7;
16
+ /** Recency boost amount. */
17
+ readonly RECENCY_BOOST: 0.15;
18
+ };
19
+ /** Scanned memory file header (CC MemoryHeader parity). */
20
+ export interface MemoryFileHeader {
21
+ /** Filename (e.g. "lesson-docker.md") */
22
+ filename: string;
23
+ /** Absolute path */
24
+ filePath: string;
25
+ /** Last modified timestamp (ms since epoch) */
26
+ mtimeMs: number;
27
+ /** File size in bytes */
28
+ sizeBytes: number;
29
+ /** Description extracted from first non-heading line */
30
+ description: string | null;
31
+ /** Category inferred from filename prefix */
32
+ category: string | null;
33
+ }
34
+ /** A selected relevant memory with content loaded. */
35
+ export interface RelevantMemory {
36
+ /** Filename */
37
+ filename: string;
38
+ /** Full file path */
39
+ filePath: string;
40
+ /** Last modified timestamp */
41
+ mtimeMs: number;
42
+ /** Relevance score (0.0 - 1.0) */
43
+ score: number;
44
+ /** Content (possibly truncated) */
45
+ content: string;
46
+ /** Whether content was truncated */
47
+ truncated: boolean;
48
+ }
49
+ /**
50
+ * Find memory files relevant to a user query.
51
+ *
52
+ * CC parity: scans topic files, scores by keyword + filename + recency,
53
+ * selects top-N, loads content. No LLM needed (unlike CC's Sonnet call).
54
+ *
55
+ * @param query - User query text
56
+ * @param memoryDir - Root of the MEMDIR directory (~/.qlogicagent/memory/)
57
+ * @param alreadySurfaced - Paths already shown in prior turns (for dedup)
58
+ * @returns Relevant memories with content, sorted by score
59
+ */
60
+ export declare function findRelevantMemories(query: string, memoryDir: string, alreadySurfaced?: ReadonlySet<string>): Promise<RelevantMemory[]>;
61
+ /**
62
+ * Scan memory directory for topic files (excludes INDEX.md).
63
+ * Returns headers sorted by modification time (newest first).
64
+ */
65
+ export declare function scanMemoryHeaders(memoryDir: string): Promise<MemoryFileHeader[]>;
66
+ /**
67
+ * Format relevant memories as a single block for system prompt injection.
68
+ * CC parity: includes freshness header per file.
69
+ */
70
+ export declare function formatRelevantMemoriesBlock(memories: RelevantMemory[]): string;
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Implicit Memory Extraction — CC extractMemories lightweight port.
3
+ *
4
+ * Architecture:
5
+ * Layer 1: Zero-cost signal detection (regex) — decides if turn has extractable content
6
+ * Layer 2: Lightweight LLM pass (async, non-blocking) — extracts structured facts
7
+ *
8
+ * This runs AFTER turn.end, so the user already has their response.
9
+ * Layer 2 only fires for ~10-20% of turns (those with detectable signals).
10
+ *
11
+ * Reference: claude-code src/services/extractMemories/extractMemories.ts
12
+ */
13
+ import type { MemoryWriter } from "../ports/memory-writer.js";
14
+ export interface ExtractedFact {
15
+ text: string;
16
+ category: "personal_fact" | "preference" | "event" | "lesson" | "pattern" | "decision";
17
+ importance: number;
18
+ eventDate?: string;
19
+ }
20
+ export interface ImplicitExtractionDeps {
21
+ /** Local memory provider for writing extracted facts. */
22
+ localProvider: MemoryWriter;
23
+ /** User ID. */
24
+ userId: string;
25
+ /** Logger. */
26
+ log: {
27
+ debug(msg: string): void;
28
+ warn(msg: string): void;
29
+ };
30
+ /**
31
+ * LLM invocation function (uses background/cheap model).
32
+ * Returns structured JSON string or null if unavailable.
33
+ */
34
+ llmExtract?: (prompt: string) => Promise<string | null>;
35
+ }
36
+ export interface TurnPair {
37
+ userMessage: string;
38
+ assistantMessage: string;
39
+ }
40
+ /**
41
+ * Layer 1: Detect if a user message contains signals worth extracting.
42
+ * Zero LLM cost — pure regex scanning.
43
+ *
44
+ * @returns true if the message likely contains extractable personal facts/events
45
+ */
46
+ export declare function hasExtractionSignal(userMessage: string): boolean;
47
+ /**
48
+ * Layer 2: Use a lightweight LLM to extract structured facts from a turn pair.
49
+ * Only called when Layer 1 signals are detected.
50
+ */
51
+ export declare function extractFactsViaLlm(turn: TurnPair, llmExtract: (prompt: string) => Promise<string | null>, today: string): Promise<ExtractedFact[]>;
52
+ /**
53
+ * Run the full implicit extraction pipeline for a completed turn.
54
+ * This is async and non-blocking — call it after turn.end.
55
+ *
56
+ * @returns Number of facts extracted and stored
57
+ */
58
+ export declare function runImplicitExtraction(turn: TurnPair, deps: ImplicitExtractionDeps): Promise<number>;
@@ -0,0 +1,54 @@
1
+ import type { QMemoryCategory } from "./categories.js";
2
+ /** Detected query scenario with preferred categories. */
3
+ export interface RecallCategoryHint {
4
+ /** Detected scenario label. */
5
+ scenario: QueryScenario;
6
+ /** Preferred categories for this scenario (ordered by priority). */
7
+ preferred: QMemoryCategory[];
8
+ /** Categories to deprioritize (still recalled but scored lower). */
9
+ deprioritized: QMemoryCategory[];
10
+ /** Confidence of scenario detection (0.0-1.0). */
11
+ confidence: number;
12
+ }
13
+ /** Known query scenarios. */
14
+ export type QueryScenario = "coding" | "config" | "conversation" | "learning" | "decision" | "general";
15
+ /**
16
+ * Detect the query scenario and return category preferences.
17
+ *
18
+ * Uses pattern matching on the user query to infer intent.
19
+ * Returns "general" (no filtering) when confidence is below threshold.
20
+ *
21
+ * @param query - User query text
22
+ * @returns Category hint with preferred/deprioritized categories
23
+ */
24
+ export declare function detectRecallCategories(query: string): RecallCategoryHint;
25
+ /**
26
+ * Apply category boost/penalty to a recall score.
27
+ *
28
+ * Used by recall hooks to adjust memory scores based on category alignment.
29
+ *
30
+ * @param baseScore - Original relevance score (0.0-1.0)
31
+ * @param memoryCategory - Category of the memory entry (if known)
32
+ * @param hint - Category hint from detectRecallCategories()
33
+ * @returns Adjusted score
34
+ */
35
+ export declare function applyCategoryBoost(baseScore: number, memoryCategory: string | undefined | null, hint: RecallCategoryHint): number;
36
+ /**
37
+ * Filter and re-rank a list of recalled memories based on category preferences.
38
+ *
39
+ * @param memories - Raw recalled memories with optional category
40
+ * @param hint - Category hint from detectRecallCategories()
41
+ * @param minScore - Minimum adjusted score to keep (default: 0)
42
+ * @returns Re-ranked memories (highest adjusted score first)
43
+ */
44
+ export declare function filterByCategory<T extends {
45
+ score?: number;
46
+ category?: string | null;
47
+ }>(memories: T[], hint: RecallCategoryHint, minScore?: number): T[];
48
+ /**
49
+ * Infer memory category from filename prefix convention.
50
+ * E.g. "lesson-docker.md" → "lesson", "fact-ports.md" → "fact"
51
+ *
52
+ * Exported for use by recall hooks.
53
+ */
54
+ export declare function inferCategoryFromFilename(filename: string): QMemoryCategory | null;
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export { PetSoulService, type PetSoul, type PetStats, type PetBreed } from "./pet-soul-service.js";
5
5
  export { maybeGenerateReaction, generateLLMReaction, type ReactionPool, type LLMReactionContext, type ReactionStyle } from "./pet-reaction-service.js";
6
- export { PetGrowthEngine, type GrowthEvent, type MoltResult, type PetAbility } from "./pet-growth-engine.js";
6
+ export { PetGrowthEngine, type GrowthEvent, type MoltResult, type PetDisplayTrait } from "./pet-growth-engine.js";
7
7
  export { loadPetFile, validatePetManifest, sanitizeSvg, type PetManifest, type PetFileBundle } from "./pet-file-loader.js";
8
8
  export { buildSkeletonPrompt, parseSkeleton, renderState, extractColors, validateSkeleton, STATE_ANIMATION_MAP, type PetSkeleton, type SkeletonPart, type StateAnimationParams } from "./pet-skeleton.js";
9
9
  export { evaluateConsistency, evaluateConsistencyWithVision, structuralConsistencyScore, buildConsistencyPrompt, parseConsistencyResponse, buildRetryPrompt, DEFAULT_THRESHOLD, DEFAULT_MAX_RETRIES, type ConsistencyResult, type ConsistencyReport, type ConsistencyOptions } from "./pet-consistency.js";
@@ -1,23 +1,24 @@
1
1
  /**
2
- * PetGrowthEngine — handles pet leveling, molting (脱壳升级), and ability unlocks.
2
+ * PetGrowthEngine — handles pet leveling, molting, and display-trait unlocks.
3
3
  *
4
4
  * Design §13: Growth system
5
5
  * - XP curve: level * 100 (linear P0, polynomial later)
6
6
  * - Molting: every 5 levels triggers a "molt" event with visual upgrade
7
- * - Abilities: unlocked at specific levels
7
+ * - Display traits: unlocked at specific levels, presentation-only
8
8
  * - Stats growth: each level-up slightly boosts one stat
9
9
  */
10
10
  import type { PetStats, PetSoul } from "./pet-soul-service.js";
11
- export interface PetAbility {
11
+ export interface PetDisplayTrait {
12
12
  id: string;
13
13
  name: string;
14
14
  description: string;
15
15
  unlockedAtLevel: number;
16
+ surface: "presentation";
16
17
  }
17
18
  export interface GrowthEvent {
18
- type: "level_up" | "molt" | "ability_unlock";
19
+ type: "level_up" | "molt" | "display_trait_unlock";
19
20
  level: number;
20
- ability?: PetAbility;
21
+ displayTrait?: PetDisplayTrait;
21
22
  moltStage?: number;
22
23
  }
23
24
  export interface MoltResult {
@@ -46,13 +47,13 @@ export declare class PetGrowthEngine {
46
47
  */
47
48
  static getMoltResult(stage: number, currentStats: PetStats): MoltResult;
48
49
  /**
49
- * Get all unlocked abilities for a given level.
50
+ * Get all unlocked presentation traits for a given level.
50
51
  */
51
- static getUnlockedAbilities(level: number): PetAbility[];
52
+ static getUnlockedDisplayTraits(level: number): PetDisplayTrait[];
52
53
  /**
53
- * Get next upcoming ability.
54
+ * Get next upcoming presentation trait.
54
55
  */
55
- static getNextAbility(level: number): PetAbility | null;
56
+ static getNextDisplayTrait(level: number): PetDisplayTrait | null;
56
57
  /**
57
58
  * XP gain rules for different events.
58
59
  */
@@ -0,0 +1 @@
1
+ export {};
@@ -31,10 +31,9 @@ export interface PetBreed {
31
31
  rarity: string;
32
32
  }
33
33
  export declare class PetSoulService {
34
- private workspaceDir;
35
34
  private soul;
36
35
  private storagePath;
37
- constructor(workspaceDir: string);
36
+ constructor(_workspaceDir: string, ownerUserId?: string);
38
37
  load(): PetSoul | null;
39
38
  hatch(userId: string, generateSoul?: (rarity: string, stats: PetStats) => Promise<{
40
39
  name: string;
@@ -0,0 +1 @@
1
+ export {};