adhdev 0.9.82-rc.1 → 0.9.82-rc.3

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
@@ -45393,6 +45393,115 @@ function readProviderPriorityFromPolicy(policy) {
45393
45393
  return true;
45394
45394
  });
45395
45395
  }
45396
+ function readObjectRecord(value) {
45397
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
45398
+ }
45399
+ function readStringValue(...values) {
45400
+ for (const value of values) {
45401
+ if (typeof value === "string" && value.trim()) return value.trim();
45402
+ }
45403
+ return void 0;
45404
+ }
45405
+ function readNumberValue(...values) {
45406
+ for (const value of values) {
45407
+ if (typeof value === "number" && Number.isFinite(value)) return value;
45408
+ }
45409
+ return void 0;
45410
+ }
45411
+ function readBooleanValue(...values) {
45412
+ for (const value of values) {
45413
+ if (typeof value === "boolean") return value;
45414
+ }
45415
+ return void 0;
45416
+ }
45417
+ function buildCachedInlineMeshGitStatus(node) {
45418
+ const cachedStatus = readObjectRecord(node?.cachedStatus);
45419
+ const cachedGit = readObjectRecord(cachedStatus.git);
45420
+ if (Object.keys(cachedGit).length) {
45421
+ const conflictFiles2 = Array.isArray(cachedGit.conflictFiles) ? cachedGit.conflictFiles.filter((value) => typeof value === "string") : [];
45422
+ const conflictCount2 = readNumberValue(cachedGit.conflicts) ?? conflictFiles2.length;
45423
+ const hasConflicts2 = readBooleanValue(cachedGit.hasConflicts) ?? conflictCount2 > 0;
45424
+ const isGitRepo2 = readBooleanValue(cachedGit.isGitRepo);
45425
+ if (isGitRepo2 !== void 0) {
45426
+ return {
45427
+ workspace: readStringValue(cachedGit.workspace, node?.workspace) || "",
45428
+ repoRoot: readStringValue(cachedGit.repoRoot, node?.repoRoot, node?.workspace) || null,
45429
+ isGitRepo: isGitRepo2,
45430
+ branch: readStringValue(cachedGit.branch) ?? null,
45431
+ headCommit: readStringValue(cachedGit.headCommit) ?? null,
45432
+ headMessage: readStringValue(cachedGit.headMessage) ?? null,
45433
+ upstream: readStringValue(cachedGit.upstream) ?? null,
45434
+ ahead: readNumberValue(cachedGit.ahead) ?? 0,
45435
+ behind: readNumberValue(cachedGit.behind) ?? 0,
45436
+ staged: readNumberValue(cachedGit.staged) ?? 0,
45437
+ modified: readNumberValue(cachedGit.modified) ?? 0,
45438
+ untracked: readNumberValue(cachedGit.untracked) ?? 0,
45439
+ deleted: readNumberValue(cachedGit.deleted) ?? 0,
45440
+ renamed: readNumberValue(cachedGit.renamed) ?? 0,
45441
+ hasConflicts: hasConflicts2,
45442
+ conflictFiles: conflictFiles2,
45443
+ stashCount: readNumberValue(cachedGit.stashCount) ?? 0,
45444
+ lastCheckedAt: readNumberValue(cachedGit.lastCheckedAt) ?? Date.now()
45445
+ };
45446
+ }
45447
+ }
45448
+ const rawGit = readObjectRecord(node?.lastGit ?? node?.last_git);
45449
+ const gitResult = readObjectRecord(rawGit.result);
45450
+ const directStatus = readObjectRecord(rawGit.status);
45451
+ const nestedStatus = readObjectRecord(gitResult.status);
45452
+ const rawProbe = readObjectRecord(node?.lastProbe ?? node?.last_probe);
45453
+ const probeGit = readObjectRecord(rawProbe.git);
45454
+ const probeGitResult = readObjectRecord(probeGit.result);
45455
+ const probeDirectStatus = readObjectRecord(probeGit.status);
45456
+ const probeNestedStatus = readObjectRecord(probeGitResult.status);
45457
+ const status = Object.keys(directStatus).length ? directStatus : Object.keys(nestedStatus).length ? nestedStatus : Object.keys(probeDirectStatus).length ? probeDirectStatus : Object.keys(probeNestedStatus).length ? probeNestedStatus : {};
45458
+ const isGitRepo = readBooleanValue(status.isGitRepo);
45459
+ if (!Object.keys(status).length || isGitRepo === void 0) return void 0;
45460
+ const conflictFiles = Array.isArray(status.conflictFiles) ? status.conflictFiles.filter((value) => typeof value === "string") : [];
45461
+ const conflictCount = readNumberValue(status.conflicts) ?? conflictFiles.length;
45462
+ const hasConflicts = readBooleanValue(status.hasConflicts) ?? conflictCount > 0;
45463
+ return {
45464
+ workspace: readStringValue(status.workspace, node?.workspace) || "",
45465
+ repoRoot: readStringValue(status.repoRoot, node?.repoRoot, node?.workspace) || null,
45466
+ isGitRepo,
45467
+ branch: readStringValue(status.branch) ?? null,
45468
+ headCommit: readStringValue(status.headCommit) ?? null,
45469
+ headMessage: readStringValue(status.headMessage) ?? null,
45470
+ upstream: readStringValue(status.upstream) ?? null,
45471
+ ahead: readNumberValue(status.ahead) ?? 0,
45472
+ behind: readNumberValue(status.behind) ?? 0,
45473
+ staged: readNumberValue(status.staged) ?? 0,
45474
+ modified: readNumberValue(status.modified) ?? 0,
45475
+ untracked: readNumberValue(status.untracked) ?? 0,
45476
+ deleted: readNumberValue(status.deleted) ?? 0,
45477
+ renamed: readNumberValue(status.renamed) ?? 0,
45478
+ hasConflicts,
45479
+ conflictFiles,
45480
+ stashCount: readNumberValue(status.stashCount) ?? 0,
45481
+ lastCheckedAt: Date.now()
45482
+ };
45483
+ }
45484
+ function applyCachedInlineMeshNodeStatus(status, node) {
45485
+ const cachedStatus = readObjectRecord(node?.cachedStatus);
45486
+ const git = buildCachedInlineMeshGitStatus(node);
45487
+ const error48 = readStringValue(cachedStatus.error, node?.error);
45488
+ const health = readStringValue(cachedStatus.health, node?.health);
45489
+ const machineStatus = readStringValue(cachedStatus.machineStatus, node?.machineStatus);
45490
+ if (!git && !error48 && !health) return false;
45491
+ if (!machineStatus && !git && !error48) return false;
45492
+ if (git) status.git = git;
45493
+ if (error48) status.error = error48;
45494
+ if (health) {
45495
+ status.health = health;
45496
+ return true;
45497
+ }
45498
+ if (git) {
45499
+ const dirty = Number(git.staged || 0) + Number(git.modified || 0) + Number(git.untracked || 0) + Number(git.deleted || 0) + Number(git.renamed || 0) > 0;
45500
+ status.health = git.isGitRepo === false ? "degraded" : dirty ? "dirty" : "online";
45501
+ return true;
45502
+ }
45503
+ return false;
45504
+ }
45396
45505
  async function resolveProviderTypeFromPriority(args) {
45397
45506
  if (!args.providerPriority.length) {
45398
45507
  return { error: `Node '${args.nodeId}' has no providerPriority policy; pass cliType explicitly or configure node.policy.providerPriority` };
@@ -45830,7 +45939,12 @@ var init_router = __esm({
45830
45939
  }
45831
45940
  return this.inlineMeshCache.get(meshId);
45832
45941
  }
45833
- async getMeshForCommand(meshId, inlineMesh) {
45942
+ async getMeshForCommand(meshId, inlineMesh, options) {
45943
+ const preferInline = options?.preferInline === true;
45944
+ if (preferInline) {
45945
+ const cached3 = this.getCachedInlineMesh(meshId, inlineMesh);
45946
+ if (cached3) return { mesh: cached3, inline: true };
45947
+ }
45834
45948
  try {
45835
45949
  const { getMesh: getMesh3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
45836
45950
  const mesh = getMesh3(meshId);
@@ -47653,7 +47767,7 @@ ${block}`);
47653
47767
  const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
47654
47768
  if (!meshId) return { success: false, error: "meshId required" };
47655
47769
  try {
47656
- const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh);
47770
+ const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
47657
47771
  const mesh = meshRecord?.mesh;
47658
47772
  if (!mesh) return { success: false, error: "Mesh not found" };
47659
47773
  const { getMeshQueueStats: getMeshQueueStats2, getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
@@ -47678,6 +47792,10 @@ ${block}`);
47678
47792
  activeSessions: []
47679
47793
  };
47680
47794
  if (node.workspace && typeof node.workspace === "string") {
47795
+ if (!fs10.existsSync(node.workspace) && applyCachedInlineMeshNodeStatus(status, node)) {
47796
+ nodeStatuses.push(status);
47797
+ continue;
47798
+ }
47681
47799
  try {
47682
47800
  const { execFile: execFile3 } = await import("child_process");
47683
47801
  const { promisify: promisify3 } = await import("util");
@@ -47737,8 +47855,12 @@ ${block}`);
47737
47855
  };
47738
47856
  status.health = branch ? dirty ? "dirty" : "online" : "degraded";
47739
47857
  } catch {
47740
- status.health = "degraded";
47858
+ if (!applyCachedInlineMeshNodeStatus(status, node)) {
47859
+ status.health = "degraded";
47860
+ }
47741
47861
  }
47862
+ } else {
47863
+ applyCachedInlineMeshNodeStatus(status, node);
47742
47864
  }
47743
47865
  nodeStatuses.push(status);
47744
47866
  }
@@ -66522,7 +66644,7 @@ var init_adhdev_daemon = __esm({
66522
66644
  init_version();
66523
66645
  init_src();
66524
66646
  init_runtime_defaults();
66525
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.1" });
66647
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.3" });
66526
66648
  AdhdevDaemon = class _AdhdevDaemon {
66527
66649
  localHttpServer = null;
66528
66650
  localWss = null;