maka-agent 0.2.0-dev.44.20260920 → 0.2.0-dev.46.20260922

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 (61) hide show
  1. package/dist/runtime-host-service-manager.js +1 -6
  2. package/dist/runtime-host-update-command.js +39 -27
  3. package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
  4. package/node_modules/@maka/core/dist/artifacts.js +1 -0
  5. package/node_modules/@maka/core/dist/model-metadata.js +1 -2
  6. package/node_modules/@maka/core/dist/provider-auth.js +1 -7
  7. package/node_modules/@maka/core/dist/provider-registry.js +13 -7
  8. package/node_modules/@maka/core/dist/recall.js +5 -1
  9. package/node_modules/@maka/core/dist/session-start-mode.js +2 -5
  10. package/node_modules/@maka/core/dist/session.js +0 -1
  11. package/node_modules/@maka/core/dist/settings.js +17 -0
  12. package/node_modules/@maka/core/dist/tool-quiet-preview.js +2 -16
  13. package/node_modules/@maka/core/dist/transcript-search.js +46 -0
  14. package/node_modules/@maka/core/package.json +1 -4
  15. package/node_modules/@maka/runtime/dist/model-factory.js +0 -16
  16. package/node_modules/@maka/runtime/dist/model-fetcher.js +1 -4
  17. package/node_modules/@maka/runtime/dist/model-runtime.js +0 -8
  18. package/node_modules/@maka/runtime/dist/recall-tools.js +4 -0
  19. package/node_modules/@maka/runtime/dist/session-manager.js +4 -13
  20. package/node_modules/@maka/runtime/dist/subagent-tools.js +69 -11
  21. package/node_modules/@maka/runtime/dist/test-connection.js +1 -48
  22. package/node_modules/@maka/runtime/package.json +0 -1
  23. package/node_modules/@maka/runtime-host/dist/client/host-handoff-copy.js +25 -18
  24. package/node_modules/@maka/runtime-host/dist/client/host-handoff.js +3 -1
  25. package/node_modules/@maka/runtime-host/dist/protocol/connection-effects.js +0 -108
  26. package/node_modules/@maka/runtime-host/dist/protocol/index.js +6 -1
  27. package/node_modules/@maka/runtime-host/dist/protocol/operations.js +4 -5
  28. package/node_modules/@maka/runtime-host/dist/protocol/recall.js +270 -0
  29. package/node_modules/@maka/runtime-host/dist/protocol/session-continuity.js +1 -7
  30. package/node_modules/@maka/runtime-host/dist/protocol/usage-screen.js +12 -4
  31. package/node_modules/@maka/runtime-host/dist/server/access-credential-store.js +4 -0
  32. package/node_modules/@maka/runtime-host/dist/server/connection-effect-coordinator.js +1 -57
  33. package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +11 -33
  34. package/node_modules/@maka/runtime-host/dist/server/interactive-run-composer.js +3 -20
  35. package/node_modules/@maka/runtime-host/dist/server/recall-coordinator.js +117 -0
  36. package/node_modules/@maka/runtime-host/dist/server/session-revision-coordinator.js +0 -4
  37. package/node_modules/@maka/storage/dist/artifact-metadata-codec.js +4 -3
  38. package/node_modules/@maka/storage/dist/artifact-store.js +1 -11
  39. package/node_modules/@maka/storage/dist/process-lifetime-file-update-lock.js +0 -41
  40. package/node_modules/@maka/storage/dist/runtime-policy/coordinator.js +0 -28
  41. package/node_modules/@maka/storage/dist/runtime-policy-stores.js +0 -2
  42. package/node_modules/@maka/storage/dist/sqlite-usage-schema.js +29 -5
  43. package/node_modules/@maka/storage/dist/sqlite-workflow-schema.js +2 -0
  44. package/node_modules/@maka/storage/dist/storage-writer-composition.js +0 -3
  45. package/node_modules/@maka/storage/dist/telemetry-file-schema.js +5 -3
  46. package/node_modules/@maka/storage/dist/usage-screen.js +5 -6
  47. package/node_modules/@maka/storage/dist/usage-stores.js +14 -4
  48. package/node_modules/@maka/storage/package.json +0 -2
  49. package/package.json +1 -1
  50. package/node_modules/@maka/core/dist/connection-usage.js +0 -27
  51. package/node_modules/@maka/core/dist/deep-research-client-progress.js +0 -132
  52. package/node_modules/@maka/core/dist/deep-research-run.js +0 -625
  53. package/node_modules/@maka/core/dist/deep-research.js +0 -208
  54. package/node_modules/@maka/core/dist/thread-search.js +0 -498
  55. package/node_modules/@maka/runtime/dist/commandcode-cli-language-model.js +0 -837
  56. package/node_modules/@maka/runtime/dist/connection-usage.js +0 -232
  57. package/node_modules/@maka/runtime/dist/deep-research-tools.js +0 -732
  58. package/node_modules/@maka/runtime-host/dist/protocol/deep-research.js +0 -233
  59. package/node_modules/@maka/runtime-host/dist/server/deep-research-coordinator.js +0 -116
  60. package/node_modules/@maka/storage/dist/deep-research-authority.js +0 -129
  61. package/node_modules/@maka/storage/dist/deep-research-store.js +0 -343
