@feng0531/dsh-code-review 0.18.1 → 0.18.2
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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/coverage-plan.mjs +1 -1
- package/src/review.mjs +13 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## 当前状态
|
|
6
6
|
|
|
7
|
-
当前代码版本为 0.18.
|
|
7
|
+
当前代码版本为 0.18.2,包含有界覆盖预检、显式项目规则及候选证据与反证复核;发布状态以 npm 和 GitHub Release 为准。已通过真实临时 Git/SVN 仓库测试,以及隔离进程中的真实 DSH ToolRuntime 注册验证。当前开发会话的实际预览已返回0.6.0的plan/rules字段,空变更预览与默认关闭外发已验证;已进行经宿主审批的六次小规模真实试跑,累计12次模型调用;四组合成正负例与历史修复对照符合预期,历史引入方向检出候选但引用复核未完成(partial)。不是独立盲测或整体质量证明。详情见 [试跑结果](evaluation/PILOT-RESULTS.md)。
|
|
8
8
|
|
|
9
9
|
## 工作区下多个子仓库(0.11.0)
|
|
10
10
|
|
package/package.json
CHANGED
package/src/coverage-plan.mjs
CHANGED
|
@@ -16,7 +16,7 @@ export function buildCoveragePlan(input, options) {
|
|
|
16
16
|
const item = { fileId: file.id, path: file.path, status: file.eligibility, minimumCalls: 0 };
|
|
17
17
|
if (file.eligibility !== 'reviewable') return item;
|
|
18
18
|
const prepared = preparePrimaryInput(input, file, options);
|
|
19
|
-
return { ...item, ...prepared.metadata, status: prepared.budget.fits ? 'ready' : 'input-blocked', minimumCalls: prepared.budget.fits ? ((prepared.batches?.length ?? 1) + (prepared.synthesis?.budget.fits ? 1 : 0)) : 0 };
|
|
19
|
+
return { ...item, ...prepared.metadata, status: prepared.budget.fits ? 'ready' : 'input-blocked', minimumCalls: prepared.budget.fits ? ((prepared.batches?.length ?? 1) * (options.enableRiskPlanning === true ? 2 : 1) + (prepared.synthesis?.budget.fits ? 1 : 0)) : 0 };
|
|
20
20
|
});
|
|
21
21
|
const interactions = options.scope && options.grouping ? options.grouping.groups.filter(g => g.fileIds.length > 1).map(group => { const prepared = prepareInteractionInput(input, group, payload => initialInputBudget({ instructions: options.instructions, input: payload }, options.scope, options.maxInputBytes)); return { groupId: group.id, fileIds: prepared.fileIds, status: prepared.status, reason: prepared.reason, minimumCalls: prepared.status === 'ready' ? 1 : 0 }; }) : [];
|
|
22
22
|
return { interactions, snapshotId: input.id, maxInputBytes: options.maxInputBytes, items, minimumCalls: items.reduce((sum,item) => sum + item.minimumCalls, 0) + interactions.reduce((sum,item) => sum + item.minimumCalls, 0), initialRequestsOnly: true };
|
package/src/review.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RISK_PLAN_INSTRUCTIONS, validateRiskPlan } from './risk-plan.mjs';
|
|
1
2
|
import { prepareInteractionInput } from './interaction-input.mjs';
|
|
2
3
|
import { validateInteractionFindings } from './interaction-findings.mjs';
|
|
3
4
|
import { initialInputBudget } from './input-budget.mjs';
|
|
@@ -125,7 +126,18 @@ export async function reviewSnapshot(snapshot, model, options = {}) {
|
|
|
125
126
|
if (interactionPlan?.prepared.status === 'ready') batches.push({ payload: interactionPlan.prepared.payload, windowIds: [], interaction: interactionPlan.group });
|
|
126
127
|
for (const batch of batches) {
|
|
127
128
|
enclosingRequest.signal.throwIfAborted();
|
|
128
|
-
|
|
129
|
+
let batchPayload = batch.payload;
|
|
130
|
+
if (options.enableRiskPlanning === true && !batch.synthesis && !batch.interaction) {
|
|
131
|
+
state.riskPlans ??= [];
|
|
132
|
+
const entry = { status: 'pending', windowIds: batch.windowIds, risks: [] };
|
|
133
|
+
state.riskPlans.push(entry);
|
|
134
|
+
const response = await executor({ ...enclosingRequest, input: batch.payload, instructions: RISK_PLAN_INSTRUCTIONS });
|
|
135
|
+
const risks = validateRiskPlan(response, [{ fileId: file.id, edits: changes.edits ?? [] }], scope?.catalog() ?? []);
|
|
136
|
+
entry.status = 'completed'; entry.risks = risks;
|
|
137
|
+
batchPayload = JSON.stringify({ ...JSON.parse(batch.payload), riskPlan: risks, riskPlanNotice: '未可信假设而非发现或证据;须验证及寻找反证,不增加读取权限。' });
|
|
138
|
+
if (!initialInputBudget({ instructions: REVIEW_INSTRUCTIONS, input: batchPayload }, scope, maxInputBytes).fits) throw new Error('Risk-enriched review input exceeds budget');
|
|
139
|
+
}
|
|
140
|
+
const request = { ...enclosingRequest, input: batchPayload };
|
|
129
141
|
const auditStart = state.retrievalAudit?.length ?? 0;
|
|
130
142
|
const response = await executor(request);
|
|
131
143
|
const generated = batch.interaction ? validateInteractionFindings(response, input, batch.interaction, (state.retrievalAudit ?? []).slice(auditStart), scope.catalog()) : validateResponse(response, file, changes);
|