@adhdev/daemon-standalone 0.9.82-rc.258 → 0.9.82-rc.259

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.258",
3
+ "version": "0.9.82-rc.259",
4
4
  "description": "ADHDev standalone daemon — embedded HTTP/WS server for local dashboard",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -1077,6 +1077,26 @@ function assignFullGitSnapshot(entry, status) {
1077
1077
  if (!status || typeof status !== "object" || Array.isArray(status)) return;
1078
1078
  entry.git = status;
1079
1079
  }
1080
+ function buildCompactGitSnapshot(status) {
1081
+ if (!status || typeof status !== "object" || Array.isArray(status)) return void 0;
1082
+ const slim = {};
1083
+ const carry = [
1084
+ "isGitRepo",
1085
+ "branch",
1086
+ "headCommit",
1087
+ "upstream",
1088
+ "upstreamStatus",
1089
+ "ahead",
1090
+ "behind",
1091
+ "dirty",
1092
+ "detached",
1093
+ "submodules"
1094
+ ];
1095
+ for (const key of carry) {
1096
+ if (status[key] !== void 0) slim[key] = status[key];
1097
+ }
1098
+ return slim;
1099
+ }
1080
1100
  function extractLaunchPayload(value) {
1081
1101
  return findNestedPayload(value, (payload) => Boolean(payload?.sessionId || payload?.id || payload?.runtimeSessionId));
1082
1102
  }
@@ -1920,7 +1940,9 @@ var MESH_STATUS_TOOL = {
1920
1940
  type: "object",
1921
1941
  properties: {
1922
1942
  _gemini_compat: { type: "string", description: "Dummy property for Gemini compatibility. Ignore this." },
1923
- includeStaleDirectWorkDetails: { type: "boolean", description: "Opt in to the full staleDirectWork array. Defaults false; normal status returns compact staleDirectWorkSummary only." }
1943
+ includeStaleDirectWorkDetails: { type: "boolean", description: "Opt in to the full staleDirectWork array. Defaults false; normal status returns compact staleDirectWorkSummary only." },
1944
+ compact: { type: "boolean", description: "Slim payload for LLM callers. Default true. Set false (or verbose=true) for the full dashboard-grade payload." },
1945
+ verbose: { type: "boolean", description: "Force the full payload; overrides compact." }
1924
1946
  }
1925
1947
  }
1926
1948
  };
@@ -1968,7 +1990,9 @@ var MESH_VIEW_QUEUE_TOOL = {
1968
1990
  type: "string",
1969
1991
  enum: ["all", "active", "historical"],
1970
1992
  description: "Optional row view. active returns pending/assigned rows, historical returns completed/failed/cancelled rows, all returns every persisted queue row. Defaults to all for compatibility."
1971
- }
1993
+ },
1994
+ compact: { type: "boolean", description: "Slim payload for LLM callers. Default true. Drops large historical (completed/failed/cancelled) row arrays in favor of status counts; pending/assigned active rows are retained. Set false (or verbose=true) for the full dashboard-grade payload." },
1995
+ verbose: { type: "boolean", description: "Force the full payload; overrides compact." }
1972
1996
  }
1973
1997
  }
1974
1998
  };
@@ -2288,6 +2312,7 @@ var ALL_MESH_TOOLS = [
2288
2312
  ];
2289
2313
  async function meshStatus(ctx, args = {}) {
2290
2314
  const rateResult = (0, import_daemon_core.recordMeshToolCall)({ meshId: ctx.mesh.id, tool: "mesh_status" });
2315
+ const compact = args.verbose === true ? false : args.compact ?? true;
2291
2316
  await refreshMeshFromDaemon(ctx);
2292
2317
  const { mesh, transport } = ctx;
2293
2318
  let ledgerSummary = (0, import_daemon_core.getLedgerSummary)(mesh.id);
@@ -2434,11 +2459,17 @@ async function meshStatus(ctx, args = {}) {
2434
2459
  }
2435
2460
  }
2436
2461
  }
