@adhdev/daemon-core 0.9.82-rc.227 → 0.9.82-rc.229
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 +64 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +64 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/commands/chat-commands.ts +11 -5
- package/src/commands/router.ts +43 -2
- package/src/mesh/mesh-events-coordinator.ts +29 -5
- package/src/status/builders.ts +3 -1
package/dist/index.mjs
CHANGED
|
@@ -6854,7 +6854,7 @@ function markAutoLaunch(meshId, taskId, args) {
|
|
|
6854
6854
|
error: args.error
|
|
6855
6855
|
});
|
|
6856
6856
|
}
|
|
6857
|
-
async function resolveUsableProvider(components, nodeId, node) {
|
|
6857
|
+
async function resolveUsableProvider(components, nodeId, node, requiredTags) {
|
|
6858
6858
|
const providerPriority = normalizeProviderPriority(node?.policy);
|
|
6859
6859
|
if (!providerPriority.length) return { reason: "missing_provider_priority" };
|
|
6860
6860
|
const providerLoader = components.providerLoader;
|
|
@@ -6862,6 +6862,10 @@ async function resolveUsableProvider(components, nodeId, node) {
|
|
|
6862
6862
|
const failed = [];
|
|
6863
6863
|
for (const requestedType of providerPriority) {
|
|
6864
6864
|
const normalizedType = typeof providerLoader.resolveAlias === "function" ? providerLoader.resolveAlias(requestedType) : requestedType;
|
|
6865
|
+
if (requiredTags?.length && !nodeSatisfiesRequiredTags(requiredTags, buildMeshNodeCapabilityTags(node, normalizedType))) {
|
|
6866
|
+
failed.push(`${requestedType}: required_tags_mismatch`);
|
|
6867
|
+
continue;
|
|
6868
|
+
}
|
|
6865
6869
|
if (typeof providerLoader.isMachineProviderEnabled === "function" && !providerLoader.isMachineProviderEnabled(normalizedType)) {
|
|
6866
6870
|
failed.push(`${requestedType}: disabled`);
|
|
6867
6871
|
continue;
|
|
@@ -6900,9 +6904,19 @@ async function maybeAutoLaunchOneQueueSession(components, meshId, mesh) {
|
|
|
6900
6904
|
markAutoLaunch(meshId, task.id, { status: "skipped", reason: "target_session_constraint" });
|
|
6901
6905
|
continue;
|
|
6902
6906
|
}
|
|
6903
|
-
const candidateNodes = Array.isArray(mesh?.nodes) ? mesh.nodes.filter((node) =>
|
|
6907
|
+
const candidateNodes = Array.isArray(mesh?.nodes) ? mesh.nodes.filter((node) => {
|
|
6908
|
+
if (task.targetNodeId && node?.id !== task.targetNodeId) return false;
|
|
6909
|
+
if (task.requiredTags?.length) {
|
|
6910
|
+
const priorities = normalizeProviderPriority(node?.policy);
|
|
6911
|
+
const providerCandidates = priorities.length ? priorities : [void 0];
|
|
6912
|
+
return providerCandidates.some(
|
|
6913
|
+
(p) => nodeSatisfiesRequiredTags(task.requiredTags, buildMeshNodeCapabilityTags(node, p))
|
|
6914
|
+
);
|
|
6915
|
+
}
|
|
6916
|
+
return true;
|
|
6917
|
+
}) : [];
|
|
6904
6918
|
if (!candidateNodes.length) {
|
|
6905
|
-
markAutoLaunch(meshId, task.id, { status: "skipped", reason: "
|
|
6919
|
+
markAutoLaunch(meshId, task.id, { status: "skipped", reason: "no_node_satisfies_required_tags", nodeId: task.targetNodeId });
|
|
6906
6920
|
continue;
|
|
6907
6921
|
}
|
|
6908
6922
|
for (const node of candidateNodes) {
|
|
@@ -6944,7 +6958,7 @@ async function maybeAutoLaunchOneQueueSession(components, meshId, mesh) {
|
|
|
6944
6958
|
}
|
|
6945
6959
|
autoLaunchInProgress.add(launchKey);
|
|
6946
6960
|
try {
|
|
6947
|
-
const resolved = await resolveUsableProvider(components, nodeId, node);
|
|
6961
|
+
const resolved = await resolveUsableProvider(components, nodeId, node, task.requiredTags);
|
|
6948
6962
|
if (!resolved.providerType) {
|
|
6949
6963
|
markAutoLaunch(meshId, task.id, { status: "skipped", reason: resolved.reason || "provider_unusable", nodeId });
|
|
6950
6964
|
continue;
|
|
@@ -22436,7 +22450,7 @@ function buildCliSession(state, options) {
|
|
|
22436
22450
|
mode: state.mode,
|
|
22437
22451
|
resume: state.resume,
|
|
22438
22452
|
activeChat,
|
|
22439
|
-
|
|
22453
|
+
activeInteractivePrompt: state.activeInteractivePrompt ?? null,
|
|
22440
22454
|
...summaryMetadata && { summaryMetadata },
|
|
22441
22455
|
...includeSessionMetadata && {
|
|
22442
22456
|
capabilities: state.mode === "terminal" ? PTY_SESSION_CAPABILITIES : CLI_CHAT_SESSION_CAPABILITIES,
|
|
@@ -22451,7 +22465,8 @@ function buildCliSession(state, options) {
|
|
|
22451
22465
|
lastUpdated: state.lastUpdated,
|
|
22452
22466
|
settings: state.settings,
|
|
22453
22467
|
...coordinator && { coordinator },
|
|
22454
|
-
...meshQueueStats && { meshQueueStats }
|
|
22468
|
+
...meshQueueStats && { meshQueueStats },
|
|
22469
|
+
...state.settings?.spawnedSessionVisibility === "hidden" && { surfaceHidden: true }
|
|
22455
22470
|
};
|
|
22456
22471
|
}
|
|
22457
22472
|
function buildAcpSession(state, options) {
|
|
@@ -22491,7 +22506,8 @@ function buildAcpSession(state, options) {
|
|
|
22491
22506
|
lastUpdated: state.lastUpdated,
|
|
22492
22507
|
settings: state.settings,
|
|
22493
22508
|
...coordinator && { coordinator },
|
|
22494
|
-
...meshQueueStats && { meshQueueStats }
|
|
22509
|
+
...meshQueueStats && { meshQueueStats },
|
|
22510
|
+
...state.settings?.spawnedSessionVisibility === "hidden" && { surfaceHidden: true }
|
|
22495
22511
|
};
|
|
22496
22512
|
}
|
|
22497
22513
|
function buildSessionEntries(allStates, cdpManagers, options = {}) {
|
|
@@ -24796,8 +24812,10 @@ async function handleReadChat(h, args) {
|
|
|
24796
24812
|
const agentStr = provider?.type || args?.agentType || getCurrentProviderType(h);
|
|
24797
24813
|
const targetSid = typeof args?.targetSessionId === "string" ? args.targetSessionId.trim() : "";
|
|
24798
24814
|
const registrySessionWorkspace = targetSid ? h.ctx?.sessionRegistry?.get?.(targetSid)?.workspace : void 0;
|
|
24799
|
-
const
|
|
24800
|
-
const
|
|
24815
|
+
const currentSessionWorkspace = typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : void 0;
|
|
24816
|
+
const argsWorkspace = typeof args?.workspace === "string" ? args.workspace : void 0;
|
|
24817
|
+
const workspace = targetSid ? typeof registrySessionWorkspace === "string" ? registrySessionWorkspace : argsWorkspace ?? currentSessionWorkspace : typeof currentSessionWorkspace === "string" ? currentSessionWorkspace : void 0;
|
|
24818
|
+
const intendedWorkspace = argsWorkspace;
|
|
24801
24819
|
const supportsNative = supportsCliNativeTranscript(agentStr, provider) && isNativeSourceCanonicalHistory(provider?.nativeHistory);
|
|
24802
24820
|
const history = supportsNative ? readCliProviderNativeHistory(agentStr, {
|
|
24803
24821
|
canonicalHistory: provider?.nativeHistory,
|
|
@@ -43466,14 +43484,27 @@ ${tail}` : ""
|
|
|
43466
43484
|
const nodeId = typeof args?.nodeId === "string" ? args.nodeId.trim() : "";
|
|
43467
43485
|
let workspace = typeof args?.workspace === "string" ? args.workspace.trim() : "";
|
|
43468
43486
|
let submoduleIgnorePaths = Array.isArray(args?.submoduleIgnorePaths) ? args.submoduleIgnorePaths.filter((value) => typeof value === "string") : void 0;
|
|
43469
|
-
|
|
43487
|
+
let nodeDaemonId;
|
|
43488
|
+
if (meshId && nodeId) {
|
|
43470
43489
|
const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh);
|
|
43471
43490
|
const mesh = meshRecord?.mesh;
|
|
43472
43491
|
const node = mesh?.nodes?.find((n) => n.id === nodeId || n.nodeId === nodeId);
|
|
43473
|
-
|
|
43492
|
+
if (!workspace) {
|
|
43493
|
+
workspace = typeof node?.workspace === "string" ? node.workspace.trim() : "";
|
|
43494
|
+
}
|
|
43474
43495
|
if (!submoduleIgnorePaths && Array.isArray(node?.policy?.submoduleIgnorePaths)) {
|
|
43475
43496
|
submoduleIgnorePaths = node.policy.submoduleIgnorePaths.filter((value) => typeof value === "string");
|
|
43476
43497
|
}
|
|
43498
|
+
nodeDaemonId = typeof node?.daemonId === "string" ? node.daemonId.trim() : void 0;
|
|
43499
|
+
}
|
|
43500
|
+
const selfDaemonId = this.deps.statusInstanceId;
|
|
43501
|
+
const isRemote = nodeDaemonId && selfDaemonId && nodeDaemonId !== selfDaemonId;
|
|
43502
|
+
if (isRemote && this.deps.dispatchMeshCommand) {
|
|
43503
|
+
const forwarded = await this.deps.dispatchMeshCommand(nodeDaemonId, "fast_forward_mesh_node", {
|
|
43504
|
+
...typeof args === "object" && args !== null ? args : {},
|
|
43505
|
+
workspace
|
|
43506
|
+
});
|
|
43507
|
+
return forwarded ?? { success: false, error: "no response from remote node" };
|
|
43477
43508
|
}
|
|
43478
43509
|
const result = await fastForwardMeshNode({
|
|
43479
43510
|
meshId: meshId || void 0,
|
|
@@ -43511,6 +43542,14 @@ ${tail}` : ""
|
|
|
43511
43542
|
}
|
|
43512
43543
|
let worktreeCleanup;
|
|
43513
43544
|
if (node?.isLocalWorktree) {
|
|
43545
|
+
const nodeDaemonId = typeof node.daemonId === "string" ? node.daemonId.trim() : void 0;
|
|
43546
|
+
const isRemoteWorktree = nodeDaemonId && nodeDaemonId !== this.deps.statusInstanceId && this.deps.dispatchMeshCommand;
|
|
43547
|
+
if (isRemoteWorktree) {
|
|
43548
|
+
const forwarded = await this.deps.dispatchMeshCommand(nodeDaemonId, "remove_mesh_node", {
|
|
43549
|
+
...typeof args === "object" && args !== null ? args : {}
|
|
43550
|
+
});
|
|
43551
|
+
return forwarded ?? { success: false, error: "no response from remote node" };
|
|
43552
|
+
}
|
|
43514
43553
|
const cleanupResult = await this.cleanupLocalWorktreeNode({ mesh, node, nodeId, force: args?.force === true });
|
|
43515
43554
|
if (cleanupResult.success === false) {
|
|
43516
43555
|
return {
|
|
@@ -43577,6 +43616,13 @@ ${tail}` : ""
|
|
|
43577
43616
|
if (!mesh) return { success: false, error: "Mesh not found" };
|
|
43578
43617
|
const sourceNode = mesh.nodes?.find((n) => n.id === sourceNodeId || n.nodeId === sourceNodeId);
|
|
43579
43618
|
if (!sourceNode) return { success: false, error: `Source node '${sourceNodeId}' not found in mesh` };
|
|
43619
|
+
const sourceDaemonId = typeof sourceNode.daemonId === "string" ? sourceNode.daemonId.trim() : void 0;
|
|
43620
|
+
if (sourceDaemonId && sourceDaemonId !== this.deps.statusInstanceId && this.deps.dispatchMeshCommand) {
|
|
43621
|
+
const forwarded = await this.deps.dispatchMeshCommand(sourceDaemonId, "clone_mesh_node", {
|
|
43622
|
+
...typeof args === "object" && args !== null ? args : {}
|
|
43623
|
+
});
|
|
43624
|
+
return forwarded ?? { success: false, error: "no response from remote node" };
|
|
43625
|
+
}
|
|
43580
43626
|
const repoRoot = sourceNode.repoRoot || sourceNode.workspace;
|
|
43581
43627
|
const { createWorktree: createWorktree2 } = await Promise.resolve().then(() => (init_git_worktree(), git_worktree_exports));
|
|
43582
43628
|
const result = await createWorktree2({
|
|
@@ -43809,6 +43855,13 @@ ${tail}` : ""
|
|
|
43809
43855
|
const node = mesh.nodes?.find((n) => n.id === nodeId || n.nodeId === nodeId);
|
|
43810
43856
|
if (!node) return { success: false, error: `Node '${nodeId}' not found in mesh` };
|
|
43811
43857
|
if (!node.isLocalWorktree) return { success: false, error: "Node is not a local worktree node" };
|
|
43858
|
+
const nodeDaemonId = typeof node.daemonId === "string" ? node.daemonId.trim() : void 0;
|
|
43859
|
+
if (nodeDaemonId && nodeDaemonId !== this.deps.statusInstanceId && this.deps.dispatchMeshCommand) {
|
|
43860
|
+
const forwarded = await this.deps.dispatchMeshCommand(nodeDaemonId, "retry_mesh_node_bootstrap", {
|
|
43861
|
+
...typeof args === "object" && args !== null ? args : {}
|
|
43862
|
+
});
|
|
43863
|
+
return forwarded ?? { success: false, error: "no response from remote node" };
|
|
43864
|
+
}
|
|
43812
43865
|
const currentBootstrap = node.worktreeBootstrap;
|
|
43813
43866
|
if (currentBootstrap?.status === "running") {
|
|
43814
43867
|
return { success: false, error: "Bootstrap is already running for this node" };
|