adhdev 0.9.82-rc.42 → 0.9.82-rc.44

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
@@ -46638,6 +46638,70 @@ function readBooleanValue(...values) {
46638
46638
  }
46639
46639
  return void 0;
46640
46640
  }
46641
+ function summarizeRepoMeshDebugGit(git) {
46642
+ const record2 = readObjectRecord(git);
46643
+ if (!Object.keys(record2).length) return null;
46644
+ const submodules = Array.isArray(record2.submodules) ? record2.submodules.map((entry) => ({
46645
+ path: readStringValue(entry?.path) ?? null,
46646
+ commit: readStringValue(entry?.commit)?.slice(0, 12) ?? null,
46647
+ dirty: readBooleanValue(entry?.dirty) ?? false,
46648
+ outOfSync: readBooleanValue(entry?.outOfSync, entry?.out_of_sync) ?? false
46649
+ })) : [];
46650
+ return {
46651
+ isGitRepo: readBooleanValue(record2.isGitRepo),
46652
+ workspace: readStringValue(record2.workspace) ?? null,
46653
+ repoRoot: readStringValue(record2.repoRoot, record2.repo_root) ?? null,
46654
+ branch: readStringValue(record2.branch) ?? null,
46655
+ upstream: readStringValue(record2.upstream) ?? null,
46656
+ upstreamStatus: readStringValue(record2.upstreamStatus, record2.upstream_status) ?? null,
46657
+ headCommit: readStringValue(record2.headCommit, record2.head_commit)?.slice(0, 12) ?? null,
46658
+ ahead: readNumberValue(record2.ahead) ?? null,
46659
+ behind: readNumberValue(record2.behind) ?? null,
46660
+ dirtyCounts: {
46661
+ staged: readNumberValue(record2.staged) ?? 0,
46662
+ modified: readNumberValue(record2.modified) ?? 0,
46663
+ untracked: readNumberValue(record2.untracked) ?? 0,
46664
+ deleted: readNumberValue(record2.deleted) ?? 0,
46665
+ renamed: readNumberValue(record2.renamed) ?? 0
46666
+ },
46667
+ lastCheckedAt: readNumberValue(record2.lastCheckedAt, record2.last_checked_at) ?? null,
46668
+ submoduleCount: submodules.length,
46669
+ submodules
46670
+ };
46671
+ }
46672
+ function summarizeRepoMeshStatusDebug(status) {
46673
+ const nodes = Array.isArray(status?.nodes) ? status.nodes : [];
46674
+ return {
46675
+ success: status?.success,
46676
+ meshId: readStringValue(status?.meshId, status?.mesh_id) ?? null,
46677
+ refreshedAt: readStringValue(status?.refreshedAt, status?.refreshed_at) ?? null,
46678
+ sourceOfTruth: status?.sourceOfTruth ?? null,
46679
+ nodeCount: nodes.length,
46680
+ nodes: nodes.map((node) => ({
46681
+ nodeId: readStringValue(node?.nodeId, node?.id) ?? null,
46682
+ daemonId: readStringValue(node?.daemonId, node?.daemon_id) ?? null,
46683
+ workspace: readStringValue(node?.workspace, node?.git?.workspace) ?? null,
46684
+ health: readStringValue(node?.health) ?? null,
46685
+ machineStatus: readStringValue(node?.machineStatus, node?.machine_status) ?? null,
46686
+ connection: node?.connection && typeof node.connection === "object" ? {
46687
+ state: readStringValue(node.connection.state) ?? null,
46688
+ transport: readStringValue(node.connection.transport) ?? null,
46689
+ source: readStringValue(node.connection.source) ?? null,
46690
+ reported: readBooleanValue(node.connection.reported) ?? null
46691
+ } : null,
46692
+ gitProbePending: node?.gitProbePending === true,
46693
+ launchReady: node?.launchReady === true,
46694
+ git: summarizeRepoMeshDebugGit(node?.git)
46695
+ }))
46696
+ };
46697
+ }
46698
+ function logRepoMeshStatusDebug(event, fields) {
46699
+ try {
46700
+ LOG.info("MeshStatusDebug", `[RepoMeshStatusDebug] ${JSON.stringify({ event, ...fields })}`);
46701
+ } catch {
46702
+ LOG.info("MeshStatusDebug", `[RepoMeshStatusDebug] ${event}`);
46703
+ }
46704
+ }
46641
46705
  function joinRepoPath(root, relativePath) {
46642
46706
  const normalizedRoot = typeof root === "string" ? root.trim().replace(/[\\/]+$/, "") : "";
46643
46707
  const normalizedPath = typeof relativePath === "string" ? relativePath.trim() : "";
@@ -49657,7 +49721,15 @@ ${block}`);
49657
49721
  const refreshRequested = args?.refresh === true || args?.forceRefresh === true;
49658
49722
  if (!refreshRequested) {
49659
49723
  const cachedStatus = this.getCachedAggregateMeshStatus(meshId);
49660
- if (cachedStatus) return cachedStatus;
49724
+ if (cachedStatus) {
49725
+ logRepoMeshStatusDebug("return_cached", {
49726
+ meshId,
49727
+ command: "mesh_status",
49728
+ refreshRequested,
49729
+ summary: summarizeRepoMeshStatusDebug(cachedStatus)
49730
+ });
49731
+ return cachedStatus;
49732
+ }
49661
49733
  }
49662
49734
  const refreshReason = refreshRequested ? "explicit_refresh" : "cold_cache_miss";
49663
49735
  const { getMeshQueueStats: getMeshQueueStats2, getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
@@ -49685,7 +49757,7 @@ ${block}`);
49685
49757
  };
