@jwilger/pi-development-system 0.36.0 → 0.36.1

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": "@jwilger/pi-development-system",
3
- "version": "0.36.0",
3
+ "version": "0.36.1",
4
4
  "description": "A pi extension package representing a seasoned approach to software development using a full AI SDLC.",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -83,6 +83,8 @@ export function registerTurnVerifier(deps: TurnVerifierDeps): void {
83
83
  });
84
84
 
85
85
  deps.pi.on("turn_end", async (event, ctx) => {
86
+ // An aborted or errored turn is dropped by pi; judging it would delay the abort and spend a correction.
87
+ if (event.outcome !== "completed") return undefined;
86
88
  const state = deps.state.get();
87
89
  if (!VERIFIED_PHASES.has(state.phase)) return undefined;
88
90
  const parts = assistantParts(event.message);
@@ -38,19 +38,21 @@ const matches = (candidates: readonly string[], model: string): boolean => {
38
38
  );
39
39
  };
40
40
 
41
+ const direct = (matrix: ModelMatrix, tier: Tier): string[] =>
42
+ // `fast` falls back to `@strong`; expanding it would make every strong model fast.
43
+ matrix[tier].filter((c) => !c.startsWith("@"));
44
+
41
45
  /**
42
- * The lowest tier whose candidates include `provider/id`: a model that appears as a fallback in a
43
- * higher tier (sol in frontier) still belongs to the tier it is natively listed in. Undefined when
44
- * the model is in none of them.
46
+ * The tier a model natively belongs to: the lowest tier that lists it (sol is a fallback in
47
+ * frontier but lives in strong). Undefined when it is in none of them.
45
48
  */
46
49
  export function tierOf(matrix: ModelMatrix, model: string): Tier | undefined {
47
- // Direct candidates only: `fast` falls back to `@strong`, which must not make strong models fast.
48
- return [...TIERS].reverse().find((tier) =>
49
- matches(
50
- matrix[tier].filter((c) => !c.startsWith("@")),
51
- model,
52
- ),
53
- );
50
+ return [...TIERS].reverse().find((tier) => matches(direct(matrix, tier), model));
51
+ }
52
+
53
+ /** The best tier that lists the model at all: what a slot resolving to it is asking for. */
54
+ function bestTierOf(matrix: ModelMatrix, model: string): Tier | undefined {
55
+ return TIERS.find((tier) => matches(direct(matrix, tier), model));
54
56
  }
55
57
 
56
58
  export type AdviceInput = {
@@ -74,7 +76,7 @@ export function adviseModel(input: AdviceInput): string | undefined {
74
76
  // Anything the slot itself lists is acceptable for the phase, whatever tier it natively sits in.
75
77
  if (matches(flattenSlot(input.matrix, slot), input.model)) return undefined;
76
78
  const have = tierOf(input.matrix, input.model);
77
- const need = tierOf(input.matrix, wanted.value.model);
79
+ const need = bestTierOf(input.matrix, wanted.value.model);
78
80
  if (have === undefined || need === undefined) return undefined;
79
81
  if (TIERS.indexOf(have) <= TIERS.indexOf(need)) return undefined;
80
82
  return `${input.phase} on ${input.model} (${have} tier) — the matrix prefers ${wanted.value.model} (${need} tier) for the ${slot} slot. Consider asking an advisor subagent for the hard decisions, or continue and record a departure (gate models.phase-mismatch). The system never switches your model for you.`;