@adhdev/daemon-standalone 0.9.82-rc.96 → 0.9.82-rc.98

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.82-rc.96",
3
+ "version": "0.9.82-rc.98",
4
4
  "description": "ADHDev standalone daemon — embedded HTTP/WS server for local dashboard",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -267,6 +267,18 @@ function annotateRapidReadChatAdvisory(payload, options) {
267
267
  // src/tools/mesh-tools.ts
268
268
  var import_daemon_core = require("@adhdev/daemon-core");
269
269
  var meshSessionProviderMetadata = /* @__PURE__ */ new Map();
270
+ var ACTIVE_WORK_POLLING_BACKOFF_MS = 6e4;
271
+ function buildActiveWorkPollingGuidance(summary, now = Date.now()) {
272
+ if (!summary || summary.generatingCount <= 0) return void 0;
273
+ return {
274
+ activeGeneratingWork: true,
275
+ generatingCount: summary.generatingCount,
276
+ doNotPollBefore: new Date(now + ACTIVE_WORK_POLLING_BACKOFF_MS).toISOString(),
277
+ eventSurface: "pendingCoordinatorEvents",
278
+ nextRecommendedAction: "Wait for pendingCoordinatorEvents/completion events or an explicit user status request. After a terminal signal, call mesh_read_chat once with compact=true, then verify git state if repository changes were expected.",
279
+ message: "Do not repeatedly poll mesh_status/mesh_view_queue/mesh_read_chat while delegated work is generating; these snapshots rarely change until the worker emits a completion/status event."
280
+ };
281
+ }
270
282
  function readString(value) {
271
283
  return typeof value === "string" && value.trim() ? value.trim() : void 0;
272
284
  }
@@ -1417,7 +1429,7 @@ function buildRemoveNodeArgs(ctx, nodeId, sessionCleanupMode) {
1417
1429
  }
1418
1430
  var MESH_STATUS_TOOL = {
1419
1431
  name: "mesh_status",
1420
- description: "Get the current status of all nodes in the repo mesh \u2014 health, git state, active sessions, recovery hints, and recommended next steps. Use this to decide which node to send work to or how to recover from failures.",
1432
+ description: "Get the current status of all nodes in the repo mesh \u2014 health, git state, active sessions, recovery hints, and recommended next steps. Use this to decide which node to send work to or how to recover from failures. Do not repeatedly call this to wait for generating delegated work; wait for pendingCoordinatorEvents/completion events or an explicit user status request.",
1421
1433
  inputSchema: {
1422
1434
  type: "object",
1423
1435
  properties: {
@@ -1450,7 +1462,7 @@ var MESH_ENQUEUE_TASK_TOOL = {
1450
1462
  };
1451
1463
  var MESH_VIEW_QUEUE_TOOL = {
1452
1464
  name: "mesh_view_queue",
1453
- description: "View the mesh work queue with source-of-truth active counts separated from historical completed/failed/cancelled records.",
1465
+ description: "View the mesh work queue with source-of-truth active counts separated from historical completed/failed/cancelled records. Do not repeatedly call this to wait for generating assigned work; wait for pendingCoordinatorEvents/completion events or an explicit user status request.",
1454
1466
  inputSchema: {
1455
1467
  type: "object",
1456
1468
  properties: {
@@ -1884,6 +1896,7 @@ async function meshStatus(ctx) {
1884
1896
  ledgerEntries: (0, import_daemon_core.readLedgerEntries)(mesh.id, { tail: 500 }),
1885
1897
  nodes: results
1886
1898
  });
1899
+ const pollingGuidance = buildActiveWorkPollingGuidance(activeWorkEvidence.summary);
1887
1900
  const response = {
1888
1901
  meshId: mesh.id,
1889
1902
  meshName: mesh.name,
@@ -1901,6 +1914,7 @@ async function meshStatus(ctx) {
1901
1914
  staleDirectWork: activeWorkEvidence.staleDirectWork,
1902
1915
  terminalDirectWork: activeWorkEvidence.terminalDirectWork,
1903
1916
  activeWorkSummary: activeWorkEvidence.summary,
1917
+ ...pollingGuidance ? { pollingGuidance } : {},
1904
1918
  branchConvergenceSummary: summarizeBranchConvergence(results)
1905
1919
  };
1906
1920
  try {
@@ -2106,6 +2120,7 @@ async function meshViewQueue(ctx, args) {
2106
2120
  });
2107
2121
  const staleAssignedTasks = maintenance.staleAssignedTasks || [];
2108
2122
  const requestedHistoricalRows = queue.some((task) => HISTORICAL_QUEUE_STATUSES.has(String(task?.status || "")));
2123
+ const pollingGuidance = buildActiveWorkPollingGuidance(activeWorkEvidence.summary);
2109
2124
  return JSON.stringify({
2110
2125
  success: true,
2111
2126
  sourceOfTruth: {
@@ -2124,6 +2139,7 @@ async function meshViewQueue(ctx, args) {
2124
2139
  activeWork: activeWorkEvidence.activeWork,
2125
2140
  staleDirectWork: activeWorkEvidence.staleDirectWork,
2126
2141
  activeWorkSummary: activeWorkEvidence.summary,
2142
+ ...pollingGuidance ? { pollingGuidance } : {},
2127
2143
  visibleSummary,
2128
2144
  summary,
2129
2145
  activeCounts: summary.activeCounts,