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/cli/index.js CHANGED
@@ -46381,6 +46381,115 @@ function readProviderPriorityFromPolicy(policy) {
46381
46381
  return true;
46382
46382
  });
46383
46383
  }
46384
+ function readObjectRecord(value) {
46385
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
46386
+ }
46387
+ function readStringValue(...values) {
46388
+ for (const value of values) {
46389
+ if (typeof value === "string" && value.trim()) return value.trim();
46390
+ }
46391
+ return void 0;
46392
+ }
46393
+ function readNumberValue(...values) {
46394
+ for (const value of values) {
46395
+ if (typeof value === "number" && Number.isFinite(value)) return value;
46396
+ }
46397
+ return void 0;
46398
+ }
46399
+ function readBooleanValue(...values) {
46400
+ for (const value of values) {
46401
+ if (typeof value === "boolean") return value;
46402
+ }
46403
+ return void 0;
46404
+ }
46405
+ function buildCachedInlineMeshGitStatus(node) {
46406
+ const cachedStatus = readObjectRecord(node?.cachedStatus);
46407
+ const cachedGit = readObjectRecord(cachedStatus.git);
46408
+ if (Object.keys(cachedGit).length) {
46409
+ const conflictFiles2 = Array.isArray(cachedGit.conflictFiles) ? cachedGit.conflictFiles.filter((value) => typeof value === "string") : [];
46410
+ const conflictCount2 = readNumberValue(cachedGit.conflicts) ?? conflictFiles2.length;
46411
+ const hasConflicts2 = readBooleanValue(cachedGit.hasConflicts) ?? conflictCount2 > 0;
46412
+ const isGitRepo2 = readBooleanValue(cachedGit.isGitRepo);
46413
+ if (isGitRepo2 !== void 0) {
46414
+ return {
46415
+ workspace: readStringValue(cachedGit.workspace, node?.workspace) || "",
46416
+ repoRoot: readStringValue(cachedGit.repoRoot, node?.repoRoot, node?.workspace) || null,
46417
+ isGitRepo: isGitRepo2,
46418
+ branch: readStringValue(cachedGit.branch) ?? null,
46419
+ headCommit: readStringValue(cachedGit.headCommit) ?? null,
46420
+ headMessage: readStringValue(cachedGit.headMessage) ?? null,
46421
+ upstream: readStringValue(cachedGit.upstream) ?? null,
46422
+ ahead: readNumberValue(cachedGit.ahead) ?? 0,
46423
+ behind: readNumberValue(cachedGit.behind) ?? 0,
46424
+ staged: readNumberValue(cachedGit.staged) ?? 0,
46425
+ modified: readNumberValue(cachedGit.modified) ?? 0,
46426
+ untracked: readNumberValue(cachedGit.untracked) ?? 0,
46427
+ deleted: readNumberValue(cachedGit.deleted) ?? 0,
46428
+ renamed: readNumberValue(cachedGit.renamed) ?? 0,
46429
+ hasConflicts: hasConflicts2,
46430
+ conflictFiles: conflictFiles2,
46431
+ stashCount: readNumberValue(cachedGit.stashCount) ?? 0,
46432
+ lastCheckedAt: readNumberValue(cachedGit.lastCheckedAt) ?? Date.now()
46433
+ };
46434
+ }
46435
+ }
46436
+ const rawGit = readObjectRecord(node?.lastGit ?? node?.last_git);
46437
+ const gitResult = readObjectRecord(rawGit.result);
46438
+ const directStatus = readObjectRecord(rawGit.status);
46439
+ const nestedStatus = readObjectRecord(gitResult.status);
46440
+ const rawProbe = readObjectRecord(node?.lastProbe ?? node?.last_probe);
46441
+ const probeGit = readObjectRecord(rawProbe.git);
46442
+ const probeGitResult = readObjectRecord(probeGit.result);
46443
+ const probeDirectStatus = readObjectRecord(probeGit.status);
46444
+ const probeNestedStatus = readObjectRecord(probeGitResult.status);
46445
+ const status = Object.keys(directStatus).length ? directStatus : Object.keys(nestedStatus).length ? nestedStatus : Object.keys(probeDirectStatus).length ? probeDirectStatus : Object.keys(probeNestedStatus).length ? probeNestedStatus : {};
46446
+ const isGitRepo = readBooleanValue(status.isGitRepo);
46447
+ if (!Object.keys(status).length || isGitRepo === void 0) return void 0;
46448
+ const conflictFiles = Array.isArray(status.conflictFiles) ? status.conflictFiles.filter((value) => typeof value === "string") : [];
46449
+ const conflictCount = readNumberValue(status.conflicts) ?? conflictFiles.length;
46450
+ const hasConflicts = readBooleanValue(status.hasConflicts) ?? conflictCount > 0;
46451
+ return {
46452
+ workspace: readStringValue(status.workspace, node?.workspace) || "",
46453
+ repoRoot: readStringValue(status.repoRoot, node?.repoRoot, node?.workspace) || null,
46454
+ isGitRepo,
46455
+ branch: readStringValue(status.branch) ?? null,
46456
+ headCommit: readStringValue(status.headCommit) ?? null,
46457
+ headMessage: readStringValue(status.headMessage) ?? null,
46458
+ upstream: readStringValue(status.upstream) ?? null,
46459
+ ahead: readNumberValue(status.ahead) ?? 0,
46460
+ behind: readNumberValue(status.behind) ?? 0,
46461
+ staged: readNumberValue(status.staged) ?? 0,
46462
+ modified: readNumberValue(status.modified) ?? 0,
46463
+ untracked: readNumberValue(status.untracked) ?? 0,
46464
+ deleted: readNumberValue(status.deleted) ?? 0,
46465
+ renamed: readNumberValue(status.renamed) ?? 0,
46466
+ hasConflicts,
46467
+ conflictFiles,
46468
+ stashCount: readNumberValue(status.stashCount) ?? 0,
46469
+ lastCheckedAt: Date.now()
46470
+ };
46471
+ }
46472
+ function applyCachedInlineMeshNodeStatus(status, node) {
46473
+ const cachedStatus = readObjectRecord(node?.cachedStatus);
46474
+ const git = buildCachedInlineMeshGitStatus(node);
46475
+ const error48 = readStringValue(cachedStatus.error, node?.error);
46476
+ const health = readStringValue(cachedStatus.health, node?.health);
46477
+ const machineStatus = readStringValue(cachedStatus.machineStatus, node?.machineStatus);
46478
+ if (!git && !error48 && !health) return false;
46479
+ if (!machineStatus && !git && !error48) return false;
46480
+ if (git) status.git = git;
46481
+ if (error48) status.error = error48;
46482
+ if (health) {
46483
+ status.health = health;
46484
+ return true;
46485
+ }
46486
+ if (git) {
46487
+ const dirty = Number(git.staged || 0) + Number(git.modified || 0) + Number(git.untracked || 0) + Number(git.deleted || 0) + Number(git.renamed || 0) > 0;
46488
+ status.health = git.isGitRepo === false ? "degraded" : dirty ? "dirty" : "online";
46489
+ return true;
46490
+ }
46491
+ return false;
46492
+ }
46384
46493
  async function resolveProviderTypeFromPriority(args) {
46385
46494
  if (!args.providerPriority.length) {
46386
46495
  return { error: `Node '${args.nodeId}' has no providerPriority policy; pass cliType explicitly or configure node.policy.providerPriority` };
@@ -46818,7 +46927,12 @@ var init_router = __esm({
46818
46927
  }
46819
46928
  return this.inlineMeshCache.get(meshId);
46820
46929
  }
46821
- async getMeshForCommand(meshId, inlineMesh) {
46930
+ async getMeshForCommand(meshId, inlineMesh, options) {
46931
+ const preferInline = options?.preferInline === true;
46932
+ if (preferInline) {
46933
+ const cached3 = this.getCachedInlineMesh(meshId, inlineMesh);
46934
+ if (cached3) return { mesh: cached3, inline: true };
46935
+ }
46822
46936
  try {
46823
46937
  const { getMesh: getMesh3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
46824
46938
  const mesh = getMesh3(meshId);
@@ -48641,7 +48755,7 @@ ${block}`);
48641
48755
  const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
48642
48756
  if (!meshId) return { success: false, error: "meshId required" };
48643
48757
  try {
48644
- const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh);
48758
+ const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
48645
48759
  const mesh = meshRecord?.mesh;
48646
48760
  if (!mesh) return { success: false, error: "Mesh not found" };
48647
48761
  const { getMeshQueueStats: getMeshQueueStats2, getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
@@ -48666,6 +48780,10 @@ ${block}`);
48666
48780
  activeSessions: []
48667
48781
  };
48668
48782
  if (node.workspace && typeof node.workspace === "string") {
48783
+ if (!fs10.existsSync(node.workspace) && applyCachedInlineMeshNodeStatus(status, node)) {
48784
+ nodeStatuses.push(status);
48785
+ continue;
48786
+ }
48669
48787
  try {
48670
48788
  const { execFile: execFile3 } = await import("child_process");
48671
48789
  const { promisify: promisify3 } = await import("util");
@@ -48725,8 +48843,12 @@ ${block}`);
48725
48843
  };
48726
48844
  status.health = branch ? dirty ? "dirty" : "online" : "degraded";
48727
48845
  } catch {
48728
- status.health = "degraded";
48846
+ if (!applyCachedInlineMeshNodeStatus(status, node)) {
48847
+ status.health = "degraded";
48848
+ }
48729
48849
  }
48850
+ } else {
48851
+ applyCachedInlineMeshNodeStatus(status, node);
48730
48852
  }
48731
48853
  nodeStatuses.push(status);
48732
48854
  }
@@ -97695,7 +97817,7 @@ var init_adhdev_daemon = __esm({
97695
97817
  init_version();
97696
97818
  init_src();
97697
97819
  init_runtime_defaults();
97698
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.1" });
97820
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.3" });
97699
97821
  AdhdevDaemon = class _AdhdevDaemon {
97700
97822
  localHttpServer = null;
97701
97823
  localWss = null;