@polderlabs/bizar 10.23.13 → 10.23.14
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/cli/commands/models.mjs
CHANGED
|
@@ -1021,7 +1021,6 @@ export function applyModelOverrides({ settingsJsonPath, pickedIds, liveIds = [],
|
|
|
1021
1021
|
skippedStale: skipped,
|
|
1022
1022
|
skippedDisabled,
|
|
1023
1023
|
settingsPath: path,
|
|
1024
|
-
agentAliases: resolveNativeAgentAliases(settings.modelOverrides),
|
|
1025
1024
|
};
|
|
1026
1025
|
}
|
|
1027
1026
|
|
|
@@ -1061,35 +1060,13 @@ export const CLAUDE_MODEL_OVERRIDE_KEYS = Object.freeze([
|
|
|
1061
1060
|
'claude-3-5-sonnet-20241022',
|
|
1062
1061
|
]);
|
|
1063
1062
|
|
|
1064
|
-
// These are Claude Code transport aliases, not model choices. Gateway model
|
|
1065
|
-
// IDs remain entirely operator-selected in the global Bizar router. Do not
|
|
1066
|
-
// use `fable`: its Claude-branded label is misleading for opted-out users.
|
|
1067
|
-
export const NATIVE_AGENT_TRANSPORT_KEYS = Object.freeze({
|
|
1068
|
-
sonnet: 'claude-sonnet-5',
|
|
1069
|
-
opus: 'claude-opus-5',
|
|
1070
|
-
haiku: 'claude-haiku-4-5-20251001',
|
|
1071
|
-
});
|
|
1072
|
-
|
|
1073
|
-
export function resolveNativeAgentAliases(modelOverrides) {
|
|
1074
|
-
const overrides = modelOverrides && typeof modelOverrides === 'object' ? modelOverrides : {};
|
|
1075
|
-
return Object.fromEntries(Object.entries(NATIVE_AGENT_TRANSPORT_KEYS)
|
|
1076
|
-
.filter(([, key]) => typeof overrides[key] === 'string' && overrides[key].trim())
|
|
1077
|
-
.map(([alias, key]) => [overrides[key].trim(), alias]));
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
1063
|
export function buildClaudeModelOverrides(modelIds) {
|
|
1081
1064
|
const unique = [...new Set((Array.isArray(modelIds) ? modelIds : [])
|
|
1082
1065
|
.filter((id) => typeof id === 'string' && id.trim())
|
|
1083
1066
|
.map((id) => id.trim()))];
|
|
1084
1067
|
if (unique.length === 0) return {};
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
const transportIndex = new Map(Object.values(NATIVE_AGENT_TRANSPORT_KEYS)
|
|
1088
|
-
.map((key, index) => [key, index]));
|
|
1089
|
-
return Object.fromEntries(CLAUDE_MODEL_OVERRIDE_KEYS.map((key, index) => [
|
|
1090
|
-
key,
|
|
1091
|
-
unique[(transportIndex.get(key) ?? index) % unique.length],
|
|
1092
|
-
]));
|
|
1068
|
+
return Object.fromEntries(CLAUDE_MODEL_OVERRIDE_KEYS
|
|
1069
|
+
.map((key, index) => [key, unique[index % unique.length]]));
|
|
1093
1070
|
}
|
|
1094
1071
|
|
|
1095
1072
|
/** Custom gateway IDs must be discoverable to Claude's SDK/subagent path. */
|
|
@@ -38,11 +38,11 @@ Before every Workflow, Agent, or Agent-team call, read the global Bizar model ro
|
|
|
38
38
|
small `args.routing` object whose `default`, `medium`, and `high` values are
|
|
39
39
|
explicit enabled configured model IDs (user picks win; otherwise use enabled
|
|
40
40
|
tier candidates). Include the user's task in the same args object under the
|
|
41
|
-
workflow's documented task field.
|
|
42
|
-
|
|
43
|
-
that
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
workflow's documented task field. Pass the exact enabled raw gateway ID chosen
|
|
42
|
+
from `bizar models` as `model`; never substitute a Claude family alias. You may
|
|
43
|
+
include that selection in `additionalContext.bizarConfiguredModel` for audit
|
|
44
|
+
telemetry. If no configured model exists, stop and ask the operator to run
|
|
45
|
+
`bizar models`; never retry by omitting `model` or using `inherit`.
|
|
46
46
|
|
|
47
47
|
Invoke the selected workflow by `name` first. If Claude reports that the Bizar
|
|
48
48
|
name is unavailable, resolve the active Claude config directory and retry once
|
|
@@ -57,12 +57,12 @@ implementation around a broken workflow installation.
|
|
|
57
57
|
|
|
58
58
|
For every Agent call, select the cheapest sufficient enabled configured model
|
|
59
59
|
from the global Bizar router. User-selected models take precedence over tier
|
|
60
|
-
candidates; `disabledProviders` excludes both. Pass
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
candidates; `disabledProviders` excludes both. Pass that raw selected custom
|
|
61
|
+
ID directly; the guard verifies it is in the enabled selected pool. If no
|
|
62
|
+
enabled configured candidate exists, stop with the configuration error. Never
|
|
63
|
+
let Claude choose an unconfigured default, inherit the session model, or retry
|
|
64
|
+
by cycling models, providers, or tiers. A single configured transport failover
|
|
65
|
+
is allowed only when the router explicitly supplies it.
|
|
66
66
|
|
|
67
67
|
## Worktree Discipline and integration
|
|
68
68
|
|
|
@@ -224,8 +224,12 @@ export async function guardAgentModel(input, options = {}) {
|
|
|
224
224
|
|
|
225
225
|
const transportTarget = readTransportTarget(requested, options);
|
|
226
226
|
if (transportTarget) {
|
|
227
|
-
|
|
228
|
-
|
|
227
|
+
// `modelOverrides` is the native Agent transport contract: Claude Code
|
|
228
|
+
// invokes this alias with the mapped gateway ID. The optional context is
|
|
229
|
+
// useful for telemetry, but must not make a valid configured alias fail
|
|
230
|
+
// when Mike's prompt carries a different (also selected) planning pick.
|
|
231
|
+
if (!userPicks.has(transportTarget)) {
|
|
232
|
+
return deny(`Bizar Agent dispatch blocked: native alias ${requested} does not map to an enabled Bizar selection. Re-run \`bizar models\` and restart Claude Code.`);
|
|
229
233
|
}
|
|
230
234
|
return {};
|
|
231
235
|
}
|
|
@@ -60,7 +60,7 @@ const ROUTE_POLICY = [
|
|
|
60
60
|
'Adaptive Bizar routing policy:',
|
|
61
61
|
'- If this is the primary session, you ARE @mike. First do only bounded read-only orientation. Then ask one concise clarification question describing the inferred outcome, the material choice/risk, and your proposed coordination mode. Wait for the answer before edits, branches, tests, or editor dispatch. If the user explicitly waives questions, continue autonomously.',
|
|
62
62
|
'- After clarification, choose the lightest coordination mode: a direct tiny edit, one isolated Agent for a bounded change, a native Bizar Workflow for repeatable phased work, parallel Agents for disjoint scopes, or an Agent team only when 3+ sustained roles need cross-talk. Do not force a workflow or team when it adds no value.',
|
|
63
|
-
'- Every Agent or team member receives
|
|
63
|
+
'- Every Agent or team member receives one exact raw model ID from the enabled `bizar models` user selection. Pass that ID directly as `model`; never substitute a Claude family alias, provider default, or inherited session model. The guard allows only IDs in the global user-selected pool. If a selected custom model is denied, inspect `~/.claude/model-router.json`; do not retry with another model. Every editing worker uses call-level `isolation: "worktree"`. For genuinely disjoint writable scopes, dispatch concurrently; otherwise use one owner.',
|
|
64
64
|
'- Consume terminal agent results, merge queued worktrees with bizar worktree-merge, and run integration checks in the primary session. A subagent may not recursively dispatch itself.',
|
|
65
65
|
'- Do NOT execute any tool you do not have. If a tool you need is missing from your tools list, dispatch to a subagent that has it — do not pretend you have it.',
|
|
66
66
|
'- If you are already running as a Bizar custom agent, follow your assigned role and do not recursively dispatch yourself.',
|
|
@@ -387,24 +387,9 @@ function defaultConfigPaths({ cwd = process.cwd(), env = process.env } = {}) {
|
|
|
387
387
|
health: join(home, 'health.json'),
|
|
388
388
|
budget: join(home, 'budget.json'),
|
|
389
389
|
userSelected: join(home, 'userSelected.json'),
|
|
390
|
-
claudeSettings: join(claudeDir, 'settings.json'),
|
|
391
390
|
};
|
|
392
391
|
}
|
|
393
392
|
|
|
394
|
-
const NATIVE_AGENT_TRANSPORT_KEYS = Object.freeze({
|
|
395
|
-
sonnet: 'claude-sonnet-5',
|
|
396
|
-
opus: 'claude-opus-5',
|
|
397
|
-
haiku: 'claude-haiku-4-5-20251001',
|
|
398
|
-
});
|
|
399
|
-
|
|
400
|
-
function loadAgentTransportAliases(settingsPath) {
|
|
401
|
-
const overrides = readJson(settingsPath)?.modelOverrides;
|
|
402
|
-
if (!overrides || typeof overrides !== 'object') return {};
|
|
403
|
-
return Object.fromEntries(Object.entries(NATIVE_AGENT_TRANSPORT_KEYS)
|
|
404
|
-
.filter(([, key]) => typeof overrides[key] === 'string' && overrides[key].trim())
|
|
405
|
-
.map(([alias, key]) => [overrides[key].trim(), alias]));
|
|
406
|
-
}
|
|
407
|
-
|
|
408
393
|
function readJson(path) {
|
|
409
394
|
try {
|
|
410
395
|
if (!existsSync(path)) return undefined;
|
|
@@ -479,8 +464,7 @@ export function loadDispatchContext({ cwd = process.cwd(), env = process.env } =
|
|
|
479
464
|
const healthRaw = readJson(paths.health) ?? {};
|
|
480
465
|
const health = (healthRaw && typeof healthRaw === 'object' && healthRaw.models) || {};
|
|
481
466
|
const activeSessionModel = env.BIZAR_ACTIVE_SESSION_MODEL ?? loadActiveSessionModel();
|
|
482
|
-
|
|
483
|
-
return { selectedProfiles, staticProfiles, activeSessionModel, budget, health, agentAliases, evidenceDir: resolveEvidenceDir() };
|
|
467
|
+
return { selectedProfiles, staticProfiles, activeSessionModel, budget, health, evidenceDir: resolveEvidenceDir() };
|
|
484
468
|
}
|
|
485
469
|
|
|
486
470
|
function resolveEvidenceDir({ cwd = process.cwd(), env = process.env } = {}) {
|
|
@@ -813,13 +797,13 @@ export function classifyDispatchOutcome(result, error, startMs) {
|
|
|
813
797
|
|
|
814
798
|
/**
|
|
815
799
|
* Build the augmented agent-call payload. The native Agent model field cannot
|
|
816
|
-
* carry
|
|
817
|
-
*
|
|
800
|
+
* carry selected gateway IDs directly. The guard validates that the raw ID is
|
|
801
|
+
* an enabled Bizar selection before the native Agent tool sees it.
|
|
818
802
|
*/
|
|
819
|
-
export function augmentPayload(opts, decision, agentName
|
|
803
|
+
export function augmentPayload(opts, decision, agentName) {
|
|
820
804
|
return {
|
|
821
805
|
...opts,
|
|
822
|
-
model:
|
|
806
|
+
model: decision.modelId,
|
|
823
807
|
additionalContext: {
|
|
824
808
|
...(opts.additionalContext && typeof opts.additionalContext === 'object' ? opts.additionalContext : {}),
|
|
825
809
|
bizarConfiguredModel: decision.modelId ?? null,
|
|
@@ -880,14 +864,7 @@ export async function dispatchAgent(agentFn, agentName, prompt, opts = {}, conte
|
|
|
880
864
|
'No enabled configured model is available for this Agent dispatch. Configure a model tier or user selection with `bizar models`; refusing to inherit an unconfigured provider default.',
|
|
881
865
|
);
|
|
882
866
|
}
|
|
883
|
-
const
|
|
884
|
-
const transportAlias = ctx.agentAliases?.[decision.modelId];
|
|
885
|
-
if (!transportAlias) {
|
|
886
|
-
throw new ModelRoutingError(
|
|
887
|
-
`No native Agent transport alias maps to ${decision.modelId}. Re-run \`bizar models\` to synchronize global Claude settings, then restart Claude Code.`,
|
|
888
|
-
);
|
|
889
|
-
}
|
|
890
|
-
const augmented = augmentPayload(opts, decision, agentName, transportAlias);
|
|
867
|
+
const augmented = augmentPayload(opts, decision, agentName);
|
|
891
868
|
|
|
892
869
|
// F-191 / IMP-018 audit trail — persist the decision before invoking
|
|
893
870
|
// the agent. Best-effort: telemetry failures MUST NOT abort the
|
package/package.json
CHANGED