49686
49758
  const directTruthSatisfied = meshRecord.source !== "inline_bootstrap" || directTruth.directEvidenceCount > 0;
49687
49759
  if (requireDirectPeerTruth && !directTruthSatisfied) {
49688
- return {
49760
+ const failureResult = {
49689
49761
  success: false,
49690
49762
  code: "mesh_direct_peer_truth_unavailable",
49691
49763
  error: "Selected coordinator could not confirm direct mesh truth yet. Bootstrap inventory stays unavailable until direct mesh_status probes succeed.",
@@ -49704,6 +49776,14 @@ ${block}`);
49704
49776
  }
49705
49777
  }
49706
49778
  };
49779
+ logRepoMeshStatusDebug("direct_truth_unavailable", {
49780
+ meshId,
49781
+ command: "mesh_status",
49782
+ refreshRequested,
49783
+ meshSource: meshRecord.source,
49784
+ directTruth
49785
+ });
49786
+ return failureResult;
49707
49787
  }
49708
49788
  const directTruthUnavailableNodeIds = new Set(directTruth.unavailableNodeIds);
49709
49789
  const selectedCoordinatorNodeId = readStringValue(
@@ -49911,7 +49991,17 @@ ${block}`);
49911
49991
  queue: { tasks: queue, summary: queueSummary },
49912
49992
  ledger: { entries: ledgerEntries, summary: ledgerSummary }
49913
49993
  };
49914
- return this.rememberAggregateMeshStatus(meshId, statusResult, refreshReason);
49994
+ const rememberedStatus = this.rememberAggregateMeshStatus(meshId, statusResult, refreshReason);
49995
+ logRepoMeshStatusDebug("return_live", {
49996
+ meshId,
49997
+ command: "mesh_status",
49998
+ refreshRequested,
49999
+ refreshReason,
50000
+ meshSource: meshRecord.source,
50001
+ directTruth,
50002
+ summary: summarizeRepoMeshStatusDebug(rememberedStatus)
50003
+ });
50004
+ return rememberedStatus;
49915
50005
  } catch (e) {
49916
50006
  return { success: false, error: e.message };
49917
50007
  }
@@ -58745,7 +58835,7 @@ var require_yoctocolors_cjs = __commonJS({
58745
58835
  }
58746
58836
  });
58747
58837
 
