adhdev 0.8.76 → 0.8.77

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/dist/cli/index.js CHANGED
@@ -1546,6 +1546,67 @@ var init_host_memory = __esm({
1546
1546
  }
1547
1547
  });
1548
1548
 
1549
+ // ../../oss/packages/daemon-core/src/session-host/runtime-surface.ts
1550
+ function isSessionHostLiveRuntime(record2) {
1551
+ const lifecycle = String(record2?.lifecycle || "").trim();
1552
+ return LIVE_LIFECYCLES.has(lifecycle);
1553
+ }
1554
+ function getSessionHostRecoveryLabel(meta3) {
1555
+ const recoveryState = typeof meta3?.runtimeRecoveryState === "string" ? String(meta3.runtimeRecoveryState).trim() : "";
1556
+ if (!recoveryState) return null;
1557
+ if (recoveryState === "auto_resumed") return "restored after restart";
1558
+ if (recoveryState === "resume_failed") return "restore failed";
1559
+ if (recoveryState === "host_restart_interrupted") return "host restart interrupted";
1560
+ if (recoveryState === "orphan_snapshot") return "snapshot recovered";
1561
+ return recoveryState.replace(/_/g, " ");
1562
+ }
1563
+ function isSessionHostRecoverySnapshot(record2) {
1564
+ if (!record2) return false;
1565
+ if (isSessionHostLiveRuntime(record2)) return false;
1566
+ const lifecycle = String(record2.lifecycle || "").trim();
1567
+ if (lifecycle && lifecycle !== "stopped" && lifecycle !== "failed") {
1568
+ return false;
1569
+ }
1570
+ const meta3 = record2.meta || void 0;
1571
+ if (meta3?.restoredFromStorage === true) return true;
1572
+ return getSessionHostRecoveryLabel(meta3) !== null;
1573
+ }
1574
+ function getSessionHostSurfaceKind(record2) {
1575
+ if (isSessionHostLiveRuntime(record2)) return "live_runtime";
1576
+ if (isSessionHostRecoverySnapshot(record2)) return "recovery_snapshot";
1577
+ return "inactive_record";
1578
+ }
1579
+ function partitionSessionHostRecords(records) {
1580
+ const liveRuntimes = [];
1581
+ const recoverySnapshots = [];
1582
+ const inactiveRecords = [];
1583
+ for (const record2 of records) {
1584
+ const kind = getSessionHostSurfaceKind(record2);
1585
+ if (kind === "live_runtime") {
1586
+ liveRuntimes.push(record2);
1587
+ } else if (kind === "recovery_snapshot") {
1588
+ recoverySnapshots.push(record2);
1589
+ } else {
1590
+ inactiveRecords.push(record2);
1591
+ }
1592
+ }
1593
+ return {
1594
+ liveRuntimes,
1595
+ recoverySnapshots,
1596
+ inactiveRecords
1597
+ };
1598
+ }
1599
+ function partitionSessionHostDiagnosticsSessions(records) {
1600
+ return partitionSessionHostRecords(records || []);
1601
+ }
1602
+ var LIVE_LIFECYCLES;
1603
+ var init_runtime_surface = __esm({
1604
+ "../../oss/packages/daemon-core/src/session-host/runtime-surface.ts"() {
1605
+ "use strict";
1606
+ LIVE_LIFECYCLES = /* @__PURE__ */ new Set(["starting", "running", "stopping", "interrupted"]);
1607
+ }
1608
+ });
1609
+
1549
1610
  // ../../oss/packages/daemon-core/src/status/chat-tail-hot-sessions.ts
1550
1611
  function parseMessageTimestamp(value) {
1551
1612
  if (typeof value === "number" && Number.isFinite(value)) return value;
@@ -1555,6 +1616,23 @@ function parseMessageTimestamp(value) {
1555
1616
  }
1556
1617
  return 0;
1557
1618
  }
