@diegopetrucci/pi-extensions 0.1.68 → 0.1.69

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.
@@ -23,11 +23,33 @@ const THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "ma
23
23
  type ThinkingLevel = (typeof THINKING_LEVELS)[number];
24
24
  type ThinkingLevelMap = Partial<Record<ThinkingLevel, unknown | null>>;
25
25
  const CODE_REVIEWER_MODEL_PREFERENCES = [
26
+ "openai/gpt-6-astra ",
27
+ "global.openai.gpt-6-astra ",
28
+ "us.openai.gpt-6-astra ",
29
+ "openai.gpt-6-astra ",
30
+ "gpt-6-astra ",
26
31
  "gpt-6-astra",
32
+ "openai/gpt-6-sol ",
33
+ "gpt-6-sol ",
34
+ "gpt-6-sol",
27
35
  "gpt-5.6-sol",
28
36
  "gpt-5.6-terra",
37
+ "openai/gpt-6-luna ",
38
+ "gpt-6-luna ",
39
+ "gpt-6-luna",
29
40
  "gpt-5.6-luna",
30
41
  "gpt-5.5",
42
+ "anthropic/claude-opus-5.5 ",
43
+ "global.anthropic.claude-opus-5-5 ",
44
+ "au.anthropic.claude-opus-5-5 ",
45
+ "eu.anthropic.claude-opus-5-5 ",
46
+ "jp.anthropic.claude-opus-5-5 ",
47
+ "us.anthropic.claude-opus-5-5 ",
48
+ "anthropic.claude-opus-5-5 ",
49
+ "claude-opus-5.5 ",
50
+ "claude-opus-5-5 ",
51
+ "claude-opus-5-5",
52
+ "claude-opus-5.5",
31
53
  "claude-opus-5",
32
54
  "claude-opus-4-8",
33
55
  "claude-opus-4.8",
@@ -37,19 +59,37 @@ const CODE_REVIEWER_MODEL_PREFERENCES = [
37
59
  "claude-sonnet-4-5",
38
60
  "claude-sonnet-4.5",
39
61
  "claude-sonnet-4",
62
+ "x-ai/grok-4.7 ",
63
+ "spacexai/grok-4.7 ",
64
+ "grok-4.7 ",
65
+ "grok-4.7",
66
+ "grok-4.6",
40
67
  "grok-4.5",
41
68
  "gemini-3.5-flash",
42
69
  ];
43
70
  const PROVIDER_MODEL_PREFERENCES: Record<string, string[]> = {
44
71
  "amazon-bedrock": [
72
+ "global.anthropic.claude-opus-5-5 ",
73
+ "au.anthropic.claude-opus-5-5 ",
74
+ "eu.anthropic.claude-opus-5-5 ",
75
+ "jp.anthropic.claude-opus-5-5 ",
76
+ "us.anthropic.claude-opus-5-5 ",
77
+ "anthropic.claude-opus-5-5 ",
78
+ "claude-opus-5-5",
45
79
  "claude-opus-5",
46
80
  "claude-fable-5",
47
81
  "claude-opus-4-8",
82
+ "global.openai.gpt-6-astra ",
83
+ "us.openai.gpt-6-astra ",
84
+ "openai.gpt-6-astra ",
85
+ "gpt-6-astra",
48
86
  "claude-sonnet-5",
49
87
  "claude-sonnet-4-6",
50
88
  "claude-sonnet-4-5",
51
89
  ],
52
90
  anthropic: [
91
+ "claude-opus-5-5 ",
92
+ "claude-opus-5-5",
53
93
  "claude-opus-5",
54
94
  "claude-fable-5",
55
95
  "claude-opus-4-8",
@@ -57,28 +97,167 @@ const PROVIDER_MODEL_PREFERENCES: Record<string, string[]> = {
57
97
  "claude-sonnet-4-6",
58
98
  "claude-sonnet-4-5",
59
99
  ],
60
- openai: ["gpt-6-astra", "gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "gpt-5.5", "gpt-5", "gpt-4.1", "o3", "o4-mini"],
61
- "openai-codex": [
100
+ "azure-openai-responses": [
101
+ "gpt-6-astra ",
62
102
  "gpt-6-astra",
103
+ "gpt-6-sol ",
104
+ "gpt-6-sol",
63
105
  "gpt-5.6-sol",
64
106
  "gpt-5.6-terra",
107
+ "gpt-6-luna ",
108
+ "gpt-6-luna",
65
109
  "gpt-5.6-luna",
110
+ "gpt-5.5-pro",
66
111
  "gpt-5.5",
112
+ "gpt-5.4-pro",
67
113
  "gpt-5.4",
114
+ "gpt-5.3-codex",
115
+ "gpt-5-pro",
116
+ "gpt-5-chat-latest",
117
+ "gpt-5.2-pro",
118
+ "gpt-5.2",
119
+ "gpt-5.1",
120
+ "o3-pro",
121
+ "o1-pro",
68
122
  "gpt-5.4-mini",
123
+ "gpt-5-mini",
124
+ ],
125
+ "cloudflare-ai-gateway": [
126
+ "claude-fable-5",
127
+ "claude-opus-5",
128
+ "claude-opus-4.8",
129
+ "claude-opus-4.7",
130
+ "claude-opus-4.6",
131
+ "claude-opus-4.5",
132
+ "gpt-6-astra ",
133
+ "gpt-6-astra",
134
+ "gpt-5.5",
135
+ "gpt-5.4",
136
+ ],
137
+ "github-copilot": [
138
+ "gpt-6-astra ",
139
+ "gpt-6-astra",
140
+ "gpt-6-sol ",
141
+ "gpt-6-sol",
142
+ "gpt-5.6-sol",
143
+ "gpt-5.6-terra",
144
+ "gpt-6-luna ",
145
+ "gpt-6-luna",
146
+ "gpt-5.6-luna",
147
+ "gpt-5.5",
148
+ "claude-opus-5.5 ",
149
+ "claude-opus-5.5",
150
+ "claude-opus-5",
151
+ "gpt-5.4",
152
+ "gpt-5.3-codex",
153
+ "gpt-5-mini",
154
+ "grok-4.7 ",
155
+ "grok-4.7",
156
+ "grok-4.6",
157
+ "grok-4.5",
158
+ ],
159
+ opencode: [
160
+ "gpt-6-astra ",
161
+ "gpt-6-astra",
162
+ "gpt-6-sol ",
163
+ "gpt-6-sol",
164
+ "gpt-5.6-sol",
165
+ "gpt-5.6-terra",
166
+ "gpt-6-luna ",
167
+ "gpt-6-luna",
168
+ "gpt-5.6-luna",
169
+ "gpt-5.5-pro",
170
+ "gpt-5.5",
171
+ "claude-opus-5-5 ",
172
+ "claude-opus-5-5",
173
+ "claude-opus-5",
174
+ "gpt-5.4-pro",
175
+ "gpt-5.4",
176
+ "gpt-5.3-codex",
177
+ ],
178
+ "opencode-go": [
179
+ "grok-4.7 ",
180
+ "grok-4.7",
181
+ "grok-4.6",
182
+ ],
183
+ openrouter: [
184
+ "openai/gpt-6-astra ",
185
+ "openai/gpt-6-astra",
186
+ "openai/gpt-6-sol ",
187
+ "openai/gpt-6-sol",
188
+ "openai/gpt-5.6-sol-pro",
189
+ "openai/gpt-5.6-sol",
190
+ "openai/gpt-5.6-terra-pro",
191
+ "openai/gpt-5.6-terra",
192
+ "openai/gpt-6-luna ",
193
+ "openai/gpt-6-luna",
194
+ "openai/gpt-5.6-luna-pro",
195
+ "openai/gpt-5.6-luna",
196
+ "openai/gpt-5.5-pro",
197
+ "openai/gpt-5.5",
198
+ "anthropic/claude-opus-5.5 ",
199
+ "anthropic/claude-opus-5.5",
200
+ "anthropic/claude-opus-5",
201
+ "x-ai/grok-4.7 ",
202
+ "x-ai/grok-4.7",
203
+ "x-ai/grok-4.6",
204
+ "x-ai/grok-4.5",
205
+ ],
206
+ radius: [
207
+ "gpt-6-astra ",
208
+ "gpt-6-astra",
209
+ "gpt-6-sol ",
210
+ "gpt-6-sol",
211
+ "gpt-5.6-sol",
212
+ "gpt-5.6-terra",
213
+ "gpt-6-luna ",
214
+ "gpt-6-luna",
215
+ "gpt-5.6-luna",
216
+ "gpt-5.5",
217
+ "claude-opus-5-5 ",
218
+ "claude-opus-5-5",
219
+ "claude-opus-5",
220
+ "gpt-5.4",
221
+ "gpt-5.3-codex",
222
+ "gpt-5.4-mini",
223
+ ],
224
+ openai: ["gpt-6-astra ", "gpt-6-astra", "gpt-6-sol ", "gpt-6-sol", "gpt-5.6-sol", "gpt-5.6-terra", "gpt-6-luna ", "gpt-6-luna", "gpt-5.6-luna", "gpt-5.5", "gpt-5", "gpt-4.1", "o3", "o4-mini"],
225
+ "openai-codex": [
226
+ "gpt-6-astra ",
227
+ "gpt-6-astra",
228
+ "gpt-6-sol ",
229
+ "gpt-6-sol",
230
+ "gpt-5.6-sol",
231
+ "gpt-5.6-terra",
232
+ "gpt-6-luna ",
233
+ "gpt-6-luna",
234
+ "gpt-5.6-luna",
235
+ "gpt-5.5",
69
236
  "gpt-5.3-codex-spark",
70
237
  ],
238
+ xai: ["grok-4.7 ", "grok-4.7", "grok-4.6", "grok-4.5"],
71
239
  "vercel-ai-gateway": [
240
+ "anthropic/claude-opus-5.5 ",
241
+ "anthropic/claude-opus-5.5",
72
242
  "anthropic/claude-opus-5",
73
243
  "anthropic/claude-fable-5",
74
244
  "anthropic/claude-opus-4.8",
75
245
  "anthropic/claude-opus-4.7",
76
246
  "anthropic/claude-opus-4.6",
77
247
  "anthropic/claude-sonnet-5",
248
+ "openai/gpt-6-astra ",
249
+ "openai/gpt-6-astra",
250
+ "openai/gpt-6-sol ",
251
+ "openai/gpt-6-sol",
78
252
  "openai/gpt-5.6-sol",
79
253
  "openai/gpt-5.6-terra",
254
+ "openai/gpt-6-luna ",
255
+ "openai/gpt-6-luna",
80
256
  "openai/gpt-5.6-luna",
81
257
  "openai/gpt-5.5",
258
+ "spacexai/grok-4.7 ",
259
+ "spacexai/grok-4.7",
260
+ "spacexai/grok-4.6",
82
261
  "xai/grok-4.5",
83
262
  "google/gemini-3.5-flash",
84
263
  ],
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegopetrucci/pi-code-reviewer",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
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",
@@ -157,6 +157,21 @@ type MinimalEntry = {
157
157
  firstKeptEntryId?: string;
158
158
  };
159
159
 
160
+ type MinimalProjectionEntry = {
161
+ sourceEntry: MinimalEntry;
162
+ messages: MinimalMessage[];
163
+ };
164
+
165
+ type MinimalSessionProjection = {
166
+ entries: MinimalProjectionEntry[];
167
+ messages?: MinimalMessage[];
168
+ };
169
+
170
+ type AnalysisResult = {
171
+ segments: Segment[];
172
+ messageCount: number;
173
+ };
174
+
160
175
  type Segment = {
161
176
  id: string;
162
177
  category: CategoryId;
@@ -757,13 +772,53 @@ function collectCurrentContextEntries(branchEntries: MinimalEntry[]): MinimalEnt
757
772
  return result;
758
773
  }
759
774
 
775
+ function isProjectionSourceEntry(value: unknown): value is MinimalEntry {
776
+ return isRecord(value)
777
+ && typeof value.type === "string"
778
+ && value.type.length > 0
779
+ && typeof value.id === "string"
780
+ && value.id.length > 0;
781
+ }
782
+
783
+ function isProjectionMessage(value: unknown): value is MinimalMessage {
784
+ return isRecord(value) && typeof value.role === "string" && value.role.length > 0;
785
+ }
786
+
787
+ function resolveSessionProjection(ctx: ExtensionCommandContext): MinimalSessionProjection | undefined {
788
+ const sessionManager = ctx.sessionManager as unknown as { buildSessionProjection?: () => unknown };
789
+ const buildProjection = sessionManager.buildSessionProjection;
790
+ if (typeof buildProjection !== "function") return undefined;
791
+
792
+ const projection = safeCall(() => buildProjection.call(sessionManager));
793
+ if (!isRecord(projection) || !Array.isArray(projection.entries)) return undefined;
794
+
795
+ const entries: MinimalProjectionEntry[] = [];
796
+ for (const candidate of projection.entries) {
797
+ if (!isRecord(candidate) || !isProjectionSourceEntry(candidate.sourceEntry) || !Array.isArray(candidate.messages)) return undefined;
798
+ if (!candidate.messages.every(isProjectionMessage)) return undefined;
799
+ entries.push({
800
+ sourceEntry: candidate.sourceEntry,
801
+ messages: candidate.messages,
802
+ });
803
+ }
804
+ if ("messages" in projection && (!Array.isArray(projection.messages) || !projection.messages.every(isProjectionMessage))) return undefined;
805
+ return {
806
+ entries,
807
+ messages: Array.isArray(projection.messages) ? projection.messages : entries.flatMap((entry) => entry.messages),
808
+ };
809
+ }
810
+
760
811
  function resolveCurrentContextEntries(ctx: ExtensionCommandContext, branchEntries: MinimalEntry[]): MinimalEntry[] {
761
- const currentEntries = safeCall(() => ctx.sessionManager.buildContextEntries()) as MinimalEntry[] | undefined;
762
- if (Array.isArray(currentEntries)) return currentEntries;
812
+ const sessionManager = ctx.sessionManager as unknown as { buildContextEntries?: () => unknown };
813
+ const buildEntries = sessionManager.buildContextEntries;
814
+ const currentEntries = typeof buildEntries === "function"
815
+ ? safeCall(() => buildEntries.call(sessionManager))
816
+ : undefined;
817
+ if (Array.isArray(currentEntries)) return currentEntries as MinimalEntry[];
763
818
  return collectCurrentContextEntries(branchEntries);
764
819
  }
765
820
 
766
- function analyzeEntries(entries: MinimalEntry[], redact: boolean): { segments: Segment[]; messageCount: number } {
821
+ function analyzeEntries(entries: MinimalEntry[], redact: boolean): AnalysisResult {
767
822
  const state: AnalyzerState = { segments: [], sequence: 0, turn: 0, redact };
768
823
  let messageCount = 0;
769
824
  for (const entry of entries) {
@@ -775,6 +830,31 @@ function analyzeEntries(entries: MinimalEntry[], redact: boolean): { segments: S
775
830
  return { segments: state.segments, messageCount };
776
831
  }
777
832
 
833
+ function analyzeProjection(projection: MinimalSessionProjection, redact: boolean): AnalysisResult {
834
+ const state: AnalyzerState = { segments: [], sequence: 0, turn: 0, redact };
835
+ let messageCount = 0;
836
+ for (const projectedEntry of projection.entries) {
837
+ for (const message of projectedEntry.messages) {
838
+ // Pi's projection may carry the persisted system message on a compaction
839
+ // entry; the active system prompt is accounted for separately as overhead.
840
+ if (message.role === "system") continue;
841
+ messageCount++;
842
+ analyzeMessage(state, message, projectedEntry.sourceEntry);
843
+ }
844
+ }
845
+ return { segments: state.segments, messageCount };
846
+ }
847
+
848
+ function resolveCurrentContextAnalysis(
849
+ ctx: ExtensionCommandContext,
850
+ branchEntries: MinimalEntry[],
851
+ redact: boolean,
852
+ ): AnalysisResult {
853
+ const projection = resolveSessionProjection(ctx);
854
+ if (projection) return analyzeProjection(projection, redact);
855
+ return analyzeEntries(resolveCurrentContextEntries(ctx, branchEntries), redact);
856
+ }
857
+
778
858
  function collectToolSchemaText(pi: ExtensionAPI): string {
779
859
  try {
780
860
  const activeToolNames = new Set(pi.getActiveTools());
@@ -927,9 +1007,8 @@ function getSessionName(ctx: ExtensionCommandContext): string | undefined {
927
1007
 
928
1008
  function buildReportData(pi: ExtensionAPI, ctx: ExtensionCommandContext, options: CommandOptions): ReportData {
929
1009
  const branchEntries = ctx.sessionManager.getBranch() as MinimalEntry[];
930
- const currentEntries = resolveCurrentContextEntries(ctx, branchEntries);
931
1010
  const overhead = buildOverheadSegments(pi, ctx, options.redact);
932
- const currentAnalysis = analyzeEntries(currentEntries, options.redact);
1011
+ const currentAnalysis = resolveCurrentContextAnalysis(ctx, branchEntries, options.redact);
933
1012
  const fullAnalysis = analyzeEntries(branchEntries, options.redact);
934
1013
  const usage = ctx.getContextUsage();
935
1014
  const contextTokens = usage?.tokens ?? null;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegopetrucci/pi-context-inspector",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "A pi extension that opens a local HTML dashboard explaining where the current session context is going.",
5
5
  "keywords": [
6
6
  "pi-package",