@adhdev/daemon-standalone 0.9.77-rc.47 → 0.9.77-rc.48

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-standalone",
3
- "version": "0.9.77-rc.47",
3
+ "version": "0.9.77-rc.48",
4
4
  "description": "ADHDev standalone daemon — embedded HTTP/WS server for local dashboard",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -29178,26 +29178,8 @@ async function syncMeshes(transport) {
29178
29178
  }
29179
29179
  }
29180
29180
  }
29181
- if (transport.syncMeshLedger) {
29182
- for (const local of localMeshes) {
29183
- try {
29184
- await syncMeshLedger(local.id, transport);
29185
- } catch (e) {
29186
- result.errors.push(`Ledger sync failed for "${local.name}": ${e.message}`);
29187
- }
29188
- }
29189
- }
29190
29181
  return result;
29191
29182
  }
29192
- async function syncMeshLedger(meshId, transport) {
29193
- if (!transport.syncMeshLedger) return;
29194
- const { readLedgerEntries: readLedgerEntries2, appendRemoteLedgerEntries: appendRemoteLedgerEntries2 } = await Promise.resolve().then(() => (init_mesh_ledger(), mesh_ledger_exports));
29195
- const localEntries = readLedgerEntries2(meshId);
29196
- const res = await transport.syncMeshLedger(meshId, { newEntries: localEntries });
29197
- if (res.missingEntries && res.missingEntries.length > 0) {
29198
- appendRemoteLedgerEntries2(meshId, res.missingEntries);
29199
- }
29200
- }
29201
29183
  function messageFromError(error48) {
29202
29184
  if (error48 instanceof Error) return error48.message;
29203
29185
  if (typeof error48 === "string") return error48;
@@ -59711,8 +59693,22 @@ async function meshStatus(ctx) {
59711
59693
  entry.note = "No daemonId available for cloud status probe";
59712
59694
  }
59713
59695
  } catch (e) {
59696
+ const failure2 = buildCoordinatorP2pRelayFailure(e, {
59697
+ command: "git_status",
59698
+ targetDaemonId: node.daemonId,
59699
+ nodeId: node.id
59700
+ });
59714
59701
  entry.health = "degraded";
59715
- entry.error = e.message;
59702
+ entry.error = failure2.error;
59703
+ entry.degradedReason = failure2.recoverable ? "p2p_relay_failure" : "git_status_unavailable";
59704
+ Object.assign(entry, {
59705
+ code: failure2.code,
59706
+ transport: failure2.transport,
59707
+ recoverable: failure2.recoverable,
59708
+ retryRecommended: failure2.retryRecommended,
59709
+ nextAction: failure2.nextAction,
59710
+ noFallbackReason: failure2.noFallbackReason
59711
+ });
59716
59712
  }
59717
59713
  const recoveryContext = getSessionRecoveryContext(mesh.id, { nodeId: node.id });
59718
59714
  if (recoveryContext.consecutiveNodeFailures > 0) {
@@ -60252,31 +60248,43 @@ async function meshLaunchSession(ctx, args) {
60252
60248
  }
60253
60249
  async function meshGitStatus(ctx, args) {
60254
60250
  const node = await findNodeWithRefresh(ctx, args.node_id);
60255
- if (!isLocalTransport(ctx.transport) && node.daemonId) {
60256
- const result = await ctx.transport.gitStatus(node.daemonId, node.workspace, true);
60257
- return JSON.stringify({
60258
- nodeId: args.node_id,
60259
- workspace: node.workspace,
60260
- status: extractGitStatus(result),
60261
- diff: extractGitDiff(result),
60262
- relatedRepos: await collectRelatedRepoStatuses(ctx, node)
60263
- }, null, 2);
60264
- } else if (isLocalTransport(ctx.transport)) {
60265
- const statusResult = await commandForNode(ctx, node, "git_status", {
60266
- workspace: node.workspace
60267
- });
60268
- const diffResult = await commandForNode(ctx, node, "git_diff_summary", {
60269
- workspace: node.workspace
60251
+ try {
60252
+ if (!isLocalTransport(ctx.transport) && node.daemonId) {
60253
+ const result = await ctx.transport.gitStatus(node.daemonId, node.workspace, true);
60254
+ return JSON.stringify({
60255
+ nodeId: args.node_id,
60256
+ workspace: node.workspace,
60257
+ status: extractGitStatus(result),
60258
+ diff: extractGitDiff(result),
60259
+ relatedRepos: await collectRelatedRepoStatuses(ctx, node)
60260
+ }, null, 2);
60261
+ } else if (isLocalTransport(ctx.transport)) {
60262
+ const statusResult = await commandForNode(ctx, node, "git_status", {
60263
+ workspace: node.workspace
60264
+ });
60265
+ const diffResult = await commandForNode(ctx, node, "git_diff_summary", {
60266
+ workspace: node.workspace
60267
+ });
60268
+ return JSON.stringify({
60269
+ nodeId: args.node_id,
60270
+ workspace: node.workspace,
60271
+ status: extractGitStatus(statusResult),
60272
+ diff: extractGitDiff(diffResult),
60273
+ relatedRepos: await collectRelatedRepoStatuses(ctx, node)
60274
+ }, null, 2);
60275
+ } else {
60276
+ return JSON.stringify({ error: "No daemonId available for cloud git_status probe" });
60277
+ }
60278
+ } catch (e) {
60279
+ const failure2 = buildCoordinatorP2pRelayFailure(e, {
60280
+ command: "git_status",
60281
+ targetDaemonId: node.daemonId,
60282
+ nodeId: args.node_id
60270
60283
  });
60271
60284
  return JSON.stringify({
60272
- nodeId: args.node_id,
60273
- workspace: node.workspace,
60274
- status: extractGitStatus(statusResult),
60275
- diff: extractGitDiff(diffResult),
60276
- relatedRepos: await collectRelatedRepoStatuses(ctx, node)
60285
+ ...failure2,
60286
+ workspace: node.workspace
60277
60287
  }, null, 2);
60278
- } else {
60279
- return JSON.stringify({ error: "No daemonId available for cloud git_status probe" });
60280
60288
  }
60281
60289
  }
60282
60290
  async function meshCheckpoint(ctx, args) {
@@ -60646,15 +60654,6 @@ var CloudTransport = class {
60646
60654
  });
60647
60655
  if (!res.ok) throw new Error(`Delete remote mesh failed: ${res.status}`);
60648
60656
  }
60649
- async syncMeshLedger(meshId, data) {
60650
- const res = await fetch(`${this.baseUrl}/api/v1/repo-meshes/${encodeURIComponent(meshId)}/ledger/sync`, {
60651
- method: "POST",
60652
- headers: this.headers(),
60653
- body: JSON.stringify(data)
60654
- });
60655
- if (!res.ok) throw new Error(`Sync mesh ledger failed: ${res.status}`);
60656
- return res.json();
60657
- }
60658
60657
  async listDaemons() {
60659
60658
  const res = await fetch(`${this.baseUrl}/api/v1/daemons`, { headers: this.headers() });
60660
60659
  if (!res.ok) throw new Error(`List daemons failed: ${res.status}`);