1619
+ function isDefinitelyNonLiveRuntimeSession(session) {
1620
+ const surfaceKind = String(session?.runtimeSurfaceKind || "").trim();
1621
+ if (surfaceKind === "live_runtime") return false;
1622
+ if (surfaceKind === "recovery_snapshot") return true;
1623
+ if (surfaceKind === "inactive_record") return false;
1624
+ const lifecycle = String(session?.runtimeLifecycle || "").trim();
1625
+ if (lifecycle && LIVE_RUNTIME_LIFECYCLES.has(lifecycle)) return false;
1626
+ const inferredSurfaceKind = getSessionHostSurfaceKind({
1627
+ lifecycle: lifecycle || null,
1628
+ meta: {
1629
+ restoredFromStorage: session?.runtimeRestoredFromStorage === true,
1630
+ ...session?.runtimeRecoveryState ? { runtimeRecoveryState: session.runtimeRecoveryState } : {}
1631
+ }
1632
+ });
1633
+ if (inferredSurfaceKind === "recovery_snapshot") return true;
1634
+ return false;
1635
+ }
1558
1636
  function classifyHotChatSessionsForSubscriptionFlush(sessions, previousHotSessionIds, options = {}) {
1559
1637
  const now = options.now ?? Date.now();
1560
1638
  const recentMessageGraceMs = Math.max(
@@ -1563,9 +1641,14 @@ function classifyHotChatSessionsForSubscriptionFlush(sessions, previousHotSessio
1563
1641
  );
1564
1642
  const activeStatuses = options.activeStatuses ?? DEFAULT_ACTIVE_CHAT_POLL_STATUSES;
1565
1643
  const active = /* @__PURE__ */ new Set();
1644
+ const excluded = /* @__PURE__ */ new Set();
1566
1645
  for (const session of sessions) {
1567
1646
  const sessionId = typeof session?.id === "string" ? session.id : "";
1568
1647
  if (!sessionId) continue;
1648
+ if (isDefinitelyNonLiveRuntimeSession(session)) {
1649
+ excluded.add(sessionId);
1650
+ continue;
1651
+ }
1569
1652
  const status = String(session?.status || "").toLowerCase();
1570
1653
  const lastMessageAt = parseMessageTimestamp(session?.lastMessageAt);
1571
1654
  const recentlyUpdated = lastMessageAt > 0 && now - lastMessageAt <= recentMessageGraceMs;
@@ -1574,20 +1657,22 @@ function classifyHotChatSessionsForSubscriptionFlush(sessions, previousHotSessio
1574
1657
  }
1575
1658
  }
1576
1659
  const finalizing = new Set(
1577
- Array.from(previousHotSessionIds).filter((sessionId) => !active.has(sessionId))
1660
+ Array.from(previousHotSessionIds).filter((sessionId) => !active.has(sessionId) && !excluded.has(sessionId))
1578
1661
  );
1579
1662
  return { active, finalizing };
1580
1663
  }
1581
- var DEFAULT_ACTIVE_CHAT_POLL_STATUSES, DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS;
1664
+ var DEFAULT_ACTIVE_CHAT_POLL_STATUSES, DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS, LIVE_RUNTIME_LIFECYCLES;
1582
1665
  var init_chat_tail_hot_sessions = __esm({
1583
1666
  "../../oss/packages/daemon-core/src/status/chat-tail-hot-sessions.ts"() {
1584
1667
  "use strict";
1668
+ init_runtime_surface();
1585
1669
  DEFAULT_ACTIVE_CHAT_POLL_STATUSES = /* @__PURE__ */ new Set([
1586
1670
  "generating",
1587
1671
  "waiting_approval",
1588
1672
  "starting"
1589
1673
  ]);
1590
1674
  DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS = 8e3;
1675
+ LIVE_RUNTIME_LIFECYCLES = /* @__PURE__ */ new Set(["starting", "running", "stopping", "interrupted"]);
1591
1676
  }
1592
1677
  });
1593
1678
 
@@ -6651,7 +6736,7 @@ function shouldIncludeSessionMetadata(profile) {
6651
6736
  return profile !== "live";
6652
6737
  }
6653
6738
  function shouldIncludeRuntimeMetadata(profile) {
6654
- return profile !== "live";
6739
+ return true;
6655
6740
  }
6656
6741
  function findCdpManager(cdpManagers, key) {
6657
6742
  const exact = cdpManagers.get(key);
@@ -6783,8 +6868,12 @@ function buildCliSession(state, options) {
6783
6868
  runtimeKey: state.runtime?.runtimeKey,
6784
6869
  runtimeDisplayName: state.runtime?.displayName,
6785
6870
  runtimeWorkspaceLabel: state.runtime?.workspaceLabel,
6871
+ runtimeLifecycle: state.runtime?.lifecycle ?? null,
6872
+ runtimeSurfaceKind: state.runtime?.surfaceKind,
6786
6873
  runtimeWriteOwner: state.runtime?.writeOwner || null,
6787
- runtimeAttachedClients: state.runtime?.attachedClients || []
6874
+ runtimeAttachedClients: state.runtime?.attachedClients || [],
6875
+ runtimeRestoredFromStorage: state.runtime?.restoredFromStorage === true,
6876
+ runtimeRecoveryState: state.runtime?.recoveryState ?? null
6788
6877
  },
6789
6878
  mode: state.mode,
6790
6879
  resume: state.resume,
@@ -10694,11 +10783,11 @@ __export(dist_exports, {
10694
10783
  ensureNodePtySpawnHelperPermissions: () => ensureNodePtySpawnHelperPermissions,
10695
10784
  formatRuntimeOwner: () => formatRuntimeOwner,
10696
10785
  getDefaultSessionHostEndpoint: () => getDefaultSessionHostEndpoint,
10697
- getSessionHostRecoveryLabel: () => getSessionHostRecoveryLabel,
10698
- getSessionHostSurfaceKind: () => getSessionHostSurfaceKind,
10786
+ getSessionHostRecoveryLabel: () => getSessionHostRecoveryLabel2,
10787
+ getSessionHostSurfaceKind: () => getSessionHostSurfaceKind2,
10699
10788
  getWorkspaceLabel: () => getWorkspaceLabel,
10700
- isSessionHostLiveRuntime: () => isSessionHostLiveRuntime,
10701
- isSessionHostRecoverySnapshot: () => isSessionHostRecoverySnapshot,
10789
+ isSessionHostLiveRuntime: () => isSessionHostLiveRuntime2,
10790
+ isSessionHostRecoverySnapshot: () => isSessionHostRecoverySnapshot2,
10702
10791
  resolveAttachableRuntimeRecord: () => resolveAttachableRuntimeRecord,
10703
10792
  resolveRuntimeRecord: () => resolveRuntimeRecord,
10704
10793
  sanitizeSpawnEnv: () => sanitizeSpawnEnv,
@@ -10738,14 +10827,14 @@ function buildRuntimeKey(payload, existingKeys) {
10738
10827
  }
10739
10828
  return candidate;
10740
10829
  }
10741
- function isSessionHostLiveRuntime(record2) {
10830
+ function isSessionHostLiveRuntime2(record2) {
10742
10831
  if (!record2) return false;
10743
10832
  if (record2.surfaceKind === "live_runtime") return true;
10744
10833
  if (record2.surfaceKind === "recovery_snapshot" || record2.surfaceKind === "inactive_record") return false;
10745
10834
  const lifecycle = String(record2.lifecycle || "").trim();
10746
- return LIVE_LIFECYCLES.has(lifecycle);
10835
+ return LIVE_LIFECYCLES2.has(lifecycle);
10747
10836
  }
10748
- function getSessionHostRecoveryLabel(meta3) {
10837
+ function getSessionHostRecoveryLabel2(meta3) {
10749
10838
  const recoveryState = typeof meta3?.runtimeRecoveryState === "string" ? String(meta3.runtimeRecoveryState).trim() : "";
10750
10839
  if (!recoveryState) return null;
10751
10840
  if (recoveryState === "auto_resumed") return "restored after restart";
@@ -10754,30 +10843,30 @@ function getSessionHostRecoveryLabel(meta3) {
10754
10843
  if (recoveryState === "orphan_snapshot") return "snapshot recovered";
10755
10844
  return recoveryState.replace(/_/g, " ");
10756
10845
  }
10757
- function isSessionHostRecoverySnapshot(record2) {
10846
+ function isSessionHostRecoverySnapshot2(record2) {
10758
10847
  if (!record2) return false;
10759
10848
  if (record2.surfaceKind === "recovery_snapshot") return true;
10760
10849
  if (record2.surfaceKind === "live_runtime" || record2.surfaceKind === "inactive_record") return false;
10761
- if (isSessionHostLiveRuntime(record2)) return false;
10850
+ if (isSessionHostLiveRuntime2(record2)) return false;
10762
10851
  const lifecycle = String(record2.lifecycle || "").trim();
10763
10852
  if (lifecycle && lifecycle !== "stopped" && lifecycle !== "failed") {
10764
10853
  return false;
10765
10854
  }
10766
10855
  const meta3 = record2.meta || void 0;
10767
10856
  if (meta3?.restoredFromStorage === true) return true;
10768
- return getSessionHostRecoveryLabel(meta3) !== null;
10857
+ return getSessionHostRecoveryLabel2(meta3) !== null;
10769
10858
  }
10770
- function getSessionHostSurfaceKind(record2) {
10859
+ function getSessionHostSurfaceKind2(record2) {
10771
10860
  if (record2?.surfaceKind === "live_runtime" || record2?.surfaceKind === "recovery_snapshot" || record2?.surfaceKind === "inactive_record") {
10772
10861
  return record2.surfaceKind;
10773
10862
  }
10774
- if (isSessionHostLiveRuntime(record2)) return "live_runtime";
10775
- if (isSessionHostRecoverySnapshot(record2)) return "recovery_snapshot";
10863
+ if (isSessionHostLiveRuntime2(record2)) return "live_runtime";
10864
+ if (isSessionHostRecoverySnapshot2(record2)) return "recovery_snapshot";
10776
10865
  return "inactive_record";
10777
10866
  }
10778
10867
  function resolveAttachableRuntimeRecord(records, identifier) {
10779
10868
  const record2 = resolveRuntimeRecord(records, identifier);
10780
- const surfaceKind = getSessionHostSurfaceKind(record2);
10869
+ const surfaceKind = getSessionHostSurfaceKind2(record2);
10781
10870
  if (surfaceKind === "live_runtime") {
10782
10871
  return record2;
10783
10872
  }
@@ -10900,7 +10989,7 @@ function ensureNodePtySpawnHelperPermissions(logFn) {
10900
10989
  } catch {
10901
10990
  }
10902
10991
  }
10903
- var import_crypto3, path9, os9, path22, net, import_crypto4, os22, path32, __require, SessionRingBuffer, LIVE_LIFECYCLES, SessionHostRegistry, SessionHostClient;
10992
+ var import_crypto3, path9, os9, path22, net, import_crypto4, os22, path32, __require, SessionRingBuffer, LIVE_LIFECYCLES2, SessionHostRegistry, SessionHostClient;
10904
10993
  var init_dist = __esm({
10905
10994
  "../../oss/packages/session-host-core/dist/index.mjs"() {
10906
10995
  "use strict";
@@ -10978,7 +11067,7 @@ var init_dist = __esm({
10978
11067
  }
10979
11068
  }
10980
11069
  };
10981
- LIVE_LIFECYCLES = /* @__PURE__ */ new Set(["starting", "running", "stopping", "interrupted"]);
11070
+ LIVE_LIFECYCLES2 = /* @__PURE__ */ new Set(["starting", "running", "stopping", "interrupted"]);
10982
11071
  SessionHostRegistry = class {
10983
11072
  sessions = /* @__PURE__ */ new Map();
10984
11073
  createSession(payload) {
@@ -13919,8 +14008,12 @@ var init_cli_provider_instance = __esm({
13919
14008
  runtimeKey: runtime.runtimeKey,
13920
14009
  displayName: runtime.displayName,
13921
14010
  workspaceLabel: runtime.workspaceLabel,
14011
+ lifecycle: runtime.lifecycle ?? null,
14012
+ surfaceKind: runtime.surfaceKind,
13922
14013
  writeOwner: runtime.writeOwner || null,
13923
- attachedClients: runtime.attachedClients || []
14014
+ attachedClients: runtime.attachedClients || [],
14015
+ restoredFromStorage: runtime.restoredFromStorage === true,
14016
+ recoveryState: runtime.recoveryState ?? null
13924
14017
  } : void 0,
13925
14018
  resume: this.provider.resume,
13926
14019
  controlValues: surface.controlValues,
@@ -36331,67 +36424,6 @@ var init_command_log = __esm({
36331
36424
  }
36332
36425
  });
36333
36426
 
36334
- // ../../oss/packages/daemon-core/src/session-host/runtime-surface.ts
36335
- function isSessionHostLiveRuntime2(record2) {
36336
- const lifecycle = String(record2?.lifecycle || "").trim();
36337
- return LIVE_LIFECYCLES2.has(lifecycle);
36338
- }
36339
- function getSessionHostRecoveryLabel2(meta3) {
36340
- const recoveryState = typeof meta3?.runtimeRecoveryState === "string" ? String(meta3.runtimeRecoveryState).trim() : "";
36341
- if (!recoveryState) return null;
36342
- if (recoveryState === "auto_resumed") return "restored after restart";
36343
- if (recoveryState === "resume_failed") return "restore failed";
36344
- if (recoveryState === "host_restart_interrupted") return "host restart interrupted";
36345
- if (recoveryState === "orphan_snapshot") return "snapshot recovered";
36346
- return recoveryState.replace(/_/g, " ");
36347
- }
36348
- function isSessionHostRecoverySnapshot2(record2) {
36349
- if (!record2) return false;
36350
- if (isSessionHostLiveRuntime2(record2)) return false;
36351
- const lifecycle = String(record2.lifecycle || "").trim();
36352
- if (lifecycle && lifecycle !== "stopped" && lifecycle !== "failed") {
36353
- return false;
36354
- }
36355
- const meta3 = record2.meta || void 0;
36356
- if (meta3?.restoredFromStorage === true) return true;
36357
- return getSessionHostRecoveryLabel2(meta3) !== null;
36358
- }
36359
- function getSessionHostSurfaceKind2(record2) {
36360
- if (isSessionHostLiveRuntime2(record2)) return "live_runtime";
36361
- if (isSessionHostRecoverySnapshot2(record2)) return "recovery_snapshot";
36362
- return "inactive_record";
36363
- }
36364
- function partitionSessionHostRecords(records) {
36365
- const liveRuntimes = [];
36366
- const recoverySnapshots = [];
36367
- const inactiveRecords = [];
36368
- for (const record2 of records) {
36369
- const kind = getSessionHostSurfaceKind2(record2);
36370
- if (kind === "live_runtime") {
36371
- liveRuntimes.push(record2);
36372
- } else if (kind === "recovery_snapshot") {
36373
- recoverySnapshots.push(record2);
36374
- } else {
36375
- inactiveRecords.push(record2);
36376
- }
36377
- }
36378
- return {
36379
- liveRuntimes,
36380
- recoverySnapshots,
36381
- inactiveRecords
36382
- };
36383
- }
36384
- function partitionSessionHostDiagnosticsSessions(records) {
36385
- return partitionSessionHostRecords(records || []);
36386
- }
36387
- var LIVE_LIFECYCLES2;
36388
- var init_runtime_surface = __esm({
36389
- "../../oss/packages/daemon-core/src/session-host/runtime-surface.ts"() {
36390
- "use strict";
36391
- LIVE_LIFECYCLES2 = /* @__PURE__ */ new Set(["starting", "running", "stopping", "interrupted"]);
36392
- }
36393
- });
36394
-
36395
36427
  // ../../oss/packages/daemon-core/src/status/snapshot.ts
36396
36428
  function buildRecentReadDebugSignature(snapshot) {
36397
36429
  return [
@@ -36927,7 +36959,7 @@ function summarizeSessionHostRecord(result) {
36927
36959
  return {
36928
36960
  runtimeKey: typeof record2.runtimeKey === "string" ? record2.runtimeKey : void 0,
36929
36961
  lifecycle: typeof record2.lifecycle === "string" ? record2.lifecycle : void 0,
36930
- surfaceKind: getSessionHostSurfaceKind2(record2),
36962
+ surfaceKind: getSessionHostSurfaceKind(record2),
36931
36963
  attachedClientCount: Array.isArray(record2.attachedClients) ? record2.attachedClients.length : void 0,
36932
36964
  hasWriteOwner: !!record2.writeOwner,
36933
36965
  writeOwnerClientId: typeof record2.writeOwner?.clientId === "string" ? record2.writeOwner.clientId : void 0
@@ -44922,6 +44954,8 @@ var init_session_host_transport = __esm({
44922
44954
  runtimeKey: record2.runtimeKey,
44923
44955
  displayName: record2.displayName,
44924
44956
  workspaceLabel: record2.workspaceLabel,
44957
+ lifecycle: typeof record2.lifecycle === "string" ? record2.lifecycle : null,
44958
+ surfaceKind: record2.surfaceKind,
44925
44959
  writeOwner: record2.writeOwner ? {
44926
44960
  clientId: record2.writeOwner.clientId,
44927
44961
  ownerType: record2.writeOwner.ownerType
@@ -45649,8 +45683,8 @@ __export(src_exports, {
45649
45683
  getRecentDebugTrace: () => getRecentDebugTrace,
45650
45684
  getRecentLogs: () => getRecentLogs,
45651
45685
  getSavedProviderSessions: () => getSavedProviderSessions,
45652
- getSessionHostRecoveryLabel: () => getSessionHostRecoveryLabel2,
45653
- getSessionHostSurfaceKind: () => getSessionHostSurfaceKind2,
45686
+ getSessionHostRecoveryLabel: () => getSessionHostRecoveryLabel,
45687
+ getSessionHostSurfaceKind: () => getSessionHostSurfaceKind,
45654
45688
  getWorkspaceState: () => getWorkspaceState,
45655
45689
  hasCdpManager: () => hasCdpManager,
45656
45690
  hashSignatureParts: () => hashSignatureParts,
@@ -45663,8 +45697,8 @@ __export(src_exports, {
45663
45697
  isIdeRunning: () => isIdeRunning,
45664
45698
  isManagedStatusWaiting: () => isManagedStatusWaiting,
45665
45699
  isManagedStatusWorking: () => isManagedStatusWorking,
45666
- isSessionHostLiveRuntime: () => isSessionHostLiveRuntime2,
45667
- isSessionHostRecoverySnapshot: () => isSessionHostRecoverySnapshot2,
45700
+ isSessionHostLiveRuntime: () => isSessionHostLiveRuntime,
45701
+ isSessionHostRecoverySnapshot: () => isSessionHostRecoverySnapshot,
45668
45702
  isSetupComplete: () => isSetupComplete,
45669
45703
  killIdeProcess: () => killIdeProcess,
45670
45704
  launchIDE: () => launchIDE,
@@ -85815,7 +85849,7 @@ var init_adhdev_daemon = __esm({
85815
85849
  init_source();
85816
85850
  init_version();
85817
85851
  init_src();
85818
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.76" });
85852
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.77" });
85819
85853
  AdhdevDaemon = class _AdhdevDaemon {
85820
85854
  localHttpServer = null;
85821
85855
  localWss = null;
@@ -87284,7 +87318,7 @@ async function buildRuntimeTargetResolutionTrace(records, target, options) {
87284
87318
  runtimeKey: record2.runtimeKey,
87285
87319
  displayName: record2.displayName,
87286
87320
  lifecycle: record2.lifecycle,
87287
- surfaceKind: getSessionHostSurfaceKind(record2),
87321
+ surfaceKind: getSessionHostSurfaceKind2(record2),
87288
87322
  attachedClientCount: Array.isArray(record2.attachedClients) ? record2.attachedClients.length : 0,
87289
87323
  writeOwnerClientId: record2.writeOwner?.clientId
87290
87324
  };