@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.js
CHANGED
|
@@ -6860,7 +6860,7 @@ function markAutoLaunch(meshId, taskId, args) {
|
|
|
6860
6860
|
error: args.error
|
|
6861
6861
|
});
|
|
6862
6862
|
}
|
|
6863
|
-
async function resolveUsableProvider(components, nodeId, node) {
|
|
6863
|
+
async function resolveUsableProvider(components, nodeId, node, requiredTags) {
|
|
6864
6864
|
const providerPriority = normalizeProviderPriority(node?.policy);
|
|
6865
6865
|
if (!providerPriority.length) return { reason: "missing_provider_priority" };
|
|
6866
6866
|
const providerLoader = components.providerLoader;
|
|
@@ -6868,6 +6868,10 @@ async function resolveUsableProvider(components, nodeId, node) {
|
|
|
6868
6868
|
const failed = [];
|
|
6869
6869
|
for (const requestedType of providerPriority) {
|
|
6870
6870
|
const normalizedType = typeof providerLoader.resolveAlias === "function" ? providerLoader.resolveAlias(requestedType) : requestedType;
|
|
6871
|
+
if (requiredTags?.length && !nodeSatisfiesRequiredTags(requiredTags, buildMeshNodeCapabilityTags(node, normalizedType))) {
|
|
6872
|
+
failed.push(`${requestedType}: required_tags_mismatch`);
|
|
6873
|
+
continue;
|
|
6874
|
+
}
|
|
6871
6875
|
if (typeof providerLoader.isMachineProviderEnabled === "function" && !providerLoader.isMachineProviderEnabled(normalizedType)) {
|
|
6872
6876
|
failed.push(`${requestedType}: disabled`);
|
|
6873
6877
|
continue;
|
|
@@ -6906,9 +6910,19 @@ async function maybeAutoLaunchOneQueueSession(components, meshId, mesh) {
|
|
|
6906
6910
|
markAutoLaunch(meshId, task.id, { status: "skipped", reason: "target_session_constraint" });
|
|
6907
6911
|
continue;
|
|
6908
6912
|
}
|
|
6909
|
-
const candidateNodes = Array.isArray(mesh?.nodes) ? mesh.nodes.filter((node) =>
|
|
6913
|
+
const candidateNodes = Array.isArray(mesh?.nodes) ? mesh.nodes.filter((node) => {
|
|
6914
|
+
if (task.targetNodeId && node?.id !== task.targetNodeId) return false;
|
|
6915
|
+
if (task.requiredTags?.length) {
|
|
6916
|
+
const priorities = normalizeProviderPriority(node?.policy);
|
|
6917
|
+
const providerCandidates = priorities.length ? priorities : [void 0];
|
|
6918
|
+
return providerCandidates.some(
|
|
6919
|
+
(p) => nodeSatisfiesRequiredTags(task.requiredTags, buildMeshNodeCapabilityTags(node, p))
|
|
6920
|
+
);
|
|
6921
|
+
}
|
|
6922
|
+
return true;
|
|
6923
|
+
}) : [];
|
|
6910
6924
|
if (!candidateNodes.length) {
|
|
6911
|
-
markAutoLaunch(meshId, task.id, { status: "skipped", reason: "
|
|
6925
|
+
markAutoLaunch(meshId, task.id, { status: "skipped", reason: "no_node_satisfies_required_tags", nodeId: task.targetNodeId });
|
|
6912
6926
|
continue;
|
|
6913
6927
|
}
|
|
6914
6928
|
for (const node of candidateNodes) {
|
|
@@ -6950,7 +6964,7 @@ async function maybeAutoLaunchOneQueueSession(components, meshId, mesh) {
|
|
|
6950
6964
|
}
|
|
6951
6965
|
autoLaunchInProgress.add(launchKey);
|
|
6952
6966
|
try {
|
|
6953
|
-
const resolved = await resolveUsableProvider(components, nodeId, node);
|
|
6967
|
+
const resolved = await resolveUsableProvider(components, nodeId, node, task.requiredTags);
|
|
6954
6968
|
if (!resolved.providerType) {
|
|
6955
6969
|
markAutoLaunch(meshId, task.id, { status: "skipped", reason: resolved.reason || "provider_unusable", nodeId });
|
|
6956
6970
|
continue;
|
|
@@ -22768,7 +22782,7 @@ function buildCliSession(state, options) {
|
|
|
22768
22782
|
mode: state.mode,
|
|
22769
22783
|
resume: state.resume,
|
|
22770
22784
|
activeChat,
|
|
22771
|
-
|
|
22785
|
+
activeInteractivePrompt: state.activeInteractivePrompt ?? null,
|
|
22772
22786
|
...summaryMetadata && { summaryMetadata },
|
|
22773
22787
|
...includeSessionMetadata && {
|
|
22774
22788
|
capabilities: state.mode === "terminal" ? PTY_SESSION_CAPABILITIES : CLI_CHAT_SESSION_CAPABILITIES,
|
|
@@ -22783,7 +22797,8 @@ function buildCliSession(state, options) {
|
|
|
22783
22797
|
lastUpdated: state.lastUpdated,
|
|
22784
22798
|
settings: state.settings,
|
|
22785
22799
|
...coordinator && { coordinator },
|
|
22786
|
-
...meshQueueStats && { meshQueueStats }
|
|
22800
|
+
...meshQueueStats && { meshQueueStats },
|
|
22801
|
+
...state.settings?.spawnedSessionVisibility === "hidden" && { surfaceHidden: true }
|
|
22787
22802
|
};
|
|
22788
22803
|
}
|
|
22789
22804
|
function buildAcpSession(state, options) {
|
|
@@ -22823,7 +22838,8 @@ function buildAcpSession(state, options) {
|
|
|
22823
22838
|
lastUpdated: state.lastUpdated,
|
|
22824
22839
|
settings: state.settings,
|
|
22825
22840
|
...coordinator && { coordinator },
|
|
22826
|
-
...meshQueueStats && { meshQueueStats }
|
|
22841
|
+
...meshQueueStats && { meshQueueStats },
|
|
22842
|
+
...state.settings?.spawnedSessionVisibility === "hidden" && { surfaceHidden: true }
|
|
22827
22843
|
};
|
|
22828
22844
|
}
|
|
22829
22845
|
function buildSessionEntries(allStates, cdpManagers, options = {}) {
|
|
@@ -25128,8 +25144,10 @@ async function handleReadChat(h, args) {
|
|
|
25128
25144
|
const agentStr = provider?.type || args?.agentType || getCurrentProviderType(h);
|
|
25129
25145
|
const targetSid = typeof args?.targetSessionId === "string" ? args.targetSessionId.trim() : "";
|
|
25130
25146
|
const registrySessionWorkspace = targetSid ? h.ctx?.sessionRegistry?.get?.(targetSid)?.workspace : void 0;
|
|
25131
|
-
const
|
|
25132
|
-
const
|
|
25147
|
+
const currentSessionWorkspace = typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : void 0;
|
|
25148
|
+
const argsWorkspace = typeof args?.workspace === "string" ? args.workspace : void 0;
|
|
25149
|
+
const workspace = targetSid ? typeof registrySessionWorkspace === "string" ? registrySessionWorkspace : argsWorkspace ?? currentSessionWorkspace : typeof currentSessionWorkspace === "string" ? currentSessionWorkspace : void 0;
|
|
25150
|
+
const intendedWorkspace = argsWorkspace;
|
|
25133
25151
|
const supportsNative = supportsCliNativeTranscript(agentStr, provider) && isNativeSourceCanonicalHistory(provider?.nativeHistory);
|
|
25134
25152
|
const history = supportsNative ? readCliProviderNativeHistory(agentStr, {
|
|
25135
25153
|
canonicalHistory: provider?.nativeHistory,
|
|
@@ -43793,14 +43811,27 @@ ${tail}` : ""
|
|
|
43793
43811
|
const nodeId = typeof args?.nodeId === "string" ? args.nodeId.trim() : "";
|
|
43794
43812
|
let workspace = typeof args?.workspace === "string" ? args.workspace.trim() : "";
|
|
43795
43813
|
let submoduleIgnorePaths = Array.isArray(args?.submoduleIgnorePaths) ? args.submoduleIgnorePaths.filter((value) => typeof value === "string") : void 0;
|
|
43796
|
-
|
|
43814
|
+
let nodeDaemonId;
|
|
43815
|
+
if (meshId && nodeId) {
|
|
43797
43816
|
const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh);
|
|
43798
43817
|
const mesh = meshRecord?.mesh;
|
|
43799
43818
|
const node = mesh?.nodes?.find((n) => n.id === nodeId || n.nodeId === nodeId);
|
|
43800
|
-
|
|
43819
|
+
if (!workspace) {
|
|
43820
|
+
workspace = typeof node?.workspace === "string" ? node.workspace.trim() : "";
|
|
43821
|
+
}
|
|
43801
43822
|
if (!submoduleIgnorePaths && Array.isArray(node?.policy?.submoduleIgnorePaths)) {
|
|
43802
43823
|
submoduleIgnorePaths = node.policy.submoduleIgnorePaths.filter((value) => typeof value === "string");
|
|
43803
43824
|
}
|
|
43825
|
+
nodeDaemonId = typeof node?.daemonId === "string" ? node.daemonId.trim() : void 0;
|
|
43826
|
+
}
|
|
43827
|
+
const selfDaemonId = this.deps.statusInstanceId;
|
|
43828
|
+
const isRemote = nodeDaemonId && selfDaemonId && nodeDaemonId !== selfDaemonId;
|
|
43829
|
+
if (isRemote && this.deps.dispatchMeshCommand) {
|
|
43830
|
+
const forwarded = await this.deps.dispatchMeshCommand(nodeDaemonId, "fast_forward_mesh_node", {
|
|
43831
|
+
...typeof args === "object" && args !== null ? args : {},
|
|
43832
|
+
workspace
|
|
43833
|
+
});
|
|
43834
|
+
return forwarded ?? { success: false, error: "no response from remote node" };
|
|
43804
43835
|
}
|
|
43805
43836
|
const result = await fastForwardMeshNode({
|
|
43806
43837
|
meshId: meshId || void 0,
|
|
@@ -43838,6 +43869,14 @@ ${tail}` : ""
|
|
|
43838
43869
|
}
|
|
43839
43870
|
let worktreeCleanup;
|
|
43840
43871
|
if (node?.isLocalWorktree) {
|
|
43872
|
+
const nodeDaemonId = typeof node.daemonId === "string" ? node.daemonId.trim() : void 0;
|
|
43873
|
+
const isRemoteWorktree = nodeDaemonId && nodeDaemonId !== this.deps.statusInstanceId && this.deps.dispatchMeshCommand;
|
|
43874
|
+
if (isRemoteWorktree) {
|
|
43875
|
+
const forwarded = await this.deps.dispatchMeshCommand(nodeDaemonId, "remove_mesh_node", {
|
|
43876
|
+
...typeof args === "object" && args !== null ? args : {}
|
|
43877
|
+
});
|
|
43878
|
+
return forwarded ?? { success: false, error: "no response from remote node" };
|
|
43879
|
+
}
|
|
43841
43880
|
const cleanupResult = await this.cleanupLocalWorktreeNode({ mesh, node, nodeId, force: args?.force === true });
|
|
43842
43881
|
if (cleanupResult.success === false) {
|
|
43843
43882
|
return {
|
|
@@ -43904,6 +43943,13 @@ ${tail}` : ""
|
|
|
43904
43943
|
if (!mesh) return { success: false, error: "Mesh not found" };
|
|
43905
43944
|
const sourceNode = mesh.nodes?.find((n) => n.id === sourceNodeId || n.nodeId === sourceNodeId);
|
|
43906
43945
|
if (!sourceNode) return { success: false, error: `Source node '${sourceNodeId}' not found in mesh` };
|
|
43946
|
+
const sourceDaemonId = typeof sourceNode.daemonId === "string" ? sourceNode.daemonId.trim() : void 0;
|
|
43947
|
+
if (sourceDaemonId && sourceDaemonId !== this.deps.statusInstanceId && this.deps.dispatchMeshCommand) {
|
|
43948
|
+
const forwarded = await this.deps.dispatchMeshCommand(sourceDaemonId, "clone_mesh_node", {
|
|
43949
|
+
...typeof args === "object" && args !== null ? args : {}
|
|
43950
|
+
});
|
|
43951
|
+
return forwarded ?? { success: false, error: "no response from remote node" };
|
|
43952
|
+
}
|
|
43907
43953
|
const repoRoot = sourceNode.repoRoot || sourceNode.workspace;
|
|
43908
43954
|
const { createWorktree: createWorktree2 } = await Promise.resolve().then(() => (init_git_worktree(), git_worktree_exports));
|
|
43909
43955
|
const result = await createWorktree2({
|
|
@@ -44136,6 +44182,13 @@ ${tail}` : ""
|
|
|
44136
44182
|
const node = mesh.nodes?.find((n) => n.id === nodeId || n.nodeId === nodeId);
|
|
44137
44183
|
if (!node) return { success: false, error: `Node '${nodeId}' not found in mesh` };
|
|
44138
44184
|
if (!node.isLocalWorktree) return { success: false, error: "Node is not a local worktree node" };
|
|
44185
|
+
const nodeDaemonId = typeof node.daemonId === "string" ? node.daemonId.trim() : void 0;
|
|
44186
|
+
if (nodeDaemonId && nodeDaemonId !== this.deps.statusInstanceId && this.deps.dispatchMeshCommand) {
|
|
44187
|
+
const forwarded = await this.deps.dispatchMeshCommand(nodeDaemonId, "retry_mesh_node_bootstrap", {
|
|
44188
|
+
...typeof args === "object" && args !== null ? args : {}
|
|
44189
|
+
});
|
|
44190
|
+
return forwarded ?? { success: false, error: "no response from remote node" };
|
|
44191
|
+
}
|
|
44139
44192
|
const currentBootstrap = node.worktreeBootstrap;
|
|
44140
44193
|
if (currentBootstrap?.status === "running") {
|
|
44141
44194
|
return { success: false, error: "Bootstrap is already running for this node" };
|