mcp-probe-kit 3.0.23 → 3.1.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.
- package/README.md +755 -779
- package/build/index.js +38 -40
- package/build/lib/__tests__/memory-injection.unit.test.js +1 -0
- package/build/lib/agents-md-template.js +32 -32
- package/build/lib/memory-client.d.ts +2 -0
- package/build/lib/memory-client.js +1 -0
- package/build/lib/memory-config.d.ts +2 -0
- package/build/lib/memory-config.js +1 -0
- package/build/lib/memory-orchestration.d.ts +4 -0
- package/build/lib/memory-orchestration.js +28 -5
- package/build/lib/skill-bridge.js +12 -12
- package/build/resources/index.d.ts +4 -0
- package/build/resources/index.js +4 -0
- package/build/resources/tool-params-guide.d.ts +571 -0
- package/build/resources/tool-params-guide.js +488 -0
- package/build/resources/ui-ux-data/guidelines/vercel-web-interface.json +1632 -1632
- package/build/resources/ui-ux-data/metadata.json +30 -30
- package/build/resources/ui-ux-data/shadcn/blocks.json +2541 -2541
- package/build/resources/ui-ux-data/shadcn/components.json +997 -997
- package/build/resources/ui-ux-data/themes/presets.json +483 -483
- package/build/schemas/index.d.ts +0 -22
- package/build/schemas/memory-tools.d.ts +0 -22
- package/build/schemas/memory-tools.js +0 -14
- package/build/tools/__tests__/read_memory_asset.unit.test.js +75 -0
- package/build/tools/__tests__/search_memory.unit.test.js +7 -1
- package/build/tools/analyze_project.d.ts +1 -0
- package/build/tools/analyze_project.js +527 -0
- package/build/tools/check_deps.d.ts +13 -0
- package/build/tools/check_deps.js +204 -0
- package/build/tools/code_insight.js +41 -41
- package/build/tools/convert.d.ts +13 -0
- package/build/tools/convert.js +599 -0
- package/build/tools/css_order.d.ts +13 -0
- package/build/tools/css_order.js +81 -0
- package/build/tools/debug.d.ts +13 -0
- package/build/tools/debug.js +131 -0
- package/build/tools/design2code.d.ts +20 -0
- package/build/tools/design2code.js +426 -0
- package/build/tools/detect_shell.d.ts +6 -0
- package/build/tools/detect_shell.js +151 -0
- package/build/tools/explain.d.ts +13 -0
- package/build/tools/explain.js +390 -0
- package/build/tools/fix.d.ts +13 -0
- package/build/tools/fix.js +303 -0
- package/build/tools/fix_bug.js +161 -161
- package/build/tools/gen_mock.d.ts +22 -0
- package/build/tools/gen_mock.js +269 -0
- package/build/tools/gen_skill.d.ts +13 -0
- package/build/tools/gen_skill.js +560 -0
- package/build/tools/genapi.d.ts +13 -0
- package/build/tools/genapi.js +174 -0
- package/build/tools/genchangelog.d.ts +13 -0
- package/build/tools/genchangelog.js +250 -0
- package/build/tools/gencommit.js +60 -60
- package/build/tools/gendoc.d.ts +13 -0
- package/build/tools/gendoc.js +232 -0
- package/build/tools/genpr.d.ts +13 -0
- package/build/tools/genpr.js +194 -0
- package/build/tools/genreadme.d.ts +13 -0
- package/build/tools/genreadme.js +626 -0
- package/build/tools/gensql.d.ts +13 -0
- package/build/tools/gensql.js +320 -0
- package/build/tools/genui.d.ts +13 -0
- package/build/tools/genui.js +803 -0
- package/build/tools/index.d.ts +0 -1
- package/build/tools/index.js +0 -1
- package/build/tools/init_component_catalog.d.ts +22 -0
- package/build/tools/init_component_catalog.js +809 -0
- package/build/tools/init_project_context.js +432 -432
- package/build/tools/init_setting.d.ts +13 -0
- package/build/tools/init_setting.js +47 -0
- package/build/tools/perf.d.ts +13 -0
- package/build/tools/perf.js +409 -0
- package/build/tools/read_memory_asset.js +2 -1
- package/build/tools/render_ui.d.ts +22 -0
- package/build/tools/render_ui.js +384 -0
- package/build/tools/resolve_conflict.d.ts +13 -0
- package/build/tools/resolve_conflict.js +349 -0
- package/build/tools/search_memory.js +1 -0
- package/build/tools/security_scan.d.ts +22 -0
- package/build/tools/security_scan.js +323 -0
- package/build/tools/split.d.ts +13 -0
- package/build/tools/split.js +599 -0
- package/build/tools/start_api.d.ts +13 -0
- package/build/tools/start_api.js +193 -0
- package/build/tools/start_bugfix.js +233 -233
- package/build/tools/start_doc.d.ts +13 -0
- package/build/tools/start_doc.js +207 -0
- package/build/tools/start_feature.js +117 -117
- package/build/tools/start_product.js +1 -1
- package/build/tools/start_refactor.d.ts +13 -0
- package/build/tools/start_refactor.js +188 -0
- package/build/tools/start_release.d.ts +13 -0
- package/build/tools/start_release.js +167 -0
- package/build/tools/start_review.d.ts +13 -0
- package/build/tools/start_review.js +175 -0
- package/build/tools/start_ui.js +399 -399
- package/build/tools/ui-ux-tools.js +290 -290
- package/build/utils/__tests__/vercel-guidelines-sync.unit.test.js +12 -12
- package/build/utils/themes-sync.js +8 -8
- package/package.json +81 -83
- package/build/lib/__tests__/memory-orchestration.unit.test.js +0 -84
- package/build/lib/__tests__/memory-payload.unit.test.js +0 -35
- package/build/lib/cursor-history-client.d.ts +0 -54
- package/build/lib/cursor-history-client.js +0 -240
- package/build/tools/__tests__/cursor-history.unit.test.js +0 -38
- package/build/tools/cursor_read_conversation.d.ts +0 -7
- package/build/tools/cursor_read_conversation.js +0 -36
- package/docs/.mcp-probe/layout.json +0 -11
- package/docs/CNAME +0 -1
- package/docs/assets/font/MaterialSymbolsOutlined.codepoints +0 -4102
- package/docs/assets/font/MaterialSymbolsOutlined.ttf +0 -0
- package/docs/assets/font/noto-sans-sc-400.ttf +0 -0
- package/docs/assets/font/noto-sans-sc-700.ttf +0 -0
- package/docs/assets/font/noto-sans-sc-900.ttf +0 -0
- package/docs/assets/js/i18n.js +0 -375
- package/docs/assets/js/tailwind.js +0 -83
- package/docs/assets/logo-zh.png +0 -0
- package/docs/assets/logo.png +0 -0
- package/docs/data/tools.js +0 -523
- package/docs/i18n/all-tools/en.json +0 -190
- package/docs/i18n/all-tools/ja.json +0 -171
- package/docs/i18n/all-tools/ko.json +0 -171
- package/docs/i18n/all-tools/zh-CN.json +0 -190
- package/docs/i18n/en.json +0 -626
- package/docs/i18n/ja.json +0 -602
- package/docs/i18n/ko.json +0 -602
- package/docs/i18n/zh-CN.json +0 -626
- package/docs/index.html +0 -327
- package/docs/memory-local-setup.md +0 -314
- package/docs/memory-local-setup.zh-CN.md +0 -283
- package/docs/pages/all-tools.html +0 -515
- package/docs/pages/examples.html +0 -717
- package/docs/pages/getting-started.html +0 -964
- package/docs/pages/migration.html +0 -308
- package/docs/specs/user-auth/design.md +0 -82
- package/docs/specs/user-auth/requirements.md +0 -52
- package/docs/specs/user-auth/tasks.md +0 -55
- /package/build/{lib/__tests__/memory-orchestration.unit.test.d.ts → tools/__tests__/read_memory_asset.unit.test.d.ts} +0 -0
- /package/build/{lib/__tests__/memory-payload.unit.test.d.ts → utils/design-docs-generator.d.ts} +0 -0
- /package/build/{tools/__tests__/cursor-history.unit.test.d.ts → utils/design-docs-generator.js} +0 -0
package/build/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { InMemoryTaskMessageQueue, InMemoryTaskStore, } from "@modelcontextproto
|
|
|
5
5
|
import { CallToolRequestSchema, ListToolsRequestSchema, ListResourcesRequestSchema, ProgressNotificationSchema, ReadResourceRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
6
6
|
import * as fs from "node:fs";
|
|
7
7
|
import * as path from "node:path";
|
|
8
|
-
import { initProject, gencommit, codeReview, codeInsight, gentest, refactor, initProjectContext, addFeature, fixBug, estimate, startFeature, startBugfix, startOnboard, startRalph, interview, askUser, uiDesignSystem, uiSearch, syncUiData, startUi, startProduct, gitWorkReport, searchMemory, readMemoryAsset, memorizeAsset, scanAndExtractPatterns
|
|
8
|
+
import { initProject, gencommit, codeReview, codeInsight, gentest, refactor, initProjectContext, addFeature, fixBug, estimate, startFeature, startBugfix, startOnboard, startRalph, interview, askUser, uiDesignSystem, uiSearch, syncUiData, startUi, startProduct, gitWorkReport, searchMemory, readMemoryAsset, memorizeAsset, scanAndExtractPatterns } from "./tools/index.js";
|
|
9
9
|
import { VERSION, NAME } from "./version.js";
|
|
10
10
|
import { allToolSchemas } from "./schemas/index.js";
|
|
11
11
|
import { filterTools, getToolsetFromEnv } from "./lib/toolset-manager.js";
|
|
@@ -116,43 +116,43 @@ function buildUiResourceHtml(name, args, result) {
|
|
|
116
116
|
.join("\n\n")
|
|
117
117
|
: "";
|
|
118
118
|
const now = new Date().toISOString();
|
|
119
|
-
return `<!doctype html>
|
|
120
|
-
<html lang="zh-CN">
|
|
121
|
-
<head>
|
|
122
|
-
<meta charset="utf-8">
|
|
123
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
124
|
-
<title>${escapeHtml(name)} · MCP Apps</title>
|
|
125
|
-
<style>
|
|
126
|
-
:root { color-scheme: light; }
|
|
127
|
-
body { font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; margin: 0; background: #f4f7fb; color: #1e2a35; }
|
|
128
|
-
.wrap { max-width: 960px; margin: 0 auto; padding: 24px; }
|
|
129
|
-
.card { background: #fff; border-radius: 14px; padding: 18px; box-shadow: 0 4px 18px rgba(30,42,53,.08); margin-bottom: 16px; }
|
|
130
|
-
h1 { margin: 0 0 8px; font-size: 24px; }
|
|
131
|
-
h2 { margin: 0 0 10px; font-size: 16px; color: #2f4a65; }
|
|
132
|
-
pre { white-space: pre-wrap; word-break: break-word; background: #0f1720; color: #d9e7f7; border-radius: 10px; padding: 12px; font-size: 12px; line-height: 1.45; }
|
|
133
|
-
.meta { color: #4f6880; font-size: 12px; }
|
|
134
|
-
</style>
|
|
135
|
-
</head>
|
|
136
|
-
<body>
|
|
137
|
-
<div class="wrap">
|
|
138
|
-
<div class="card">
|
|
139
|
-
<h1>${escapeHtml(name)}</h1>
|
|
140
|
-
<div class="meta">Generated at ${escapeHtml(now)} · MCP Apps preview</div>
|
|
141
|
-
</div>
|
|
142
|
-
<div class="card">
|
|
143
|
-
<h2>Text Output</h2>
|
|
144
|
-
<pre>${escapeHtml(textBlocks || "(no text output)")}</pre>
|
|
145
|
-
</div>
|
|
146
|
-
<div class="card">
|
|
147
|
-
<h2>Structured Content</h2>
|
|
148
|
-
<pre>${escapeHtml(structured)}</pre>
|
|
149
|
-
</div>
|
|
150
|
-
<div class="card">
|
|
151
|
-
<h2>Arguments</h2>
|
|
152
|
-
<pre>${escapeHtml(argJson)}</pre>
|
|
153
|
-
</div>
|
|
154
|
-
</div>
|
|
155
|
-
</body>
|
|
119
|
+
return `<!doctype html>
|
|
120
|
+
<html lang="zh-CN">
|
|
121
|
+
<head>
|
|
122
|
+
<meta charset="utf-8">
|
|
123
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
124
|
+
<title>${escapeHtml(name)} · MCP Apps</title>
|
|
125
|
+
<style>
|
|
126
|
+
:root { color-scheme: light; }
|
|
127
|
+
body { font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; margin: 0; background: #f4f7fb; color: #1e2a35; }
|
|
128
|
+
.wrap { max-width: 960px; margin: 0 auto; padding: 24px; }
|
|
129
|
+
.card { background: #fff; border-radius: 14px; padding: 18px; box-shadow: 0 4px 18px rgba(30,42,53,.08); margin-bottom: 16px; }
|
|
130
|
+
h1 { margin: 0 0 8px; font-size: 24px; }
|
|
131
|
+
h2 { margin: 0 0 10px; font-size: 16px; color: #2f4a65; }
|
|
132
|
+
pre { white-space: pre-wrap; word-break: break-word; background: #0f1720; color: #d9e7f7; border-radius: 10px; padding: 12px; font-size: 12px; line-height: 1.45; }
|
|
133
|
+
.meta { color: #4f6880; font-size: 12px; }
|
|
134
|
+
</style>
|
|
135
|
+
</head>
|
|
136
|
+
<body>
|
|
137
|
+
<div class="wrap">
|
|
138
|
+
<div class="card">
|
|
139
|
+
<h1>${escapeHtml(name)}</h1>
|
|
140
|
+
<div class="meta">Generated at ${escapeHtml(now)} · MCP Apps preview</div>
|
|
141
|
+
</div>
|
|
142
|
+
<div class="card">
|
|
143
|
+
<h2>Text Output</h2>
|
|
144
|
+
<pre>${escapeHtml(textBlocks || "(no text output)")}</pre>
|
|
145
|
+
</div>
|
|
146
|
+
<div class="card">
|
|
147
|
+
<h2>Structured Content</h2>
|
|
148
|
+
<pre>${escapeHtml(structured)}</pre>
|
|
149
|
+
</div>
|
|
150
|
+
<div class="card">
|
|
151
|
+
<h2>Arguments</h2>
|
|
152
|
+
<pre>${escapeHtml(argJson)}</pre>
|
|
153
|
+
</div>
|
|
154
|
+
</div>
|
|
155
|
+
</body>
|
|
156
156
|
</html>`;
|
|
157
157
|
}
|
|
158
158
|
function putUiAppResource(toolName, args, result) {
|
|
@@ -467,8 +467,6 @@ async function executeTool(name, args, context) {
|
|
|
467
467
|
return await memorizeAsset(args);
|
|
468
468
|
case "scan_and_extract_patterns":
|
|
469
469
|
return await scanAndExtractPatterns(args);
|
|
470
|
-
case "cursor_read_conversation":
|
|
471
|
-
return await cursorReadConversation(args);
|
|
472
470
|
default:
|
|
473
471
|
throw new Error(`未知工具: ${name}`);
|
|
474
472
|
}
|
|
@@ -20,6 +20,7 @@ describe('memory injection auto-load', () => {
|
|
|
20
20
|
type: 'bugfix',
|
|
21
21
|
description: 'Feishu proxy mismatch',
|
|
22
22
|
summary: 'proxy caused 400 on HTTPS',
|
|
23
|
+
content: '【现象】submit 成功但 sync_failed\n【根因】HTTP_PROXY 污染\n【修复】proxy:false',
|
|
23
24
|
tags: ['bugfix', 'proxy'],
|
|
24
25
|
},
|
|
25
26
|
],
|
|
@@ -4,18 +4,18 @@ function link(layout, targetRel) {
|
|
|
4
4
|
}
|
|
5
5
|
function memorySection(locale) {
|
|
6
6
|
if (locale === "zh-CN") {
|
|
7
|
-
return `
|
|
8
|
-
记忆(需 MEMORY_QDRANT_URL 等已配置):
|
|
9
|
-
- 检索:\`start_*\` 命中后**自动注入**历史经验全文;中途补查可用 \`search_memory\`;单条精读仍可用 \`read_memory_asset\`
|
|
10
|
-
- 沉淀:跨仓库共享**勿填** source_project/source_path;路径写进 content;summary 写检索关键词
|
|
11
|
-
- Bug 修完验证通过 → **必须** \`memorize_asset\` type=\`bugfix\` tags=\`bugfix,root-cause\`(content 含【现象】【根因】【修复】【验证】)
|
|
7
|
+
return `
|
|
8
|
+
记忆(需 MEMORY_QDRANT_URL 等已配置):
|
|
9
|
+
- 检索:\`start_*\` 命中后**自动注入**历史经验全文;中途补查可用 \`search_memory\`;单条精读仍可用 \`read_memory_asset\`
|
|
10
|
+
- 沉淀:跨仓库共享**勿填** source_project/source_path;路径写进 content;summary 写检索关键词
|
|
11
|
+
- Bug 修完验证通过 → **必须** \`memorize_asset\` type=\`bugfix\` tags=\`bugfix,root-cause\`(content 含【现象】【根因】【修复】【验证】)
|
|
12
12
|
- 功能/UI 可复用产出 → \`memorize_asset\` type=\`pattern\`/\`component\``;
|
|
13
13
|
}
|
|
14
|
-
return `
|
|
15
|
-
Memory (requires MEMORY_* env):
|
|
16
|
-
- Search: \`start_*\` auto-injects full memory hits; use \`search_memory\` mid-task; \`read_memory_asset\` for a specific id
|
|
17
|
-
- Store: do NOT use source_project/source_path for cross-repo pools; put paths in content; write keyword-rich summary
|
|
18
|
-
- After verified bugfix → MUST \`memorize_asset\` type=\`bugfix\` (sections: symptom, root cause, fix, verification)
|
|
14
|
+
return `
|
|
15
|
+
Memory (requires MEMORY_* env):
|
|
16
|
+
- Search: \`start_*\` auto-injects full memory hits; use \`search_memory\` mid-task; \`read_memory_asset\` for a specific id
|
|
17
|
+
- Store: do NOT use source_project/source_path for cross-repo pools; put paths in content; write keyword-rich summary
|
|
18
|
+
- After verified bugfix → MUST \`memorize_asset\` type=\`bugfix\` (sections: symptom, root cause, fix, verification)
|
|
19
19
|
- Reusable feature/UI → \`memorize_asset\` type=\`pattern\`/\`component\``;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
@@ -26,30 +26,30 @@ export function generateAgentsMdInner(input) {
|
|
|
26
26
|
const graph = link(layout, layout.latestMarkdownPath);
|
|
27
27
|
const ctxIndex = link(layout, layout.legacyIndexPath);
|
|
28
28
|
if (locale === "zh-CN") {
|
|
29
|
-
return `## MCP(必须先调)
|
|
30
|
-
需已配置 mcp-probe-kit。\`start_*\` 若返回 delegated plan,逐步执行完再结束。
|
|
31
|
-
|
|
32
|
-
- 新功能 → \`start_feature\`(会先搜记忆)
|
|
33
|
-
- Bug → \`start_bugfix\`(会先搜记忆)
|
|
34
|
-
- UI → \`start_ui\`(会先搜记忆)
|
|
35
|
-
- 不熟代码 / 影响面 → \`code_insight\`(context / impact / auto)
|
|
36
|
-
- 缺上下文 → \`init_project_context\`
|
|
37
|
-
- 提交 → \`gencommit\`
|
|
38
|
-
|
|
39
|
-
上下文:写代码前先读 [project-context](${ctxIndex})(链到 \`${layout.modularDir}/\` 各文档)
|
|
29
|
+
return `## MCP(必须先调)
|
|
30
|
+
需已配置 mcp-probe-kit。\`start_*\` 若返回 delegated plan,逐步执行完再结束。
|
|
31
|
+
|
|
32
|
+
- 新功能 → \`start_feature\`(会先搜记忆)
|
|
33
|
+
- Bug → \`start_bugfix\`(会先搜记忆)
|
|
34
|
+
- UI → \`start_ui\`(会先搜记忆)
|
|
35
|
+
- 不熟代码 / 影响面 → \`code_insight\`(context / impact / auto)
|
|
36
|
+
- 缺上下文 → \`init_project_context\`
|
|
37
|
+
- 提交 → \`gencommit\`
|
|
38
|
+
|
|
39
|
+
上下文:写代码前先读 [project-context](${ctxIndex})(链到 \`${layout.modularDir}/\` 各文档)
|
|
40
40
|
图谱:大改前读 [latest](${graph});过期 \`code_insight\` mode=auto save_to_docs=true${memorySection(locale)}`;
|
|
41
41
|
}
|
|
42
|
-
return `## MCP (call first)
|
|
43
|
-
Requires mcp-probe-kit. Complete every \`start_*\` delegated plan step before done.
|
|
44
|
-
|
|
45
|
-
- Feature → \`start_feature\` (searches memory first)
|
|
46
|
-
- Bug → \`start_bugfix\` (searches memory first)
|
|
47
|
-
- UI → \`start_ui\` (searches memory first)
|
|
48
|
-
- Unfamiliar code / impact → \`code_insight\` (context / impact / auto)
|
|
49
|
-
- Missing context → \`init_project_context\`
|
|
50
|
-
- Commit → \`gencommit\`
|
|
51
|
-
|
|
52
|
-
Context: before coding read [project-context](${ctxIndex}) (links to \`${layout.modularDir}/\`)
|
|
42
|
+
return `## MCP (call first)
|
|
43
|
+
Requires mcp-probe-kit. Complete every \`start_*\` delegated plan step before done.
|
|
44
|
+
|
|
45
|
+
- Feature → \`start_feature\` (searches memory first)
|
|
46
|
+
- Bug → \`start_bugfix\` (searches memory first)
|
|
47
|
+
- UI → \`start_ui\` (searches memory first)
|
|
48
|
+
- Unfamiliar code / impact → \`code_insight\` (context / impact / auto)
|
|
49
|
+
- Missing context → \`init_project_context\`
|
|
50
|
+
- Commit → \`gencommit\`
|
|
51
|
+
|
|
52
|
+
Context: before coding read [project-context](${ctxIndex}) (links to \`${layout.modularDir}/\`)
|
|
53
53
|
Graph: read [latest](${graph}) before large changes; refresh \`code_insight\` mode=auto save_to_docs=true${memorySection(locale)}`;
|
|
54
54
|
}
|
|
55
55
|
export function generateAgentsMdTemplate(input) {
|
|
@@ -23,6 +23,8 @@ export interface MemorySearchResult {
|
|
|
23
23
|
type: string;
|
|
24
24
|
description: string;
|
|
25
25
|
summary: string;
|
|
26
|
+
/** Full payload content from Qdrant (may be empty on legacy points) */
|
|
27
|
+
content: string;
|
|
26
28
|
tags: string[];
|
|
27
29
|
sourceProject?: string;
|
|
28
30
|
sourcePath?: string;
|
|
@@ -245,6 +245,7 @@ export class MemoryClient {
|
|
|
245
245
|
type: fields.type,
|
|
246
246
|
description: fields.description,
|
|
247
247
|
summary: truncate(fields.summary, this.config.summaryMaxChars),
|
|
248
|
+
content: fields.content,
|
|
248
249
|
tags: fields.tags,
|
|
249
250
|
sourceProject: fields.sourceProject,
|
|
250
251
|
sourcePath: fields.sourcePath,
|
|
@@ -16,6 +16,8 @@ export interface MemoryConfig {
|
|
|
16
16
|
repoId: string;
|
|
17
17
|
/** Max chars of each asset content injected into start_* guides */
|
|
18
18
|
injectionContentMaxChars: number;
|
|
19
|
+
/** Max chars of content in search_memory text; 0 = omit content block */
|
|
20
|
+
searchContentMaxChars: number;
|
|
19
21
|
}
|
|
20
22
|
export declare function getMemoryConfig(): MemoryConfig;
|
|
21
23
|
export declare function isMemoryEnabled(config?: MemoryConfig): boolean;
|
|
@@ -40,6 +40,7 @@ export function getMemoryConfig() {
|
|
|
40
40
|
searchMinScore: getOptionalNumberEnv('MEMORY_SEARCH_MIN_SCORE', 0),
|
|
41
41
|
repoId: (process.env.MEMORY_REPO_ID || '').trim(),
|
|
42
42
|
injectionContentMaxChars: getNumberEnv('MEMORY_INJECTION_CONTENT_MAX_CHARS', 1500),
|
|
43
|
+
searchContentMaxChars: getOptionalNumberEnv('MEMORY_SEARCH_CONTENT_MAX_CHARS', 1500),
|
|
43
44
|
};
|
|
44
45
|
}
|
|
45
46
|
export function isMemoryEnabled(config = getMemoryConfig()) {
|
|
@@ -15,6 +15,10 @@ export declare function truncateInjectionText(value: string, maxChars: number):
|
|
|
15
15
|
export declare function loadMemoryInjectionContext(query: string, kind?: MemoryPlanKind): Promise<MemoryInjectionContext>;
|
|
16
16
|
export declare function formatSearchMemoryResultsText(results: MemorySearchResult[], config?: MemoryConfig): string;
|
|
17
17
|
export declare function shouldShowSourceInSearch(item: MemorySearchResult, config?: MemoryConfig): boolean;
|
|
18
|
+
export declare function formatMemoryAssetText(asset: MemoryAsset, options?: {
|
|
19
|
+
maxContentChars?: number;
|
|
20
|
+
}): string;
|
|
21
|
+
export declare function formatReadMemoryAssetText(asset: MemoryAsset): string;
|
|
18
22
|
export declare function renderMemoryGuideSection(context: MemoryInjectionContext): string;
|
|
19
23
|
export declare function buildMemoryPlanStep(kind?: MemoryPlanKind): {
|
|
20
24
|
id: string;
|
|
@@ -93,7 +93,17 @@ export function formatSearchMemoryResultsText(results, config = getMemoryConfig(
|
|
|
93
93
|
if (shouldShowSourceInSearch(item, config) && item.sourcePath) {
|
|
94
94
|
lines.push(` - 来源: ${item.sourcePath}`);
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
if (config.searchContentMaxChars > 0) {
|
|
97
|
+
const body = truncateInjectionText(item.content || '', config.searchContentMaxChars);
|
|
98
|
+
lines.push(' --- content ---');
|
|
99
|
+
lines.push(body
|
|
100
|
+
? body
|
|
101
|
+
.split('\n')
|
|
102
|
+
.map((line) => ` ${line}`)
|
|
103
|
+
.join('\n')
|
|
104
|
+
: ' (empty)');
|
|
105
|
+
}
|
|
106
|
+
lines.push(` - 更长全文: read_memory_asset {"asset_id": "${item.id}"}`);
|
|
97
107
|
return lines.filter(Boolean).join('\n');
|
|
98
108
|
});
|
|
99
109
|
return `${header}\n\n${items.join('\n\n')}`;
|
|
@@ -113,23 +123,36 @@ function formatSourceHint(item, config) {
|
|
|
113
123
|
}
|
|
114
124
|
return `\n - 来源: ${item.sourcePath}`;
|
|
115
125
|
}
|
|
116
|
-
function
|
|
126
|
+
export function formatMemoryAssetText(asset, options) {
|
|
127
|
+
const content = options?.maxContentChars !== undefined
|
|
128
|
+
? truncateInjectionText(asset.content, options.maxContentChars)
|
|
129
|
+
: asset.content;
|
|
117
130
|
const lines = [
|
|
118
131
|
`### ${asset.name}`,
|
|
119
132
|
`- asset_id: ${asset.id}`,
|
|
133
|
+
asset.type ? `- type: ${asset.type}` : '',
|
|
134
|
+
asset.summary ? `- 摘要: ${asset.summary}` : '',
|
|
120
135
|
asset.description ? `- 描述: ${asset.description}` : '',
|
|
121
136
|
asset.usage ? `- 适用: ${asset.usage}` : '',
|
|
122
137
|
asset.tags.length > 0 ? `- 标签: ${asset.tags.join(', ')}` : '',
|
|
138
|
+
asset.sourcePath ? `- 来源: ${asset.sourcePath}` : '',
|
|
123
139
|
'',
|
|
124
|
-
|
|
140
|
+
'--- content ---',
|
|
141
|
+
content || '(empty)',
|
|
125
142
|
].filter(Boolean);
|
|
126
143
|
return lines.join('\n');
|
|
127
144
|
}
|
|
145
|
+
export function formatReadMemoryAssetText(asset) {
|
|
146
|
+
return `已读取记忆资产: ${asset.name}\n\n${formatMemoryAssetText(asset)}`;
|
|
147
|
+
}
|
|
148
|
+
function formatAssetBody(asset, config) {
|
|
149
|
+
return formatMemoryAssetText(asset, { maxContentChars: config.injectionContentMaxChars });
|
|
150
|
+
}
|
|
128
151
|
function formatResultBlock(item, index, context, config) {
|
|
129
152
|
const label = formatMemoryResultLabel(item);
|
|
130
153
|
const asset = context.assetsById[item.id];
|
|
131
154
|
const header = `${index + 1}. ${label} score=${item.score.toFixed(3)}\n - 摘要: ${item.summary}${formatSourceHint(item, config)}`;
|
|
132
|
-
if (asset
|
|
155
|
+
if (asset) {
|
|
133
156
|
return `${header}\n\n${formatAssetBody(asset, config)}\n`;
|
|
134
157
|
}
|
|
135
158
|
return `${header}\n - 全文加载失败,可手动: read_memory_asset {"asset_id": "${item.id}"}\n`;
|
|
@@ -145,7 +168,7 @@ export function renderMemoryGuideSection(context) {
|
|
|
145
168
|
if (context.results.length === 0) {
|
|
146
169
|
return `\n\n## 🧠 记忆系统\n- 状态: 已启用\n- 检索结果: 未找到高相关记录(含历史 Bug 修复与可复用模式)\n- 处理: 继续主流程;Bug 修复验证通过后必须 \`memorize_asset\` 沉淀;功能/UI 有可复用产出再沉淀\n`;
|
|
147
170
|
}
|
|
148
|
-
const loadedCount = context.results.filter((item) => context.assetsById[item.id]
|
|
171
|
+
const loadedCount = context.results.filter((item) => Boolean(context.assetsById[item.id])).length;
|
|
149
172
|
const items = context.results
|
|
150
173
|
.map((item, index) => formatResultBlock(item, index, context, config))
|
|
151
174
|
.join('\n');
|
|
@@ -84,17 +84,17 @@ export function renderSkillBridgeSection(status) {
|
|
|
84
84
|
const conclusion = status.ready
|
|
85
85
|
? "全部 skill 可用,建议按顺序调用后再执行 MCP 工具步骤。"
|
|
86
86
|
: "部分 skill 缺失:继续执行 MCP 主流程,不阻塞;安装缺失 skill 后下次运行可获得更高质量输出。";
|
|
87
|
-
return `## 🧩 Skill Bridge(UI/PRD 增强)
|
|
88
|
-
|
|
89
|
-
按顺序调用(宿主支持时):
|
|
90
|
-
${orderLines}
|
|
91
|
-
|
|
92
|
-
当前状态:
|
|
93
|
-
${stateLines}
|
|
94
|
-
|
|
95
|
-
${conclusion}
|
|
96
|
-
|
|
97
|
-
---
|
|
98
|
-
|
|
87
|
+
return `## 🧩 Skill Bridge(UI/PRD 增强)
|
|
88
|
+
|
|
89
|
+
按顺序调用(宿主支持时):
|
|
90
|
+
${orderLines}
|
|
91
|
+
|
|
92
|
+
当前状态:
|
|
93
|
+
${stateLines}
|
|
94
|
+
|
|
95
|
+
${conclusion}
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
99
|
`;
|
|
100
100
|
}
|