@bizzywork/routing 0.2.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.
- package/dist/bundle/bizzy-routing.js +4 -4
- package/dist/bundle/{clack-ui-KUXMJI7C.js → clack-ui-KG2I32T5.js} +1 -0
- package/dist/bundle/harnesses/claude-code/hooks/register.ts +11 -2
- package/dist/bundle/{main-7NNVOX2S.js → main-6WPWCLN3.js} +22 -3
- package/dist/bundle/{ui-4PTMUQQ4.js → ui-PEKFVWX7.js} +4 -0
- package/package.json +1 -1
|
@@ -24,9 +24,9 @@ async function readStdin() {
|
|
|
24
24
|
for await (const chunk of process.stdin) text += String(chunk);
|
|
25
25
|
return text;
|
|
26
26
|
}
|
|
27
|
-
var { run } = await import("./main-
|
|
28
|
-
var { plainUi } = await import("./ui-
|
|
29
|
-
var { clackUi, showError } = await import("./clack-ui-
|
|
27
|
+
var { run } = await import("./main-6WPWCLN3.js");
|
|
28
|
+
var { plainUi } = await import("./ui-PEKFVWX7.js");
|
|
29
|
+
var { clackUi, showError } = await import("./clack-ui-KG2I32T5.js");
|
|
30
30
|
var interactive = Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
31
31
|
try {
|
|
32
32
|
const result = await run({
|
|
@@ -35,7 +35,7 @@ try {
|
|
|
35
35
|
home: homedir(),
|
|
36
36
|
execPath: process.execPath,
|
|
37
37
|
bundleDir: dirname(fileURLToPath(import.meta.url)),
|
|
38
|
-
version: true ? "0.
|
|
38
|
+
version: true ? "0.3.0" : "dev",
|
|
39
39
|
platform: process.platform,
|
|
40
40
|
uid: process.getuid?.(),
|
|
41
41
|
interactive,
|
|
@@ -1370,6 +1370,7 @@ function clackUi() {
|
|
|
1370
1370
|
intro: (title) => intro(styleText3(["bgCyan", "black"], ` ${title} `)),
|
|
1371
1371
|
outro: (message) => outro(message),
|
|
1372
1372
|
note: (body, title) => note(body, title),
|
|
1373
|
+
command: (command, title) => note(styleText3(["bold", "cyan"], command), title),
|
|
1373
1374
|
message: (text) => log.message(text),
|
|
1374
1375
|
warn: (message) => log.warn(message),
|
|
1375
1376
|
step: async (message, work, done) => {
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
|
|
@@ -76520,7 +76520,13 @@ var RunRecordSchema = external_exports.object({
|
|
|
76520
76520
|
/** The judge's P(advantage), 0–1, when its verdict routed the run; validation calibrates the cutoff from it. */
|
|
76521
76521
|
judgeAdvantage: UnitSchema.exactOptional(),
|
|
76522
76522
|
/** Set when a calibration trial served the rule against the judge's verdict. */
|
|
76523
|
-
judgeTrial: external_exports.boolean().exactOptional()
|
|
76523
|
+
judgeTrial: external_exports.boolean().exactOptional(),
|
|
76524
|
+
/** Set by the caller when a live routing-vs-control comparison chose this run's arm;
|
|
76525
|
+
* unset outside a comparison. The caller decides the arm itself and reports it here —
|
|
76526
|
+
* bizzy-v2 never sees or sets it. */
|
|
76527
|
+
arm: external_exports.enum(["treatment", "control"]).exactOptional(),
|
|
76528
|
+
/** The comparison window this run belongs to, when `arm` is set. */
|
|
76529
|
+
windowId: SafeIdSchema.exactOptional()
|
|
76524
76530
|
}),
|
|
76525
76531
|
startedAt: IsoDateSchema,
|
|
76526
76532
|
settledAt: IsoDateSchema,
|
|
@@ -81314,8 +81320,17 @@ var routeNotices = {
|
|
|
81314
81320
|
absent: "no OpenRouter key: routing with Bizzy's own rules",
|
|
81315
81321
|
failed: "Jev did not answer: routing with Bizzy's own rules"
|
|
81316
81322
|
};
|
|
81323
|
+
var noContextNotice = "no context set: routing with Bizzy's own rules";
|
|
81317
81324
|
async function routeSteps(body, options, onStep, signal) {
|
|
81318
|
-
|
|
81325
|
+
const done = await driveRoute(
|
|
81326
|
+
body,
|
|
81327
|
+
await routeInput(body.envelope, options),
|
|
81328
|
+
options,
|
|
81329
|
+
onStep,
|
|
81330
|
+
signal
|
|
81331
|
+
);
|
|
81332
|
+
const implicitCascade = body.envelope.profile !== "cascade" && body.material.policy === "none";
|
|
81333
|
+
return implicitCascade && !done.notice ? { ...done, notice: noContextNotice } : done;
|
|
81319
81334
|
}
|
|
81320
81335
|
function driveRoute(body, input2, options, onStep = () => {
|
|
81321
81336
|
}, signal) {
|
|
@@ -83008,7 +83023,10 @@ function wireClaude(target, runtime) {
|
|
|
83008
83023
|
return {
|
|
83009
83024
|
done: `Wired Claude Code: ${marketplace}`,
|
|
83010
83025
|
notes: [],
|
|
83011
|
-
|
|
83026
|
+
...installed && {
|
|
83027
|
+
run: { command: "claude /reload-plugins", title: "Start Claude Code with" }
|
|
83028
|
+
},
|
|
83029
|
+
next: installed ? "Already in a Claude Code session? Type /reload-plugins there instead." : `In Claude Code:
|
|
83012
83030
|
/plugin marketplace add ${marketplace}
|
|
83013
83031
|
/plugin install ${pluginId}
|
|
83014
83032
|
/reload-plugins`
|
|
@@ -83377,6 +83395,7 @@ async function installFlow(harness, target, flags) {
|
|
|
83377
83395
|
else if (io.interactive && !hasKey) ui.warn("No routing key: turns route with Bizzy's own rules");
|
|
83378
83396
|
if (flags.sharePrompts === false) writeEnvValues(target.dataDir, { BIZZY_SHARE_PROMPTS: "0" });
|
|
83379
83397
|
else if (flags.sharePrompts) writeEnvValues(target.dataDir, { BIZZY_SHARE_PROMPTS: void 0 });
|
|
83398
|
+
if (wired.run) ui.command(wired.run.command, wired.run.title);
|
|
83380
83399
|
ui.note(wired.next, "Next");
|
|
83381
83400
|
}
|
|
83382
83401
|
function verdict(checks) {
|
package/package.json
CHANGED