@zhuan-ai/zhuanspec 2.17.10 → 2.17.13
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.
|
@@ -49,6 +49,14 @@ export interface KnowledgeReferencesFile {
|
|
|
49
49
|
interface KnowledgeReferencesOptions {
|
|
50
50
|
json?: boolean;
|
|
51
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* 判断是否为知识检索类工具调用(强特征、低误伤)。
|
|
54
|
+
*
|
|
55
|
+
* 覆盖:knowledge-agent-action / load-project-knowledge skill,以及前台 Bash 跑
|
|
56
|
+
* search_knowledge.py。这类工具出现时几乎必然处于 techDesign 流程,即便当前 phase
|
|
57
|
+
* 仍是 idle(set-phase 尚未执行、被检索抢跑),也应落盘,避免丢失知识溯源。
|
|
58
|
+
*/
|
|
59
|
+
export declare function isKnowledgeRetrievalTool(toolName: string, toolInput: Record<string, unknown>): boolean;
|
|
52
60
|
export declare function selectKnowledgeReferenceToolResult(stdinData: Record<string, unknown>): {
|
|
53
61
|
key: string;
|
|
54
62
|
value: unknown;
|
|
@@ -143,6 +143,24 @@ function isKnowledgeAgentSearchInvocation(toolName, toolInput) {
|
|
|
143
143
|
const skillName = extractSkillName(toolName, toolInput);
|
|
144
144
|
return isKnowledgeSkill(skillName, toolName) || isKnowledgeCarrierSkill(skillName);
|
|
145
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* 判断是否为知识检索类工具调用(强特征、低误伤)。
|
|
148
|
+
*
|
|
149
|
+
* 覆盖:knowledge-agent-action / load-project-knowledge skill,以及前台 Bash 跑
|
|
150
|
+
* search_knowledge.py。这类工具出现时几乎必然处于 techDesign 流程,即便当前 phase
|
|
151
|
+
* 仍是 idle(set-phase 尚未执行、被检索抢跑),也应落盘,避免丢失知识溯源。
|
|
152
|
+
*/
|
|
153
|
+
export function isKnowledgeRetrievalTool(toolName, toolInput) {
|
|
154
|
+
if (isSkillAnalyticsTool(toolName))
|
|
155
|
+
return false;
|
|
156
|
+
if (isKnowledgeAgentSearchInvocation(toolName, toolInput))
|
|
157
|
+
return true;
|
|
158
|
+
if (toolName === 'Bash') {
|
|
159
|
+
const command = toolInput.command || '';
|
|
160
|
+
return isKnowledgeSearchScriptCommand(command);
|
|
161
|
+
}
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
146
164
|
function isGenericSuccessEnvelope(toolResult) {
|
|
147
165
|
if (!isObject(toolResult))
|
|
148
166
|
return false;
|
|
@@ -1499,13 +1517,25 @@ export async function knowledgeReferencesHook(_options) {
|
|
|
1499
1517
|
};
|
|
1500
1518
|
// 阶段过滤
|
|
1501
1519
|
if (!ACTIVE_PHASES.includes(phase)) {
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1520
|
+
// 容错:techDesign 流程里知识检索可能抢跑在 set-phase 之前,此时 phase 仍是 idle。
|
|
1521
|
+
// 对知识检索类工具(强特征、低误伤)放行,归到 tech-design 落盘,避免丢失知识溯源。
|
|
1522
|
+
if (phase === 'idle' && isKnowledgeRetrievalTool(toolName, toolInput)) {
|
|
1523
|
+
phase = 'tech-design';
|
|
1524
|
+
await appendDebugLog(debugBase, {
|
|
1525
|
+
...debugContext,
|
|
1526
|
+
event: 'idle-knowledge-retrieval-recovered',
|
|
1527
|
+
recoveredPhase: phase,
|
|
1528
|
+
});
|
|
1529
|
+
}
|
|
1530
|
+
else {
|
|
1531
|
+
await appendDebugLog(debugBase, {
|
|
1532
|
+
...debugContext,
|
|
1533
|
+
event: 'phase-skipped',
|
|
1534
|
+
activePhases: ACTIVE_PHASES,
|
|
1535
|
+
});
|
|
1536
|
+
outputEnvelope();
|
|
1537
|
+
return;
|
|
1538
|
+
}
|
|
1509
1539
|
}
|
|
1510
1540
|
// TaskOutput 大输出会被截断并写入文件,读取全量文件以拿到完整知识 JSON。
|
|
1511
1541
|
let effectiveToolResult = toolResult;
|
package/dist/core/init.js
CHANGED
|
@@ -1582,17 +1582,9 @@ export class InitCommand {
|
|
|
1582
1582
|
},
|
|
1583
1583
|
],
|
|
1584
1584
|
},
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
{
|
|
1589
|
-
type: 'command',
|
|
1590
|
-
command: 'zhuanspec-hook knowledge-references --json',
|
|
1591
|
-
statusMessage: '📖 Recording knowledge references...',
|
|
1592
|
-
async: true,
|
|
1593
|
-
},
|
|
1594
|
-
],
|
|
1595
|
-
},
|
|
1585
|
+
// knowledge-references hook 已下线:知识检索落盘改由 knowledge-agent-action
|
|
1586
|
+
// skill(search_knowledge.py / search_knowledge_no_code.py)在检索成功后直接完成,
|
|
1587
|
+
// 不再依赖 progress.json 的 phase 时序,避免重复记录。
|
|
1596
1588
|
],
|
|
1597
1589
|
Stop: [
|
|
1598
1590
|
{
|
|
@@ -65,12 +65,8 @@ const CODEX_DEFAULT_HOOKS = [
|
|
|
65
65
|
matcher: 'Read|Grep|Glob|Bash',
|
|
66
66
|
command: 'ZHUANSPEC_HOST=codex zhuanspec-hook knowledge-usage --json',
|
|
67
67
|
},
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
matcher: 'Skill|Read|Grep|Glob|Bash|Agent|TaskOutput|mcp__.*',
|
|
71
|
-
command: 'ZHUANSPEC_HOST=codex zhuanspec-hook knowledge-references --json',
|
|
72
|
-
statusMessage: '📖 Recording knowledge references...',
|
|
73
|
-
},
|
|
68
|
+
// knowledge-references hook 已下线:知识检索落盘改由 knowledge-agent-action
|
|
69
|
+
// skill 在检索成功后直接完成,避免重复记录。
|
|
74
70
|
{
|
|
75
71
|
event: 'Stop',
|
|
76
72
|
command: 'ZHUANSPEC_HOST=codex zhuanspec-hook summarize --json',
|