@bizzywork/routing 0.1.0 → 0.3.0

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.
@@ -233,7 +233,13 @@ async function fallback<E extends { model: string; turnId: string }>(
233
233
  error: unknown,
234
234
  ): Promise<E | undefined> {
235
235
  const text = error instanceof Error ? error.message : String(error ?? "");
236
- const transient = !/model|not.?found|404|permission|403/i.test(text);
236
+ // Bare "model" matched too much: "Fable requires usage credits. /model to switch models." is a
237
+ // hard refusal, not a flaky retry, but only by luck of containing the word "model" at all —
238
+ // "the model is temporarily overloaded, please retry" would have matched the same way.
239
+ const transient =
240
+ !/not.?found|permission denied|40[34]|usage credit|insufficient.?credit|quota exceeded/i.test(
241
+ text,
242
+ );
237
243
  let model = e.model;
238
244
  try {
239
245
  const decision = await post<{ model: string | null }>($, "/v1/harness/fallback", {
@@ -296,7 +302,10 @@ export const register: Register = (on) => {
296
302
  on("command.run", { command: "model" }, async ($, e, next) => {
297
303
  const result = await next(e);
298
304
  await sync($);
299
- if (enabled && e.args.trim()) pause($, await $.session.model());
305
+ // Gating on e.args meant picking a model from /model's own interactive menu (no inline
306
+ // argument) never paused Bizzy Auto: the next turn routed right over the manual pick. By the
307
+ // time next(e) resolves the pick is final either way, so just check whether Bizzy is on.
308
+ if (enabled) pause($, await $.session.model());
300
309
  return result;
301
310
  }).catch(($, e, next) => (next.called ? {} : next(e)));
302
311