instar 1.2.45 → 1.2.47

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;AAkQH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAiqDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAglLtE;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"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAkQH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAiqDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAuoLtE;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"}
@@ -2152,7 +2152,20 @@ export async function startServer(options) {
2152
2152
  // backwards-compat; INSTAR_FRAMEWORK=codex-cli routes through Codex.
2153
2153
  try {
2154
2154
  const { buildIntelligenceProvider, frameworkFromEnv } = await import('../core/intelligenceProviderFactory.js');
2155
- const framework = frameworkFromEnv() ?? 'claude-code';
2155
+ // _defaultFramework is what the Telegram spawn path uses for any topic
2156
+ // without an explicit per-topic override (resolveTopicFramework returns
2157
+ // it). It MUST come from the agent's resolved runtime framework
2158
+ // (config.sessions.framework — derived at load from
2159
+ // sessions.framework | enabledFrameworks[0] | INSTAR_FRAMEWORK), NOT from
2160
+ // INSTAR_FRAMEWORK alone. Before this fix it was `frameworkFromEnv() ??
2161
+ // 'claude-code'`, so a codex-cli-only agent that didn't set the
2162
+ // INSTAR_FRAMEWORK env var (the common case — the wizard sets
2163
+ // enabledFrameworks, not the env) silently defaulted to claude-code and
2164
+ // spawned a CLAUDE session on every Telegram message. The fresh-spawn
2165
+ // path (spawnInteractiveSession's internal resolution) already read
2166
+ // config.framework correctly; this aligns the Telegram path with it so
2167
+ // both doors agree. See specs/dev-infrastructure/framework-spawn-portability.md.
2168
+ const framework = config.sessions?.framework ?? frameworkFromEnv() ?? 'claude-code';
2156
2169
  resolvedFramework = framework;
2157
2170
  _defaultFramework = framework;
2158
2171
  _topicFrameworks = config.topicFrameworks ?? {};
@@ -4415,6 +4428,37 @@ export async function startServer(options) {
4415
4428
  port: config.port,
4416
4429
  stateDir: config.stateDir,
4417
4430
  });
4431
+ // Wire credential rotation (tunnel-failure-resilience spec Part 6).
4432
+ // The manager owns WHEN to rotate (every terminal exit from
4433
+ // relay-active + boot-recovery); this closure owns WHAT: regenerate
4434
+ // the dashboard PIN + authToken, persist them, and DM the owner the
4435
+ // new PIN. Rotating authToken invalidates every previously-signed
4436
+ // view URL and the dashboard session — the documented UX cost of
4437
+ // having briefly routed private traffic through a third-party relay.
4438
+ tunnel.setCredentialRotator(async () => {
4439
+ const { randomUUID } = await import('node:crypto');
4440
+ const newPin = String(Math.floor(100000 + Math.random() * 900000)); // 6-digit, matches startup gen
4441
+ const newToken = randomUUID();
4442
+ // Persist to config.json (survives restart; boot reads the new token)…
4443
+ liveConfig.set('authToken', newToken);
4444
+ liveConfig.set('dashboardPin', newPin);
4445
+ // …and mutate the in-memory config the running server reads live,
4446
+ // so the auth middleware + view-URL signing reject the old token
4447
+ // and old signed links immediately, without a restart.
4448
+ config.authToken = newToken;
4449
+ config.dashboardPin = newPin;
4450
+ console.log(pc.yellow(' [tunnel] rotated dashboard PIN + auth token after relay episode'));
4451
+ if (telegram) {
4452
+ const msg = [
4453
+ `Security cleanup after the backup tunnel: I've rotated your dashboard PIN and access token.`,
4454
+ ``,
4455
+ `New dashboard PIN: ${newPin}`,
4456
+ ``,
4457
+ `Heads up: any dashboard tab you had open will need to sign in again with this new PIN, and any private view links you shared earlier no longer work. That's deliberate — it makes sure the backup operator can't reuse anything they may have seen while the backup was running.`,
4458
+ ].join('\n');
4459
+ await telegram.sendToOwnerDM(msg).catch(() => { });
4460
+ }
4461
+ });
4418
4462
  }
4419
4463
  // Set up evolution system (always enabled — the feedback loop infrastructure)
4420
4464
  const evolution = new EvolutionManager({
@@ -6720,6 +6764,15 @@ export async function startServer(options) {
6720
6764
  });
6721
6765
  }
6722
6766
  const server = new AgentServer({ config, sessionManager, state, scheduler, telegram, relationships, feedback, feedbackAnomalyDetector, dispatches, updateChecker, autoUpdater, autoDispatcher, quotaTracker, quotaManager, publisher, viewer, tunnel, evolution, watchdog, topicMemory, triageNurse, projectMapper, coherenceGate: scopeVerifier, contextHierarchy, canonicalState, operationGate, sentinel, adaptiveTrust, memoryMonitor, orphanReaper, coherenceMonitor, commitmentTracker, semanticMemory, activitySentinel, rateLimitSentinel, messageRouter, summarySentinel, spawnManager, systemReviewer, capabilityMapper, selfKnowledgeTree, coverageAuditor, topicResumeMap: _topicResumeMap ?? undefined, sessionRefresh: _sessionRefresh ?? undefined, autonomyManager, trustElevationTracker, autonomousEvolution, coordinator: coordinator.enabled ? coordinator : undefined, localSigningKeyPem, whatsapp: whatsappAdapter, slack: slackAdapter, imessage: imessageAdapter, whatsappBusinessBackend, messageBridge, hookEventReceiver, worktreeMonitor, subagentTracker, instructionsVerifier, handshakeManager: threadlineHandshake, threadlineRouter, threadResumeMap, topicLinkageHandler: topicLinkageHandler ?? undefined, threadlineRelayClient, threadlineReplyWaiters, listenerManager: listenerManager ?? undefined, responseReviewGate, messagingToneGate, outboundDedupGate, telemetryHeartbeat, pasteManager, featureRegistry, discoveryEvaluator, unifiedTrust, liveConfig, sharedStateLedger, ledgerSessionRegistry, worktreeManager, oidcEnrolledRepos: parallelDevConfig?.oidcEnrolledRepos, initiativeTracker, projectRoundRunner, projectDriftChecker, machineHeartbeat, proxyCoordinator, topicIntentStore, telegramBridgeConfig, telegramBridge: telegramBridge ?? undefined, threadlineObservability, workingMemory, taskFlowRegistry, threadlineFlowBridge });
6767
+ // Boot-recovery (tunnel-failure-resilience spec Part 6): if the agent
6768
+ // died mid-relay-episode, the persisted tunnel.json carries
6769
+ // rotationPending=true. Rotate the dashboard PIN + authToken BEFORE
6770
+ // the server starts accepting API traffic, so a relay operator who saw
6771
+ // the old credentials can't use them against the freshly-booted server.
6772
+ if (tunnel && tunnel.lifecycleState.rotationPending) {
6773
+ console.log(pc.yellow(' [tunnel] boot-recovery: relay episode was in flight at last shutdown — rotating credentials before serving'));
6774
+ await tunnel.recoverPendingRotation();
6775
+ }
6723
6776
  await server.start();
6724
6777
  void taskFlowSweeper;
6725
6778
  void taskFlowDueWaker;