adhdev 0.9.69 → 0.9.71
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/cli/index.js +146 -25
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +146 -25
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/vendor/mcp-server/index.js +6 -2
- package/vendor/mcp-server/index.js.map +1 -1
package/dist/index.js
CHANGED
|
@@ -8464,7 +8464,8 @@ function buildIdeWorkspaceSession(state, cdpManagers, options) {
|
|
|
8464
8464
|
},
|
|
8465
8465
|
errorMessage: state.errorMessage,
|
|
8466
8466
|
errorReason: state.errorReason,
|
|
8467
|
-
lastUpdated: state.lastUpdated
|
|
8467
|
+
lastUpdated: state.lastUpdated,
|
|
8468
|
+
settings: state.settings
|
|
8468
8469
|
};
|
|
8469
8470
|
}
|
|
8470
8471
|
function buildExtensionAgentSession(parent, ext, options) {
|
|
@@ -8499,7 +8500,8 @@ function buildExtensionAgentSession(parent, ext, options) {
|
|
|
8499
8500
|
},
|
|
8500
8501
|
errorMessage: ext.errorMessage,
|
|
8501
8502
|
errorReason: ext.errorReason,
|
|
8502
|
-
lastUpdated: ext.lastUpdated
|
|
8503
|
+
lastUpdated: ext.lastUpdated,
|
|
8504
|
+
settings: ext.settings
|
|
8503
8505
|
};
|
|
8504
8506
|
}
|
|
8505
8507
|
function shouldIncludeExtensionSession(ext) {
|
|
@@ -8565,7 +8567,8 @@ function buildCliSession(state, options) {
|
|
|
8565
8567
|
},
|
|
8566
8568
|
errorMessage: state.errorMessage,
|
|
8567
8569
|
errorReason: state.errorReason,
|
|
8568
|
-
lastUpdated: state.lastUpdated
|
|
8570
|
+
lastUpdated: state.lastUpdated,
|
|
8571
|
+
settings: state.settings
|
|
8569
8572
|
};
|
|
8570
8573
|
}
|
|
8571
8574
|
function buildAcpSession(state, options) {
|
|
@@ -8599,7 +8602,8 @@ function buildAcpSession(state, options) {
|
|
|
8599
8602
|
},
|
|
8600
8603
|
errorMessage: state.errorMessage,
|
|
8601
8604
|
errorReason: state.errorReason,
|
|
8602
|
-
lastUpdated: state.lastUpdated
|
|
8605
|
+
lastUpdated: state.lastUpdated,
|
|
8606
|
+
settings: state.settings
|
|
8603
8607
|
};
|
|
8604
8608
|
}
|
|
8605
8609
|
function buildSessionEntries(allStates, cdpManagers, options = {}) {
|
|
@@ -9063,6 +9067,8 @@ function getSendChatInputEnvelope(args) {
|
|
|
9063
9067
|
function getHistorySessionId(h, args) {
|
|
9064
9068
|
const explicit = typeof args?.historySessionId === "string" ? args.historySessionId.trim() : "";
|
|
9065
9069
|
if (explicit) return explicit;
|
|
9070
|
+
const explicitProviderSessionId = typeof args?.providerSessionId === "string" ? args.providerSessionId.trim() : "";
|
|
9071
|
+
if (explicitProviderSessionId) return explicitProviderSessionId;
|
|
9066
9072
|
const targetSessionId = typeof args?.targetSessionId === "string" ? args.targetSessionId.trim() : "";
|
|
9067
9073
|
if (!targetSessionId) return void 0;
|
|
9068
9074
|
const instance = h.ctx.instanceManager?.getInstance(targetSessionId);
|
|
@@ -9619,7 +9625,32 @@ async function handleReadChat(h, args) {
|
|
|
9619
9625
|
...coverage ? { coverage } : {}
|
|
9620
9626
|
}, args);
|
|
9621
9627
|
}
|
|
9622
|
-
|
|
9628
|
+
const historyLimit = normalizeReadChatTailLimit(args);
|
|
9629
|
+
try {
|
|
9630
|
+
const agentStr = provider?.type || args?.agentType || getCurrentProviderType(h);
|
|
9631
|
+
const workspace = typeof args?.workspace === "string" ? args.workspace : typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : void 0;
|
|
9632
|
+
const history = readProviderChatHistory(agentStr, {
|
|
9633
|
+
canonicalHistory: provider?.canonicalHistory,
|
|
9634
|
+
historySessionId,
|
|
9635
|
+
workspace,
|
|
9636
|
+
offset: 0,
|
|
9637
|
+
limit: historyLimit,
|
|
9638
|
+
excludeRecentCount: 0,
|
|
9639
|
+
historyBehavior: provider?.historyBehavior,
|
|
9640
|
+
scripts: provider?.scripts
|
|
9641
|
+
});
|
|
9642
|
+
const historyProviderSessionId = typeof history?.providerSessionId === "string" ? history.providerSessionId : historySessionId;
|
|
9643
|
+
return buildReadChatCommandResult({
|
|
9644
|
+
messages: Array.isArray(history?.messages) ? history.messages : [],
|
|
9645
|
+
status: "idle",
|
|
9646
|
+
...typeof history?.title === "string" ? { title: history.title } : {},
|
|
9647
|
+
...historyProviderSessionId ? { providerSessionId: historyProviderSessionId } : {},
|
|
9648
|
+
...provider?.historyBehavior?.transcriptAuthority === "provider" || provider?.historyBehavior?.transcriptAuthority === "daemon" ? { transcriptAuthority: (provider?.historyBehavior).transcriptAuthority } : {},
|
|
9649
|
+
coverage: "tail"
|
|
9650
|
+
}, args);
|
|
9651
|
+
} catch (error48) {
|
|
9652
|
+
return { success: false, error: error48?.message || `${transport} adapter not found` };
|
|
9653
|
+
}
|
|
9623
9654
|
}
|
|
9624
9655
|
if (isExtensionTransport(transport)) {
|
|
9625
9656
|
let extensionReadChatError = "";
|
|
@@ -15410,11 +15441,22 @@ var init_provider_cli_adapter = __esm({
|
|
|
15410
15441
|
}
|
|
15411
15442
|
}
|
|
15412
15443
|
}
|
|
15444
|
+
getParsedDebugState() {
|
|
15445
|
+
if (this.startupParseGate || typeof this.cliScripts?.parseSession !== "function") return null;
|
|
15446
|
+
try {
|
|
15447
|
+
const parsed = this.getScriptParsedStatus();
|
|
15448
|
+
return parsed && typeof parsed === "object" ? parsed : null;
|
|
15449
|
+
} catch {
|
|
15450
|
+
return null;
|
|
15451
|
+
}
|
|
15452
|
+
}
|
|
15413
15453
|
getDebugState() {
|
|
15414
15454
|
const screenText = sanitizeTerminalText(this.terminalScreen.getText());
|
|
15415
15455
|
const startupModal = this.startupParseGate ? this.runParseApproval(this.recentOutputBuffer) : null;
|
|
15416
15456
|
const effectiveStatus = this.projectEffectiveStatus(startupModal);
|
|
15417
15457
|
const effectiveReady = this.ready || !!startupModal;
|
|
15458
|
+
const parsedDebugState = this.getParsedDebugState();
|
|
15459
|
+
const parsedMessages = Array.isArray(parsedDebugState?.messages) ? parsedDebugState.messages : [];
|
|
15418
15460
|
return {
|
|
15419
15461
|
type: this.cliType,
|
|
15420
15462
|
name: this.cliName,
|
|
@@ -15427,8 +15469,18 @@ var init_provider_cli_adapter = __esm({
|
|
|
15427
15469
|
startupParseGate: this.startupParseGate,
|
|
15428
15470
|
spawnAt: this.spawnAt,
|
|
15429
15471
|
workingDir: this.workingDir,
|
|
15430
|
-
messages:
|
|
15431
|
-
messageCount:
|
|
15472
|
+
messages: parsedMessages,
|
|
15473
|
+
messageCount: parsedMessages.length,
|
|
15474
|
+
parsedStatus: parsedDebugState ? {
|
|
15475
|
+
id: parsedDebugState.id,
|
|
15476
|
+
status: parsedDebugState.status,
|
|
15477
|
+
title: parsedDebugState.title,
|
|
15478
|
+
providerSessionId: parsedDebugState.providerSessionId,
|
|
15479
|
+
transcriptAuthority: parsedDebugState.transcriptAuthority,
|
|
15480
|
+
coverage: parsedDebugState.coverage,
|
|
15481
|
+
activeModal: parsedDebugState.activeModal,
|
|
15482
|
+
messageCount: parsedMessages.length
|
|
15483
|
+
} : null,
|
|
15432
15484
|
screenText: screenText.slice(-4e3),
|
|
15433
15485
|
currentTurnScope: this.currentTurnScope,
|
|
15434
15486
|
startupBuffer: this.startupBuffer.slice(-4e3),
|
|
@@ -15762,7 +15814,7 @@ var init_cli_provider_instance = __esm({
|
|
|
15762
15814
|
this.errorMessage = void 0;
|
|
15763
15815
|
this.errorReason = void 0;
|
|
15764
15816
|
}
|
|
15765
|
-
const autoApproveActive = adapterStatus
|
|
15817
|
+
const autoApproveActive = this.maybeAutoApproveStatus(adapterStatus, Date.now());
|
|
15766
15818
|
const visibleStatus = parseErrorMessage ? "error" : autoApproveActive ? "generating" : adapterStatus.status;
|
|
15767
15819
|
const parsedProviderSessionId = normalizeProviderSessionId(
|
|
15768
15820
|
this.provider,
|
|
@@ -15955,12 +16007,8 @@ var init_cli_provider_instance = __esm({
|
|
|
15955
16007
|
}
|
|
15956
16008
|
this.applyProviderResponse(parsed.payload, { phase: "immediate" });
|
|
15957
16009
|
}
|
|
15958
|
-
|
|
15959
|
-
const
|
|
15960
|
-
const adapterStatus = this.adapter.getStatus({ allowParse: false });
|
|
15961
|
-
const parsedStatus = null;
|
|
15962
|
-
const rawStatus = adapterStatus.status;
|
|
15963
|
-
const autoApproveActive = rawStatus === "waiting_approval" && this.shouldAutoApprove();
|
|
16010
|
+
maybeAutoApproveStatus(adapterStatus, now = Date.now()) {
|
|
16011
|
+
const autoApproveActive = adapterStatus?.status === "waiting_approval" && this.shouldAutoApprove();
|
|
15964
16012
|
if (autoApproveActive && !this.autoApproveBusy) {
|
|
15965
16013
|
this.autoApproveBusy = true;
|
|
15966
16014
|
if (this.autoApproveBusyTimer) clearTimeout(this.autoApproveBusyTimer);
|
|
@@ -15968,12 +16016,21 @@ var init_cli_provider_instance = __esm({
|
|
|
15968
16016
|
this.autoApproveBusy = false;
|
|
15969
16017
|
this.autoApproveBusyTimer = null;
|
|
15970
16018
|
}, 2e3);
|
|
15971
|
-
const
|
|
15972
|
-
|
|
16019
|
+
const modal = adapterStatus.activeModal;
|
|
16020
|
+
const { index: buttonIndex, label: buttonLabel } = pickApprovalButton(modal?.buttons, this.provider);
|
|
16021
|
+
this.recordAutoApproval(modal?.message, buttonLabel, now);
|
|
15973
16022
|
setTimeout(() => {
|
|
15974
16023
|
this.adapter.resolveModal(buttonIndex);
|
|
15975
16024
|
}, 0);
|
|
15976
16025
|
}
|
|
16026
|
+
return autoApproveActive;
|
|
16027
|
+
}
|
|
16028
|
+
detectStatusTransition() {
|
|
16029
|
+
const now = Date.now();
|
|
16030
|
+
const adapterStatus = this.adapter.getStatus({ allowParse: false });
|
|
16031
|
+
const parsedStatus = null;
|
|
16032
|
+
const rawStatus = adapterStatus.status;
|
|
16033
|
+
const autoApproveActive = this.maybeAutoApproveStatus(adapterStatus, now);
|
|
15977
16034
|
const newStatus = autoApproveActive ? "generating" : rawStatus;
|
|
15978
16035
|
const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
|
|
15979
16036
|
const chatTitle = `${this.provider.name} \xB7 ${dirName}`;
|
|
@@ -34379,7 +34436,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
34379
34436
|
resolvedDir,
|
|
34380
34437
|
resolvedCliArgs,
|
|
34381
34438
|
resolvedProvider,
|
|
34382
|
-
this.providerLoader.getSettings(normalizedType),
|
|
34439
|
+
{ ...this.providerLoader.getSettings(normalizedType), ...options?.settingsOverride || {} },
|
|
34383
34440
|
false,
|
|
34384
34441
|
{
|
|
34385
34442
|
providerSessionId: sessionBinding.providerSessionId,
|
|
@@ -34633,7 +34690,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
34633
34690
|
dir,
|
|
34634
34691
|
args?.cliArgs,
|
|
34635
34692
|
args?.initialModel,
|
|
34636
|
-
{ resumeSessionId: args?.resumeSessionId }
|
|
34693
|
+
{ resumeSessionId: args?.resumeSessionId, settingsOverride: args?.settings }
|
|
34637
34694
|
);
|
|
34638
34695
|
return {
|
|
34639
34696
|
success: true,
|
|
@@ -40518,11 +40575,16 @@ var init_router = __esm({
|
|
|
40518
40575
|
const cliType = typeof args?.cliType === "string" ? args.cliType.trim() : "claude-cli";
|
|
40519
40576
|
if (!meshId) return { success: false, error: "meshId required" };
|
|
40520
40577
|
try {
|
|
40521
|
-
const { getMesh: getMesh3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
|
|
40522
40578
|
const { buildCoordinatorSystemPrompt: buildCoordinatorSystemPrompt2 } = await Promise.resolve().then(() => (init_coordinator_prompt(), coordinator_prompt_exports));
|
|
40523
|
-
|
|
40579
|
+
let mesh;
|
|
40580
|
+
if (args?.inlineMesh && typeof args.inlineMesh === "object") {
|
|
40581
|
+
mesh = args.inlineMesh;
|
|
40582
|
+
} else {
|
|
40583
|
+
const { getMesh: getMesh3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
|
|
40584
|
+
mesh = getMesh3(meshId);
|
|
40585
|
+
}
|
|
40524
40586
|
if (!mesh) return { success: false, error: "Mesh not found" };
|
|
40525
|
-
if (mesh.nodes.length === 0) return { success: false, error: "No nodes in mesh" };
|
|
40587
|
+
if (!Array.isArray(mesh.nodes) || mesh.nodes.length === 0) return { success: false, error: "No nodes in mesh" };
|
|
40526
40588
|
const workspace = mesh.nodes[0].workspace;
|
|
40527
40589
|
const providerMeta = this.deps.providerLoader.resolve?.(cliType) || this.deps.providerLoader.getMeta(cliType);
|
|
40528
40590
|
const coordinatorSetup = resolveMeshCoordinatorSetup({
|
|
@@ -40590,10 +40652,20 @@ var init_router = __esm({
|
|
|
40590
40652
|
} catch {
|
|
40591
40653
|
systemPrompt = `You are a Repo Mesh Coordinator for "${mesh.name}". Use the adhdev-mesh MCP tools (mesh_status, mesh_list_nodes, mesh_send_task, mesh_read_chat, mesh_launch_session, etc.) to orchestrate work across ${mesh.nodes.length} node(s).`;
|
|
40592
40654
|
}
|
|
40655
|
+
const cliArgs = [];
|
|
40656
|
+
if (systemPrompt) {
|
|
40657
|
+
cliArgs.push("--append-system-prompt", systemPrompt);
|
|
40658
|
+
}
|
|
40659
|
+
if (cliType === "claude-cli") {
|
|
40660
|
+
cliArgs.push("--mcp-config", coordinatorSetup.configPath);
|
|
40661
|
+
}
|
|
40593
40662
|
const launchResult = await this.deps.cliManager.handleCliCommand("launch_cli", {
|
|
40594
40663
|
cliType,
|
|
40595
40664
|
dir: workspace,
|
|
40596
|
-
|
|
40665
|
+
cliArgs: cliArgs.length > 0 ? cliArgs : void 0,
|
|
40666
|
+
settings: {
|
|
40667
|
+
meshCoordinatorFor: meshId
|
|
40668
|
+
}
|
|
40597
40669
|
});
|
|
40598
40670
|
if (!launchResult?.success) {
|
|
40599
40671
|
return { success: false, error: launchResult?.error || "Failed to launch CLI session" };
|
|
@@ -40904,7 +40976,8 @@ var init_reporter = __esm({
|
|
|
40904
40976
|
workspace: session.workspace ?? null,
|
|
40905
40977
|
title: session.title,
|
|
40906
40978
|
cdpConnected: session.cdpConnected,
|
|
40907
|
-
summaryMetadata: session.summaryMetadata
|
|
40979
|
+
summaryMetadata: session.summaryMetadata,
|
|
40980
|
+
settings: session.settings
|
|
40908
40981
|
})),
|
|
40909
40982
|
p2p: payload.p2p,
|
|
40910
40983
|
timestamp: now
|
|
@@ -48484,6 +48557,51 @@ var init_registry = __esm({
|
|
|
48484
48557
|
}
|
|
48485
48558
|
});
|
|
48486
48559
|
|
|
48560
|
+
// ../../oss/packages/daemon-core/src/mesh/mesh-events.ts
|
|
48561
|
+
function setupMeshEventForwarding(components) {
|
|
48562
|
+
components.instanceManager.onEvent((event) => {
|
|
48563
|
+
if (event.event !== "agent:generating_completed" && event.event !== "agent:waiting_approval") return;
|
|
48564
|
+
const instanceId = event.instanceId;
|
|
48565
|
+
if (!instanceId) return;
|
|
48566
|
+
const sourceInstance = components.instanceManager.getInstance(instanceId);
|
|
48567
|
+
if (!sourceInstance || sourceInstance.category !== "cli") return;
|
|
48568
|
+
const state = sourceInstance.getState();
|
|
48569
|
+
const workspace = state.workspace;
|
|
48570
|
+
if (!workspace) return;
|
|
48571
|
+
const mesh = getMeshByRepo(workspace);
|
|
48572
|
+
if (!mesh) return;
|
|
48573
|
+
const allInstances = components.instanceManager.getByCategory("cli");
|
|
48574
|
+
const coordinatorInstances = allInstances.filter((inst) => {
|
|
48575
|
+
const instState = inst.getState();
|
|
48576
|
+
if (instState.settings?.meshCoordinatorFor !== mesh.id) return false;
|
|
48577
|
+
if (instState.instanceId === instanceId) return false;
|
|
48578
|
+
return true;
|
|
48579
|
+
});
|
|
48580
|
+
if (coordinatorInstances.length === 0) return;
|
|
48581
|
+
const targetNode = mesh.nodes.find((n) => n.workspace === workspace);
|
|
48582
|
+
const nodeLabel = targetNode ? `Node '${targetNode.id}'` : `Agent at ${workspace}`;
|
|
48583
|
+
let messageText = "";
|
|
48584
|
+
if (event.event === "agent:generating_completed") {
|
|
48585
|
+
messageText = `[System] ${nodeLabel} has completed its task and is now idle. You may use mesh_read_chat to review its progress.`;
|
|
48586
|
+
} else if (event.event === "agent:waiting_approval") {
|
|
48587
|
+
messageText = `[System] ${nodeLabel} is waiting for approval to proceed. You may use mesh_read_chat and mesh_approve to handle it.`;
|
|
48588
|
+
}
|
|
48589
|
+
if (!messageText) return;
|
|
48590
|
+
for (const coord of coordinatorInstances) {
|
|
48591
|
+
const coordState = coord.getState();
|
|
48592
|
+
LOG.info("MeshEvents", `Forwarding event from ${workspace} to coordinator ${coordState.instanceId}`);
|
|
48593
|
+
coord.onEvent("send_message", { input: { text: messageText, textFallback: messageText } });
|
|
48594
|
+
}
|
|
48595
|
+
});
|
|
48596
|
+
}
|
|
48597
|
+
var init_mesh_events = __esm({
|
|
48598
|
+
"../../oss/packages/daemon-core/src/mesh/mesh-events.ts"() {
|
|
48599
|
+
"use strict";
|
|
48600
|
+
init_mesh_config();
|
|
48601
|
+
init_logger();
|
|
48602
|
+
}
|
|
48603
|
+
});
|
|
48604
|
+
|
|
48487
48605
|
// ../../oss/packages/daemon-core/src/boot/daemon-lifecycle.ts
|
|
48488
48606
|
async function initDaemonComponents(config2) {
|
|
48489
48607
|
installGlobalInterceptor();
|
|
@@ -48642,7 +48760,7 @@ async function initDaemonComponents(config2) {
|
|
|
48642
48760
|
});
|
|
48643
48761
|
poller.start();
|
|
48644
48762
|
instanceManager.startTicking(config2.tickIntervalMs ?? 5e3);
|
|
48645
|
-
|
|
48763
|
+
const components = {
|
|
48646
48764
|
providerLoader,
|
|
48647
48765
|
instanceManager,
|
|
48648
48766
|
cliManager,
|
|
@@ -48656,6 +48774,8 @@ async function initDaemonComponents(config2) {
|
|
|
48656
48774
|
detectedIdes: detectedIdesRef,
|
|
48657
48775
|
refreshProviderAvailability
|
|
48658
48776
|
};
|
|
48777
|
+
setupMeshEventForwarding(components);
|
|
48778
|
+
return components;
|
|
48659
48779
|
}
|
|
48660
48780
|
async function startDaemonDevSupport(options) {
|
|
48661
48781
|
const devServer = new DevServer({
|
|
@@ -48731,6 +48851,7 @@ var init_daemon_lifecycle = __esm({
|
|
|
48731
48851
|
init_runtime_defaults();
|
|
48732
48852
|
init_config();
|
|
48733
48853
|
init_git_commands();
|
|
48854
|
+
init_mesh_events();
|
|
48734
48855
|
}
|
|
48735
48856
|
});
|
|
48736
48857
|
|
|
@@ -58915,7 +59036,7 @@ var init_adhdev_daemon = __esm({
|
|
|
58915
59036
|
init_version();
|
|
58916
59037
|
init_src();
|
|
58917
59038
|
init_runtime_defaults();
|
|
58918
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.
|
|
59039
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.71" });
|
|
58919
59040
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
58920
59041
|
localHttpServer = null;
|
|
58921
59042
|
localWss = null;
|