58748
- // ../../node_modules/@inquirer/figures/dist/esm/index.js
58838
+ // ../../node_modules/@inquirer/figures/dist/esm/index.mjs
58749
58839
  function isUnicodeSupported() {
58750
58840
  if (import_node_process3.default.platform !== "win32") {
58751
58841
  return import_node_process3.default.env["TERM"] !== "linux";
@@ -58757,7 +58847,7 @@ function isUnicodeSupported() {
58757
58847
  }
58758
58848
  var import_node_process3, common2, specialMainSymbols, specialFallbackSymbols, mainSymbols, fallbackSymbols, shouldUseMain, figures, esm_default, replacements;
58759
58849
  var init_esm3 = __esm({
58760
- "../../node_modules/@inquirer/figures/dist/esm/index.js"() {
58850
+ "../../node_modules/@inquirer/figures/dist/esm/index.mjs"() {
58761
58851
  "use strict";
58762
58852
  import_node_process3 = __toESM(require("process"), 1);
58763
58853
  common2 = {
@@ -59028,10 +59118,7 @@ var init_esm3 = __esm({
59028
59118
  oneNinth: "1/9",
59029
59119
  oneTenth: "1/10"
59030
59120
  };
59031
- mainSymbols = {
59032
- ...common2,
59033
- ...specialMainSymbols
59034
- };
59121
+ mainSymbols = { ...common2, ...specialMainSymbols };
59035
59122
  fallbackSymbols = {
59036
59123
  ...common2,
59037
59124
  ...specialFallbackSymbols
@@ -98243,6 +98330,84 @@ var daemon_mesh_manager_exports = {};
98243
98330
  __export(daemon_mesh_manager_exports, {
98244
98331
  DaemonMeshManager: () => DaemonMeshManager
98245
98332
  });
98333
+ function asRecord(value) {
98334
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
98335
+ }
98336
+ function summarizeMeshCommandArgs(command, args) {
98337
+ if (command === "git_status") {
98338
+ return {
98339
+ workspace: typeof args.workspace === "string" ? args.workspace : null,
98340
+ refreshUpstream: args.refreshUpstream === true,
98341
+ includeSubmodules: args.includeSubmodules === true
98342
+ };
98343
+ }
98344
+ if (command === "mesh_status" || command === "get_mesh") {
98345
+ const inlineMesh = asRecord(args.inlineMesh);
98346
+ const inlineNodes = Array.isArray(inlineMesh.nodes) ? inlineMesh.nodes : [];
98347
+ return {
98348
+ meshId: typeof args.meshId === "string" ? args.meshId : null,
98349
+ requireDirectPeerTruth: args.requireDirectPeerTruth === true,
98350
+ refresh: args.refresh === true,
98351
+ inlineMeshNodes: inlineNodes.length
98352
+ };
98353
+ }
98354
+ return { keys: Object.keys(args).sort() };
98355
+ }
98356
+ function summarizeMeshCommandGitResult(result) {
98357
+ const envelope = asRecord(result);
98358
+ const nestedResult = asRecord(envelope.result);
98359
+ const status = Object.keys(asRecord(envelope.status)).length ? asRecord(envelope.status) : Object.keys(asRecord(nestedResult.status)).length ? asRecord(nestedResult.status) : Object.keys(envelope).length ? envelope : {};
98360
+ if (!Object.keys(status).length) return null;
98361
+ const submodules = Array.isArray(status.submodules) ? status.submodules.map((entry) => ({
98362
+ path: typeof entry?.path === "string" ? entry.path : null,
98363
+ commit: typeof entry?.commit === "string" ? entry.commit.slice(0, 12) : null,
98364
+ dirty: entry?.dirty === true,
98365
+ outOfSync: entry?.outOfSync === true
98366
+ })) : [];
98367
+ return {
98368
+ workspace: typeof status.workspace === "string" ? status.workspace : null,
98369
+ repoRoot: typeof status.repoRoot === "string" ? status.repoRoot : null,
98370
+ isGitRepo: status.isGitRepo,
98371
+ branch: status.branch ?? null,
98372
+ upstream: status.upstream ?? null,
98373
+ upstreamStatus: status.upstreamStatus ?? null,
98374
+ headCommit: typeof status.headCommit === "string" ? status.headCommit.slice(0, 12) : status.headCommit ?? null,
98375
+ ahead: status.ahead ?? null,
98376
+ behind: status.behind ?? null,
98377
+ dirtyCounts: {
98378
+ staged: status.staged ?? 0,
98379
+ modified: status.modified ?? 0,
98380
+ untracked: status.untracked ?? 0,
98381
+ deleted: status.deleted ?? 0,
98382
+ renamed: status.renamed ?? 0
98383
+ },
98384
+ lastCheckedAt: status.lastCheckedAt ?? null,
98385
+ submoduleCount: submodules.length,
98386
+ submodules
98387
+ };
98388
+ }
98389
+ function summarizeMeshCommandResult(command, result) {
98390
+ if (command === "git_status") return summarizeMeshCommandGitResult(result);
98391
+ const record2 = asRecord(result);
98392
+ if (command === "mesh_status") {
98393
+ const nodes = Array.isArray(record2.nodes) ? record2.nodes : [];
98394
+ return {
98395
+ success: record2.success,
98396
+ meshId: record2.meshId ?? null,
98397
+ sourceOfTruth: record2.sourceOfTruth ?? null,
98398
+ nodeCount: nodes.length,
98399
+ nodes: nodes.map((node) => ({
98400
+ nodeId: node?.nodeId ?? node?.id ?? null,
98401
+ daemonId: node?.daemonId ?? null,
98402
+ workspace: node?.workspace ?? node?.git?.workspace ?? null,
98403
+ health: node?.health ?? null,
98404
+ gitProbePending: node?.gitProbePending === true,
98405
+ git: summarizeMeshCommandGitResult({ status: node?.git })
98406
+ }))
98407
+ };
98408
+ }
98409
+ return null;
98410
+ }
98246
98411
  function interpolateArgs(args, context) {
98247
98412
  const result = {};
98248
98413
  for (const [k, v] of Object.entries(args)) {
@@ -98432,7 +98597,9 @@ var init_daemon_mesh_manager = __esm({
98432
98597
  targetDaemonId,
98433
98598
  sentAt: (/* @__PURE__ */ new Date()).toISOString(),
98434
98599
  peerState: peer.state,
98435
- success: !error48
98600
+ success: !error48,
98601
+ resultSummary: !error48 ? summarizeMeshCommandGitResult(result) : null,
98602
+ error: error48
98436
98603
  });
98437
98604
  } catch (err) {
98438
98605
  LOG.warn("Mesh", `[Mesh] Failed to send command result: ${err.message}`);
@@ -98526,7 +98693,8 @@ var init_daemon_mesh_manager = __esm({
98526
98693
  queuedAt,
98527
98694
  sentAt,
98528
98695
  peerState: peer.state,
98529
- transport: peer.isRelay === true ? "relay" : peer.isRelay === false ? "direct" : "unknown"
98696
+ transport: peer.isRelay === true ? "relay" : peer.isRelay === false ? "direct" : "unknown",
98697
+ argsSummary: summarizeMeshCommandArgs(command, args)
98530
98698
  });
98531
98699
  try {
98532
98700
  peer.dataChannel.sendMessage(JSON.stringify(payload));
@@ -98554,7 +98722,8 @@ var init_daemon_mesh_manager = __esm({
98554
98722
  targetDaemonId,
98555
98723
  queuedAt,
98556
98724
  peerState: peer.state,
98557
- transport: peer.isRelay === true ? "relay" : peer.isRelay === false ? "direct" : "unknown"
98725
+ transport: peer.isRelay === true ? "relay" : peer.isRelay === false ? "direct" : "unknown",
98726
+ argsSummary: summarizeMeshCommandArgs(command, args)
98558
98727
  });
98559
98728
  if (!peer.commandQueue) {
98560
98729
  peer.commandQueue = [];
@@ -98741,7 +98910,8 @@ var init_daemon_mesh_manager = __esm({
98741
98910
  sentAt,
98742
98911
  peerState: entry.state,
98743
98912
  transport: entry.isRelay === true ? "relay" : entry.isRelay === false ? "direct" : "unknown",
98744
- flushed: true
98913
+ flushed: true,
98914
+ argsSummary: summarizeMeshCommandArgs(item.command, item.args)
98745
98915
  });
98746
98916
  dc.sendMessage(JSON.stringify({
98747
98917
  type: "mesh_command",
@@ -98776,7 +98946,8 @@ var init_daemon_mesh_manager = __esm({
98776
98946
  requestId: data.requestId,
98777
98947
  command: data.command,
98778
98948
  senderDaemonId: targetDaemonId,
98779
- receivedAt: (/* @__PURE__ */ new Date()).toISOString()
98949
+ receivedAt: (/* @__PURE__ */ new Date()).toISOString(),
98950
+ argsSummary: summarizeMeshCommandArgs(data.command, asRecord(data.args))
98780
98951
  });
98781
98952
  if (this.commandCallback) {
98782
98953
  this.commandCallback(targetDaemonId, data.command, data.args, data.requestId).catch((e) => {
@@ -98793,7 +98964,9 @@ var init_daemon_mesh_manager = __esm({
98793
98964
  queuedAt: pending.queuedAt,
98794
98965
  sentAt: pending.sentAt,
98795
98966
  receivedAt: (/* @__PURE__ */ new Date()).toISOString(),
98796
- success: data.success === true
98967
+ success: data.success === true,
98968
+ resultSummary: data.success === true ? summarizeMeshCommandResult(pending.command, data.result) : null,
98969
+ error: data.success === true ? void 0 : data.error
98797
98970
  });
98798
98971
  if (data.success) {
98799
98972
  pending.resolve(data.result);
@@ -99063,7 +99236,7 @@ var init_adhdev_daemon = __esm({
99063
99236
  init_version();
99064
99237
  init_src();
99065
99238
  init_runtime_defaults();
99066
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.42" });
99239
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.44" });
99067
99240
  AdhdevDaemon = class _AdhdevDaemon {
99068
99241
  localHttpServer = null;
99069
99242
  localWss = null;