@adhdev/daemon-standalone 0.9.77-rc.49 → 0.9.77-rc.50
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/dist/index.js +161 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/mcp-server/index.js +161 -12
- package/vendor/mcp-server/index.js.map +1 -1
package/package.json
CHANGED
|
@@ -25847,6 +25847,11 @@ function buildRulesSection(coordinatorCliType) {
|
|
|
25847
25847
|
- **Do not strand completed branches.** A checkpointed or clean feature/worktree branch is not done by itself. Merge/refine it to the mesh default branch, or explicitly report one of \`pushed_feature_branch_needs_merge\`, \`blocked_review\`, \`cleanup_candidate\`, or \`not_mergeable\` with the next action.
|
|
25848
25848
|
- **Name worktree branches meaningfully.** Use descriptive names like \`feat/auth-refactor\` or \`fix/build-123\`.${coordinatorNote}`;
|
|
25849
25849
|
}
|
|
25850
|
+
function isIntentionalCleanupStopEntry(entry) {
|
|
25851
|
+
if (entry.kind !== "session_stopped" && entry.kind !== "task_failed" && entry.kind !== "task_stalled") return false;
|
|
25852
|
+
const payload = entry.payload && typeof entry.payload === "object" && !Array.isArray(entry.payload) ? entry.payload : {};
|
|
25853
|
+
return payload.intentional === true && (payload.reason === "operator_cleanup" || payload.intentionalStopReason === "operator_cleanup" || payload.source === "mesh_cleanup_sessions" || payload.source === "mesh_remove_node");
|
|
25854
|
+
}
|
|
25850
25855
|
function getLedgerDir() {
|
|
25851
25856
|
const dir = (0, import_path3.join)(getConfigDir(), LEDGER_DIR_NAME);
|
|
25852
25857
|
if (!(0, import_fs6.existsSync)(dir)) {
|
|
@@ -25862,6 +25867,37 @@ function getRotatedPath(meshId, index) {
|
|
|
25862
25867
|
const safe = meshId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
25863
25868
|
return (0, import_path3.join)(getLedgerDir(), `${safe}.${index}.jsonl`);
|
|
25864
25869
|
}
|
|
25870
|
+
function buildTaskCompletionEvidence(opts) {
|
|
25871
|
+
const providerSessionId = opts.providerSessionId?.trim() || void 0;
|
|
25872
|
+
const providerType = opts.providerType?.trim() || void 0;
|
|
25873
|
+
return {
|
|
25874
|
+
source: "agent_status_event",
|
|
25875
|
+
event: opts.event,
|
|
25876
|
+
nodeId: opts.nodeId,
|
|
25877
|
+
sessionId: opts.sessionId,
|
|
25878
|
+
providerType,
|
|
25879
|
+
completedAt: opts.completedAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
25880
|
+
transcriptHandle: {
|
|
25881
|
+
kind: providerSessionId ? "provider_session" : "runtime_session",
|
|
25882
|
+
sessionId: opts.sessionId,
|
|
25883
|
+
providerSessionId,
|
|
25884
|
+
finalSummaryAvailable: typeof opts.finalSummary === "string" && opts.finalSummary.trim().length > 0
|
|
25885
|
+
},
|
|
25886
|
+
git: {
|
|
25887
|
+
status: "deferred",
|
|
25888
|
+
reason: "ordinary_completion_git_status_not_checked"
|
|
25889
|
+
},
|
|
25890
|
+
validation: {
|
|
25891
|
+
status: "deferred",
|
|
25892
|
+
commandsRun: [],
|
|
25893
|
+
reason: "ordinary_completion_validation_not_run"
|
|
25894
|
+
},
|
|
25895
|
+
checkpoint: {
|
|
25896
|
+
attempted: false,
|
|
25897
|
+
reason: "not_attempted_for_ordinary_completion"
|
|
25898
|
+
}
|
|
25899
|
+
};
|
|
25900
|
+
}
|
|
25865
25901
|
function appendLedgerEntry(meshId, partial2) {
|
|
25866
25902
|
const entry = {
|
|
25867
25903
|
id: (0, import_crypto4.randomUUID)(),
|
|
@@ -26022,15 +26058,17 @@ function getLedgerSummary(meshId) {
|
|
|
26022
26058
|
summary.taskCompleted++;
|
|
26023
26059
|
break;
|
|
26024
26060
|
case "task_failed": {
|
|
26061
|
+
if (isIntentionalCleanupStopEntry(entry)) break;
|
|
26025
26062
|
summary.taskFailed++;
|
|
26026
26063
|
if (new Date(entry.timestamp).getTime() >= recentFailureCutoff) {
|
|
26027
26064
|
summary.recentFailures++;
|
|
26028
26065
|
}
|
|
26029
26066
|
break;
|
|
26030
26067
|
}
|
|
26031
|
-
case "task_stalled":
|
|
26032
|
-
summary.taskStalled++;
|
|
26068
|
+
case "task_stalled": {
|
|
26069
|
+
if (!isIntentionalCleanupStopEntry(entry)) summary.taskStalled++;
|
|
26033
26070
|
break;
|
|
26071
|
+
}
|
|
26034
26072
|
case "session_launched":
|
|
26035
26073
|
summary.sessionLaunched++;
|
|
26036
26074
|
break;
|
|
@@ -26069,6 +26107,7 @@ function getSessionRecoveryContext(meshId, opts) {
|
|
|
26069
26107
|
if (new Date(e.timestamp).getTime() < recentWindow) break;
|
|
26070
26108
|
if (opts.nodeId && e.nodeId !== opts.nodeId) continue;
|
|
26071
26109
|
if (e.kind === "task_failed") {
|
|
26110
|
+
if (isIntentionalCleanupStopEntry(e)) continue;
|
|
26072
26111
|
consecutiveNodeFailures++;
|
|
26073
26112
|
} else if (e.kind === "task_completed" || e.kind === "task_dispatched") {
|
|
26074
26113
|
break;
|
|
@@ -26580,6 +26619,28 @@ function getMeshWithCache(components, meshId) {
|
|
|
26580
26619
|
if (localMesh) return localMesh;
|
|
26581
26620
|
return components.router?.getCachedInlineMesh(meshId);
|
|
26582
26621
|
}
|
|
26622
|
+
function isIntentionalCleanupStopMetadata(event) {
|
|
26623
|
+
return event.intentional === true || event.intentionalStop === true || event.operatorCleanup === true || event.reason === "operator_cleanup" || event.stopReason === "operator_cleanup" || event.cleanupReason === "operator_cleanup" || event.source === "mesh_cleanup_sessions" || event.source === "mesh_remove_node";
|
|
26624
|
+
}
|
|
26625
|
+
function hasRecentIntentionalCleanupStop(meshId, sessionId, nodeId) {
|
|
26626
|
+
if (!sessionId && !nodeId) return false;
|
|
26627
|
+
const cutoff = Date.now() - INTENTIONAL_CLEANUP_STOP_SUPPRESSION_MS;
|
|
26628
|
+
const entries = readLedgerEntries(meshId);
|
|
26629
|
+
for (let i = entries.length - 1; i >= 0; i--) {
|
|
26630
|
+
const entry = entries[i];
|
|
26631
|
+
const timestamp2 = new Date(entry.timestamp).getTime();
|
|
26632
|
+
if (!Number.isNaN(timestamp2) && timestamp2 < cutoff) break;
|
|
26633
|
+
if (!isIntentionalCleanupStopEntry(entry)) continue;
|
|
26634
|
+
if (sessionId && entry.sessionId === sessionId) return true;
|
|
26635
|
+
if (!sessionId && nodeId && entry.nodeId === nodeId) return true;
|
|
26636
|
+
}
|
|
26637
|
+
return false;
|
|
26638
|
+
}
|
|
26639
|
+
function shouldSuppressIntentionalCleanupStop(args) {
|
|
26640
|
+
if (args.event !== "agent:stopped" && args.event !== "monitor:long_generating") return false;
|
|
26641
|
+
if (isIntentionalCleanupStopMetadata(args.metadataEvent)) return true;
|
|
26642
|
+
return hasRecentIntentionalCleanupStop(args.meshId, args.sessionId, args.nodeId);
|
|
26643
|
+
}
|
|
26583
26644
|
function tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType) {
|
|
26584
26645
|
const task = claimNextTask(meshId, nodeId, sessionId);
|
|
26585
26646
|
if (!task) {
|
|
@@ -26916,6 +26977,22 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
|
|
|
26916
26977
|
return "";
|
|
26917
26978
|
}
|
|
26918
26979
|
function injectMeshSystemMessage(components, args) {
|
|
26980
|
+
const eventSessionId = resolveEventSessionId(args.metadataEvent, args.sourceInstanceId);
|
|
26981
|
+
const eventNodeId = readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId);
|
|
26982
|
+
const intentionalCleanupStop = shouldSuppressIntentionalCleanupStop({
|
|
26983
|
+
event: args.event,
|
|
26984
|
+
meshId: args.meshId,
|
|
26985
|
+
metadataEvent: args.metadataEvent,
|
|
26986
|
+
sessionId: eventSessionId || void 0,
|
|
26987
|
+
nodeId: eventNodeId || void 0
|
|
26988
|
+
});
|
|
26989
|
+
if (intentionalCleanupStop) {
|
|
26990
|
+
if (eventSessionId && eventNodeId) {
|
|
26991
|
+
remoteIdleSessions.delete(`${eventNodeId}:${eventSessionId}`);
|
|
26992
|
+
}
|
|
26993
|
+
LOG.info("MeshEvents", `Suppressed ${args.event} for intentionally cleanup-stopped session ${eventSessionId || "(unknown session)"}`);
|
|
26994
|
+
return { success: true, forwarded: 0, suppressed: true, intentionalCleanupStop: true };
|
|
26995
|
+
}
|
|
26919
26996
|
let completedTaskForLedger = null;
|
|
26920
26997
|
if (args.event === "agent:generating_completed") {
|
|
26921
26998
|
const sessionId = resolveEventSessionId(args.metadataEvent, args.sourceInstanceId);
|
|
@@ -26949,7 +27026,15 @@ function injectMeshSystemMessage(components, args) {
|
|
|
26949
27026
|
taskId: completedTask.id,
|
|
26950
27027
|
completedViaReady: true,
|
|
26951
27028
|
providerSessionId: readNonEmptyString(args.metadataEvent.providerSessionId) || void 0,
|
|
26952
|
-
finalSummary: readNonEmptyString(args.metadataEvent.finalSummary) || void 0
|
|
27029
|
+
finalSummary: readNonEmptyString(args.metadataEvent.finalSummary) || void 0,
|
|
27030
|
+
evidence: buildTaskCompletionEvidence({
|
|
27031
|
+
event: "agent:ready",
|
|
27032
|
+
nodeId,
|
|
27033
|
+
sessionId,
|
|
27034
|
+
providerType: providerType || void 0,
|
|
27035
|
+
providerSessionId: readNonEmptyString(args.metadataEvent.providerSessionId) || void 0,
|
|
27036
|
+
finalSummary: readNonEmptyString(args.metadataEvent.finalSummary) || void 0
|
|
27037
|
+
})
|
|
26953
27038
|
}
|
|
26954
27039
|
});
|
|
26955
27040
|
} catch (e) {
|
|
@@ -26984,17 +27069,29 @@ function injectMeshSystemMessage(components, args) {
|
|
|
26984
27069
|
const ledgerKind = EVENT_TO_LEDGER_KIND[args.event];
|
|
26985
27070
|
if (ledgerKind) {
|
|
26986
27071
|
try {
|
|
27072
|
+
const ledgerNodeId = readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId) || void 0;
|
|
27073
|
+
const ledgerSessionId = resolveEventSessionId(args.metadataEvent, args.sourceInstanceId) || void 0;
|
|
27074
|
+
const ledgerProviderType = readNonEmptyString(args.metadataEvent.providerType) || void 0;
|
|
27075
|
+
const completionEvidence = ledgerKind === "task_completed" && ledgerNodeId && ledgerSessionId ? buildTaskCompletionEvidence({
|
|
27076
|
+
event: "agent:generating_completed",
|
|
27077
|
+
nodeId: ledgerNodeId,
|
|
27078
|
+
sessionId: ledgerSessionId,
|
|
27079
|
+
providerType: ledgerProviderType,
|
|
27080
|
+
providerSessionId: readNonEmptyString(args.metadataEvent.providerSessionId) || void 0,
|
|
27081
|
+
finalSummary: readNonEmptyString(args.metadataEvent.finalSummary) || void 0
|
|
27082
|
+
}) : void 0;
|
|
26987
27083
|
appendLedgerEntry(args.meshId, {
|
|
26988
27084
|
kind: ledgerKind,
|
|
26989
|
-
nodeId:
|
|
26990
|
-
sessionId:
|
|
26991
|
-
providerType:
|
|
27085
|
+
nodeId: ledgerNodeId,
|
|
27086
|
+
sessionId: ledgerSessionId,
|
|
27087
|
+
providerType: ledgerProviderType,
|
|
26992
27088
|
payload: {
|
|
26993
27089
|
event: args.event,
|
|
26994
27090
|
nodeLabel: args.nodeLabel,
|
|
26995
27091
|
taskId: completedTaskForLedger?.id || void 0,
|
|
26996
27092
|
providerSessionId: readNonEmptyString(args.metadataEvent.providerSessionId) || void 0,
|
|
26997
|
-
finalSummary: readNonEmptyString(args.metadataEvent.finalSummary) || void 0
|
|
27093
|
+
finalSummary: readNonEmptyString(args.metadataEvent.finalSummary) || void 0,
|
|
27094
|
+
evidence: completionEvidence
|
|
26998
27095
|
}
|
|
26999
27096
|
});
|
|
27000
27097
|
} catch (e) {
|
|
@@ -27110,7 +27207,14 @@ function handleMeshForwardEvent(components, payload) {
|
|
|
27110
27207
|
targetSessionId: readNonEmptyString(payload.targetSessionId) || readNonEmptyString(payload.sessionId) || readNonEmptyString(payload.instanceId),
|
|
27111
27208
|
providerType: readNonEmptyString(payload.providerType),
|
|
27112
27209
|
providerSessionId: readNonEmptyString(payload.providerSessionId),
|
|
27113
|
-
finalSummary: readNonEmptyString(payload.finalSummary) || readNonEmptyString(payload.summary)
|
|
27210
|
+
finalSummary: readNonEmptyString(payload.finalSummary) || readNonEmptyString(payload.summary),
|
|
27211
|
+
intentional: payload.intentional === true,
|
|
27212
|
+
intentionalStop: payload.intentionalStop === true,
|
|
27213
|
+
operatorCleanup: payload.operatorCleanup === true,
|
|
27214
|
+
reason: readNonEmptyString(payload.reason),
|
|
27215
|
+
stopReason: readNonEmptyString(payload.stopReason),
|
|
27216
|
+
cleanupReason: readNonEmptyString(payload.cleanupReason),
|
|
27217
|
+
source: readNonEmptyString(payload.source)
|
|
27114
27218
|
}
|
|
27115
27219
|
});
|
|
27116
27220
|
}
|
|
@@ -41807,7 +41911,7 @@ async function shutdownDaemonComponents(components) {
|
|
|
41807
41911
|
}
|
|
41808
41912
|
cdpManagers.clear();
|
|
41809
41913
|
}
|
|
41810
|
-
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, DEFAULT_LEDGER_SLICE_LIMIT, MAX_LEDGER_SLICE_LIMIT, 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;
|
|
41914
|
+
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, DEFAULT_LEDGER_SLICE_LIMIT, MAX_LEDGER_SLICE_LIMIT, 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, INTENTIONAL_CLEANUP_STOP_SUPPRESSION_MS, 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;
|
|
41811
41915
|
var init_dist2 = __esm({
|
|
41812
41916
|
"../daemon-core/dist/index.mjs"() {
|
|
41813
41917
|
"use strict";
|
|
@@ -42135,9 +42239,11 @@ Follow these recovery rules:
|
|
|
42135
42239
|
MAX_LEDGER_SLICE_LIMIT: () => MAX_LEDGER_SLICE_LIMIT,
|
|
42136
42240
|
appendLedgerEntry: () => appendLedgerEntry,
|
|
42137
42241
|
appendRemoteLedgerEntries: () => appendRemoteLedgerEntries,
|
|
42242
|
+
buildTaskCompletionEvidence: () => buildTaskCompletionEvidence,
|
|
42138
42243
|
getLedgerDir: () => getLedgerDir,
|
|
42139
42244
|
getLedgerSummary: () => getLedgerSummary,
|
|
42140
42245
|
getSessionRecoveryContext: () => getSessionRecoveryContext,
|
|
42246
|
+
isIntentionalCleanupStopEntry: () => isIntentionalCleanupStopEntry,
|
|
42141
42247
|
meshLedgerEvents: () => meshLedgerEvents,
|
|
42142
42248
|
readLedgerEntries: () => readLedgerEntries,
|
|
42143
42249
|
readLedgerSlice: () => readLedgerSlice
|
|
@@ -42273,6 +42379,7 @@ Follow these recovery rules:
|
|
|
42273
42379
|
"agent:stopped": "task_failed",
|
|
42274
42380
|
"monitor:long_generating": "task_stalled"
|
|
42275
42381
|
};
|
|
42382
|
+
INTENTIONAL_CLEANUP_STOP_SUPPRESSION_MS = 30 * 60 * 1e3;
|
|
42276
42383
|
autoLaunchInProgress = /* @__PURE__ */ new Set();
|
|
42277
42384
|
autoLaunchCooldownUntil = /* @__PURE__ */ new Map();
|
|
42278
42385
|
AUTO_LAUNCH_COOLDOWN_MS = 5e3;
|
|
@@ -53432,6 +53539,27 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
53432
53539
|
isCompletedHostedSession(record2) {
|
|
53433
53540
|
return record2?.lifecycle === "stopped" || record2?.lifecycle === "failed" || record2?.lifecycle === "interrupted";
|
|
53434
53541
|
}
|
|
53542
|
+
async recordIntentionalMeshSessionStop(args) {
|
|
53543
|
+
try {
|
|
53544
|
+
const { appendLedgerEntry: appendLedgerEntry2 } = await Promise.resolve().then(() => (init_mesh_ledger(), mesh_ledger_exports));
|
|
53545
|
+
appendLedgerEntry2(args.meshId, {
|
|
53546
|
+
kind: "session_stopped",
|
|
53547
|
+
nodeId: args.nodeId,
|
|
53548
|
+
sessionId: args.sessionId,
|
|
53549
|
+
payload: {
|
|
53550
|
+
intentional: true,
|
|
53551
|
+
reason: "operator_cleanup",
|
|
53552
|
+
intentionalStopReason: "operator_cleanup",
|
|
53553
|
+
source: args.source,
|
|
53554
|
+
cleanupMode: args.mode,
|
|
53555
|
+
action: args.action,
|
|
53556
|
+
workspace: typeof args.node?.workspace === "string" ? args.node.workspace : void 0
|
|
53557
|
+
}
|
|
53558
|
+
});
|
|
53559
|
+
} catch (e) {
|
|
53560
|
+
LOG.warn("MeshCleanup", `Failed to record intentional cleanup stop for ${args.sessionId}: ${e?.message || e}`);
|
|
53561
|
+
}
|
|
53562
|
+
}
|
|
53435
53563
|
async cleanupMeshSessions(args) {
|
|
53436
53564
|
if (args.mode === "preserve") {
|
|
53437
53565
|
return { success: true, mode: "preserve", matchedCount: 0, stoppedSessionIds: [], deletedSessionIds: [], skippedSessionIds: [] };
|
|
@@ -53448,6 +53576,21 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
53448
53576
|
const deleteUnsupportedSessionIds = [];
|
|
53449
53577
|
const recordsRemainSessionIds = [];
|
|
53450
53578
|
const errors = [];
|
|
53579
|
+
const cleanupSource = args.source || "mesh_cleanup_sessions";
|
|
53580
|
+
const markedIntentionalStopSessionIds = /* @__PURE__ */ new Set();
|
|
53581
|
+
const markIntentionalStop = async (sessionId, action) => {
|
|
53582
|
+
if (args.dryRun || markedIntentionalStopSessionIds.has(sessionId)) return;
|
|
53583
|
+
markedIntentionalStopSessionIds.add(sessionId);
|
|
53584
|
+
await this.recordIntentionalMeshSessionStop({
|
|
53585
|
+
meshId: args.meshId,
|
|
53586
|
+
nodeId: args.nodeId,
|
|
53587
|
+
node: args.node,
|
|
53588
|
+
sessionId,
|
|
53589
|
+
mode: args.mode,
|
|
53590
|
+
source: cleanupSource,
|
|
53591
|
+
action
|
|
53592
|
+
});
|
|
53593
|
+
};
|
|
53451
53594
|
const matchedBySurfaceKind = {
|
|
53452
53595
|
live_runtime: 0,
|
|
53453
53596
|
recovery_snapshot: 0,
|
|
@@ -53470,7 +53613,10 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
53470
53613
|
try {
|
|
53471
53614
|
if (args.mode === "stop") {
|
|
53472
53615
|
if (!completed) {
|
|
53473
|
-
if (!args.dryRun)
|
|
53616
|
+
if (!args.dryRun) {
|
|
53617
|
+
await markIntentionalStop(sessionId, "stop_session");
|
|
53618
|
+
await this.deps.sessionHostControl.stopSession(sessionId);
|
|
53619
|
+
}
|
|
53474
53620
|
stoppedSessionIds.push(sessionId);
|
|
53475
53621
|
} else {
|
|
53476
53622
|
skippedSessionIds.push(sessionId);
|
|
@@ -53487,6 +53633,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
53487
53633
|
continue;
|
|
53488
53634
|
}
|
|
53489
53635
|
if (args.mode === "stop_and_delete") {
|
|
53636
|
+
if (!completed) await markIntentionalStop(sessionId, "delete_session_force");
|
|
53490
53637
|
if (!args.dryRun) await this.deps.sessionHostControl.deleteSession(sessionId, { force: true });
|
|
53491
53638
|
deletedSessionIds.push(sessionId);
|
|
53492
53639
|
continue;
|
|
@@ -53498,6 +53645,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
53498
53645
|
recordsRemainSessionIds.push(sessionId);
|
|
53499
53646
|
if (args.mode === "stop_and_delete" && !completed) {
|
|
53500
53647
|
try {
|
|
53648
|
+
await markIntentionalStop(sessionId, "stop_session");
|
|
53501
53649
|
await this.deps.sessionHostControl.stopSession(sessionId);
|
|
53502
53650
|
stoppedSessionIds.push(sessionId);
|
|
53503
53651
|
} catch (stopError) {
|
|
@@ -54398,7 +54546,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
54398
54546
|
node,
|
|
54399
54547
|
mode,
|
|
54400
54548
|
sessionIds,
|
|
54401
|
-
dryRun: args?.dryRun === true
|
|
54549
|
+
dryRun: args?.dryRun === true,
|
|
54550
|
+
source: "mesh_cleanup_sessions"
|
|
54402
54551
|
});
|
|
54403
54552
|
return result;
|
|
54404
54553
|
} catch (e) {
|
|
@@ -54533,7 +54682,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
54533
54682
|
);
|
|
54534
54683
|
let sessionCleanup;
|
|
54535
54684
|
if (node && sessionCleanupMode !== "preserve") {
|
|
54536
|
-
sessionCleanup = await this.cleanupMeshSessions({ meshId, nodeId, node, mode: sessionCleanupMode });
|
|
54685
|
+
sessionCleanup = await this.cleanupMeshSessions({ meshId, nodeId, node, mode: sessionCleanupMode, source: "mesh_remove_node" });
|
|
54537
54686
|
if (sessionCleanup.success === false) return { success: false, removed: false, sessionCleanup };
|
|
54538
54687
|
}
|
|
54539
54688
|
let worktreeCleanup;
|