@adhdev/daemon-core 0.9.82-rc.303 → 0.9.82-rc.304

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/daemon-core",
3
- "version": "0.9.82-rc.303",
3
+ "version": "0.9.82-rc.304",
4
4
  "description": "ADHDev daemon core — CDP, IDE detection, providers, command execution",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -46,7 +46,7 @@
46
46
  "author": "vilmire",
47
47
  "license": "AGPL-3.0-or-later",
48
48
  "dependencies": {
49
- "@adhdev/mesh-shared": "0.9.82-rc.303",
49
+ "@adhdev/mesh-shared": "0.9.82-rc.304",
50
50
  "@adhdev/session-host-core": "*",
51
51
  "@agentclientprotocol/sdk": "^0.16.1",
52
52
  "ajv": "^8.20.0",
@@ -966,6 +966,26 @@ function finalizeMeshNodeStatus(args: {
966
966
  );
967
967
  }
968
968
 
969
+ // Reads a positive integer timeout (ms) from an env var, clamped to [1s, 120s];
970
+ // falls back to the default when unset or out of range. Lets slow cross-machine
971
+ // peers (e.g. a TURN-relayed Windows daemon whose git_status RTT is 10-18s) be
972
+ // tuned without a rebuild.
973
+ function readMeshTimeoutEnvMs(name: string, defaultMs: number): number {
974
+ const raw = process.env[name]?.trim();
975
+ if (!raw) return defaultMs;
976
+ const parsed = Number.parseInt(raw, 10);
977
+ if (Number.isFinite(parsed) && parsed >= 1_000 && parsed <= 120_000) return parsed;
978
+ return defaultMs;
979
+ }
980
+
981
+ // Direct-peer git_status probe timeout for the dashboard's requireDirectPeerTruth
982
+ // bootstrap. The previous hard-coded 8s/12s were shorter than the real P2P
983
+ // round-trip to slow (often TURN-relayed) peers, so such a node was permanently
984
+ // marked unavailable and blocked the whole mesh graph. Default raised to 25s
985
+ // (still under the P2P REQUEST_TIMEOUT of 30s) and made env-overridable.
986
+ const MESH_DIRECT_PROBE_TIMEOUT_MS = readMeshTimeoutEnvMs('MESH_DIRECT_PROBE_TIMEOUT_MS', 25_000);
987
+ const MESH_DIRECT_PROBE_RETRY_TIMEOUT_MS = readMeshTimeoutEnvMs('MESH_DIRECT_PROBE_RETRY_TIMEOUT_MS', 25_000);
988
+
969
989
  async function probeRemoteMeshGitStatus(args: {
970
990
  dispatchMeshCommand?: (daemonId: string, cmd: string, args: Record<string, unknown>) => Promise<unknown>;
971
991
  daemonId: string;
@@ -1057,7 +1077,7 @@ async function hydrateInlineMeshDirectTruth(args: {
1057
1077
  dispatchMeshCommand: args.dispatchMeshCommand,
1058
1078
  daemonId,
1059
1079
  workspace,
1060
- timeoutMs: 8_000,
1080
+ timeoutMs: MESH_DIRECT_PROBE_TIMEOUT_MS,
1061
1081
  });
1062
1082
  if (remoteGit) {
1063
1083
  recordInlineMeshDirectGitTruth(node, remoteGit, 'selected_coordinator_mesh_p2p_git');
@@ -8574,7 +8594,7 @@ export class DaemonCommandRouter {
8574
8594
  dispatchMeshCommand: this.deps.dispatchMeshCommand,
8575
8595
  daemonId,
8576
8596
  workspace,
8577
- timeoutMs: 8000,
8597
+ timeoutMs: MESH_DIRECT_PROBE_TIMEOUT_MS,
8578
8598
  });
8579
8599
  if (remoteGit) {
8580
8600
  status.git = remoteGit;
@@ -8600,7 +8620,7 @@ export class DaemonCommandRouter {
8600
8620
  dispatchMeshCommand: this.deps.dispatchMeshCommand,
8601
8621
  daemonId,
8602
8622
  workspace,
8603
- timeoutMs: 12000,
8623
+ timeoutMs: MESH_DIRECT_PROBE_RETRY_TIMEOUT_MS,
8604
8624
  });
8605
8625
  if (remoteGit) {
8606
8626
  status.git = remoteGit;