instar 1.3.586 → 1.3.587

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.
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAkCH,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAS3D,OAAO,EAAE,eAAe,EAAiC,MAAM,iCAAiC,CAAC;AAuBjG,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAkH7D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAsBtD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC1C,OAAO,CAUT;AAyID,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAg4CD,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,EACzB,cAAc,EAAE,cAAc,EAC9B,YAAY,CAAC,EAAE,YAAY,EAC3B,WAAW,CAAC,EAAE,WAAW,EACzB,WAAW,CAAC,EAAE,WAAW,EACzB,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,EAGvE,UAAU,CAAC,EAAE,MAAM,OAAO,8BAA8B,EAAE,WAAW,GAAG,IAAI,EAK5E,qBAAqB,CAAC,EAAE,MAAM,OAAO,gCAAgC,EAAE,kBAAkB,GAAG,IAAI,EAKhG,mBAAmB,CAAC,EAAE,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E,WAAW,EACzB,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,EAGvE,UAAU,CAAC,EAAE,MAAM,OAAO,8BAA8B,EAAE,WAAW,GAAG,IAAI,EAK5E,qBAAqB,CAAC,EAAE,MAAM,OAAO,gCAAgC,EAAE,kBAAkB,GAAG,IAAI,EAKhG,mBAAmB,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,GAAG,SAAS,GACpD,IAAI,CA8eN;AA2lBD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA04ctE;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDzE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD5E"}
@@ -4372,43 +4372,96 @@ export async function startServer(options) {
4372
4372
  const { IntelligenceRouter } = await import('../core/IntelligenceRouter.js');
4373
4373
  const { buildIntelligenceProvider: buildIP } = await import('../core/intelligenceProviderFactory.js');
4374
4374
  const { LlmCircuitBreaker } = await import('../core/LlmCircuitBreaker.js');
4375
+ const { INTERNAL_FRAMEWORK_PREFERENCE, resolveInternalFrameworkDefault, } = await import('../core/internalFrameworkDefault.js');
4375
4376
  const defaultFw = resolvedFramework;
4376
4377
  const rawDefault = sharedIntelligence;
4378
+ // Build a non-default framework's provider (its OWN breaker → a Claude trip
4379
+ // can't pause Codex). claude-code builds inherit subscription-path routing so a
4380
+ // component routed to Claude under a codex default still honors June-15 routing.
4381
+ const buildFrameworkProvider = (fw) => buildIP({
4382
+ framework: fw,
4383
+ breaker: new LlmCircuitBreaker(),
4384
+ // The per-component routing path is the one the cartographer sweep actually
4385
+ // uses — the kill-switch must reach it too.
4386
+ ...(fw === 'codex-cli' && resolveCodexExecJson ? { resolveExecJson: resolveCodexExecJson } : {}),
4387
+ ...(fw === 'claude-code' && subscriptionPathOption
4388
+ ? { subscriptionPath: subscriptionPathOption }
4389
+ : {}),
4390
+ // pi-cli routing (PI-HARNESS-INTEGRATION-SPEC §4.4): thread the configured
4391
+ // model pattern + the explicit Anthropic override. Absent pattern ⇒ the
4392
+ // factory degrades to null (guarded by design).
4393
+ ...(fw === 'pi-cli'
4394
+ ? {
4395
+ ...(config.sessions?.frameworkDefaultModels?.['pi-cli']
4396
+ ? { piModel: config.sessions.frameworkDefaultModels['pi-cli'] }
4397
+ : {}),
4398
+ ...(config.sessions?.piCliAllowAnthropicProviders !== undefined
4399
+ ? { piAllowAnthropicProviders: config.sessions.piCliAllowAnthropicProviders }
4400
+ : {}),
4401
+ }
4402
+ : {}),
4403
+ });
4404
+ const probeCache = new Map();
4405
+ const cachedBuild = (fw) => {
4406
+ if (probeCache.has(fw))
4407
+ return probeCache.get(fw);
4408
+ let p = null;
4409
+ try {
4410
+ p = buildFrameworkProvider(fw);
4411
+ }
4412
+ catch {
4413
+ p = null;
4414
+ }
4415
+ probeCache.set(fw, p);
4416
+ return p;
4417
+ };
4418
+ // §4.2 active-provider filtering: the active-set is the preference chain
4419
+ // filtered to frameworks whose provider genuinely BUILDS on this machine
4420
+ // (`buildProvider(fw) !== null` — the router's own truth, not a bare `which`).
4421
+ // claude-code is the default framework (always "active" — buildIP not needed),
4422
+ // so it's never dropped from the tail; off-default frameworks are probed.
4423
+ // Memoize ONLY this SET (§4.6 — never a frozen config object). Machine-local
4424
+ // by design (§5): each machine probes its own installed CLIs.
4425
+ const activeFrameworkSet = INTERNAL_FRAMEWORK_PREFERENCE.filter((fw) => fw === defaultFw || cachedBuild(fw) !== null);
4426
+ // §4.4 boot snapshot — load-bearing & mutation-proof: capture WHETHER the
4427
+ // operator set componentFrameworks ONCE here, at construction, BEFORE the only
4428
+ // runtime mutator (CartographerSweep auto-vivify, ~server.ts:11266). If we
4429
+ // tested the live object later, we'd mistake the auto-vivified block for an
4430
+ // operator override and silently disable the default policy (round-1 M5).
4431
+ const operatorSetComponentFrameworks = config.sessions?.componentFrameworks !== undefined;
4432
+ const computedDefault = resolveInternalFrameworkDefault(activeFrameworkSet);
4377
4433
  sharedIntelligence = new IntelligenceRouter({
4378
4434
  defaultProvider: rawDefault,
4379
4435
  defaultFramework: defaultFw,
4380
- // Live read: each call sees the current config object's componentFrameworks
4381
- // (a config edit that mutates the in-memory object is hot; a file reload is
4382
- // out of B1 scope same semantics as the rest of instar's config).
4383
- resolveConfig: () => config.sessions?.componentFrameworks,
4384
- // Each non-default framework gets its OWN breaker → a Claude trip can't
4385
- // pause Codex (the whole point). Default framework keeps the shared one.
4386
- // claude-code builds inherit the subscription-path routing so a
4387
- // component routed to Claude under a codex default still honors
4388
- // the June-15 SDK-pot-vs-subscription decision.
4389
- buildProvider: (fw) => buildIP({
4390
- framework: fw,
4391
- breaker: new LlmCircuitBreaker(),
4392
- // The per-component routing path is the one the cartographer
4393
- // sweep actually uses — the kill-switch must reach it too.
4394
- ...(fw === 'codex-cli' && resolveCodexExecJson ? { resolveExecJson: resolveCodexExecJson } : {}),
4395
- ...(fw === 'claude-code' && subscriptionPathOption
4396
- ? { subscriptionPath: subscriptionPathOption }
4397
- : {}),
4398
- // pi-cli routing (PI-HARNESS-INTEGRATION-SPEC §4.4): thread the
4399
- // configured model pattern + the explicit Anthropic override.
4400
- // Absent pattern the factory degrades to null (guarded by design).
4401
- ...(fw === 'pi-cli'
4402
- ? {
4403
- ...(config.sessions?.frameworkDefaultModels?.['pi-cli']
4404
- ? { piModel: config.sessions.frameworkDefaultModels['pi-cli'] }
4405
- : {}),
4406
- ...(config.sessions?.piCliAllowAnthropicProviders !== undefined
4407
- ? { piAllowAnthropicProviders: config.sessions.piCliAllowAnthropicProviders }
4408
- : {}),
4409
- }
4410
- : {}),
4411
- }),
4436
+ // §4.6 live-read, layered resolveConfig:
4437
+ // - operator-set at boot return the LIVE operator block unchanged (live
4438
+ // edits to its contents flow through; today's behavior).
4439
+ // - else the computed default LAYERED UNDER any live in-memory override
4440
+ // (e.g. CartographerSweep's runtime-injected categories/overrides WIN for
4441
+ // their slot this layering is what stops a frozen default from silently
4442
+ // disabling the freshness sweep, round-3 R3-2). Reads live every call;
4443
+ // memoizes only the active-SET, never a frozen config object.
4444
+ resolveConfig: () => {
4445
+ const live = config.sessions?.componentFrameworks;
4446
+ if (operatorSetComponentFrameworks)
4447
+ return live;
4448
+ if (!live)
4449
+ return computedDefault;
4450
+ // Layer the live in-memory override OVER the computed default.
4451
+ return {
4452
+ ...computedDefault,
4453
+ ...live,
4454
+ categories: { ...computedDefault.categories, ...live.categories },
4455
+ ...(live.overrides ? { overrides: live.overrides } : {}),
4456
+ ...(live.failureSwap !== undefined ? { failureSwap: live.failureSwap } : {}),
4457
+ };
4458
+ },
4459
+ // §4.5: per-attempt swap timeout, inline-defaulted to 5s (no ConfigDefaults
4460
+ // entry codexExecJson precedent; absent ⇒ 5s, present ⇒ operator's value).
4461
+ swapAttemptTimeoutMs: config.intelligence?.swapAttemptTimeoutMs ?? 5000,
4462
+ // Each non-default framework gets its OWN breaker (built once, from the
4463
+ // shared probe-cache so the active-set probe doesn't double-build).
4464
+ buildProvider: (fw) => cachedBuild(fw),
4412
4465
  onDegrade: (info) => {
4413
4466
  try {
4414
4467
  DegradationReporter.getInstance().report({