@czottmann/pi-automode 1.8.0 → 1.8.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.
|
@@ -262,7 +262,7 @@ The fast stage requires one visible digit but allows `maxTokens: 4`, because som
|
|
|
262
262
|
|
|
263
263
|
## Parsing the classifier result
|
|
264
264
|
|
|
265
|
-
The fast-stage parser
|
|
265
|
+
The fast-stage parser requires `stopReason: "stop"`, trims surrounding whitespace, and then accepts only `0` or `1`. Empty responses, additional non-whitespace content, malformed output, and non-stop responses block immediately. Observability logs preserve the untrimmed model response.
|
|
266
266
|
|
|
267
267
|
The detailed parser accepts only the exact JSON object requested by the prompt from a response with `stopReason: "stop"`. It requires exactly `decision`, `tier`, and `reason`; rejects wrappers, extra fields, unknown tiers, and empty reasons; and fails closed on any shape drift. A truncated response with `stopReason: "length"` is retried but cannot authorize an action itself; other non-stop responses block immediately.
|
|
268
268
|
|
|
@@ -336,7 +336,7 @@ export async function classifyInStages(
|
|
|
336
336
|
};
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
-
const fastText = extractAssistantText(fastResponse, false);
|
|
339
|
+
const fastText = extractAssistantText(fastResponse, false).trim();
|
|
340
340
|
const failure = classifierFailure(fastResponse, "Fast classifier");
|
|
341
341
|
options.onAttempt?.(
|
|
342
342
|
responseAttempt(
|
|
@@ -361,7 +361,7 @@ export async function classifyInStages(
|
|
|
361
361
|
decision: "block",
|
|
362
362
|
tier: "none",
|
|
363
363
|
reason:
|
|
364
|
-
"Fast classifier response was not
|
|
364
|
+
"Fast classifier response was not 0 or 1 after trimming whitespace; auto mode fails closed.",
|
|
365
365
|
};
|
|
366
366
|
}
|
|
367
367
|
|