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/cli/index.js CHANGED
@@ -46570,6 +46570,96 @@ function buildCachedInlineMeshGitStatus(node) {
46570
46570
  ...submodules ? { submodules } : {}
46571
46571
  };
46572
46572
  }
46573
+ function shouldDiscardCachedInlineMeshStatus(node) {
46574
+ const cachedStatus = readObjectRecord(node?.cachedStatus);
46575
+ if (!Object.keys(cachedStatus).length) return false;
46576
+ const cachedGit = readObjectRecord(cachedStatus.git);
46577
+ const workspaceError = readStringValue(cachedStatus.error, node?.error);
46578
+ if (workspaceError && /workspace must be an existing directory/i.test(workspaceError)) return true;
46579
+ const isGitRepo = readBooleanValue(cachedGit.isGitRepo);
46580
+ const branch = readStringValue(cachedGit.branch);
46581
+ const headCommit = readStringValue(cachedGit.headCommit);
46582
+ return isGitRepo === false && !branch && !headCommit;
46583
+ }
46584
+ function stripInlineMeshTransientNodeState(node) {
46585
+ if (!node || typeof node !== "object" || Array.isArray(node)) return node;
46586
+ const {
46587
+ cachedStatus,
46588
+ lastGit: _lastGit,
46589
+ last_git: _lastGitLegacy,
46590
+ lastProbe: _lastProbe,
46591
+ last_probe: _lastProbeLegacy,
46592
+ error: _error,
46593
+ health: _health,
46594
+ machineStatus: _machineStatus,
46595
+ lastSeenAt: _lastSeenAt,
46596
+ last_seen_at: _lastSeenAtLegacy,
46597
+ updatedAt: _updatedAt,
46598
+ updated_at: _updatedAtLegacy,
46599
+ activeSession: _activeSession,
46600
+ active_session: _activeSessionLegacy,
46601
+ activeSessionId: _activeSessionId,
46602
+ active_session_id: _activeSessionIdLegacy,
46603
+ sessionId: _sessionId,
46604
+ session_id: _sessionIdLegacy,
46605
+ providerType: _providerType,
46606
+ provider_type: _providerTypeLegacy,
46607
+ providers: _providers,
46608
+ ...rest
46609
+ } = node;
46610
+ if (cachedStatus && !shouldDiscardCachedInlineMeshStatus(node)) {
46611
+ return { ...rest, cachedStatus };
46612
+ }
46613
+ return rest;
46614
+ }
46615
+ function hasInlineMeshTransientNodeState(node) {
46616
+ if (!node || typeof node !== "object" || Array.isArray(node)) return false;
46617
+ 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;
46618
+ }
46619
+ function readInlineMeshNodeId(node) {
46620
+ return readStringValue(node?.id, node?.nodeId) || "";
46621
+ }
46622
+ function sanitizeInlineMesh(inlineMesh) {
46623
+ if (!inlineMesh || typeof inlineMesh !== "object" || Array.isArray(inlineMesh)) return inlineMesh;
46624
+ if (!Array.isArray(inlineMesh.nodes)) return inlineMesh;
46625
+ let changed = false;
46626
+ const nodes = inlineMesh.nodes.map((node) => {
46627
+ if (!hasInlineMeshTransientNodeState(node)) return node;
46628
+ changed = true;
46629
+ return stripInlineMeshTransientNodeState(node);
46630
+ });
46631
+ if (!changed) return inlineMesh;
46632
+ return {
46633
+ ...inlineMesh,
46634
+ nodes
46635
+ };
46636
+ }
46637
+ function reconcileInlineMeshCache(cached2, incoming) {
46638
+ if (!cached2 || typeof cached2 !== "object" || Array.isArray(cached2)) return incoming;
46639
+ if (!incoming || typeof incoming !== "object" || Array.isArray(incoming)) return cached2;
46640
+ const cachedNodes = Array.isArray(cached2.nodes) ? cached2.nodes : [];
46641
+ const incomingNodes = Array.isArray(incoming.nodes) ? incoming.nodes : [];
46642
+ if (!cachedNodes.length || !incomingNodes.length) return { ...cached2, ...incoming };
46643
+ const incomingById = /* @__PURE__ */ new Map();
46644
+ for (const node of incomingNodes) {
46645
+ const nodeId = readInlineMeshNodeId(node);
46646
+ if (nodeId) incomingById.set(nodeId, node);
46647
+ }
46648
+ const nodes = cachedNodes.map((cachedNode) => {
46649
+ const nodeId = readInlineMeshNodeId(cachedNode);
46650
+ const incomingNode = nodeId ? incomingById.get(nodeId) : void 0;
46651
+ if (!incomingNode) return cachedNode;
46652
+ if (hasInlineMeshTransientNodeState(incomingNode)) {
46653
+ return { ...cachedNode, ...incomingNode };
46654
+ }
46655
+ return { ...stripInlineMeshTransientNodeState(cachedNode), ...incomingNode };
46656
+ });
46657
+ return {
46658
+ ...cached2,
46659
+ ...incoming,
46660
+ nodes
46661
+ };
46662
+ }
46573
46663
  function hasGitWorktreeChanges(git) {
46574
46664
  if (!git) return false;
46575
46665
  return Number(git.staged || 0) + Number(git.modified || 0) + Number(git.untracked || 0) + Number(git.deleted || 0) + Number(git.renamed || 0) > 0;
@@ -47161,10 +47251,15 @@ var init_router = __esm({
47161
47251
  }
47162
47252
  warmInlineMeshCache(meshId, inlineMesh) {
47163
47253
  if (!inlineMesh || typeof inlineMesh !== "object") return void 0;
47254
+ const sanitizedInlineMesh = sanitizeInlineMesh(inlineMesh);
47164
47255
  const cached2 = this.inlineMeshCache.get(meshId);
47165
- if (cached2) return cached2;
47166
- this.inlineMeshCache.set(meshId, inlineMesh);
47167
- return inlineMesh;
47256
+ if (cached2) {
47257
+ const merged = reconcileInlineMeshCache(cached2, sanitizedInlineMesh);
47258
+ this.inlineMeshCache.set(meshId, merged);
47259
+ return merged;
47260
+ }
47261
+ this.inlineMeshCache.set(meshId, sanitizedInlineMesh);
47262
+ return sanitizedInlineMesh;
47168
47263
  }
47169
47264
  async getMeshForCommand(meshId, inlineMesh, options) {
47170
47265
  const preferInline = options?.preferInline === true;
@@ -49107,10 +49202,17 @@ ${block}`);
49107
49202
  }
49108
49203
  }
49109
49204
  if (workspace) {
49110
- if (!fs10.existsSync(workspace) && applyCachedInlineMeshNodeStatus(status, node)) {
49111
- status.launchReady = !!daemonId && (readStringValue(status.machineStatus) === "online" || isSelfNode);
49112
- nodeStatuses.push(status);
49113
- continue;
49205
+ if (!fs10.existsSync(workspace)) {
49206
+ if (applyCachedInlineMeshNodeStatus(status, node)) {
49207
+ status.launchReady = !!daemonId && (readStringValue(status.machineStatus) === "online" || isSelfNode);
49208
+ nodeStatuses.push(status);
49209
+ continue;
49210
+ }
49211
+ if (meshRecord?.source === "inline_cache" && !isSelfNode) {
49212
+ status.launchReady = !!daemonId && (readStringValue(status.machineStatus) === "online" || isSelfNode);
49213
+ nodeStatuses.push(status);
49214
+ continue;
49215
+ }
49114
49216
  }
49115
49217
  try {
49116
49218
  const gitStatus = await getGitRepoStatus(workspace, { timeoutMs: 1e4, refreshUpstream: true });
@@ -57981,7 +58083,7 @@ var require_yoctocolors_cjs = __commonJS({
57981
58083
  }
57982
58084
  });
57983
58085
 
57984
- // ../../node_modules/@inquirer/figures/dist/esm/index.mjs
58086
+ // ../../node_modules/@inquirer/figures/dist/esm/index.js
57985
58087
  function isUnicodeSupported() {
57986
58088
  if (import_node_process3.default.platform !== "win32") {
57987
58089
  return import_node_process3.default.env["TERM"] !== "linux";
@@ -57993,7 +58095,7 @@ function isUnicodeSupported() {
57993
58095
  }
57994
58096
  var import_node_process3, common2, specialMainSymbols, specialFallbackSymbols, mainSymbols, fallbackSymbols, shouldUseMain, figures, esm_default, replacements;
57995
58097
  var init_esm3 = __esm({
57996
- "../../node_modules/@inquirer/figures/dist/esm/index.mjs"() {
58098
+ "../../node_modules/@inquirer/figures/dist/esm/index.js"() {
57997
58099
  "use strict";
57998
58100
  import_node_process3 = __toESM(require("process"), 1);
57999
58101
  common2 = {
@@ -58264,7 +58366,10 @@ var init_esm3 = __esm({
58264
58366
  oneNinth: "1/9",
58265
58367
  oneTenth: "1/10"
58266
58368
  };
58267
- mainSymbols = { ...common2, ...specialMainSymbols };
58369
+ mainSymbols = {
58370
+ ...common2,
58371
+ ...specialMainSymbols
58372
+ };
58268
58373
  fallbackSymbols = {
58269
58374
  ...common2,
58270
58375
  ...specialFallbackSymbols
@@ -98169,7 +98274,7 @@ var init_adhdev_daemon = __esm({
98169
98274
  init_version();
98170
98275
  init_src();
98171
98276
  init_runtime_defaults();
98172
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.20" });
98277
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.22" });
98173
98278
  AdhdevDaemon = class _AdhdevDaemon {
98174
98279
  localHttpServer = null;
98175
98280
  localWss = null;