@adhdev/daemon-standalone 0.9.77-rc.48 → 0.9.77-rc.49
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 +163 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/mcp-server/index.js +259 -7
- package/vendor/mcp-server/index.js.map +1 -1
package/package.json
CHANGED
|
@@ -25090,6 +25090,7 @@ __export(dist_exports, {
|
|
|
25090
25090
|
IdeProviderInstance: () => IdeProviderInstance,
|
|
25091
25091
|
InMemoryGitSnapshotStore: () => InMemoryGitSnapshotStore,
|
|
25092
25092
|
LOG: () => LOG,
|
|
25093
|
+
MAX_LEDGER_SLICE_LIMIT: () => MAX_LEDGER_SLICE_LIMIT,
|
|
25093
25094
|
MIN_GIT_WORKSPACE_POLL_INTERVAL_MS: () => MIN_GIT_WORKSPACE_POLL_INTERVAL_MS,
|
|
25094
25095
|
MIN_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS: () => MIN_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS,
|
|
25095
25096
|
MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS: () => MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS,
|
|
@@ -25105,12 +25106,15 @@ __export(dist_exports, {
|
|
|
25105
25106
|
addNode: () => addNode,
|
|
25106
25107
|
appendLedgerEntry: () => appendLedgerEntry,
|
|
25107
25108
|
appendRecentActivity: () => appendRecentActivity,
|
|
25109
|
+
appendRemoteLedgerEntries: () => appendRemoteLedgerEntries,
|
|
25108
25110
|
buildAssistantChatMessage: () => buildAssistantChatMessage,
|
|
25109
25111
|
buildChatMessage: () => buildChatMessage,
|
|
25110
25112
|
buildChatMessageSignature: () => buildChatMessageSignature,
|
|
25111
25113
|
buildChatTailDeliverySignature: () => buildChatTailDeliverySignature,
|
|
25112
25114
|
buildCoordinatorSystemPrompt: () => buildCoordinatorSystemPrompt,
|
|
25113
25115
|
buildMachineInfo: () => buildMachineInfo,
|
|
25116
|
+
buildMeshLedgerReconciliationEvidence: () => buildMeshLedgerReconciliationEvidence,
|
|
25117
|
+
buildMeshLedgerReplicaEvidence: () => buildMeshLedgerReplicaEvidence,
|
|
25114
25118
|
buildP2pRelayFailurePayload: () => buildP2pRelayFailurePayload,
|
|
25115
25119
|
buildPinnedGlobalInstallCommand: () => buildPinnedGlobalInstallCommand,
|
|
25116
25120
|
buildRuntimeSystemChatMessage: () => buildRuntimeSystemChatMessage,
|
|
@@ -25233,6 +25237,7 @@ __export(dist_exports, {
|
|
|
25233
25237
|
probeCdpPort: () => probeCdpPort,
|
|
25234
25238
|
readChatHistory: () => readChatHistory,
|
|
25235
25239
|
readLedgerEntries: () => readLedgerEntries,
|
|
25240
|
+
readLedgerSlice: () => readLedgerSlice,
|
|
25236
25241
|
recordDebugTrace: () => recordDebugTrace,
|
|
25237
25242
|
registerExtensionProviders: () => registerExtensionProviders,
|
|
25238
25243
|
removeNode: () => removeNode,
|
|
@@ -25883,15 +25888,49 @@ function appendLedgerEntry(meshId, partial2) {
|
|
|
25883
25888
|
throw new Error(`Failed to append to ledger for mesh ${meshId}: ${e.message}`);
|
|
25884
25889
|
}
|
|
25885
25890
|
}
|
|
25891
|
+
function clampLedgerSliceLimit(limit) {
|
|
25892
|
+
if (typeof limit !== "number" || !Number.isFinite(limit)) return DEFAULT_LEDGER_SLICE_LIMIT;
|
|
25893
|
+
return Math.max(1, Math.min(MAX_LEDGER_SLICE_LIMIT, Math.floor(limit)));
|
|
25894
|
+
}
|
|
25895
|
+
function isValidRemoteLedgerEntry(meshId, value) {
|
|
25896
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
25897
|
+
const entry = value;
|
|
25898
|
+
if (typeof entry.id !== "string" || !entry.id.trim()) return false;
|
|
25899
|
+
if (entry.meshId !== meshId) return false;
|
|
25900
|
+
if (typeof entry.timestamp !== "string" || Number.isNaN(new Date(entry.timestamp).getTime())) return false;
|
|
25901
|
+
if (typeof entry.kind !== "string" || !entry.kind.trim()) return false;
|
|
25902
|
+
if (!entry.payload || typeof entry.payload !== "object" || Array.isArray(entry.payload)) return false;
|
|
25903
|
+
return true;
|
|
25904
|
+
}
|
|
25886
25905
|
function appendRemoteLedgerEntries(meshId, entries) {
|
|
25887
|
-
if (entries.length === 0) return;
|
|
25906
|
+
if (entries.length === 0) return { accepted: 0, skippedDuplicate: 0, rejectedInvalid: 0, entries: [] };
|
|
25888
25907
|
const ledgerPath = getLedgerPath(meshId);
|
|
25889
25908
|
const existing = new Set(readLedgerEntries(meshId).map((e) => e.id));
|
|
25890
|
-
const
|
|
25891
|
-
|
|
25909
|
+
const validEntries = [];
|
|
25910
|
+
let rejectedInvalid = 0;
|
|
25911
|
+
let skippedDuplicate = 0;
|
|
25912
|
+
for (const entry of entries) {
|
|
25913
|
+
if (!isValidRemoteLedgerEntry(meshId, entry)) {
|
|
25914
|
+
rejectedInvalid++;
|
|
25915
|
+
continue;
|
|
25916
|
+
}
|
|
25917
|
+
if (existing.has(entry.id)) {
|
|
25918
|
+
skippedDuplicate++;
|
|
25919
|
+
continue;
|
|
25920
|
+
}
|
|
25921
|
+
existing.add(entry.id);
|
|
25922
|
+
validEntries.push(entry);
|
|
25923
|
+
}
|
|
25924
|
+
if (validEntries.length === 0) {
|
|
25925
|
+
return { accepted: 0, skippedDuplicate, rejectedInvalid, entries: [] };
|
|
25926
|
+
}
|
|
25892
25927
|
try {
|
|
25893
|
-
const lines =
|
|
25928
|
+
const lines = validEntries.map((e) => JSON.stringify(e)).join("\n") + "\n";
|
|
25894
25929
|
(0, import_fs6.appendFileSync)(ledgerPath, lines, { encoding: "utf-8", mode: 384 });
|
|
25930
|
+
for (const entry of validEntries) {
|
|
25931
|
+
meshLedgerEvents.emit("append", meshId, entry);
|
|
25932
|
+
}
|
|
25933
|
+
return { accepted: validEntries.length, skippedDuplicate, rejectedInvalid, entries: validEntries };
|
|
25895
25934
|
} catch (e) {
|
|
25896
25935
|
throw new Error(`Failed to append remote ledger entries for mesh ${meshId}: ${e.message}`);
|
|
25897
25936
|
}
|
|
@@ -25930,6 +25969,34 @@ function readLedgerEntries(meshId, opts) {
|
|
|
25930
25969
|
}
|
|
25931
25970
|
return entries;
|
|
25932
25971
|
}
|
|
25972
|
+
function readLedgerSlice(meshId, opts) {
|
|
25973
|
+
const limit = clampLedgerSliceLimit(opts?.limit);
|
|
25974
|
+
let entries = readLedgerEntries(meshId, { since: opts?.since, kind: opts?.kind });
|
|
25975
|
+
const afterId = typeof opts?.afterId === "string" && opts.afterId.trim() ? opts.afterId.trim() : null;
|
|
25976
|
+
if (afterId) {
|
|
25977
|
+
const index = entries.findIndex((entry) => entry.id === afterId);
|
|
25978
|
+
entries = index >= 0 ? entries.slice(index + 1) : entries;
|
|
25979
|
+
}
|
|
25980
|
+
const bounded = entries.slice(0, limit);
|
|
25981
|
+
return {
|
|
25982
|
+
protocol: "adhdev.mesh.ledger.slice.v1",
|
|
25983
|
+
meshId,
|
|
25984
|
+
entries: bounded,
|
|
25985
|
+
cursor: {
|
|
25986
|
+
afterId,
|
|
25987
|
+
nextAfterId: bounded.length ? bounded[bounded.length - 1].id : afterId,
|
|
25988
|
+
limit,
|
|
25989
|
+
hasMore: entries.length > bounded.length
|
|
25990
|
+
},
|
|
25991
|
+
summary: getLedgerSummary(meshId),
|
|
25992
|
+
sourceOfTruth: {
|
|
25993
|
+
kind: "local_jsonl",
|
|
25994
|
+
path: getLedgerPath(meshId),
|
|
25995
|
+
bounded: true,
|
|
25996
|
+
maxLimit: MAX_LEDGER_SLICE_LIMIT
|
|
25997
|
+
}
|
|
25998
|
+
};
|
|
25999
|
+
}
|
|
25933
26000
|
function getLedgerSummary(meshId) {
|
|
25934
26001
|
const entries = readLedgerEntries(meshId);
|
|
25935
26002
|
const now = Date.now();
|
|
@@ -29180,6 +29247,62 @@ async function syncMeshes(transport) {
|
|
|
29180
29247
|
}
|
|
29181
29248
|
return result;
|
|
29182
29249
|
}
|
|
29250
|
+
function lastTimestamp(slice) {
|
|
29251
|
+
const entries = Array.isArray(slice?.entries) ? slice.entries : [];
|
|
29252
|
+
return entries.length ? entries[entries.length - 1].timestamp : null;
|
|
29253
|
+
}
|
|
29254
|
+
function buildMeshLedgerReplicaEvidence(args) {
|
|
29255
|
+
const entriesReceived = Array.isArray(args.slice?.entries) ? args.slice.entries.length : 0;
|
|
29256
|
+
return {
|
|
29257
|
+
nodeId: args.nodeId,
|
|
29258
|
+
...args.daemonId ? { daemonId: args.daemonId } : {},
|
|
29259
|
+
status: args.status ?? (args.importResult && args.importResult.accepted > 0 ? "imported" : "queried"),
|
|
29260
|
+
transport: args.transport,
|
|
29261
|
+
protocol: "adhdev.mesh.ledger.slice.v1",
|
|
29262
|
+
entriesReceived,
|
|
29263
|
+
entriesImported: args.importResult?.accepted ?? 0,
|
|
29264
|
+
skippedDuplicate: args.importResult?.skippedDuplicate ?? 0,
|
|
29265
|
+
rejectedInvalid: args.importResult?.rejectedInvalid ?? 0,
|
|
29266
|
+
hasMore: args.slice?.cursor?.hasMore === true,
|
|
29267
|
+
nextAfterId: args.slice?.cursor?.nextAfterId ?? null,
|
|
29268
|
+
lastTimestamp: lastTimestamp(args.slice),
|
|
29269
|
+
...args.slice?.summary ? { summary: args.slice.summary } : {},
|
|
29270
|
+
...args.error ? {
|
|
29271
|
+
error: args.error,
|
|
29272
|
+
noFallbackReason: "Ledger reconciliation is P2P/local-first only; Cloud/D1 ledger sync is intentionally disabled."
|
|
29273
|
+
} : {}
|
|
29274
|
+
};
|
|
29275
|
+
}
|
|
29276
|
+
function buildMeshLedgerReconciliationEvidence(meshId, replicas) {
|
|
29277
|
+
const failedNodes = replicas.filter((replica) => replica.status === "failed").map((replica) => replica.nodeId);
|
|
29278
|
+
const pendingNodes = replicas.filter((replica) => replica.hasMore && replica.status !== "failed").map((replica) => replica.nodeId);
|
|
29279
|
+
return {
|
|
29280
|
+
protocol: "adhdev.mesh.ledger.reconciliation.v1",
|
|
29281
|
+
meshId,
|
|
29282
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
29283
|
+
sourceOfTruth: {
|
|
29284
|
+
kind: "coordinator_local_jsonl",
|
|
29285
|
+
p2pOnly: true,
|
|
29286
|
+
cloudD1LedgerSync: false,
|
|
29287
|
+
notes: "Coordinator reconciles bounded slices from daemon-local JSONL ledgers over P2P DataChannel; Cloud/D1 is not a ledger source of truth."
|
|
29288
|
+
},
|
|
29289
|
+
replicas,
|
|
29290
|
+
totals: {
|
|
29291
|
+
replicas: replicas.length,
|
|
29292
|
+
queried: replicas.filter((replica) => replica.status !== "failed").length,
|
|
29293
|
+
failed: failedNodes.length,
|
|
29294
|
+
entriesReceived: replicas.reduce((sum, replica) => sum + replica.entriesReceived, 0),
|
|
29295
|
+
entriesImported: replicas.reduce((sum, replica) => sum + replica.entriesImported, 0),
|
|
29296
|
+
skippedDuplicate: replicas.reduce((sum, replica) => sum + replica.skippedDuplicate, 0),
|
|
29297
|
+
rejectedInvalid: replicas.reduce((sum, replica) => sum + replica.rejectedInvalid, 0)
|
|
29298
|
+
},
|
|
29299
|
+
convergence: {
|
|
29300
|
+
complete: failedNodes.length === 0 && pendingNodes.length === 0,
|
|
29301
|
+
pendingNodes,
|
|
29302
|
+
failedNodes
|
|
29303
|
+
}
|
|
29304
|
+
};
|
|
29305
|
+
}
|
|
29183
29306
|
function messageFromError(error48) {
|
|
29184
29307
|
if (error48 instanceof Error) return error48.message;
|
|
29185
29308
|
if (typeof error48 === "string") return error48;
|
|
@@ -41684,7 +41807,7 @@ async function shutdownDaemonComponents(components) {
|
|
|
41684
41807
|
}
|
|
41685
41808
|
cdpManagers.clear();
|
|
41686
41809
|
}
|
|
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, 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;
|
|
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;
|
|
41688
41811
|
var init_dist2 = __esm({
|
|
41689
41812
|
"../daemon-core/dist/index.mjs"() {
|
|
41690
41813
|
"use strict";
|
|
@@ -42009,13 +42132,15 @@ Follow these recovery rules:
|
|
|
42009
42132
|
});
|
|
42010
42133
|
mesh_ledger_exports = {};
|
|
42011
42134
|
__export2(mesh_ledger_exports, {
|
|
42135
|
+
MAX_LEDGER_SLICE_LIMIT: () => MAX_LEDGER_SLICE_LIMIT,
|
|
42012
42136
|
appendLedgerEntry: () => appendLedgerEntry,
|
|
42013
42137
|
appendRemoteLedgerEntries: () => appendRemoteLedgerEntries,
|
|
42014
42138
|
getLedgerDir: () => getLedgerDir,
|
|
42015
42139
|
getLedgerSummary: () => getLedgerSummary,
|
|
42016
42140
|
getSessionRecoveryContext: () => getSessionRecoveryContext,
|
|
42017
42141
|
meshLedgerEvents: () => meshLedgerEvents,
|
|
42018
|
-
readLedgerEntries: () => readLedgerEntries
|
|
42142
|
+
readLedgerEntries: () => readLedgerEntries,
|
|
42143
|
+
readLedgerSlice: () => readLedgerSlice
|
|
42019
42144
|
});
|
|
42020
42145
|
init_mesh_ledger = __esm2({
|
|
42021
42146
|
"src/mesh/mesh-ledger.ts"() {
|
|
@@ -42024,6 +42149,8 @@ Follow these recovery rules:
|
|
|
42024
42149
|
LEDGER_DIR_NAME = "mesh-ledger";
|
|
42025
42150
|
MAX_FILE_SIZE_BYTES = 10 * 1024 * 1024;
|
|
42026
42151
|
RECENT_FAILURE_WINDOW_MS = 30 * 60 * 1e3;
|
|
42152
|
+
DEFAULT_LEDGER_SLICE_LIMIT = 100;
|
|
42153
|
+
MAX_LEDGER_SLICE_LIMIT = 500;
|
|
42027
42154
|
meshLedgerEvents = new import_events2.EventEmitter();
|
|
42028
42155
|
}
|
|
42029
42156
|
});
|
|
@@ -54125,6 +54252,35 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
54125
54252
|
return { success: false, error: e.message };
|
|
54126
54253
|
}
|
|
54127
54254
|
}
|
|
54255
|
+
case "get_mesh_ledger_slice": {
|
|
54256
|
+
const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
|
|
54257
|
+
if (!meshId) return { success: false, error: "meshId required" };
|
|
54258
|
+
try {
|
|
54259
|
+
const { readLedgerSlice: readLedgerSlice2 } = await Promise.resolve().then(() => (init_mesh_ledger(), mesh_ledger_exports));
|
|
54260
|
+
const kind = Array.isArray(args?.kind) ? args.kind.filter((k) => typeof k === "string") : void 0;
|
|
54261
|
+
const slice = readLedgerSlice2(meshId, {
|
|
54262
|
+
afterId: typeof args?.afterId === "string" ? args.afterId : void 0,
|
|
54263
|
+
since: typeof args?.since === "string" ? args.since : void 0,
|
|
54264
|
+
kind,
|
|
54265
|
+
limit: typeof args?.limit === "number" ? args.limit : void 0
|
|
54266
|
+
});
|
|
54267
|
+
return { success: true, slice };
|
|
54268
|
+
} catch (e) {
|
|
54269
|
+
return { success: false, error: e.message };
|
|
54270
|
+
}
|
|
54271
|
+
}
|
|
54272
|
+
case "import_mesh_ledger_slice": {
|
|
54273
|
+
const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
|
|
54274
|
+
if (!meshId) return { success: false, error: "meshId required" };
|
|
54275
|
+
try {
|
|
54276
|
+
const { appendRemoteLedgerEntries: appendRemoteLedgerEntries2, getLedgerSummary: getLedgerSummary2 } = await Promise.resolve().then(() => (init_mesh_ledger(), mesh_ledger_exports));
|
|
54277
|
+
const entries = Array.isArray(args?.entries) ? args.entries : Array.isArray(args?.slice?.entries) ? args.slice.entries : [];
|
|
54278
|
+
const result = appendRemoteLedgerEntries2(meshId, entries);
|
|
54279
|
+
return { success: true, result, summary: getLedgerSummary2(meshId) };
|
|
54280
|
+
} catch (e) {
|
|
54281
|
+
return { success: false, error: e.message };
|
|
54282
|
+
}
|
|
54283
|
+
}
|
|
54128
54284
|
case "get_mesh_queue": {
|
|
54129
54285
|
const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
|
|
54130
54286
|
if (!meshId) return { success: false, error: "meshId required" };
|
|
@@ -59625,6 +59781,20 @@ var MESH_TASK_HISTORY_TOOL = {
|
|
|
59625
59781
|
}
|
|
59626
59782
|
}
|
|
59627
59783
|
};
|
|
59784
|
+
var MESH_RECONCILE_LEDGER_TOOL = {
|
|
59785
|
+
name: "mesh_reconcile_ledger",
|
|
59786
|
+
description: "Reconcile daemon-local mesh ledgers by querying bounded ledger slices over P2P/DataChannel and importing missing entries into the coordinator local JSONL ledger. Cloud/D1 is not used as a ledger source of truth.",
|
|
59787
|
+
inputSchema: {
|
|
59788
|
+
type: "object",
|
|
59789
|
+
properties: {
|
|
59790
|
+
node_ids: { type: "array", items: { type: "string" }, description: "Optional node IDs to query. Defaults to all mesh nodes." },
|
|
59791
|
+
limit: { type: "number", description: "Bounded slice size per node. Defaults to 100 and is clamped by daemon-core." },
|
|
59792
|
+
after_id: { type: "string", description: "Optional cursor entry ID; remote slices return entries strictly after this ID when present." },
|
|
59793
|
+
since: { type: "string", description: "Optional ISO timestamp lower bound for queried entries." },
|
|
59794
|
+
import_entries: { type: "boolean", description: "When false, query and report evidence without importing remote entries. Defaults true." }
|
|
59795
|
+
}
|
|
59796
|
+
}
|
|
59797
|
+
};
|
|
59628
59798
|
var MESH_REFINE_NODE_TOOL = {
|
|
59629
59799
|
name: "mesh_refine_node",
|
|
59630
59800
|
description: "The Refinery: Automatically validate and merge a completed worktree node back into its base branch. This tool automates the validation gate and merge queue step. It will merge the node's branch into its base branch and cleanly remove the worktree node and its sessions.",
|
|
@@ -59654,7 +59824,8 @@ var ALL_MESH_TOOLS = [
|
|
|
59654
59824
|
MESH_REMOVE_NODE_TOOL,
|
|
59655
59825
|
MESH_REFINE_NODE_TOOL,
|
|
59656
59826
|
MESH_CLEANUP_SESSIONS_TOOL,
|
|
59657
|
-
MESH_TASK_HISTORY_TOOL
|
|
59827
|
+
MESH_TASK_HISTORY_TOOL,
|
|
59828
|
+
MESH_RECONCILE_LEDGER_TOOL
|
|
59658
59829
|
];
|
|
59659
59830
|
async function meshStatus(ctx) {
|
|
59660
59831
|
await refreshMeshFromDaemon(ctx);
|
|
@@ -59789,6 +59960,84 @@ async function meshTaskHistory(ctx, args) {
|
|
|
59789
59960
|
const summary = getLedgerSummary(mesh.id);
|
|
59790
59961
|
return JSON.stringify({ meshId: mesh.id, entries, summary }, null, 2);
|
|
59791
59962
|
}
|
|
59963
|
+
async function meshReconcileLedger(ctx, args) {
|
|
59964
|
+
await refreshMeshFromDaemon(ctx);
|
|
59965
|
+
const requestedNodeIds = Array.isArray(args.node_ids) ? new Set(args.node_ids.map((id) => typeof id === "string" ? id.trim() : "").filter(Boolean)) : null;
|
|
59966
|
+
const nodes = ctx.mesh.nodes.filter((node) => !requestedNodeIds || requestedNodeIds.has(node.id));
|
|
59967
|
+
const replicas = [];
|
|
59968
|
+
const shouldImport = args.import_entries !== false;
|
|
59969
|
+
const queryArgs = {
|
|
59970
|
+
meshId: ctx.mesh.id,
|
|
59971
|
+
...typeof args.limit === "number" ? { limit: args.limit } : {},
|
|
59972
|
+
...typeof args.after_id === "string" && args.after_id.trim() ? { afterId: args.after_id.trim() } : {},
|
|
59973
|
+
...typeof args.since === "string" && args.since.trim() ? { since: args.since.trim() } : {}
|
|
59974
|
+
};
|
|
59975
|
+
for (const node of nodes) {
|
|
59976
|
+
try {
|
|
59977
|
+
if (isLocalControlPlaneNode(ctx, node) || !node.daemonId) {
|
|
59978
|
+
const slice2 = readLedgerSlice(ctx.mesh.id, queryArgs);
|
|
59979
|
+
replicas.push(buildMeshLedgerReplicaEvidence({
|
|
59980
|
+
nodeId: node.id,
|
|
59981
|
+
daemonId: node.daemonId,
|
|
59982
|
+
transport: "local",
|
|
59983
|
+
slice: slice2,
|
|
59984
|
+
status: "local"
|
|
59985
|
+
}));
|
|
59986
|
+
continue;
|
|
59987
|
+
}
|
|
59988
|
+
const result = await commandForNode(ctx, node, "get_mesh_ledger_slice", queryArgs);
|
|
59989
|
+
const payload = unwrapCommandPayload(result);
|
|
59990
|
+
if (payload?.success === false) {
|
|
59991
|
+
throw new Error(payload.error || "remote get_mesh_ledger_slice failed");
|
|
59992
|
+
}
|
|
59993
|
+
const slice = payload?.slice ?? payload;
|
|
59994
|
+
if (slice?.protocol !== "adhdev.mesh.ledger.slice.v1" || !Array.isArray(slice.entries)) {
|
|
59995
|
+
throw new Error("remote daemon returned an invalid ledger slice payload");
|
|
59996
|
+
}
|
|
59997
|
+
const importResult = shouldImport ? appendRemoteLedgerEntries(ctx.mesh.id, slice.entries) : { accepted: 0, skippedDuplicate: 0, rejectedInvalid: 0, entries: [] };
|
|
59998
|
+
replicas.push(buildMeshLedgerReplicaEvidence({
|
|
59999
|
+
nodeId: node.id,
|
|
60000
|
+
daemonId: node.daemonId,
|
|
60001
|
+
transport: "p2p_datachannel",
|
|
60002
|
+
slice,
|
|
60003
|
+
importResult
|
|
60004
|
+
}));
|
|
60005
|
+
if (shouldImport && importResult.accepted > 0) {
|
|
60006
|
+
appendLedgerEntry(ctx.mesh.id, {
|
|
60007
|
+
kind: "ledger_replicated",
|
|
60008
|
+
nodeId: node.id,
|
|
60009
|
+
payload: {
|
|
60010
|
+
protocol: "adhdev.mesh.ledger.slice.v1",
|
|
60011
|
+
imported: importResult.accepted,
|
|
60012
|
+
skippedDuplicate: importResult.skippedDuplicate,
|
|
60013
|
+
rejectedInvalid: importResult.rejectedInvalid,
|
|
60014
|
+
nextAfterId: slice.cursor?.nextAfterId ?? null,
|
|
60015
|
+
via: "p2p_datachannel"
|
|
60016
|
+
}
|
|
60017
|
+
});
|
|
60018
|
+
}
|
|
60019
|
+
} catch (e) {
|
|
60020
|
+
replicas.push(buildMeshLedgerReplicaEvidence({
|
|
60021
|
+
nodeId: node.id,
|
|
60022
|
+
daemonId: node.daemonId,
|
|
60023
|
+
transport: node.daemonId ? "p2p_datachannel" : "local",
|
|
60024
|
+
status: "failed",
|
|
60025
|
+
error: e?.message ?? String(e)
|
|
60026
|
+
}));
|
|
60027
|
+
}
|
|
60028
|
+
}
|
|
60029
|
+
const evidence = buildMeshLedgerReconciliationEvidence(ctx.mesh.id, replicas);
|
|
60030
|
+
appendLedgerEntry(ctx.mesh.id, {
|
|
60031
|
+
kind: "ledger_reconciled",
|
|
60032
|
+
payload: {
|
|
60033
|
+
protocol: evidence.protocol,
|
|
60034
|
+
sourceOfTruth: evidence.sourceOfTruth,
|
|
60035
|
+
totals: evidence.totals,
|
|
60036
|
+
convergence: evidence.convergence
|
|
60037
|
+
}
|
|
60038
|
+
});
|
|
60039
|
+
return JSON.stringify({ success: true, evidence }, null, 2);
|
|
60040
|
+
}
|
|
59792
60041
|
async function meshListNodes(ctx) {
|
|
59793
60042
|
await refreshMeshFromDaemon(ctx);
|
|
59794
60043
|
const { mesh } = ctx;
|
|
@@ -62246,6 +62495,9 @@ async function startMcpServer(opts) {
|
|
|
62246
62495
|
case "mesh_task_history":
|
|
62247
62496
|
text = await meshTaskHistory(meshCtx, a);
|
|
62248
62497
|
break;
|
|
62498
|
+
case "mesh_reconcile_ledger":
|
|
62499
|
+
text = await meshReconcileLedger(meshCtx, a);
|
|
62500
|
+
break;
|
|
62249
62501
|
default:
|
|
62250
62502
|
return { content: [{ type: "text", text: `Unknown tool: ${name}` }], isError: true };
|
|
62251
62503
|
}
|