instar 1.3.435 → 1.3.436

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.
@@ -3288,6 +3288,8 @@
3288
3288
  <!-- subscriptions tab (Subscription & Auth Standard P2.2 — live quota + pending logins) -->
3289
3289
  <style>
3290
3290
  .sub-account { border:1px solid var(--border,#2a2a2a); border-radius:10px; padding:14px 16px; margin-bottom:12px; }
3291
+ .sub-account-inuse { border-color:#16a34a; box-shadow:0 0 0 1px #16a34a44; }
3292
+ .sub-account-inuse-badge { font-size:11px; font-weight:600; color:#22c55e; margin-right:auto; }
3291
3293
  .sub-account-head { display:flex; justify-content:space-between; align-items:baseline; gap:12px; }
3292
3294
  .sub-account-nick { font-weight:600; font-size:15px; }
3293
3295
  .sub-account-status { font-size:12px; opacity:.75; }
@@ -130,8 +130,11 @@ export function quotaBar(doc, label, pct, resetIso, now = Date.now()) {
130
130
  return wrap;
131
131
  }
132
132
 
133
- /** Per-account rows: nickname, status, provider·framework, 5h + weekly quota bars. */
134
- export function renderAccounts(doc, target, accounts, now = Date.now()) {
133
+ /** Per-account rows: nickname, status, provider·framework, 5h + weekly quota bars.
134
+ * `inUseAccountId` (optional) is the account the agent is CURRENTLY running on —
135
+ * that card gets an "In use" marker so "active" (healthy) reads distinct from
136
+ * "actually running right now". */
137
+ export function renderAccounts(doc, target, accounts, now = Date.now(), inUseAccountId = null) {
135
138
  if (!target) return;
136
139
  target.replaceChildren();
137
140
  if (!Array.isArray(accounts) || accounts.length === 0) {
@@ -139,9 +142,11 @@ export function renderAccounts(doc, target, accounts, now = Date.now()) {
139
142
  return;
140
143
  }
141
144
  for (const a of accounts) {
142
- const card = el(doc, 'div', 'sub-account');
145
+ const inUse = !!(inUseAccountId && a && a.id === inUseAccountId);
146
+ const card = el(doc, 'div', inUse ? 'sub-account sub-account-inuse' : 'sub-account');
143
147
  const head = el(doc, 'div', 'sub-account-head');
144
148
  head.appendChild(el(doc, 'span', 'sub-account-nick', sanitizeForDisplay(a && a.nickname, 'label')));
149
+ if (inUse) head.appendChild(el(doc, 'span', 'sub-account-inuse-badge', '● In use now'));
145
150
  head.appendChild(el(doc, 'span', 'sub-account-status', friendlyStatus(a && a.status)));
146
151
  card.appendChild(head);
147
152
  card.appendChild(el(doc, 'div', 'sub-account-meta',
@@ -213,6 +218,7 @@ export function renderDisabled(doc, els) {
213
218
  const URLS = {
214
219
  accounts: '/subscription-pool',
215
220
  pending: '/subscription-pool/pending-logins',
221
+ inUse: '/subscription-pool/in-use',
216
222
  };
217
223
 
218
224
  export function createController(opts) {
@@ -239,11 +245,14 @@ export function createController(opts) {
239
245
  if (state.inFlight) { try { state.inFlight.abort(); } catch { /* superseded */ } }
240
246
  const controller = typeof AbortController !== 'undefined' ? new AbortController() : { signal: undefined, abort() {} };
241
247
  state.inFlight = controller;
242
- let accountsBody, pendingBody;
248
+ let accountsBody, pendingBody, inUseBody;
243
249
  try {
244
- [accountsBody, pendingBody] = await Promise.all([
250
+ // in-use is best-effort — its failure must not blank the accounts list, so
251
+ // it's caught independently and degrades to "unknown" (no badge).
252
+ [accountsBody, pendingBody, inUseBody] = await Promise.all([
245
253
  fetchJson(URLS.accounts, controller),
246
254
  fetchJson(URLS.pending, controller),
255
+ fetchJson(URLS.inUse, controller).catch(() => null),
247
256
  ]);
248
257
  } catch {
249
258
  if (controller.signal && controller.signal.aborted) return;
@@ -259,14 +268,15 @@ export function createController(opts) {
259
268
  reschedule();
260
269
  return;
261
270
  }
262
- render(accountsBody, pendingBody);
271
+ render(accountsBody, pendingBody, inUseBody);
263
272
  reschedule();
264
273
  }
265
274
 
266
- function render(accountsBody, pendingBody) {
275
+ function render(accountsBody, pendingBody, inUseBody) {
267
276
  const accounts = accountsBody && Array.isArray(accountsBody.accounts) ? accountsBody.accounts : [];
268
277
  const logins = pendingBody && Array.isArray(pendingBody.logins) ? pendingBody.logins : [];
269
- renderAccounts(doc, els.accounts, accounts, now());
278
+ const inUseAccountId = inUseBody && inUseBody.activeAccountId ? inUseBody.activeAccountId : null;
279
+ renderAccounts(doc, els.accounts, accounts, now(), inUseAccountId);
270
280
  renderPendingLogins(doc, els.pending, logins, now());
271
281
  }
272
282
 
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAaH,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;AAiG7D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AA6JtD,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA05BD,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,GAC/F,IAAI,CAyUN;AA2lBD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAulUtE;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAA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AAC,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"}
@@ -6518,6 +6518,11 @@ export async function startServer(options) {
6518
6518
  quotaPoller.start();
6519
6519
  console.log(pc.green(' Subscription quota poller started'));
6520
6520
  }
6521
+ // InUseAccountResolver — answers "which pool account is the agent running on
6522
+ // right now" for the dashboard "in use" badge (read-only; cached probe of
6523
+ // `claude auth status`). One shared instance so the TTL cache is honored.
6524
+ const { InUseAccountResolver } = await import('../core/InUseAccountResolver.js');
6525
+ const inUseAccountResolver = new InUseAccountResolver({});
6521
6526
  // EnrollmentWizard — mobile-first new-account login (P2.1 of the Subscription
6522
6527
  // & Auth Standard). Dark with the pool: the /subscription-pool/enroll routes
6523
6528
  // do nothing until an operator starts an enrollment. The login driver reuses
@@ -11404,7 +11409,7 @@ export async function startServer(options) {
11404
11409
  catch (err) {
11405
11410
  console.log(pc.dim(` [session-pool] rollout gate not wired: ${err instanceof Error ? err.message : String(err)}`));
11406
11411
  }
11407
- 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, subscriptionPool, quotaPoller, quotaAwareScheduler: _quotaAwareScheduler ?? undefined, enrollmentWizard, semanticMemory, activitySentinel, rateLimitSentinel, releaseReadinessSentinel: releaseReadinessSentinel ?? undefined, messageRouter, summarySentinel, spawnManager, systemReviewer, capabilityMapper, selfKnowledgeTree, coverageAuditor, topicResumeMap: _topicResumeMap ?? undefined, sessionRefresh: _sessionRefresh ?? undefined, autonomyManager, trustElevationTracker, autonomousEvolution, coordinator: coordinator.enabled ? coordinator : undefined, localSigningKeyPem, leaseTransport, onLeasePullRequest: () => leaseCoordinatorRef?.currentLease() ?? null, liveTailReceiver, handoffWireTransport, onHandoffBegin, onHandoffInitiate: handoffInitiate, handoffInProgress: handoffSentinelInProgress, messageLedger, currentInboundByTopic, replyMarkerTransport, onReplyMarker: messageLedger ? (marker) => { const m = marker; messageLedger.applyRemoteReplyMarker(m.dedupeKey, { platform: m.platform, replyIdempotencyKey: m.replyIdempotencyKey, epoch: m.epoch, topic: m.topic ?? null }); } : undefined, whatsapp: whatsappAdapter, slack: slackAdapter, imessage: imessageAdapter, whatsappBusinessBackend, messageBridge, hookEventReceiver, worktreeMonitor, subagentTracker, instructionsVerifier, handshakeManager: threadlineHandshake, threadlineRouter, conversationStore, warrantsReplyGate, collaborationSurfacer, threadResumeMap, topicLinkageHandler: topicLinkageHandler ?? undefined, threadlineRelayClient, threadlineReplyWaiters, listenerManager: listenerManager ?? undefined, a2aDeliveryTracker: a2aDeliveryTracker ?? undefined, responseReviewGate, messagingToneGate, outboundDedupGate, telemetryHeartbeat, pasteManager, featureRegistry, discoveryEvaluator, completionEvaluator, unifiedTrust, liveConfig, sharedStateLedger, ledgerSessionRegistry, worktreeManager, oidcEnrolledRepos: parallelDevConfig?.oidcEnrolledRepos, initiativeTracker, projectRoundRunner, projectDriftChecker, machineHeartbeat, machinePoolRegistry, meshRpcDispatcher, workingSetPullCoordinator, commitmentReplicaStore, forwardCommitmentMutate, sessionOwnershipRegistry, topicPinStore: _topicPinStore ?? undefined, streamTicketStore: _streamTicketStore ?? undefined, poolStreamAllowRemoteInput: config.dashboard?.poolStream?.allowRemoteInput ?? false, poolStreamConnector: _poolStreamConnector ?? undefined, secretSync: _secretSyncHandle ?? undefined, meshSelfId: _meshSelfId ?? undefined, resolveRouterUrl: _resolveRouterUrl ?? undefined, resolvePeerUrls: _resolvePeerUrls ?? undefined, sessionPoolE2EResultStore, proxyCoordinator, topicIntentStore, topicIntentArcCheck, usherSignalStore, intelligence: sharedIntelligence ?? undefined, telegramBridgeConfig, telegramBridge: telegramBridge ?? undefined, threadlineObservability, briefDeps, workingMemory, taskFlowRegistry, threadlineFlowBridge, sessionReaper, agentWorktreeReaper, mcpProcessReaper, geminiLoopRunner, sleepController, agentActivityState, reapLog, sleepWakeDetector, unjustifiedStopGate, stopGateDb, stopNotifier });
11412
+ 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, subscriptionPool, quotaPoller, quotaAwareScheduler: _quotaAwareScheduler ?? undefined, inUseAccountResolver, enrollmentWizard, semanticMemory, activitySentinel, rateLimitSentinel, releaseReadinessSentinel: releaseReadinessSentinel ?? undefined, messageRouter, summarySentinel, spawnManager, systemReviewer, capabilityMapper, selfKnowledgeTree, coverageAuditor, topicResumeMap: _topicResumeMap ?? undefined, sessionRefresh: _sessionRefresh ?? undefined, autonomyManager, trustElevationTracker, autonomousEvolution, coordinator: coordinator.enabled ? coordinator : undefined, localSigningKeyPem, leaseTransport, onLeasePullRequest: () => leaseCoordinatorRef?.currentLease() ?? null, liveTailReceiver, handoffWireTransport, onHandoffBegin, onHandoffInitiate: handoffInitiate, handoffInProgress: handoffSentinelInProgress, messageLedger, currentInboundByTopic, replyMarkerTransport, onReplyMarker: messageLedger ? (marker) => { const m = marker; messageLedger.applyRemoteReplyMarker(m.dedupeKey, { platform: m.platform, replyIdempotencyKey: m.replyIdempotencyKey, epoch: m.epoch, topic: m.topic ?? null }); } : undefined, whatsapp: whatsappAdapter, slack: slackAdapter, imessage: imessageAdapter, whatsappBusinessBackend, messageBridge, hookEventReceiver, worktreeMonitor, subagentTracker, instructionsVerifier, handshakeManager: threadlineHandshake, threadlineRouter, conversationStore, warrantsReplyGate, collaborationSurfacer, threadResumeMap, topicLinkageHandler: topicLinkageHandler ?? undefined, threadlineRelayClient, threadlineReplyWaiters, listenerManager: listenerManager ?? undefined, a2aDeliveryTracker: a2aDeliveryTracker ?? undefined, responseReviewGate, messagingToneGate, outboundDedupGate, telemetryHeartbeat, pasteManager, featureRegistry, discoveryEvaluator, completionEvaluator, unifiedTrust, liveConfig, sharedStateLedger, ledgerSessionRegistry, worktreeManager, oidcEnrolledRepos: parallelDevConfig?.oidcEnrolledRepos, initiativeTracker, projectRoundRunner, projectDriftChecker, machineHeartbeat, machinePoolRegistry, meshRpcDispatcher, workingSetPullCoordinator, commitmentReplicaStore, forwardCommitmentMutate, sessionOwnershipRegistry, topicPinStore: _topicPinStore ?? undefined, streamTicketStore: _streamTicketStore ?? undefined, poolStreamAllowRemoteInput: config.dashboard?.poolStream?.allowRemoteInput ?? false, poolStreamConnector: _poolStreamConnector ?? undefined, secretSync: _secretSyncHandle ?? undefined, meshSelfId: _meshSelfId ?? undefined, resolveRouterUrl: _resolveRouterUrl ?? undefined, resolvePeerUrls: _resolvePeerUrls ?? undefined, sessionPoolE2EResultStore, proxyCoordinator, topicIntentStore, topicIntentArcCheck, usherSignalStore, intelligence: sharedIntelligence ?? undefined, telegramBridgeConfig, telegramBridge: telegramBridge ?? undefined, threadlineObservability, briefDeps, workingMemory, taskFlowRegistry, threadlineFlowBridge, sessionReaper, agentWorktreeReaper, mcpProcessReaper, geminiLoopRunner, sleepController, agentActivityState, reapLog, sleepWakeDetector, unjustifiedStopGate, stopGateDb, stopNotifier });
11408
11413
  // Resolve the late-bound topic-operator getter (increment 2e): routing was
11409
11414
  // wired before the server existed; from here on inbound binds use the
11410
11415
  // server's own store instance.