instar 1.3.533 → 1.3.534

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.
Files changed (35) hide show
  1. package/dist/commands/server.d.ts.map +1 -1
  2. package/dist/commands/server.js +98 -2
  3. package/dist/commands/server.js.map +1 -1
  4. package/dist/core/EscalationHintStore.d.ts +60 -0
  5. package/dist/core/EscalationHintStore.d.ts.map +1 -0
  6. package/dist/core/EscalationHintStore.js +163 -0
  7. package/dist/core/EscalationHintStore.js.map +1 -0
  8. package/dist/core/ModelTierEscalation.d.ts +10 -0
  9. package/dist/core/ModelTierEscalation.d.ts.map +1 -1
  10. package/dist/core/ModelTierEscalation.js +4 -0
  11. package/dist/core/ModelTierEscalation.js.map +1 -1
  12. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  13. package/dist/core/PostUpdateMigrator.js +15 -0
  14. package/dist/core/PostUpdateMigrator.js.map +1 -1
  15. package/dist/core/TopicProfileTransferCarrier.d.ts +27 -0
  16. package/dist/core/TopicProfileTransferCarrier.d.ts.map +1 -1
  17. package/dist/core/TopicProfileTransferCarrier.js +24 -1
  18. package/dist/core/TopicProfileTransferCarrier.js.map +1 -1
  19. package/dist/scaffold/templates.d.ts.map +1 -1
  20. package/dist/scaffold/templates.js +1 -0
  21. package/dist/scaffold/templates.js.map +1 -1
  22. package/dist/server/AgentServer.d.ts +10 -0
  23. package/dist/server/AgentServer.d.ts.map +1 -1
  24. package/dist/server/AgentServer.js +26 -0
  25. package/dist/server/AgentServer.js.map +1 -1
  26. package/dist/server/routes.d.ts +6 -0
  27. package/dist/server/routes.d.ts.map +1 -1
  28. package/dist/server/routes.js +47 -1
  29. package/dist/server/routes.js.map +1 -1
  30. package/package.json +1 -1
  31. package/src/data/builtin-manifest.json +64 -64
  32. package/src/scaffold/templates.ts +1 -0
  33. package/upgrades/1.3.534.md +44 -0
  34. package/upgrades/side-effects/ws53-escalation-rides-topic.md +52 -0
  35. package/upgrades/1.3.533.md +0 -25
@@ -10,7 +10,7 @@ import { createHash, timingSafeEqual, randomUUID } from 'node:crypto';
10
10
  import fs from 'node:fs';
11
11
  import os from 'node:os';
12
12
  import path from 'node:path';
13
- import { KNOWN_CLAUDE_MODEL_IDS } from '../core/ModelTierEscalation.js';
13
+ import { KNOWN_CLAUDE_MODEL_IDS, escalatedModelIds, normalizeTierEscalationConfig, } from '../core/ModelTierEscalation.js';
14
14
  import { validateSummaryDeterministic, neutralizeInstructionShapedContent, extractCodeSymbols, } from '../core/cartographerSummary.js';
15
15
  import { navigate as cartographerNavigate } from '../core/CartographerNavigator.js';
16
16
  import { computeCoverage as computeStandardsCoverage, } from '../core/StandardsEnforcementAuditor.js';
@@ -10304,6 +10304,51 @@ export function createRoutes(ctx) {
10304
10304
  console.warn(`[pool/transfer] autonomous-run suspend failed for topic ${topicId}: ${err instanceof Error ? err.message : String(err)}`);
10305
10305
  }
10306
10306
  }
10307
+ // ── WS5.3 (escalation-rides-topic) SOURCE capture ───────────────────────
10308
+ // When the moving topic has a LIVE session running on the escalated tier,
10309
+ // file an EPHEMERAL escalation hint keyed by topic. The destination's
10310
+ // acquire pull serves it and RE-ADMITS through its OWN governor — a trigger
10311
+ // carry, NEVER a tier grant. Gated under tierEscalation.enabled && ridesTopic
10312
+ // (default false ⇒ strict no-op). Honors escalationOverride:'suppress' (a
10313
+ // suppressed topic files NO hint — it must never be re-escalated on arrival).
10314
+ // Only a REAL move files (noop/already-there never does).
10315
+ let escalationHintFiled = false;
10316
+ if (plan.action !== 'noop' && ctx.escalationHints) {
10317
+ try {
10318
+ const teCfg = normalizeTierEscalationConfig(ctx.config.models?.tierEscalation);
10319
+ if (teCfg.enabled && teCfg.ridesTopic) {
10320
+ // The topic's live session on THIS machine (the source in the
10321
+ // live-swap topology owner==holder==self; a remote-owner move
10322
+ // degrades safely — no local session, no hint, default tier).
10323
+ const topicNum = Number(topicId);
10324
+ const srcSessionName = Number.isFinite(topicNum)
10325
+ ? ctx.telegram?.getSessionForTopic?.(topicNum) ?? null
10326
+ : null;
10327
+ const srcSession = srcSessionName
10328
+ ? ctx.sessionManager.listRunningSessions().find((s) => s.name === srcSessionName || s.tmuxSession === srcSessionName) ?? null
10329
+ : null;
10330
+ const escalatedIds = escalatedModelIds(teCfg);
10331
+ const isEscalated = srcSession?.model != null && escalatedIds.has(srcSession.model);
10332
+ // suppress consult: a 'suppress'-pinned topic files no hint.
10333
+ const suppressed = ctx.topicProfile?.resolver?.resolve(topicNum)?.escalationOverride === 'suppress';
10334
+ if (isEscalated && !suppressed) {
10335
+ ctx.escalationHints.file(topicId, {
10336
+ trigger: 'transfer', // audit label only — the destination governor re-decides from real state
10337
+ sourceTier: 'escalated',
10338
+ ...(self ? { sourceMachineId: self } : {}),
10339
+ });
10340
+ escalationHintFiled = true;
10341
+ }
10342
+ }
10343
+ }
10344
+ catch {
10345
+ // @silent-fallback-ok — filing the hint is fire-and-forget enrichment of
10346
+ // the transfer: a capture error must never fail the move. Worst case the
10347
+ // resumed session re-evaluates escalation only when its heavy-work trigger
10348
+ // fires again on the destination (default tier in the meantime — the safe
10349
+ // direction, identical to WS5.3 being off).
10350
+ }
10351
+ }
10307
10352
  ctx.topicPinStore.set(topicId, target, plan.setPin ?? true);
10308
10353
  let releasedLocalOwnership = false;
10309
10354
  try {
@@ -10434,6 +10479,7 @@ export function createRoutes(ctx) {
10434
10479
  placedOwnership,
10435
10480
  autonomousRunSuspended: autonomousRunSuspended || drainRunSuspended,
10436
10481
  ...(drainLeg.attempted ? { drain: drainLeg } : {}),
10482
+ ...(escalationHintFiled ? { escalationHintFiled: true } : {}),
10437
10483
  });
10438
10484
  });
10439
10485
  // GET /secrets/sync-status — read-only view of cross-machine secret-sync (spec Phase 4).