@unifan/pi-review-zh 1.0.7 → 1.0.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unifan/pi-review-zh",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Pi AI 并发代码审查扩展(多专家子代理并发 + 门禁裁判系统,中文增强版)",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/config.ts CHANGED
@@ -31,7 +31,6 @@ export const DEFAULT_CONFIG: PiReviewConfig = {
31
31
  schemaVersion: 1,
32
32
  gate: {
33
33
  model: DEFAULT_GATE_MODEL,
34
- thinking: "low",
35
34
  enabled: true,
36
35
  threshold: 8,
37
36
  verdictPolicy: "strict",
package/src/directive.ts CHANGED
@@ -237,6 +237,8 @@ export function buildWorkflowScript(input: {
237
237
  const READ_ONLY_PREFIX =
238
238
  "只读任务(READ-ONLY)——仅执行审查分析与基准测试。严禁修改源码文件。仅返回审查发现。所有分析总结、问题描述与建议必须使用纯正中文。";
239
239
 
240
+ const lines: string[] = [];
241
+ lines.push("");
240
242
  lines.push("let reviewers;");
241
243
  lines.push("try {");
242
244
  lines.push(" reviewers = await runs.all([");
@@ -380,28 +382,29 @@ export function buildWorkflowScript(input: {
380
382
  if (gateModel && gateModel !== "inherit") {
381
383
  lines.push(` model: ${JSON.stringify(gateModelWithThinking)},`);
382
384
  }
383
- if (gateThinking && gateThinking !== "off" && gateThinking !== "false") {
385
+ if (gateThinking && gateThinking !== "off" && gateThinking !== "false" && gateThinking !== "undefined") {
384
386
  lines.push(` thinking: ${JSON.stringify(gateThinking)},`);
385
387
  }
386
388
  lines.push(` toolBudget: { soft: ${budgets.gateToolBudget.soft}, hard: ${budgets.gateToolBudget.hard} },`);
387
389
  lines.push(` turnBudget: { maxTurns: ${budgets.gateTurnBudget.maxTurns}, graceTurns: ${budgets.gateTurnBudget.graceTurns} },`);
388
390
  lines.push(" });");
389
391
  lines.push("} catch (gateLaunchError) {");
390
- lines.push(" gateRun = await runs.run('gate-fallback', {");
391
- lines.push(` agent: ${JSON.stringify(LEAN_GATE_AGENT)},`);
392
- lines.push(" task: gateTask,");
393
- lines.push(` cwd: ${JSON.stringify(workspacePath)},`);
394
- if (gateThinking && gateThinking !== "off" && gateThinking !== "false") {
395
- lines.push(` thinking: ${JSON.stringify(gateThinking)},`);
396
- }
397
- lines.push(` toolBudget: { soft: ${budgets.gateToolBudget.soft}, hard: ${budgets.gateToolBudget.hard} },`);
398
- lines.push(` turnBudget: { maxTurns: ${budgets.gateTurnBudget.maxTurns}, graceTurns: ${budgets.gateTurnBudget.graceTurns} },`);
399
- lines.push(" });");
392
+ lines.push(" try {");
393
+ lines.push(" gateRun = await runs.run('gate-fallback', {");
394
+ lines.push(` agent: ${JSON.stringify(LEAN_GATE_AGENT)},`);
395
+ lines.push(" task: gateTask,");
396
+ lines.push(` cwd: ${JSON.stringify(workspacePath)},`);
397
+ lines.push(` toolBudget: { soft: ${budgets.gateToolBudget.soft}, hard: ${budgets.gateToolBudget.hard} },`);
398
+ lines.push(` turnBudget: { maxTurns: ${budgets.gateTurnBudget.maxTurns}, graceTurns: ${budgets.gateTurnBudget.graceTurns} },`);
399
+ lines.push(" });");
400
+ lines.push(" } catch (fallbackError) {");
401
+ lines.push(" gateRun = { ok: false, error: String(fallbackError.message || fallbackError), output: '' };");
402
+ lines.push(" }");
400
403
  lines.push("}");
401
404
  lines.push("const gate = {");
402
- lines.push(" ok: gateRun.ok,");
403
- lines.push(" error: gateRun.error,");
404
- lines.push(" output: gateRun.output,");
405
+ lines.push(" ok: gateRun ? gateRun.ok : false,");
406
+ lines.push(" error: gateRun ? gateRun.error : 'gate failed',");
407
+ lines.push(" output: gateRun ? gateRun.output : '',");
405
408
  lines.push("};");
406
409
  lines.push("");
407
410
  }