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

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.45",
3
+ "version": "0.9.77-rc.47",
4
4
  "description": "ADHDev standalone daemon — embedded HTTP/WS server for local dashboard",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -25503,7 +25503,8 @@ function ensureMachineId(config2) {
25503
25503
  };
25504
25504
  }
25505
25505
  function getConfigDir() {
25506
- const dir = (0, import_path.join)((0, import_os2.homedir)(), ".adhdev");
25506
+ const override = process.env.ADHDEV_CONFIG_DIR;
25507
+ const dir = override && override.trim() ? override.trim() : (0, import_path.join)((0, import_os2.homedir)(), ".adhdev");
25507
25508
  if (!(0, import_fs4.existsSync)(dir)) {
25508
25509
  (0, import_fs4.mkdirSync)(dir, { recursive: true });
25509
25510
  }
@@ -26183,12 +26184,29 @@ function updateSessionTaskStatus(meshId, sessionId, status) {
26183
26184
  }
26184
26185
  function getMeshQueueStats(meshId) {
26185
26186
  const queue = readQueue(meshId);
26187
+ const pending = queue.filter((q) => q.status === "pending").length;
26188
+ const assigned = queue.filter((q) => q.status === "assigned").length;
26189
+ const completed = queue.filter((q) => q.status === "completed").length;
26190
+ const failed = queue.filter((q) => q.status === "failed").length;
26191
+ const cancelled = queue.filter((q) => q.status === "cancelled").length;
26186
26192
  return {
26187
- pending: queue.filter((q) => q.status === "pending").length,
26188
- assigned: queue.filter((q) => q.status === "assigned").length,
26189
- completed: queue.filter((q) => q.status === "completed").length,
26190
- failed: queue.filter((q) => q.status === "failed").length,
26191
- cancelled: queue.filter((q) => q.status === "cancelled").length,
26193
+ total: queue.length,
26194
+ active: pending + assigned,
26195
+ historical: completed + failed + cancelled,
26196
+ pending,
26197
+ assigned,
26198
+ completed,
26199
+ failed,
26200
+ cancelled,
26201
+ activeCounts: {
26202
+ pending,
26203
+ assigned
26204
+ },
26205
+ historicalCounts: {
26206
+ completed,
26207
+ failed,
26208
+ cancelled
26209
+ },
26192
26210
  activeAssignments: queue.filter((q) => q.status === "assigned").map((q) => ({
26193
26211
  id: q.id,
26194
26212
  nodeId: q.assignedNodeId,
@@ -28796,7 +28814,7 @@ function addWorkspaceEntry(config2, rawPath, label, options) {
28796
28814
  }
28797
28815
  }
28798
28816
  const v = validateWorkspacePath(abs);
28799
- if (!v.ok) return { error: v.error };
28817
+ if (v.ok !== true) return { error: v.error };
28800
28818
  const list = [...config2.workspaces || []];
28801
28819
  if (list.some((w) => path5.resolve(w.path) === abs)) {
28802
28820
  return { error: "Workspace already in list" };
@@ -41684,7 +41702,7 @@ async function shutdownDaemonComponents(components) {
41684
41702
  }
41685
41703
  cdpManagers.clear();
41686
41704
  }
41687
- var path4, import_promises4, import_fs3, import_child_process, import_util3, import_os2, import_path, import_fs4, import_crypto2, import_fs5, import_path2, import_crypto3, import_fs6, import_path3, import_crypto4, import_events2, import_fs7, import_path4, import_crypto5, import_child_process2, os22, path8, import_fs8, fs2, path9, os32, os8, os9, path14, import_child_process3, os10, path15, os11, import_child_process4, import_fs9, import_promises5, path, import_util4, import_promises6, path22, path32, fs, os4, path5, import_crypto6, path6, path7, import_fs10, import_path5, import_child_process5, import_fs11, import_os3, path10, os42, import_child_process6, http, crypto2, fs3, path11, os5, fs4, os6, path12, import_crypto7, fs5, path13, os7, os13, path18, crypto4, import_fs12, import_child_process7, os12, path16, crypto3, fs6, import_module, path17, import_stream2, import_child_process8, import_child_process9, net2, os15, path20, fs7, path19, os14, fs8, path21, os16, import_child_process10, import_crypto8, import_fs13, import_module2, os17, import_path6, os18, import_child_process11, import_child_process12, fs9, os19, path222, import_os4, import_path7, fs10, fs11, path23, os20, import_child_process13, import_os5, http2, fs15, path27, fs12, path24, fs13, path25, fs14, path26, os21, import_child_process14, __defProp2, __getOwnPropDesc2, __getOwnPropNames2, __hasOwnProp2, __require2, __esm2, __export2, __copyProps2, __toCommonJS2, DEFAULT_MESH_POLICY, init_repo_mesh_types, git_worktree_exports, execFileAsync2, WORKTREE_DIR_NAME, GIT_TIMEOUT_MS, GIT_MAX_BUFFER, SUBMODULE_WORKTREE_REMOVE_RE, init_git_worktree, config_exports, DEFAULT_CONFIG, MACHINE_ID_PREFIX, init_config, mesh_config_exports, SESSION_CLEANUP_MODES, SPAWNED_SESSION_VISIBILITY_MODES, init_mesh_config, coordinator_prompt_exports, TOOLS_SECTION, TOOL_EXPOSURE_PREFLIGHT_SECTION, WORKFLOW_SECTION, init_coordinator_prompt, mesh_ledger_exports, LEDGER_DIR_NAME, MAX_FILE_SIZE_BYTES, RECENT_FAILURE_WINDOW_MS, meshLedgerEvents, init_mesh_ledger, mesh_work_queue_exports, init_mesh_work_queue, init_cli_detector, LEVEL_NUM, LEVEL_LABEL, currentLevel, LOG_DIR, MAX_LOG_SIZE, MAX_LOG_DAYS, currentDate, currentLogFile, writeCount, RING_BUFFER_SIZE, ringBuffer, origConsoleLog, origConsoleError, origConsoleWarn, LOG, interceptorInstalled, LOG_PATH, init_logger, mesh_events_exports, remoteIdleSessions, MAX_PENDING_EVENTS, pendingMeshCoordinatorEvents, MESH_COORDINATOR_EVENTS, EVENT_TO_LEDGER_KIND, autoLaunchInProgress, autoLaunchCooldownUntil, AUTO_LAUNCH_COOLDOWN_MS, init_mesh_events, NORMAL_TRACE_BUFFER_SIZE, DEV_TRACE_BUFFER_SIZE, DEFAULT_CONFIG2, currentConfig, init_debug_config, DEFAULT_BINDING_CANDIDATES, cachedBinding, cachedBindingError, GhosttyVtTerminalBackend, init_ghostty_vt_backend, TerminalCtor, XtermTerminalBackend, init_xterm_backend, DEFAULT_SCROLLBACK, loggedTerminalBackends, TerminalScreen, init_terminal_screen, init_spawn_env, cachedPty, NodePtyRuntimeTransport, NodePtyTransportFactory, init_pty_transport, TerminalTranscriptAccumulator, buildCliSpawnEnv, init_provider_cli_shared, init_provider_cli_parse, init_provider_cli_config, init_provider_cli_runtime, provider_cli_adapter_exports, ProviderCliAdapter, init_provider_cli_adapter, execFileAsync, DEFAULT_TIMEOUT_MS, DEFAULT_MAX_BUFFER, GitCommandError, DEFAULT_MAX_FILES, DEFAULT_MAX_BYTES, summarizeGitStatus, InMemoryGitSnapshotStore, DEFAULT_GIT_WORKSPACE_POLL_INTERVAL_MS, MIN_GIT_WORKSPACE_POLL_INTERVAL_MS, GitWorkspaceMonitor, GIT_COMMAND_NAMES, SNAPSHOT_REASONS, FAILURE_REASONS, defaultSnapshotStore, defaultGitCommandServices, BUSY_STATUSES, TERMINAL_STATUSES, TurnSnapshotTracker, MAX_WORKSPACES, MAX_ACTIVITY, MAX_SAVED_SESSIONS, NO_FALLBACK_REASON, P2P_NEXT_ACTION, NON_P2P_NEXT_ACTION, P2pRelayFailureError, DEFAULT_STATE, BUILTIN_IDE_DEFINITIONS, registeredIDEs, LIVE_LIFECYCLES, DEFAULT_ACTIVE_CHAT_POLL_STATUSES, DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS, LIVE_RUNTIME_LIFECYCLES, DaemonCdpManager, CdpDomHandlers, DEFAULT_MONITOR_CONFIG, StatusMonitor, BUILTIN_CHAT_MESSAGE_KINDS, CHAT_MESSAGE_VISIBILITIES, CHAT_MESSAGE_TRANSCRIPT_VISIBILITIES, CHAT_MESSAGE_AUDIENCES, CHAT_MESSAGE_SOURCES, CHAT_MESSAGE_ACTIVITY_SOURCES, CHAT_MESSAGE_INTERNAL_SOURCES, KNOWN_CHAT_MESSAGE_KINDS, CHAT_MESSAGE_KIND_ALIASES, EXPLICIT_HIDDEN_VISIBILITIES, EXPLICIT_VISIBLE_VISIBILITIES, HIDDEN_AUDIENCES, ACTIVITY_SOURCE_SET, INTERNAL_SOURCE_SET, HISTORY_DIR, RETAIN_DAYS, SAVED_HISTORY_INDEX_VERSION, SAVED_HISTORY_INDEX_FILE, SAVED_HISTORY_INDEX_LOCK_SUFFIX, SAVED_HISTORY_INDEX_LOCK_WAIT_MS, SAVED_HISTORY_INDEX_LOCK_STALE_MS, SAVED_HISTORY_INDEX_LOCK_POLL_MS, SAVED_HISTORY_ROLLUP_THRESHOLD_BYTES, savedHistorySessionCache, savedHistoryFileSummaryCache, savedHistoryBackgroundRefresh, savedHistoryRollupInFlight, ChatHistoryWriter, IDE_PROVIDER_SESSION_CAPABILITIES_BASE, EXTENSION_PROVIDER_SESSION_CAPABILITIES_BASE, ExtensionProviderInstance, VALID_STATUSES, VALID_ROLES, VALID_BUBBLE_STATES, VALID_TURN_STATUSES, DEFAULT_APPROVAL_POSITIVE_HINTS, IdeProviderInstance, DEFAULT_CDP_SCAN_INTERVAL_MS, DEFAULT_CDP_DISCOVERY_INTERVAL_MS, DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS, DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS, DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS, MIN_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS, DEFAULT_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS, MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS, DEFAULT_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS, DEFAULT_SESSION_HOST_READY_TIMEOUT_MS, STANDALONE_CDP_SCAN_INTERVAL_MS, DaemonCdpScanner, DaemonCdpInitializer, WORKING_STATUSES, FULL_STATUS_ACTIVE_CHAT_OPTIONS, LIVE_STATUS_ACTIVE_CHAT_OPTIONS, STATUS_MODAL_MESSAGE_LIMIT, STATUS_MODAL_BUTTON_LIMIT, VALID_INPUT_MEDIA_TYPES, VALID_INPUT_STRATEGIES, TEXT_ONLY_MESSAGE_INPUT_SUPPORT, IDE_SESSION_CAPABILITIES, EXTENSION_SESSION_CAPABILITIES, PTY_SESSION_CAPABILITIES, CLI_CHAT_SESSION_CAPABILITIES, ACP_SESSION_CAPABILITIES, globalStore, RECENT_SEND_WINDOW_MS, READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS, HERMES_CLI_STARTING_SEND_SETTLE_MS, recentSendByTarget, DEFAULT_DEBUG_SANITIZE_OPTIONS, SECRET_KEY_PATTERN, KEY_TO_VK, COMMAND_DEBUG_LEVELS, DaemonCommandHandler, COMPLETED_FINALIZATION_RETRY_MS, COMPLETED_FINALIZATION_MAX_WAIT_MS, IMAGE_MIME_EXTENSIONS, MATERIALIZED_IMAGE_MAX_AGE_MS, MATERIALIZED_IMAGE_CLEANUP_INTERVAL_MS, lastMaterializedImageCleanupAt, CachedDatabaseSync, CliProviderInstance, AcpProviderInstance, chalkModule, chalkApi, COORDINATOR_DELEGATED_ENV_UNSETS, DaemonCliManager, VALID_CAPABILITY_MEDIA_TYPES, VALID_INPUT_STRATEGIES2, KNOWN_PROVIDER_FIELDS, VALUE_CONTROL_TYPES, ProviderLoader, _providerLoader, LOG_DIR2, MAX_FILE_SIZE, MAX_DAYS, SENSITIVE_KEYS, currentDate2, currentFile, writeCount2, SKIP_COMMANDS, DEFAULT_SERVER_NAME, DEFAULT_ADHDEV_MCP_COMMAND, HERMES_CLI_TYPE, HERMES_MCP_CONFIG_PATH, READ_DEBUG_ENABLED, recentReadDebugSignatureBySession, UPGRADE_HELPER_ENV, CHANNEL_NPM_TAG, CHANNEL_SERVER_URL, REFINE_VALIDATION_CATEGORIES, REFINE_VALIDATION_TIMEOUT_MS, REFINE_VALIDATION_OUTPUT_LIMIT_BYTES, REFINE_VALIDATION_SUMMARY_CHARS, REFINE_VALIDATION_MAX_COMMANDS, CHAT_COMMANDS, READ_DEBUG_ENABLED2, DaemonCommandRouter, DaemonStatusReporter, DEFAULT_DAEMON_PORT, DAEMON_WS_PATH, ProviderStreamAdapter, DaemonAgentStreamManager, AgentStreamPoller, ProviderInstanceManager, ARCHIVE_PATH, MAX_ENTRIES_PER_PROVIDER, VersionArchive, DEV_SERVER_PORT, DevServer, SessionHostRuntimeTransport, SessionHostPtyTransportFactory, DEFAULT_SESSION_HOST_APP_NAME, DEFAULT_STANDALONE_SESSION_HOST_APP_NAME, STARTUP_TIMEOUT_MS, STARTUP_POLL_MS, SessionHostCompatibilityError, EXTENSION_CATALOG, SessionRegistry;
41705
+ var path4, import_promises4, import_fs3, import_child_process, import_util3, import_os2, import_path, import_fs4, import_crypto2, import_fs5, import_path2, import_crypto3, import_fs6, import_path3, import_crypto4, import_events2, import_fs7, import_path4, import_crypto5, import_child_process2, os22, path8, import_fs8, fs2, path9, os32, os8, os9, path14, import_child_process3, os10, path15, os11, import_child_process4, import_fs9, import_promises5, path, import_util4, import_promises6, path22, path32, fs, os4, path5, import_crypto6, path6, path7, import_fs10, import_path5, import_child_process5, import_fs11, import_os3, path10, os42, import_child_process6, http, crypto2, fs3, path11, os5, fs4, os6, path12, import_crypto7, fs5, path13, os7, os13, path18, crypto4, import_fs12, import_child_process7, os12, path16, crypto3, fs6, import_module, path17, import_stream2, import_child_process8, import_child_process9, net2, os15, path20, fs7, path19, os14, fs8, path21, os16, import_child_process10, import_crypto8, import_fs13, import_module2, os17, import_path6, os18, import_child_process11, import_child_process12, fs9, os19, path222, import_os4, import_path7, fs10, fs11, path23, os20, import_child_process13, import_os5, http2, fs15, path27, fs12, path24, fs13, path25, fs14, path26, os21, import_child_process14, __defProp2, __getOwnPropDesc2, __getOwnPropNames2, __hasOwnProp2, __require2, __esm2, __export2, __copyProps2, __toCommonJS2, DEFAULT_MESH_POLICY, init_repo_mesh_types, git_worktree_exports, execFileAsync2, WORKTREE_DIR_NAME, GIT_TIMEOUT_MS, GIT_MAX_BUFFER, SUBMODULE_WORKTREE_REMOVE_RE, init_git_worktree, config_exports, DEFAULT_CONFIG, MACHINE_ID_PREFIX, init_config, mesh_config_exports, SESSION_CLEANUP_MODES, SPAWNED_SESSION_VISIBILITY_MODES, init_mesh_config, coordinator_prompt_exports, TOOLS_SECTION, TOOL_EXPOSURE_PREFLIGHT_SECTION, WORKFLOW_SECTION, init_coordinator_prompt, mesh_ledger_exports, LEDGER_DIR_NAME, MAX_FILE_SIZE_BYTES, RECENT_FAILURE_WINDOW_MS, meshLedgerEvents, init_mesh_ledger, mesh_work_queue_exports, ACTIVE_MESH_QUEUE_STATUSES, HISTORICAL_MESH_QUEUE_STATUSES, init_mesh_work_queue, init_cli_detector, LEVEL_NUM, LEVEL_LABEL, currentLevel, LOG_DIR, MAX_LOG_SIZE, MAX_LOG_DAYS, currentDate, currentLogFile, writeCount, RING_BUFFER_SIZE, ringBuffer, origConsoleLog, origConsoleError, origConsoleWarn, LOG, interceptorInstalled, LOG_PATH, init_logger, mesh_events_exports, remoteIdleSessions, MAX_PENDING_EVENTS, pendingMeshCoordinatorEvents, MESH_COORDINATOR_EVENTS, EVENT_TO_LEDGER_KIND, autoLaunchInProgress, autoLaunchCooldownUntil, AUTO_LAUNCH_COOLDOWN_MS, init_mesh_events, NORMAL_TRACE_BUFFER_SIZE, DEV_TRACE_BUFFER_SIZE, DEFAULT_CONFIG2, currentConfig, init_debug_config, DEFAULT_BINDING_CANDIDATES, cachedBinding, cachedBindingError, GhosttyVtTerminalBackend, init_ghostty_vt_backend, TerminalCtor, XtermTerminalBackend, init_xterm_backend, DEFAULT_SCROLLBACK, loggedTerminalBackends, TerminalScreen, init_terminal_screen, init_spawn_env, cachedPty, NodePtyRuntimeTransport, NodePtyTransportFactory, init_pty_transport, TerminalTranscriptAccumulator, buildCliSpawnEnv, init_provider_cli_shared, init_provider_cli_parse, init_provider_cli_config, init_provider_cli_runtime, provider_cli_adapter_exports, ProviderCliAdapter, init_provider_cli_adapter, execFileAsync, DEFAULT_TIMEOUT_MS, DEFAULT_MAX_BUFFER, GitCommandError, DEFAULT_MAX_FILES, DEFAULT_MAX_BYTES, summarizeGitStatus, InMemoryGitSnapshotStore, DEFAULT_GIT_WORKSPACE_POLL_INTERVAL_MS, MIN_GIT_WORKSPACE_POLL_INTERVAL_MS, GitWorkspaceMonitor, GIT_COMMAND_NAMES, SNAPSHOT_REASONS, FAILURE_REASONS, defaultSnapshotStore, defaultGitCommandServices, BUSY_STATUSES, TERMINAL_STATUSES, TurnSnapshotTracker, MAX_WORKSPACES, MAX_ACTIVITY, MAX_SAVED_SESSIONS, NO_FALLBACK_REASON, P2P_NEXT_ACTION, NON_P2P_NEXT_ACTION, P2pRelayFailureError, DEFAULT_STATE, BUILTIN_IDE_DEFINITIONS, registeredIDEs, LIVE_LIFECYCLES, DEFAULT_ACTIVE_CHAT_POLL_STATUSES, DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS, LIVE_RUNTIME_LIFECYCLES, DaemonCdpManager, CdpDomHandlers, DEFAULT_MONITOR_CONFIG, StatusMonitor, BUILTIN_CHAT_MESSAGE_KINDS, CHAT_MESSAGE_VISIBILITIES, CHAT_MESSAGE_TRANSCRIPT_VISIBILITIES, CHAT_MESSAGE_AUDIENCES, CHAT_MESSAGE_SOURCES, CHAT_MESSAGE_ACTIVITY_SOURCES, CHAT_MESSAGE_INTERNAL_SOURCES, KNOWN_CHAT_MESSAGE_KINDS, CHAT_MESSAGE_KIND_ALIASES, EXPLICIT_HIDDEN_VISIBILITIES, EXPLICIT_VISIBLE_VISIBILITIES, HIDDEN_AUDIENCES, ACTIVITY_SOURCE_SET, INTERNAL_SOURCE_SET, HISTORY_DIR, RETAIN_DAYS, SAVED_HISTORY_INDEX_VERSION, SAVED_HISTORY_INDEX_FILE, SAVED_HISTORY_INDEX_LOCK_SUFFIX, SAVED_HISTORY_INDEX_LOCK_WAIT_MS, SAVED_HISTORY_INDEX_LOCK_STALE_MS, SAVED_HISTORY_INDEX_LOCK_POLL_MS, SAVED_HISTORY_ROLLUP_THRESHOLD_BYTES, savedHistorySessionCache, savedHistoryFileSummaryCache, savedHistoryBackgroundRefresh, savedHistoryRollupInFlight, ChatHistoryWriter, IDE_PROVIDER_SESSION_CAPABILITIES_BASE, EXTENSION_PROVIDER_SESSION_CAPABILITIES_BASE, ExtensionProviderInstance, VALID_STATUSES, VALID_ROLES, VALID_BUBBLE_STATES, VALID_TURN_STATUSES, DEFAULT_APPROVAL_POSITIVE_HINTS, IdeProviderInstance, DEFAULT_CDP_SCAN_INTERVAL_MS, DEFAULT_CDP_DISCOVERY_INTERVAL_MS, DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS, DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS, DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS, MIN_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS, DEFAULT_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS, MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS, DEFAULT_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS, DEFAULT_SESSION_HOST_READY_TIMEOUT_MS, STANDALONE_CDP_SCAN_INTERVAL_MS, DaemonCdpScanner, DaemonCdpInitializer, WORKING_STATUSES, FULL_STATUS_ACTIVE_CHAT_OPTIONS, LIVE_STATUS_ACTIVE_CHAT_OPTIONS, STATUS_MODAL_MESSAGE_LIMIT, STATUS_MODAL_BUTTON_LIMIT, VALID_INPUT_MEDIA_TYPES, VALID_INPUT_STRATEGIES, TEXT_ONLY_MESSAGE_INPUT_SUPPORT, IDE_SESSION_CAPABILITIES, EXTENSION_SESSION_CAPABILITIES, PTY_SESSION_CAPABILITIES, CLI_CHAT_SESSION_CAPABILITIES, ACP_SESSION_CAPABILITIES, globalStore, RECENT_SEND_WINDOW_MS, READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS, HERMES_CLI_STARTING_SEND_SETTLE_MS, recentSendByTarget, DEFAULT_DEBUG_SANITIZE_OPTIONS, SECRET_KEY_PATTERN, KEY_TO_VK, COMMAND_DEBUG_LEVELS, DaemonCommandHandler, COMPLETED_FINALIZATION_RETRY_MS, COMPLETED_FINALIZATION_MAX_WAIT_MS, IMAGE_MIME_EXTENSIONS, MATERIALIZED_IMAGE_MAX_AGE_MS, MATERIALIZED_IMAGE_CLEANUP_INTERVAL_MS, lastMaterializedImageCleanupAt, CachedDatabaseSync, CliProviderInstance, AcpProviderInstance, chalkModule, chalkApi, COORDINATOR_DELEGATED_ENV_UNSETS, DaemonCliManager, VALID_CAPABILITY_MEDIA_TYPES, VALID_INPUT_STRATEGIES2, KNOWN_PROVIDER_FIELDS, VALUE_CONTROL_TYPES, ProviderLoader, _providerLoader, LOG_DIR2, MAX_FILE_SIZE, MAX_DAYS, SENSITIVE_KEYS, currentDate2, currentFile, writeCount2, SKIP_COMMANDS, DEFAULT_SERVER_NAME, DEFAULT_ADHDEV_MCP_COMMAND, HERMES_CLI_TYPE, HERMES_MCP_CONFIG_PATH, READ_DEBUG_ENABLED, recentReadDebugSignatureBySession, UPGRADE_HELPER_ENV, CHANNEL_NPM_TAG, CHANNEL_SERVER_URL, REFINE_VALIDATION_CATEGORIES, REFINE_VALIDATION_TIMEOUT_MS, REFINE_VALIDATION_OUTPUT_LIMIT_BYTES, REFINE_VALIDATION_SUMMARY_CHARS, REFINE_VALIDATION_MAX_COMMANDS, CHAT_COMMANDS, READ_DEBUG_ENABLED2, DaemonCommandRouter, DaemonStatusReporter, DEFAULT_DAEMON_PORT, DAEMON_WS_PATH, ProviderStreamAdapter, DaemonAgentStreamManager, AgentStreamPoller, ProviderInstanceManager, ARCHIVE_PATH, MAX_ENTRIES_PER_PROVIDER, VersionArchive, DEV_SERVER_PORT, DevServer, SessionHostRuntimeTransport, SessionHostPtyTransportFactory, DEFAULT_SESSION_HOST_APP_NAME, DEFAULT_STANDALONE_SESSION_HOST_APP_NAME, STARTUP_TIMEOUT_MS, STARTUP_POLL_MS, SessionHostCompatibilityError, EXTENSION_CATALOG, SessionRegistry;
41688
41706
  var init_dist2 = __esm({
41689
41707
  "../daemon-core/dist/index.mjs"() {
41690
41708
  "use strict";
@@ -42029,6 +42047,8 @@ Follow these recovery rules:
42029
42047
  });
42030
42048
  mesh_work_queue_exports = {};
42031
42049
  __export2(mesh_work_queue_exports, {
42050
+ ACTIVE_MESH_QUEUE_STATUSES: () => ACTIVE_MESH_QUEUE_STATUSES,
42051
+ HISTORICAL_MESH_QUEUE_STATUSES: () => HISTORICAL_MESH_QUEUE_STATUSES,
42032
42052
  cancelTask: () => cancelTask,
42033
42053
  claimNextTask: () => claimNextTask,
42034
42054
  enqueueTask: () => enqueueTask,
@@ -42043,6 +42063,8 @@ Follow these recovery rules:
42043
42063
  "src/mesh/mesh-work-queue.ts"() {
42044
42064
  "use strict";
42045
42065
  init_mesh_ledger();
42066
+ ACTIVE_MESH_QUEUE_STATUSES = ["pending", "assigned"];
42067
+ HISTORICAL_MESH_QUEUE_STATUSES = ["completed", "failed", "cancelled"];
42046
42068
  }
42047
42069
  });
42048
42070
  init_cli_detector = __esm2({
@@ -54125,10 +54147,21 @@ Run 'adhdev doctor' for detailed diagnostics.`
54125
54147
  const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
54126
54148
  if (!meshId) return { success: false, error: "meshId required" };
54127
54149
  try {
54128
- const { getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
54150
+ const { getMeshQueueStats: getMeshQueueStats2, getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
54129
54151
  const status = Array.isArray(args?.status) ? args.status.map((s) => typeof s === "string" ? s.trim() : "").filter(Boolean) : void 0;
54130
54152
  const queue = getQueue2(meshId, { status });
54131
- return { success: true, queue };
54153
+ const summary = getMeshQueueStats2(meshId);
54154
+ return {
54155
+ success: true,
54156
+ queue,
54157
+ summary,
54158
+ sourceOfTruth: {
54159
+ kind: "mesh_work_queue_file",
54160
+ activeStatuses: ["pending", "assigned"],
54161
+ historicalStatuses: ["completed", "failed", "cancelled"],
54162
+ notes: "pending/assigned are active work; completed/failed/cancelled are historical records."
54163
+ }
54164
+ };
54132
54165
  } catch (e) {
54133
54166
  return { success: false, error: e.message };
54134
54167
  }
@@ -58570,6 +58603,9 @@ function readString(value) {
58570
58603
  }
58571
58604
  var DUPLICATE_DISPATCH_WINDOW_MS = 6e4;
58572
58605
  var STALE_ASSIGNED_QUEUE_MS = 30 * 6e4;
58606
+ var OLD_HISTORICAL_QUEUE_RECORD_MS = 7 * 24 * 60 * 6e4;
58607
+ var ACTIVE_QUEUE_STATUSES = /* @__PURE__ */ new Set(["pending", "assigned"]);
58608
+ var HISTORICAL_QUEUE_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "cancelled"]);
58573
58609
  async function refreshMeshFromDaemon(ctx) {
58574
58610
  if (!(ctx.transport instanceof IpcTransport)) return;
58575
58611
  try {
@@ -58695,30 +58731,194 @@ function buildMissingNodeReadChatRecovery(ctx, args) {
58695
58731
  ]
58696
58732
  };
58697
58733
  }
58698
- function annotateQueueStaleness(queue) {
58734
+ function readSessionRecordId(session) {
58735
+ return readString(session?.id) || readString(session?.sessionId) || readString(session?.session_id) || readString(session?.runtimeSessionId) || readString(session?.runtime_session_id) || readString(session?.instanceId) || readString(session?.instance_id);
58736
+ }
58737
+ function addSessionRecord(target, session) {
58738
+ if (!session || typeof session !== "object" || isTerminalSessionRecord(session)) return;
58739
+ const sessionId = readSessionRecordId(session);
58740
+ if (sessionId) target.add(sessionId);
58741
+ }
58742
+ function collectNodeSessionIds(node) {
58743
+ const sessions = /* @__PURE__ */ new Set();
58744
+ const sessionArrays = [
58745
+ node?.sessions,
58746
+ node?.activeSessions,
58747
+ node?.active_sessions,
58748
+ node?.lastProbe?.sessions,
58749
+ node?.last_probe?.sessions,
58750
+ node?.lastProbe?.status?.sessions,
58751
+ node?.last_probe?.status?.sessions
58752
+ ];
58753
+ for (const value of sessionArrays) {
58754
+ if (Array.isArray(value)) value.forEach((session) => addSessionRecord(sessions, session));
58755
+ }
58756
+ const sessionRecords = [
58757
+ node?.activeSession,
58758
+ node?.active_session,
58759
+ node?.currentSession,
58760
+ node?.current_session,
58761
+ node?.runtimeSession,
58762
+ node?.runtime_session,
58763
+ node?.session,
58764
+ node?.lastProbe?.activeSession,
58765
+ node?.last_probe?.active_session,
58766
+ node?.lastProbe?.currentSession,
58767
+ node?.last_probe?.current_session,
58768
+ node?.lastProbe?.session,
58769
+ node?.last_probe?.session
58770
+ ];
58771
+ sessionRecords.forEach((session) => addSessionRecord(sessions, session));
58772
+ return sessions;
58773
+ }
58774
+ function buildQueueLivenessIndex(mesh) {
58775
+ const nodeIds = /* @__PURE__ */ new Set();
58776
+ const nodeSessionIds = /* @__PURE__ */ new Map();
58777
+ for (const node of Array.isArray(mesh?.nodes) ? mesh.nodes : []) {
58778
+ const nodeId = readString(node.id) || readString(node.nodeId) || readString(node.node_id);
58779
+ if (!nodeId) continue;
58780
+ nodeIds.add(nodeId);
58781
+ const sessions = collectNodeSessionIds(node);
58782
+ if (sessions.size > 0) nodeSessionIds.set(nodeId, sessions);
58783
+ }
58784
+ return { nodeIds, nodeSessionIds };
58785
+ }
58786
+ function queueAssignmentStaleReason(task, liveness) {
58787
+ if (task?.status !== "assigned") return void 0;
58788
+ const nodeId = readString(task.assignedNodeId) || readString(task.nodeId) || readString(task.node_id) || readString(task.targetNodeId);
58789
+ const sessionId = readString(task.assignedSessionId) || readString(task.sessionId) || readString(task.session_id) || readString(task.targetSessionId);
58790
+ if (nodeId && liveness.nodeIds.size > 0 && !liveness.nodeIds.has(nodeId)) {
58791
+ return "assigned node is not present in the current mesh snapshot";
58792
+ }
58793
+ if (nodeId && sessionId && liveness.nodeSessionIds.has(nodeId) && !liveness.nodeSessionIds.get(nodeId).has(sessionId)) {
58794
+ return "assigned session is not live on the assigned node";
58795
+ }
58796
+ const updatedAt = new Date(task.updatedAt).getTime();
58797
+ const ageMs = Number.isFinite(updatedAt) ? Date.now() - updatedAt : null;
58798
+ if (!nodeId && ageMs !== null && ageMs >= STALE_ASSIGNED_QUEUE_MS) {
58799
+ return "assigned task has no assigned node metadata";
58800
+ }
58801
+ return void 0;
58802
+ }
58803
+ function buildQueueStatusSummary(queue) {
58804
+ const counts = { pending: 0, assigned: 0, completed: 0, failed: 0, cancelled: 0 };
58805
+ for (const task of queue) {
58806
+ const status = typeof task?.status === "string" ? task.status : void 0;
58807
+ if (status && Object.prototype.hasOwnProperty.call(counts, status)) {
58808
+ counts[status] += 1;
58809
+ }
58810
+ }
58811
+ return {
58812
+ totalCount: queue.length,
58813
+ activeCount: counts.pending + counts.assigned,
58814
+ historicalCount: counts.completed + counts.failed + counts.cancelled,
58815
+ counts,
58816
+ activeCounts: {
58817
+ pending: counts.pending,
58818
+ assigned: counts.assigned
58819
+ },
58820
+ historicalCounts: {
58821
+ completed: counts.completed,
58822
+ failed: counts.failed,
58823
+ cancelled: counts.cancelled
58824
+ }
58825
+ };
58826
+ }
58827
+ function normalizeQueueViewMode(value) {
58828
+ return value === "active" || value === "historical" || value === "all" ? value : "all";
58829
+ }
58830
+ function sanitizeQueueStatusFilter(value) {
58831
+ if (!Array.isArray(value)) return void 0;
58832
+ const statuses = value.map((item) => typeof item === "string" ? item.trim() : "").filter((status) => ACTIVE_QUEUE_STATUSES.has(status) || HISTORICAL_QUEUE_STATUSES.has(status));
58833
+ return statuses.length ? Array.from(new Set(statuses)) : void 0;
58834
+ }
58835
+ function filterQueueForView(queue, view, statuses) {
58836
+ if (statuses?.length) {
58837
+ const allowed = new Set(statuses);
58838
+ return queue.filter((task) => allowed.has(String(task?.status || "")));
58839
+ }
58840
+ if (view === "active") return queue.filter((task) => ACTIVE_QUEUE_STATUSES.has(String(task?.status || "")));
58841
+ if (view === "historical") return queue.filter((task) => HISTORICAL_QUEUE_STATUSES.has(String(task?.status || "")));
58842
+ return queue;
58843
+ }
58844
+ function slimQueueTask(task) {
58845
+ return {
58846
+ id: task?.id,
58847
+ status: task?.status,
58848
+ assignedNodeId: task?.assignedNodeId,
58849
+ assignedSessionId: task?.assignedSessionId,
58850
+ targetNodeId: task?.targetNodeId,
58851
+ targetSessionId: task?.targetSessionId,
58852
+ updatedAt: task?.updatedAt,
58853
+ staleAssigned: task?.staleAssigned === true,
58854
+ staleReason: task?.staleReason
58855
+ };
58856
+ }
58857
+ function buildQueueMaintenanceReport(queue) {
58858
+ const now = Date.now();
58859
+ const staleAssignedTasks = queue.filter((task) => task?.status === "assigned" && task?.staleAssigned === true).map(slimQueueTask);
58860
+ const historicalTasks = queue.filter((task) => HISTORICAL_QUEUE_STATUSES.has(String(task?.status || "")));
58861
+ const oldHistoricalTasks = historicalTasks.filter((task) => {
58862
+ const updatedAt = new Date(task?.updatedAt).getTime();
58863
+ return Number.isFinite(updatedAt) && now - updatedAt >= OLD_HISTORICAL_QUEUE_RECORD_MS;
58864
+ }).map((task) => ({
58865
+ ...slimQueueTask(task),
58866
+ cleanupClass: "old_historical_record",
58867
+ reason: "terminal queue record is older than the read-only maintenance threshold"
58868
+ }));
58869
+ const cleanupCandidates = [
58870
+ ...staleAssignedTasks.map((task) => ({
58871
+ ...task,
58872
+ cleanupClass: "stale_assigned",
58873
+ reason: typeof task.staleReason === "string" ? task.staleReason : "active assigned task does not match current live mesh node/session state",
58874
+ suggestedOperation: "operator_review_then_requeue_or_cancel"
58875
+ })),
58876
+ ...oldHistoricalTasks.map((task) => ({
58877
+ ...task,
58878
+ suggestedOperation: "operator_review_then_archive_or_keep"
58879
+ }))
58880
+ ];
58881
+ return {
58882
+ readOnly: true,
58883
+ mutationPerformed: false,
58884
+ sourceOfTruth: "mesh_work_queue_file",
58885
+ staleAssignedDefinition: "Only active assigned queue rows are stale candidates, and only when the assigned node/session is absent from the current live mesh snapshot.",
58886
+ historicalDefinition: "completed/failed/cancelled rows are historical ledger records and never active assignments.",
58887
+ staleAssignedTasks,
58888
+ staleAssignedCount: staleAssignedTasks.length,
58889
+ historicalRecordCount: historicalTasks.length,
58890
+ oldHistoricalRecordCount: oldHistoricalTasks.length,
58891
+ cleanupCandidates,
58892
+ cleanupCandidateCount: cleanupCandidates.length
58893
+ };
58894
+ }
58895
+ function annotateQueueStaleness(queue, mesh) {
58896
+ const liveness = buildQueueLivenessIndex(mesh);
58699
58897
  const now = Date.now();
58700
58898
  return queue.map((task) => {
58701
58899
  const taskStatus = typeof task?.status === "string" ? task.status : void 0;
58702
58900
  const annotated = {
58703
58901
  ...task,
58704
58902
  taskStatus,
58903
+ isActive: taskStatus ? ACTIVE_QUEUE_STATUSES.has(taskStatus) : false,
58904
+ isHistorical: taskStatus ? HISTORICAL_QUEUE_STATUSES.has(taskStatus) : false,
58705
58905
  dispatchedAt: task?.createdAt,
58706
58906
  ...taskStatus === "assigned" ? { activeTaskId: task.id } : {},
58707
58907
  ...taskStatus === "completed" || taskStatus === "failed" ? {
58708
- isHistorical: true,
58709
58908
  completedAt: task.updatedAt
58710
58909
  } : {}
58711
58910
  };
58712
58911
  if (taskStatus !== "assigned") return annotated;
58713
58912
  const updatedAt = new Date(task.updatedAt).getTime();
58714
58913
  const ageMs = Number.isFinite(updatedAt) ? now - updatedAt : null;
58715
- if (ageMs === null || ageMs < STALE_ASSIGNED_QUEUE_MS) return annotated;
58914
+ const staleReason = queueAssignmentStaleReason(task, liveness);
58915
+ if (!staleReason) return annotated;
58716
58916
  return {
58717
58917
  ...annotated,
58718
58918
  stale: true,
58719
58919
  staleAssigned: true,
58720
- staleReason: "assigned task has not reached a terminal state within 30 minutes",
58721
- assignedAgeMs: ageMs
58920
+ staleReason,
58921
+ ...ageMs !== null ? { assignedAgeMs: ageMs } : {}
58722
58922
  };
58723
58923
  });
58724
58924
  }
@@ -59245,14 +59445,19 @@ var MESH_ENQUEUE_TASK_TOOL = {
59245
59445
  };
59246
59446
  var MESH_VIEW_QUEUE_TOOL = {
59247
59447
  name: "mesh_view_queue",
59248
- description: "View the current status of the mesh work queue (pending, assigned, completed, failed, cancelled tasks).",
59448
+ description: "View the mesh work queue with source-of-truth active counts separated from historical completed/failed/cancelled records.",
59249
59449
  inputSchema: {
59250
59450
  type: "object",
59251
59451
  properties: {
59252
59452
  status: {
59253
59453
  type: "array",
59254
59454
  items: { type: "string" },
59255
- description: "Filter by task status: pending, assigned, completed, failed, cancelled. Returns all if omitted."
59455
+ description: "Explicit row filter by task status: pending, assigned, completed, failed, cancelled. Source-of-truth counts remain unfiltered; visible* counts describe returned rows."
59456
+ },
59457
+ view: {
59458
+ type: "string",
59459
+ enum: ["all", "active", "historical"],
59460
+ 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."
59256
59461
  }
59257
59462
  }
59258
59463
  }
@@ -59649,13 +59854,50 @@ async function meshEnqueueTask(ctx, args) {
59649
59854
  }
59650
59855
  async function meshViewQueue(ctx, args) {
59651
59856
  try {
59652
- const queue = annotateQueueStaleness(getQueue(ctx.mesh.id, { status: args.status }));
59653
- const staleAssignedTasks = queue.filter((task) => task?.status === "assigned" && task?.staleAssigned);
59857
+ const statusFilter = sanitizeQueueStatusFilter(args.status);
59858
+ const view = normalizeQueueViewMode(args.view);
59859
+ const fullQueue = annotateQueueStaleness(getQueue(ctx.mesh.id), ctx.mesh);
59860
+ const queue = filterQueueForView(fullQueue, view, statusFilter);
59861
+ const summary = buildQueueStatusSummary(fullQueue);
59862
+ const visibleSummary = buildQueueStatusSummary(queue);
59863
+ const maintenance = buildQueueMaintenanceReport(fullQueue);
59864
+ const staleAssignedTasks = maintenance.staleAssignedTasks || [];
59865
+ const requestedHistoricalRows = queue.some((task) => HISTORICAL_QUEUE_STATUSES.has(String(task?.status || "")));
59654
59866
  return JSON.stringify({
59655
59867
  success: true,
59868
+ sourceOfTruth: {
59869
+ kind: "mesh_work_queue_file",
59870
+ activeStatuses: ["pending", "assigned"],
59871
+ historicalStatuses: ["completed", "failed", "cancelled"],
59872
+ notes: "pending/assigned are active work; completed/failed/cancelled are historical ledger records and never stale assignments."
59873
+ },
59874
+ filter: {
59875
+ view,
59876
+ statuses: statusFilter,
59877
+ filtered: Boolean(statusFilter?.length) || view !== "all"
59878
+ },
59656
59879
  queue,
59880
+ visibleQueue: queue,
59881
+ visibleSummary,
59882
+ summary,
59883
+ activeCounts: summary.activeCounts,
59884
+ historicalCounts: summary.historicalCounts,
59885
+ activeCount: summary.activeCount,
59886
+ historicalCount: summary.historicalCount,
59887
+ visibleActiveCounts: visibleSummary.activeCounts,
59888
+ visibleHistoricalCounts: visibleSummary.historicalCounts,
59889
+ visibleActiveCount: visibleSummary.activeCount,
59890
+ visibleHistoricalCount: visibleSummary.historicalCount,
59657
59891
  staleAssignedTasks,
59658
- staleAssignedCount: staleAssignedTasks.length,
59892
+ staleAssignedCount: maintenance.staleAssignedCount,
59893
+ queueMaintenance: maintenance,
59894
+ cleanupDryRun: maintenance,
59895
+ ...view === "active" || statusFilter?.some((status) => ACTIVE_QUEUE_STATUSES.has(status)) ? {
59896
+ activeQueue: queue.filter((task) => ACTIVE_QUEUE_STATUSES.has(String(task?.status || "")))
59897
+ } : {},
59898
+ ...view === "historical" || requestedHistoricalRows ? {
59899
+ historicalQueue: queue.filter((task) => HISTORICAL_QUEUE_STATUSES.has(String(task?.status || "")))
59900
+ } : {},
59659
59901
  // Back-compat alias for callers already reading the first hardening payload.
59660
59902
  staleAssignments: staleAssignedTasks
59661
59903
  }, null, 2);