@polderlabs/bizar 10.23.16 → 10.23.17
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
|
@@ -2325,6 +2325,7 @@ export async function run(name, args, isHelpRequest, deps = {}) {
|
|
|
2325
2325
|
|
|
2326
2326
|
const wantJson = args.includes('--json');
|
|
2327
2327
|
const wantList = args.includes('--list');
|
|
2328
|
+
const wantAgentTypes = args.includes('--agent-types');
|
|
2328
2329
|
const wantClear = args.includes('--clear');
|
|
2329
2330
|
const wantRefresh = args.includes('--refresh');
|
|
2330
2331
|
const setFlag = args.find((a) => a.startsWith('--set='));
|
|
@@ -2341,6 +2342,19 @@ export async function run(name, args, isHelpRequest, deps = {}) {
|
|
|
2341
2342
|
const routerPath = resolveRouterPath(process.cwd());
|
|
2342
2343
|
const { endpoint, authToken, source: endpointSource } = resolveEndpoint({ cwd: process.cwd() });
|
|
2343
2344
|
|
|
2345
|
+
// This is the orchestration-safe bridge from an operator-selected gateway
|
|
2346
|
+
// ID to the Claude Code definition that owns it. It is deliberately local:
|
|
2347
|
+
// no gateway discovery is needed to dispatch a model the operator selected.
|
|
2348
|
+
if (wantAgentTypes) {
|
|
2349
|
+
const router = loadRouter(routerPath);
|
|
2350
|
+
const models = configuredEnabledModels(router);
|
|
2351
|
+
const agentTypes = Object.fromEntries(models.map((id) => [id, modelAgentName(id)]));
|
|
2352
|
+
const payload = { routerPath, models, agentTypes, agentsDir: join(resolveClaudeConfigDir(), 'agents', 'bizar-models') };
|
|
2353
|
+
if (wantJson) process.stdout.write(JSON.stringify(payload, null, 2) + '\n');
|
|
2354
|
+
else for (const id of models) process.stdout.write(`${id}\t${agentTypes[id]}\n`);
|
|
2355
|
+
return true;
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2344
2358
|
// F-185: `bizar models explain <role>` — non-interactive ranking.
|
|
2345
2359
|
// Handled BEFORE the picker fetch path so it never touches the gateway.
|
|
2346
2360
|
const explainIdx = args.findIndex((a) => a === 'explain');
|
package/cli/provision.mjs
CHANGED
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
buildClaudeModelOverrides,
|
|
37
37
|
configuredEnabledModels,
|
|
38
38
|
requiresGatewayModelDiscovery,
|
|
39
|
+
syncGeneratedModelAgents,
|
|
39
40
|
} from './commands/models.mjs';
|
|
40
41
|
import { validateNativeWorkflowDirectory } from '../config/workflows/lib/native-contract.mjs';
|
|
41
42
|
|
|
@@ -502,6 +503,20 @@ export async function syncModelRouter({ dryRun = false, force = false } = {}) {
|
|
|
502
503
|
return { ok: true, message: `global model-router.json → ${dest}`, path: dest };
|
|
503
504
|
}
|
|
504
505
|
|
|
506
|
+
// Recreate the managed definition projection on every install/update. This is
|
|
507
|
+
// needed after an npm upgrade or a clean Claude directory: the router is
|
|
508
|
+
// operator-owned and preserved, while generated definitions are disposable
|
|
509
|
+
// installation artifacts derived exclusively from its selected IDs.
|
|
510
|
+
export function syncConfiguredModelAgents({ dryRun = false } = {}) {
|
|
511
|
+
const routerPath = resolveGlobalModelRouter();
|
|
512
|
+
let router = {};
|
|
513
|
+
try { if (existsSync(routerPath)) router = JSON.parse(readFileSync(routerPath, 'utf8')); } catch { return { ok: false, message: `cannot read ${routerPath}` }; }
|
|
514
|
+
const models = configuredEnabledModels(router);
|
|
515
|
+
if (dryRun) return { ok: true, message: `[dry-run] would sync ${models.length} generated model agent(s)`, models };
|
|
516
|
+
const generated = syncGeneratedModelAgents(models, { agentsDir: join(resolveClaudeDir(), 'agents', 'bizar-models') });
|
|
517
|
+
return { ok: true, message: `${generated.names.length} generated model agent(s) synced`, ...generated };
|
|
518
|
+
}
|
|
519
|
+
|
|
505
520
|
export async function syncSkillFiles({ dryRun = false, force = false } = {}) {
|
|
506
521
|
const src = join(REPO_ROOT, 'config', 'skills');
|
|
507
522
|
const dest = CLAUDE_SKILLS_DIR;
|
|
@@ -1187,6 +1202,10 @@ export async function runProvision(opts = {}) {
|
|
|
1187
1202
|
if (routerStep.ok) logOk(routerStep.message); else logErr(routerStep.message);
|
|
1188
1203
|
stepResults.push({ label: 'model-router', ...routerStep });
|
|
1189
1204
|
|
|
1205
|
+
const modelAgentsStep = syncConfiguredModelAgents({ dryRun });
|
|
1206
|
+
if (modelAgentsStep.ok) logOk(modelAgentsStep.message); else logErr(modelAgentsStep.message);
|
|
1207
|
+
stepResults.push({ label: 'model-agents', ...modelAgentsStep });
|
|
1208
|
+
|
|
1190
1209
|
section('Writing settings.json');
|
|
1191
1210
|
const settingsStep = writeClaudeSettings({ dryRun, force });
|
|
1192
1211
|
if (settingsStep.ok) logOk(settingsStep.message); else logErr(settingsStep.message);
|
|
@@ -60,14 +60,19 @@ implementation around a broken workflow installation.
|
|
|
60
60
|
|
|
61
61
|
For every dispatch, select the cheapest sufficient enabled configured model
|
|
62
62
|
from the global Bizar router. User-selected models take precedence over tier
|
|
63
|
-
candidates; `disabledProviders` excludes both. Native aliases are
|
|
64
|
-
labels bound by `bizar models`, not Anthropic selections.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
candidates; `disabledProviders` excludes both. Native aliases are compatibility
|
|
64
|
+
transport labels bound by `bizar models`, not Anthropic selections. Native
|
|
65
|
+
Agent/Task calls accept only those aliases, so do not pass a full gateway ID in
|
|
66
|
+
`model`. Run `bizar models --agent-types --json`, look up the selected ID, pass
|
|
67
|
+
its generated name as `subagent_type`, and omit `model`; the generated global
|
|
68
|
+
definition's `model:` frontmatter selects the full gateway ID. This is the
|
|
69
|
+
default for individual subagents, workflows, and agent-team teammates. For
|
|
70
|
+
teams, do not name a competing model in the spawn prompt. Use `bizar worker`
|
|
71
|
+
only when a separately launched process worktree is useful. If no enabled
|
|
72
|
+
configured candidate or generated definition exists, stop with the
|
|
73
|
+
configuration error and run `bizar models`. Never let Claude choose an
|
|
74
|
+
unconfigured default, inherit the session model, use an unmapped alias, or
|
|
75
|
+
retry by cycling models, providers, or tiers.
|
|
71
76
|
|
|
72
77
|
## Worktree Discipline and integration
|
|
73
78
|
|
|
@@ -248,11 +248,11 @@ export async function guardAgentModel(input, options = {}) {
|
|
|
248
248
|
return {};
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
-
//
|
|
252
|
-
//
|
|
253
|
-
//
|
|
254
|
-
if (userPicks.has(requested)
|
|
255
|
-
return {};
|
|
251
|
+
// Native Agent/Task transport accepts only Claude's four aliases, even when
|
|
252
|
+
// a gateway accepts arbitrary IDs for the main conversation. Full IDs belong
|
|
253
|
+
// in Bizar's generated subagent frontmatter, not in this enum-shaped field.
|
|
254
|
+
if (userPicks.has(requested)) {
|
|
255
|
+
return deny(`Bizar Agent dispatch blocked: native Agent model accepts aliases only. Use generated subagent_type ${modelAgentName(requested)} and omit model; re-run \`bizar models\` if it is missing.`);
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
// F-185 contract: when the orchestrator passes both `routingDecisionId`
|
|
@@ -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
|
-
'-
|
|
63
|
+
'- For every Agent, workflow worker, or agent-team teammate, choose one exact ID from the enabled `bizar models` user selection, then obtain its generated definition name from `bizar models --agent-types --json`. Pass that name as `subagent_type` and OMIT the native `model` field. The definition frontmatter owns the exact gateway ID. Never put a raw gateway ID or a Claude family alias in the native model field; aliases are compatibility-only. For teams, do not name a competing model in the spawn prompt. If the map or definition is missing, run `bizar models`; do not retry by cycling providers or tiers. 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.',
|
package/package.json
CHANGED