@@ -1,208 +0,0 @@
1
- /*
2
- * Licensed to the Apache Software Foundation (ASF) under one
3
- * or more contributor license agreements. See the NOTICE file
4
- * distributed with this work for additional information
5
- * regarding copyright ownership. The ASF licenses this file
6
- * to you under the Apache License, Version 2.0 (the
7
- * "License"); you may not use this file except in compliance
8
- * with the License. You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing,
13
- * software distributed under the License is distributed on an
14
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
- * KIND, either express or implied. See the License for the
16
- * specific language governing permissions and limitations
17
- * under the License.
18
- */
19
- import { SESSION_START_MODE_SPECS } from './session-start-mode.js';
20
- export const DEEP_RESEARCH_SESSION_NAME = SESSION_START_MODE_SPECS.deep_research.name;
21
- export const DEEP_RESEARCH_SESSION_LABEL = SESSION_START_MODE_SPECS.deep_research.labels[0];
22
- export const DEEP_RESEARCH_WORKFLOW_STEPS = [
23
- {
24
- title: '先定位入口',
25
- body: '读目录、配置、启动链路和测试入口,建立项目地图。',
26
- },
27
- {
28
- title: '再追数据流',
29
- body: '沿关键模块、IPC、存储、权限和运行时边界追到真实实现。',
30
- },
31
- {
32
- title: '然后对照参考',
33
- body: '把可借鉴点拆成 borrow / diverge / risk / gate。',
34
- },
35
- {
36
- title: '最后给可合入方案',
37
- body: '输出文件清单、风险边界和验证命令,不在只读模式里动手改。',
38
- },
39
- ];
40
- export const DEEP_RESEARCH_REPORT_SECTIONS = [
41
- {
42
- title: '结论先行',
43
- body: '用 3-5 条讲清楚真实现状、主要差距和优先建议。',
44
- },
45
- {
46
- title: '源码证据',
47
- body: '列出文件、函数、配置、测试和运行时路径,避免只给印象判断。',
48
- },
49
- {
50
- title: '借鉴拆解',
51
- body: '每个可借鉴点都写 borrow / diverge / risk / gate。',
52
- },
53
- {
54
- title: '落地改进',
55
- body: '给出按小步改进拆分的文件清单、边界和验证命令。',
56
- },
57
- ];
58
- export const DEEP_RESEARCH_SCOPE_OPTIONS = [
59
- {
60
- label: '快速',
61
- body: '只扫入口、关键文件和最可能的数据流,适合已知范围的小问题。',
62
- },
63
- {
64
- label: '标准',
65
- body: '默认深度:梳理核心链路、相关测试和主要风险,再给落地建议。',
66
- },
67
- {
68
- label: '深挖',
69
- body: '跨模块、参考项目和边界条件多轮追踪;只在用户明确要求时使用。',
70
- },
71
- ];
72
- export const DEEP_RESEARCH_EVIDENCE_CHECKLIST = [
73
- {
74
- title: '项目入口',
75
- body: '先看 README、package/config、启动脚本和目录分层,确认真实运行方式。',
76
- },
77
- {
78
- title: '核心链路',
79
- body: '追 UI 入口、IPC/服务、存储、运行时调用和错误处理,不只看表面组件。',
80
- },
81
- {
82
- title: '边界条件',
83
- body: '检查权限、隐身模式、token/路径暴露、失败重试和用户可见反馈。',
84
- },
85
- {
86
- title: '验证证据',
87
- body: '找对应测试、fixture、smoke 文档和可复现命令;缺口要明确标出来。',
88
- },
89
- ];
90
- export const DEEP_RESEARCH_PROGRESS_CHECKPOINTS = [
91
- {
92
- title: '先建清单',
93
- body: '研究范围超过三个相互关联的点时,先列出可核验的检查项再开始追代码。',
94
- },
95
- {
96
- title: '标当前项',
97
- body: '推进时明确当前正在验证哪一项,拿到证据后再进入下一项。',
98
- },
99
- {
100
- title: '记阻塞点',
101
- body: '找不到源码、运行时或测试证据时标成 blocked,不用猜测补空白。',
102
- },
103
- {
104
- title: '收敛方案',
105
- body: '完成项必须汇总到 borrow / diverge / risk / gate 和可落地改进里。',
106
- },
107
- ];
108
- export const DEEP_RESEARCH_STARTER_PROMPTS = [
109
- {
110
- label: '研究一个参考项目',
111
- prompt: '请只读研究这个项目:先梳理目录结构、核心模块、启动链路、数据流和测试入口,然后列出我们可以借鉴的功能设计、需要规避的风险,以及可落地到 Maka 的改进顺序。',
112
- },
113
- {
114
- label: '完整读一遍参考项目',
115
- prompt: '请按深挖范围只读研究这个参考项目:先建立目录和模块地图,再逐层读核心功能、运行时、存储、权限、UI、测试和文档;每个可借鉴点都按 borrow / diverge / risk / gate 输出,并给出 Maka 的落地改进顺序。',
116
- },
117
- {
118
- label: '对比一个功能实现',
119
- prompt: '请只读对比这个功能在参考项目和 Maka 里的实现差异:指出关键文件、运行时边界、UI 入口、持久化方式、测试覆盖,以及最小可合入的改进方案。',
120
- },
121
- {
122
- label: '做一次安全边界审计',
123
- prompt: '请只读审计这个功能的安全边界:权限、token/密钥流、IPC/renderer 暴露、文件路径、隐私模式、日志与 telemetry。输出 blocking 风险和对应 contract test。',
124
- },
125
- ];
126
- export function isDeepResearchSession(labels) {
127
- return Array.isArray(labels) && labels.includes(DEEP_RESEARCH_SESSION_LABEL);
128
- }
129
- export const DEEP_RESEARCH_IMPLEMENTATION_PROMPT_MAX_CHARS = 12_000;
130
- export function buildDeepResearchImplementationPrompt(run) {
131
- if (run.status !== 'completed' || !run.handoff || !run.reportArtifactId) {
132
- throw new Error('Deep Research implementation handoff requires a completed run');
133
- }
134
- const lines = [
135
- 'This is a new implementation task created from a completed read-only Deep Research session.',
136
- 'The original research session remains read-only. Inspect the current code and present an implementation plan before changing project files.',
137
- '',
138
- `Research objective: ${run.objective}`,
139
- `Source session: ${run.sessionId}`,
140
- `Final report artifact: ${run.reportArtifactId}`,
141
- `Handoff artifact: ${run.handoff.artifactId}`,
142
- '',
143
- 'Implementation tasks:',
144
- ...run.handoff.implementationTasks.map((item) => `- ${item}`),
145
- '',
146
- 'Recommended issues:',
147
- ...(run.handoff.recommendedIssues.length > 0
148
- ? run.handoff.recommendedIssues.map((item) => `- ${item}`)
149
- : ['- None specified.']),
150
- '',
151
- 'Recommended pull requests:',
152
- ...(run.handoff.recommendedPullRequests.length > 0
153
- ? run.handoff.recommendedPullRequests.map((item) => `- ${item}`)
154
- : ['- None specified.']),
155
- '',
156
- 'Verification commands:',
157
- ...run.handoff.verificationCommands.map((item) => `- ${item}`),
158
- ];
159
- const content = lines.join('\n');
160
- const characters = Array.from(content);
161
- if (characters.length <= DEEP_RESEARCH_IMPLEMENTATION_PROMPT_MAX_CHARS)
162
- return content;
163
- const marker = '\n[Handoff truncated to the safe composer limit.]';
164
- return (characters
165
- .slice(0, DEEP_RESEARCH_IMPLEMENTATION_PROMPT_MAX_CHARS - Array.from(marker).length)
166
- .join('') + marker);
167
- }
168
- export function buildDeepResearchSystemPromptFragment() {
169
- return [
170
- 'Deep research mode is active for this session.',
171
- '',
172
- 'Mode contract:',
173
- '- Inspect first. Prefer Read, Glob, Grep, and WebSearch.',
174
- '- Do not write, edit, delete, move, or rename user project files; do not install, run migrations, start services, or send network requests unless the user explicitly leaves research mode.',
175
- '- The deep_research_* tools are the one write exception: they only update Maka-owned research artifacts and an append-only workspace ledger, never the user project.',
176
- '- If implementation is needed, produce a concrete plan with files, risks, and verification commands instead of modifying files.',
177
- '- Keep findings source-grounded: name files, functions, configs, tests, and observed behavior.',
178
- '- Summarize borrow / diverge / risk / gate when comparing a reference project to Maka.',
179
- '',
180
- 'Durable workspace protocol:',
181
- '- Call deep_research_start once with the concrete objective and scope level. After interruption or context compaction, call deep_research_status, then deep_research_read_artifact for the exact saved evidence needed to continue.',
182
- '- Knowledge-base stage: archive each important raw source first with deep_research_save_artifact role=source, then save evidence notes that cite those source artifact ids.',
183
- '- After each bounded local exploration or web-research substep, call deep_research_record_step with roots or query terms, ignored paths, a stopping condition, expected evidence, inspected files/symbols/URLs, worker run ids, persisted evidence ids, and any blocker.',
184
- '- Keep the four durable checklist items current with deep_research_update_checklist. Completed items require evidence artifacts; blocked items require an explicit reason.',
185
- '- Checkpoint every meaningful research round with deep_research_checkpoint, including open questions, next steps, related task ids, and the artifacts needed to resume.',
186
- '- Report-writing stage: save an outline, then source-backed report_section artifacts for conclusion, source_evidence, borrow_diverge_risk_gate, implementation_recommendations, and verification. Mark each section completed only when it is ready.',
187
- '- Save one final role=report artifact and one role=handoff artifact. The handoff must turn findings into implementation tasks, recommended issues and/or PRs, and verification commands without performing project writes.',
188
- '- Call deep_research_complete only after every checklist item is completed or explicitly skipped, all five report sections are completed, and both report and handoff artifacts are persisted.',
189
- '',
190
- 'Research workflow:',
191
- ...DEEP_RESEARCH_WORKFLOW_STEPS.map((step) => `- ${step.title}: ${step.body}`),
192
- '',
193
- 'Research scope budget:',
194
- ...DEEP_RESEARCH_SCOPE_OPTIONS.map((option) => `- ${option.label}: ${option.body}`),
195
- '- If the user does not specify a scope, use 标准. Use 深挖 only when the user explicitly asks for deep / exhaustive / full-project research.',
196
- '',
197
- 'Evidence checklist:',
198
- ...DEEP_RESEARCH_EVIDENCE_CHECKLIST.map((item) => `- ${item.title}: ${item.body}`),
199
- '- If any checklist area cannot be verified from available files or runtime context, call that out explicitly instead of guessing.',
200
- '',
201
- 'Progress checkpoints:',
202
- ...DEEP_RESEARCH_PROGRESS_CHECKPOINTS.map((item) => `- ${item.title}: ${item.body}`),
203
- '- Treat the checklist as a control loop for multi-step research, not as a hidden task system. Keep it visible in the answer or status update when the research spans multiple modules.',
204
- '',
205
- 'Final report contract:',
206
- ...DEEP_RESEARCH_REPORT_SECTIONS.map((section) => `- ${section.title}: ${section.body}`),
207
- ].join('\n');
208
- }