@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.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) => task.targetNodeId ? node?.id === task.targetNodeId : true) : [];
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: "no_matching_node", nodeId: task.targetNodeId });
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;
@@ -24798,8 +24812,10 @@ async function handleReadChat(h, args) {
24798
24812
  const agentStr = provider?.type || args?.agentType || getCurrentProviderType(h);
24799
24813
  const targetSid = typeof args?.targetSessionId === "string" ? args.targetSessionId.trim() : "";
24800
24814
  const registrySessionWorkspace = targetSid ? h.ctx?.sessionRegistry?.get?.(targetSid)?.workspace : void 0;
24801
- const workspace = typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : typeof registrySessionWorkspace === "string" ? registrySessionWorkspace : void 0;
24802
- const intendedWorkspace = typeof args?.workspace === "string" ? args.workspace : void 0;
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;
24803
24819
  const supportsNative = supportsCliNativeTranscript(agentStr, provider) && isNativeSourceCanonicalHistory(provider?.nativeHistory);
24804
24820
  const history = supportsNative ? readCliProviderNativeHistory(agentStr, {
24805
24821
  canonicalHistory: provider?.nativeHistory,