@feng0531/dsh-code-review 0.24.1 → 0.25.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/CHANGELOG.md +5 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/review.mjs +5 -3
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
package/package.json
CHANGED
package/src/review.mjs
CHANGED
|
@@ -157,12 +157,14 @@ export async function reviewSnapshot(snapshot, model, options = {}) {
|
|
|
157
157
|
for (const batch of batches) {
|
|
158
158
|
enclosingRequest.signal.throwIfAborted();
|
|
159
159
|
let batchPayload = batch.payload;
|
|
160
|
-
if (options.enableRiskPlanning === true && !batch.synthesis
|
|
160
|
+
if (options.enableRiskPlanning === true && !batch.synthesis) {
|
|
161
161
|
state.riskPlans ??= [];
|
|
162
|
-
const entry = { status: 'pending', windowIds: batch.windowIds, risks: [] };
|
|
162
|
+
const entry = { status: 'pending', windowIds: batch.windowIds, ...(batch.interaction ? {groupId:batch.interaction.id,sourceMode:'file-interaction'} : {}), risks: [] };
|
|
163
163
|
state.riskPlans.push(entry);
|
|
164
164
|
const response = await executor({ ...enclosingRequest, input: batch.payload, instructions: RISK_PLAN_INSTRUCTIONS });
|
|
165
|
-
const
|
|
165
|
+
const riskFiles = batch.interaction ? JSON.parse(batch.payload).files : [{ fileId: file.id, edits: changes.edits ?? [] }];
|
|
166
|
+
const risks = validateRiskPlan(response, riskFiles, scope?.catalog() ?? []);
|
|
167
|
+
if (batch.interaction && risks.some(r=>new Set(r.editRefs.map(ref=>ref.fileId)).size<2)) throw new Error('Interaction risk requires edits across at least two files');
|
|
166
168
|
entry.status = 'completed'; entry.risks = risks;
|
|
167
169
|
batchPayload = JSON.stringify({ ...JSON.parse(batch.payload), riskPlan: risks, riskPlanNotice: '未可信假设而非发现或证据;须验证及寻找反证,不增加读取权限。' });
|
|
168
170
|
if (!initialInputBudget({ instructions: REVIEW_INSTRUCTIONS, input: batchPayload }, scope, maxInputBytes).fits) throw new Error('Risk-enriched review input exceeds budget');
|