@feng0531/dsh-code-review 0.30.1 → 0.30.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 +5 -0
- package/README.md +3 -1
- package/package.json +1 -1
- package/src/review.mjs +6 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
package/package.json
CHANGED
package/src/review.mjs
CHANGED
|
@@ -162,6 +162,7 @@ export async function reviewSnapshot(snapshot, model, options = {}) {
|
|
|
162
162
|
state.riskPlans ??= [];
|
|
163
163
|
const entry = { status: 'pending', windowIds: batch.windowIds, ...(batch.interaction ? {groupId:batch.interaction.id,sourceMode:'file-interaction'} : {}), risks: [] };
|
|
164
164
|
state.riskPlans.push(entry);
|
|
165
|
+
try {
|
|
165
166
|
const response = await executor({ ...enclosingRequest, input: batch.payload, instructions: RISK_PLAN_INSTRUCTIONS });
|
|
166
167
|
const riskFiles = batch.interaction ? JSON.parse(batch.payload).files : [{ fileId: file.id, edits: changes.edits ?? [] }];
|
|
167
168
|
const risks = validateRiskPlan(response, riskFiles, scope?.catalog() ?? []);
|
|
@@ -169,6 +170,11 @@ export async function reviewSnapshot(snapshot, model, options = {}) {
|
|
|
169
170
|
entry.status = 'completed'; entry.risks = risks;
|
|
170
171
|
batchPayload = JSON.stringify({ ...JSON.parse(batch.payload), riskPlan: risks, riskPlanNotice: '未可信假设而非发现或证据;须验证及寻找反证,不增加读取权限。' });
|
|
171
172
|
if (!initialInputBudget({ instructions: REVIEW_INSTRUCTIONS, input: batchPayload }, scope, maxInputBytes).fits) throw new Error('Risk-enriched review input exceeds budget');
|
|
173
|
+
} catch(error) {
|
|
174
|
+
enclosingRequest.signal.throwIfAborted();
|
|
175
|
+
entry.status='fallback';entry.reason=error?.message??String(error);entry.risks=[];batchPayload=batch.payload;
|
|
176
|
+
report.limitations.push({fileId:file.id,text:'风险计划未完成,回退原输入主审查:'+entry.reason});
|
|
177
|
+
}
|
|
172
178
|
}
|
|
173
179
|
const request = { ...enclosingRequest, input: batchPayload };
|
|
174
180
|
const auditStart = state.retrievalAudit?.length ?? 0;
|