2462
+ const nodesForResponse = compact ? results.map((entry) => {
2463
+ if (!entry || typeof entry !== "object" || entry.git === void 0) return entry;
2464
+ const slimGit = buildCompactGitSnapshot(entry.git);
2465
+ return slimGit ? { ...entry, git: slimGit } : entry;
2466
+ }) : results;
2437
2467
  const response = {
2438
2468
  meshId: mesh.id,
2439
2469
  meshName: mesh.name,
2440
2470
  repoIdentity: mesh.repoIdentity,
2441
2471
  policy: mesh.policy,
2472
+ payloadMode: compact ? "compact" : "full",
2442
2473
  refreshedAt: (/* @__PURE__ */ new Date()).toISOString(),
2443
2474
  sourceOfTruth: {
2444
2475
  membership: "coordinator_daemon_live_mesh",
@@ -2446,7 +2477,7 @@ async function meshStatus(ctx, args = {}) {
2446
2477
  activeWork: "mesh_queue_file_and_local_ledger",
2447
2478
  historicalEvidenceOnly: ["recoveryHints", "ledgerSummary"]
2448
2479
  },
2449
- nodes: results,
2480
+ nodes: nodesForResponse,
2450
2481
  activeWork: activeWorkEvidence.activeWork,
2451
2482
  staleDirectWorkSummary,
2452
2483
  ...args.includeStaleDirectWorkDetails === true ? { staleDirectWork: activeWorkEvidence.staleDirectWork } : {},
@@ -2490,7 +2521,20 @@ async function meshStatus(ctx, args = {}) {
2490
2521
  pendingEvents
2491
2522
  });
2492
2523
  if (asyncRefineJobs.length > 0) {
2493
- response.asyncRefineJobs = asyncRefineJobs;
2524
+ if (compact) {
2525
+ const TERMINAL_REFINE_STATUSES = /* @__PURE__ */ new Set(["failed", "completed", "succeeded", "cancelled", "aborted"]);
2526
+ const byStatus = {};
2527
+ const activeJobs = [];
2528
+ for (const job of asyncRefineJobs) {
2529
+ const status = String(job?.status ?? "unknown");
2530
+ byStatus[status] = (byStatus[status] ?? 0) + 1;
2531
+ if (!TERMINAL_REFINE_STATUSES.has(status)) activeJobs.push(job);
2532
+ }
2533
+ if (activeJobs.length > 0) response.asyncRefineJobs = activeJobs;
2534
+ response.asyncRefineJobsSummary = { total: asyncRefineJobs.length, byStatus };
2535
+ } else {
2536
+ response.asyncRefineJobs = asyncRefineJobs;
2537
+ }
2494
2538
  }
2495
2539
  if (pendingEvents.length > 0) {
2496
2540
  response.pendingCoordinatorEvents = pendingEvents;
@@ -2742,6 +2786,7 @@ async function meshEnqueueTask(ctx, args) {
2742
2786
  }
2743
2787
  async function meshViewQueue(ctx, args) {
2744
2788
  const rateResult = (0, import_daemon_core.recordMeshToolCall)({ meshId: ctx.mesh.id, tool: "mesh_view_queue" });
2789
+ const compact = args.verbose === true ? false : args.compact ?? true;
2745
2790
  try {
2746
2791
  await refreshMeshFromDaemon(ctx);
2747
2792
  const statusFilter = sanitizeQueueStatusFilter(args.status);
@@ -2787,8 +2832,12 @@ async function meshViewQueue(ctx, args) {
2787
2832
  const staleAssignedTasks = maintenance.staleAssignedTasks || [];
2788
2833
  const requestedHistoricalRows = queue.some((task) => HISTORICAL_QUEUE_STATUSES.has(String(task?.status || "")));
2789
2834
  const pollingGuidance = buildActiveWorkPollingGuidance(activeWorkEvidence.summary);
2835
+ const visibleQueue = compact ? queue.filter((task) => !HISTORICAL_QUEUE_STATUSES.has(String(task?.status || ""))) : queue;
2836
+ const wantActiveQueueArray = view === "active" || statusFilter?.some((status) => ACTIVE_QUEUE_STATUSES.has(status));
2837
+ const wantHistoricalQueueArray = !compact && (view === "historical" || requestedHistoricalRows);
2790
2838
  return JSON.stringify({
2791
2839
  success: true,
2840
+ payloadMode: compact ? "compact" : "full",
2792
2841
  sourceOfTruth: {
2793
2842
  kind: "mesh_work_queue_file",
2794
2843
  activeStatuses: ["pending", "assigned"],
@@ -2800,7 +2849,8 @@ async function meshViewQueue(ctx, args) {
2800
2849
  statuses: statusFilter,
2801
2850
  filtered: Boolean(statusFilter?.length) || view !== "all"
2802
2851
  },
2803
- queue,
2852
+ queue: visibleQueue,
2853
+ ...compact ? { historicalRowsOmitted: true, historicalRowsHint: "Completed/failed/cancelled rows are omitted in compact mode; see historicalCounts. Call mesh_view_queue with verbose=true (or view=historical, compact=false) for full rows." } : {},
2804
2854
  activeWork: activeWorkEvidence.activeWork,
2805
2855
  staleDirectWork: activeWorkEvidence.staleDirectWork,
2806
2856
  activeWorkSummary: activeWorkEvidence.summary,
@@ -2825,10 +2875,10 @@ async function meshViewQueue(ctx, args) {
2825
2875
  dispatchFailureCount: recentDispatchFailures.length,
2826
2876
  dispatchFailureNote: "Remote P2P dispatch attempts that failed. Affected tasks remain pending and may require mesh_queue_requeue if no idle session picks them up."
2827
2877
  } : {},
2828
- ...view === "active" || statusFilter?.some((status) => ACTIVE_QUEUE_STATUSES.has(status)) ? {
2878
+ ...wantActiveQueueArray ? {
2829
2879
  activeQueue: queue.filter((task) => ACTIVE_QUEUE_STATUSES.has(String(task?.status || "")))
2830
2880
  } : {},
2831
- ...view === "historical" || requestedHistoricalRows ? {
2881
+ ...wantHistoricalQueueArray ? {
2832
2882
  historicalQueue: queue.filter((task) => HISTORICAL_QUEUE_STATUSES.has(String(task?.status || "")))
2833
2883
  } : {},
2834
2884
  // Back-compat alias for callers already reading the first hardening payload.