@adhdev/daemon-core 0.9.82-rc.228 → 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 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) => task.targetNodeId ? node?.id === task.targetNodeId : true) : [];
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: "no_matching_node", nodeId: task.targetNodeId });
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;
@@ -25130,8 +25144,10 @@ async function handleReadChat(h, args) {
25130
25144
  const agentStr = provider?.type || args?.agentType || getCurrentProviderType(h);
25131
25145
  const targetSid = typeof args?.targetSessionId === "string" ? args.targetSessionId.trim() : "";
25132
25146
  const registrySessionWorkspace = targetSid ? h.ctx?.sessionRegistry?.get?.(targetSid)?.workspace : void 0;
25133
- const workspace = typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : typeof registrySessionWorkspace === "string" ? registrySessionWorkspace : void 0;
25134
- const intendedWorkspace = typeof args?.workspace === "string" ? args.workspace : void 0;
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;
25135
25151
  const supportsNative = supportsCliNativeTranscript(agentStr, provider) && isNativeSourceCanonicalHistory(provider?.nativeHistory);
25136
25152
  const history = supportsNative ? readCliProviderNativeHistory(agentStr, {
25137
25153
  canonicalHistory: provider?.nativeHistory,