@diegopetrucci/pi-code-reviewer 0.1.0 → 0.1.3

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.
@@ -1 +1 @@
1
- 0.80.3
1
+ 0.80.6
package/index.ts CHANGED
@@ -16,55 +16,63 @@ const MAX_TURNS = 8;
16
16
  const MAX_RUN_MS = 8 * 60 * 1000;
17
17
  const DEFAULT_BASH_TIMEOUT_SECONDS = 30;
18
18
  const DEFAULT_THINKING_LEVEL = "high";
19
- const THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh"] as const;
19
+ const THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"] as const;
20
20
 
21
21
  type ThinkingLevel = (typeof THINKING_LEVELS)[number];
22
22
  type ThinkingLevelMap = Partial<Record<ThinkingLevel, unknown | null>>;
23
23
  const CODE_REVIEWER_MODEL_PREFERENCES = [
24
+ "gpt-5.6-sol",
25
+ "gpt-5.6-terra",
26
+ "gpt-5.6-luna",
24
27
  "gpt-5.5",
25
28
  "claude-opus-4-8",
26
29
  "claude-opus-4.8",
27
- "claude-sonnet-5-0",
28
- "claude-sonnet-5.0",
29
30
  "claude-sonnet-5",
30
31
  "claude-sonnet-4-6",
31
32
  "claude-sonnet-4.6",
32
33
  "claude-sonnet-4-5",
33
34
  "claude-sonnet-4.5",
34
- "claude-sonnet-4-0",
35
35
  "claude-sonnet-4",
36
+ "grok-4.5",
37
+ "gemini-3.5-flash",
36
38
  ];
37
39
  const PROVIDER_MODEL_PREFERENCES: Record<string, string[]> = {
38
40
  "amazon-bedrock": [
39
41
  "claude-fable-5",
40
42
  "claude-opus-4-8",
41
- "claude-opus-4.8",
42
43
  "claude-sonnet-5",
43
44
  "claude-sonnet-4-6",
44
- "claude-sonnet-4.6",
45
45
  "claude-sonnet-4-5",
46
- "claude-sonnet-4.5",
47
- "claude-sonnet-4",
48
46
  ],
49
47
  anthropic: [
50
48
  "claude-fable-5",
51
49
  "claude-opus-4-8",
52
- "claude-opus-4.8",
53
50
  "claude-sonnet-5",
54
51
  "claude-sonnet-4-6",
55
- "claude-sonnet-4.6",
56
52
  "claude-sonnet-4-5",
57
- "claude-sonnet-4.5",
58
- "claude-sonnet-4",
59
53
  ],
60
- openai: ["gpt-5.5", "gpt-5", "gpt-4.1", "o3", "o4-mini", "o4"],
61
- "vercel-ai-gateway": [
54
+ openai: ["gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "gpt-5.5", "gpt-5", "gpt-4.1", "o3", "o4-mini"],
55
+ "openai-codex": [
56
+ "gpt-5.6-sol",
57
+ "gpt-5.6-terra",
58
+ "gpt-5.6-luna",
62
59
  "gpt-5.5",
60
+ "gpt-5.4",
61
+ "gpt-5.4-mini",
62
+ "gpt-5.3-codex-spark",
63
+ ],
64
+ "vercel-ai-gateway": [
63
65
  "anthropic/claude-fable-5",
64
- "anthropic/claude-opus-4.1",
65
- "anthropic/claude-opus-4",
66
+ "anthropic/claude-opus-4.8",
67
+ "anthropic/claude-opus-4.7",
68
+ "anthropic/claude-opus-4.6",
66
69
  "anthropic/claude-sonnet-5",
67
- "anthropic/claude-sonnet-4",
70
+ "openai/gpt-5.6-sol",
71
+ "openai/gpt-5.6-terra",
72
+ "openai/gpt-5.6-luna",
73
+ "openai/gpt-5.5",
74
+ "xai/grok-4.5",
75
+ "google/gemini-3.5-flash",
68
76
  ],
69
77
  };
70
78
 
@@ -212,7 +220,13 @@ type ModelRegistryContext = {
212
220
  modelRegistry: { getAvailable(): PiModel[] | Promise<PiModel[]> };
213
221
  };
214
222
 
215
- type CreateAgentSessionModel = NonNullable<Parameters<typeof createAgentSession>[0]>["model"];
223
+ type CreateAgentSessionOptions = NonNullable<Parameters<typeof createAgentSession>[0]>;
224
+ type CreateAgentSessionModel = CreateAgentSessionOptions["model"];
225
+
226
+ function getModelRuntimeOption(ctx: { modelRegistry?: unknown }): Pick<CreateAgentSessionOptions, "modelRuntime"> {
227
+ const modelRuntime = (ctx.modelRegistry as { runtime?: CreateAgentSessionOptions["modelRuntime"] } | undefined)?.runtime;
228
+ return modelRuntime ? { modelRuntime } : {};
229
+ }
216
230
 
217
231
  const MODEL_AVAILABILITY_ERROR_PATTERN =
218
232
  /\b(?:404|403|not[_ ]?found(?:[_ ]?error)?|model[_ ]?not[_ ]?found(?:[_ ]?error)?|no such model|unknown model|does not exist|is not available|not available|model[_ ]?not[_ ]?available|unsupported model|invalid model|forbidden|access[ _-]?denied|permission[ _-]?denied|not[ _-]?entitled|do(?:es)? not have access)\b/i;
@@ -392,8 +406,8 @@ function isThinkingLevelSupported(model: PiModel, level: ThinkingLevel): boolean
392
406
  if (!model.reasoning) return level === "off";
393
407
 
394
408
  const map = model.thinkingLevelMap;
395
- if (level === "xhigh") {
396
- return !!map && Object.prototype.hasOwnProperty.call(map, "xhigh") && map.xhigh != null;
409
+ if (level === "xhigh" || level === "max") {
410
+ return !!map && Object.prototype.hasOwnProperty.call(map, level) && map[level] != null;
397
411
  }
398
412
  return map?.[level] !== null;
399
413
  }
@@ -1068,6 +1082,7 @@ export const __test__ = {
1068
1082
  buildSafeGitCommand,
1069
1083
  formatToolCall,
1070
1084
  getBlockedBashReason,
1085
+ isModelAvailabilityError,
1071
1086
  normalizeThinkingLevel,
1072
1087
  resolveThinkingLevel,
1073
1088
  selectCodeReviewerModel,
@@ -1173,7 +1188,7 @@ export default function codeReviewerExtension(pi: ExtensionAPI) {
1173
1188
  try {
1174
1189
  const created = await createAgentSession({
1175
1190
  cwd,
1176
- modelRegistry: ctx.modelRegistry,
1191
+ ...getModelRuntimeOption(ctx),
1177
1192
  resourceLoader,
1178
1193
  settingsManager: isolatedSettingsManager,
1179
1194
  sessionManager: SessionManager.inMemory(cwd),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegopetrucci/pi-code-reviewer",
3
- "version": "0.1.0",
3
+ "version": "0.1.3",
4
4
  "description": "A standalone pi extension that adds a read-only code_reviewer subagent tool for isolated code reviews.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -31,5 +31,9 @@
31
31
  "peerDependencies": {
32
32
  "@earendil-works/pi-coding-agent": "*",
33
33
  "typebox": "*"
34
+ },
35
+ "type": "module",
36
+ "engines": {
37
+ "node": ">=22.19.0"
34
38
  }
35
39
  }