adhdev 0.9.82-rc.20 → 0.9.82-rc.22

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/index.js CHANGED
@@ -45582,6 +45582,96 @@ function buildCachedInlineMeshGitStatus(node) {
45582
45582
  ...submodules ? { submodules } : {}
45583
45583
  };
45584
45584
  }
45585
+ function shouldDiscardCachedInlineMeshStatus(node) {
45586
+ const cachedStatus = readObjectRecord(node?.cachedStatus);
45587
+ if (!Object.keys(cachedStatus).length) return false;
45588
+ const cachedGit = readObjectRecord(cachedStatus.git);
45589
+ const workspaceError = readStringValue(cachedStatus.error, node?.error);
45590
+ if (workspaceError && /workspace must be an existing directory/i.test(workspaceError)) return true;
45591
+ const isGitRepo = readBooleanValue(cachedGit.isGitRepo);
45592
+ const branch = readStringValue(cachedGit.branch);
45593
+ const headCommit = readStringValue(cachedGit.headCommit);
45594
+ return isGitRepo === false && !branch && !headCommit;
45595
+ }
45596
+ function stripInlineMeshTransientNodeState(node) {
45597
+ if (!node || typeof node !== "object" || Array.isArray(node)) return node;
45598
+ const {
45599
+ cachedStatus,
45600
+ lastGit: _lastGit,
45601
+ last_git: _lastGitLegacy,
45602
+ lastProbe: _lastProbe,
45603
+ last_probe: _lastProbeLegacy,
45604
+ error: _error,
45605
+ health: _health,
45606
+ machineStatus: _machineStatus,
45607
+ lastSeenAt: _lastSeenAt,
45608
+ last_seen_at: _lastSeenAtLegacy,
45609
+ updatedAt: _updatedAt,
45610
+ updated_at: _updatedAtLegacy,
45611
+ activeSession: _activeSession,
45612
+ active_session: _activeSessionLegacy,
45613
+ activeSessionId: _activeSessionId,
45614
+ active_session_id: _activeSessionIdLegacy,
45615
+ sessionId: _sessionId,
45616
+ session_id: _sessionIdLegacy,
45617
+ providerType: _providerType,
45618
+ provider_type: _providerTypeLegacy,
45619
+ providers: _providers,
45620
+ ...rest
45621
+ } = node;
45622
+ if (cachedStatus && !shouldDiscardCachedInlineMeshStatus(node)) {
45623
+ return { ...rest, cachedStatus };
45624
+ }
45625
+ return rest;
45626
+ }
45627
+ function hasInlineMeshTransientNodeState(node) {
45628
+ if (!node || typeof node !== "object" || Array.isArray(node)) return false;
45629
+ return "cachedStatus" in node || "lastGit" in node || "last_git" in node || "lastProbe" in node || "last_probe" in node || "error" in node || "health" in node || "machineStatus" in node || "lastSeenAt" in node || "last_seen_at" in node || "updatedAt" in node || "updated_at" in node || "activeSession" in node || "active_session" in node || "activeSessionId" in node || "active_session_id" in node || "sessionId" in node || "session_id" in node || "providerType" in node || "provider_type" in node || "providers" in node;
45630
+ }
45631
+ function readInlineMeshNodeId(node) {
45632
+ return readStringValue(node?.id, node?.nodeId) || "";
45633
+ }
45634
+ function sanitizeInlineMesh(inlineMesh) {
45635
+ if (!inlineMesh || typeof inlineMesh !== "object" || Array.isArray(inlineMesh)) return inlineMesh;
45636
+ if (!Array.isArray(inlineMesh.nodes)) return inlineMesh;
45637
+ let changed = false;
45638
+ const nodes = inlineMesh.nodes.map((node) => {
45639
+ if (!hasInlineMeshTransientNodeState(node)) return node;
45640
+ changed = true;
45641
+ return stripInlineMeshTransientNodeState(node);
45642
+ });
45643
+ if (!changed) return inlineMesh;
45644
+ return {
45645
+ ...inlineMesh,
45646
+ nodes
45647
+ };
45648
+ }
45649
+ function reconcileInlineMeshCache(cached2, incoming) {
45650
+ if (!cached2 || typeof cached2 !== "object" || Array.isArray(cached2)) return incoming;
45651
+ if (!incoming || typeof incoming !== "object" || Array.isArray(incoming)) return cached2;
45652
+ const cachedNodes = Array.isArray(cached2.nodes) ? cached2.nodes : [];
45653
+ const incomingNodes = Array.isArray(incoming.nodes) ? incoming.nodes : [];
45654
+ if (!cachedNodes.length || !incomingNodes.length) return { ...cached2, ...incoming };
45655
+ const incomingById = /* @__PURE__ */ new Map();
45656
+ for (const node of incomingNodes) {
45657
+ const nodeId = readInlineMeshNodeId(node);
45658
+ if (nodeId) incomingById.set(nodeId, node);
45659
+ }
45660
+ const nodes = cachedNodes.map((cachedNode) => {
45661
+ const nodeId = readInlineMeshNodeId(cachedNode);
45662
+ const incomingNode = nodeId ? incomingById.get(nodeId) : void 0;
45663
+ if (!incomingNode) return cachedNode;
45664
+ if (hasInlineMeshTransientNodeState(incomingNode)) {
45665
+ return { ...cachedNode, ...incomingNode };
45666
+ }
45667
+ return { ...stripInlineMeshTransientNodeState(cachedNode), ...incomingNode };
45668
+ });
45669
+ return {
45670
+ ...cached2,
45671
+ ...incoming,
45672
+ nodes
45673
+ };
45674
+ }
45585
45675
  function hasGitWorktreeChanges(git) {
45586
45676
  if (!git) return false;
45587
45677
  return Number(git.staged || 0) + Number(git.modified || 0) + Number(git.untracked || 0) + Number(git.deleted || 0) + Number(git.renamed || 0) > 0;
@@ -46173,10 +46263,15 @@ var init_router = __esm({
46173
46263
  }
46174
46264
  warmInlineMeshCache(meshId, inlineMesh) {
46175
46265
  if (!inlineMesh || typeof inlineMesh !== "object") return void 0;
46266
+ const sanitizedInlineMesh = sanitizeInlineMesh(inlineMesh);
46176
46267
  const cached2 = this.inlineMeshCache.get(meshId);
46177
- if (cached2) return cached2;
46178
- this.inlineMeshCache.set(meshId, inlineMesh);
46179
- return inlineMesh;
46268
+ if (cached2) {
46269
+ const merged = reconcileInlineMeshCache(cached2, sanitizedInlineMesh);
46270
+ this.inlineMeshCache.set(meshId, merged);
46271
+ return merged;
46272
+ }
46273
+ this.inlineMeshCache.set(meshId, sanitizedInlineMesh);
46274
+ return sanitizedInlineMesh;
46180
46275
  }
46181
46276
  async getMeshForCommand(meshId, inlineMesh, options) {
46182
46277
  const preferInline = options?.preferInline === true;
@@ -48119,10 +48214,17 @@ ${block}`);
48119
48214
  }
48120
48215
  }
48121
48216
  if (workspace) {
48122
- if (!fs10.existsSync(workspace) && applyCachedInlineMeshNodeStatus(status, node)) {
48123
- status.launchReady = !!daemonId && (readStringValue(status.machineStatus) === "online" || isSelfNode);
48124
- nodeStatuses.push(status);
48125
- continue;
48217
+ if (!fs10.existsSync(workspace)) {
48218
+ if (applyCachedInlineMeshNodeStatus(status, node)) {
48219
+ status.launchReady = !!daemonId && (readStringValue(status.machineStatus) === "online" || isSelfNode);
48220
+ nodeStatuses.push(status);
48221
+ continue;
48222
+ }
48223
+ if (meshRecord?.source === "inline_cache" && !isSelfNode) {
48224
+ status.launchReady = !!daemonId && (readStringValue(status.machineStatus) === "online" || isSelfNode);
48225
+ nodeStatuses.push(status);
48226
+ continue;
48227
+ }
48126
48228
  }
48127
48229
  try {
48128
48230
  const gitStatus = await getGitRepoStatus(workspace, { timeoutMs: 1e4, refreshUpstream: true });
@@ -66999,7 +67101,7 @@ var init_adhdev_daemon = __esm({
66999
67101
  init_version();
67000
67102
  init_src();
67001
67103
  init_runtime_defaults();
67002
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.20" });
67104
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.22" });
67003
67105
  AdhdevDaemon = class _AdhdevDaemon {
67004
67106
  localHttpServer = null;
67005
67107
  localWss = null;
@@ -68533,7 +68635,7 @@ var require_yoctocolors_cjs = __commonJS({
68533
68635
  }
68534
68636
  });
68535
68637
 
68536
- // ../../node_modules/@inquirer/figures/dist/esm/index.mjs
68638
+ // ../../node_modules/@inquirer/figures/dist/esm/index.js
68537
68639
  function isUnicodeSupported() {
68538
68640
  if (import_node_process3.default.platform !== "win32") {
68539
68641
  return import_node_process3.default.env["TERM"] !== "linux";
@@ -68545,7 +68647,7 @@ function isUnicodeSupported() {
68545
68647
  }
68546
68648
  var import_node_process3, common2, specialMainSymbols, specialFallbackSymbols, mainSymbols, fallbackSymbols, shouldUseMain, figures, esm_default, replacements;
68547
68649
  var init_esm3 = __esm({
68548
- "../../node_modules/@inquirer/figures/dist/esm/index.mjs"() {
68650
+ "../../node_modules/@inquirer/figures/dist/esm/index.js"() {
68549
68651
  "use strict";
68550
68652
  import_node_process3 = __toESM(require("process"), 1);
68551
68653
  common2 = {
@@ -68816,7 +68918,10 @@ var init_esm3 = __esm({
68816
68918
  oneNinth: "1/9",
68817
68919
  oneTenth: "1/10"
68818
68920
  };
68819
- mainSymbols = { ...common2, ...specialMainSymbols };
68921
+ mainSymbols = {
68922
+ ...common2,
68923
+ ...specialMainSymbols
68924
+ };
68820
68925
  fallbackSymbols = {
68821
68926
  ...common2,
68822
68927
  ...specialFallbackSymbols