@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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # 变更记录
2
2
 
3
+ ## 0.18.2
4
+
5
+ - 低层可选风险规划接原主批次执行,共享信号/超时/调用/读取预算;主审增加计划后重新计量输入。
6
+ - 预检相同选项纳入规划初始调用数,计划不算发现,预算耗尽零主审保留失败状态。
7
+ - 当前注册入口未开启、业务分组未完成;全量237项通过。
8
+
3
9
  ## 0.18.1
4
10
 
5
11
  - 增加风险计划纯校验组件:限定批准文件/原编辑/sourceId、20风险/4文件,标记假设非发现,不增加权限。
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## 当前状态
6
6
 
7
- 当前代码版本为 0.18.1,包含有界覆盖预检、显式项目规则及候选证据与反证复核;发布状态以 npm 和 GitHub Release 为准。已通过真实临时 Git/SVN 仓库测试,以及隔离进程中的真实 DSH ToolRuntime 注册验证。当前开发会话的实际预览已返回0.6.0的plan/rules字段,空变更预览与默认关闭外发已验证;已进行经宿主审批的六次小规模真实试跑,累计12次模型调用;四组合成正负例与历史修复对照符合预期,历史引入方向检出候选但引用复核未完成(partial)。不是独立盲测或整体质量证明。详情见 [试跑结果](evaluation/PILOT-RESULTS.md)。
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feng0531/dsh-code-review",
3
- "version": "0.18.1",
3
+ "version": "0.18.2",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org/" },
@@ -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
- const request = { ...enclosingRequest, input: batch.payload };
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);