@adhdev/daemon-standalone 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 CHANGED
@@ -36617,7 +36617,7 @@ Next step: ${nextStep}`;
36617
36617
  error: args.error
36618
36618
  });
36619
36619
  }
36620
- async function resolveUsableProvider(components, nodeId, node) {
36620
+ async function resolveUsableProvider(components, nodeId, node, requiredTags) {
36621
36621
  const providerPriority = normalizeProviderPriority(node?.policy);
36622
36622
  if (!providerPriority.length) return { reason: "missing_provider_priority" };
36623
36623
  const providerLoader = components.providerLoader;
@@ -36625,6 +36625,10 @@ Next step: ${nextStep}`;
36625
36625
  const failed = [];
36626
36626
  for (const requestedType of providerPriority) {
36627
36627
  const normalizedType = typeof providerLoader.resolveAlias === "function" ? providerLoader.resolveAlias(requestedType) : requestedType;
36628
+ if (requiredTags?.length && !nodeSatisfiesRequiredTags(requiredTags, buildMeshNodeCapabilityTags(node, normalizedType))) {
36629
+ failed.push(`${requestedType}: required_tags_mismatch`);
36630
+ continue;
36631
+ }
36628
36632
  if (typeof providerLoader.isMachineProviderEnabled === "function" && !providerLoader.isMachineProviderEnabled(normalizedType)) {
36629
36633
  failed.push(`${requestedType}: disabled`);
36630
36634
  continue;
@@ -36663,9 +36667,19 @@ Next step: ${nextStep}`;
36663
36667
  markAutoLaunch(meshId, task.id, { status: "skipped", reason: "target_session_constraint" });
36664
36668
  continue;
36665
36669
  }
36666
- const candidateNodes = Array.isArray(mesh?.nodes) ? mesh.nodes.filter((node) => task.targetNodeId ? node?.id === task.targetNodeId : true) : [];
36670
+ const candidateNodes = Array.isArray(mesh?.nodes) ? mesh.nodes.filter((node) => {
36671
+ if (task.targetNodeId && node?.id !== task.targetNodeId) return false;
36672
+ if (task.requiredTags?.length) {
36673
+ const priorities = normalizeProviderPriority(node?.policy);
36674
+ const providerCandidates = priorities.length ? priorities : [void 0];
36675
+ return providerCandidates.some(
36676
+ (p) => nodeSatisfiesRequiredTags(task.requiredTags, buildMeshNodeCapabilityTags(node, p))
36677
+ );
36678
+ }
36679
+ return true;
36680
+ }) : [];
36667
36681
  if (!candidateNodes.length) {
36668
- markAutoLaunch(meshId, task.id, { status: "skipped", reason: "no_matching_node", nodeId: task.targetNodeId });
36682
+ markAutoLaunch(meshId, task.id, { status: "skipped", reason: "no_node_satisfies_required_tags", nodeId: task.targetNodeId });
36669
36683
  continue;
36670
36684
  }
36671
36685
  for (const node of candidateNodes) {
@@ -36707,7 +36721,7 @@ Next step: ${nextStep}`;
36707
36721
  }
36708
36722
  autoLaunchInProgress.add(launchKey);
36709
36723
  try {
36710
- const resolved = await resolveUsableProvider(components, nodeId, node);
36724
+ const resolved = await resolveUsableProvider(components, nodeId, node, task.requiredTags);
36711
36725
  if (!resolved.providerType) {
36712
36726
  markAutoLaunch(meshId, task.id, { status: "skipped", reason: resolved.reason || "provider_unusable", nodeId });
36713
36727
  continue;
@@ -52418,7 +52432,7 @@ ${effect.notification.body || ""}`.trim();
52418
52432
  mode: state.mode,
52419
52433
  resume: state.resume,
52420
52434
  activeChat,
52421
- ...state.activeInteractivePrompt ? { activeInteractivePrompt: state.activeInteractivePrompt } : {},
52435
+ activeInteractivePrompt: state.activeInteractivePrompt ?? null,
52422
52436
  ...summaryMetadata && { summaryMetadata },
52423
52437
  ...includeSessionMetadata && {
52424
52438
  capabilities: state.mode === "terminal" ? PTY_SESSION_CAPABILITIES : CLI_CHAT_SESSION_CAPABILITIES,
@@ -52433,7 +52447,8 @@ ${effect.notification.body || ""}`.trim();
52433
52447
  lastUpdated: state.lastUpdated,
52434
52448
  settings: state.settings,
52435
52449
  ...coordinator && { coordinator },
52436
- ...meshQueueStats && { meshQueueStats }
52450
+ ...meshQueueStats && { meshQueueStats },
52451
+ ...state.settings?.spawnedSessionVisibility === "hidden" && { surfaceHidden: true }
52437
52452
  };
52438
52453
  }
52439
52454
  function buildAcpSession(state, options) {
@@ -52473,7 +52488,8 @@ ${effect.notification.body || ""}`.trim();
52473
52488
  lastUpdated: state.lastUpdated,
52474
52489
  settings: state.settings,
52475
52490
  ...coordinator && { coordinator },
52476
- ...meshQueueStats && { meshQueueStats }
52491
+ ...meshQueueStats && { meshQueueStats },
52492
+ ...state.settings?.spawnedSessionVisibility === "hidden" && { surfaceHidden: true }
52477
52493
  };
52478
52494
  }
52479
52495
  function buildSessionEntries(allStates, cdpManagers, options = {}) {
@@ -54760,8 +54776,10 @@ ${effect.notification.body || ""}`.trim();
54760
54776
  const agentStr = provider?.type || args?.agentType || getCurrentProviderType(h);
54761
54777
  const targetSid = typeof args?.targetSessionId === "string" ? args.targetSessionId.trim() : "";
54762
54778
  const registrySessionWorkspace = targetSid ? h.ctx?.sessionRegistry?.get?.(targetSid)?.workspace : void 0;
54763
- const workspace = typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : typeof registrySessionWorkspace === "string" ? registrySessionWorkspace : void 0;
54764
- const intendedWorkspace = typeof args?.workspace === "string" ? args.workspace : void 0;
54779
+ const currentSessionWorkspace = typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : void 0;
54780
+ const argsWorkspace = typeof args?.workspace === "string" ? args.workspace : void 0;
54781
+ const workspace = targetSid ? typeof registrySessionWorkspace === "string" ? registrySessionWorkspace : argsWorkspace ?? currentSessionWorkspace : typeof currentSessionWorkspace === "string" ? currentSessionWorkspace : void 0;
54782
+ const intendedWorkspace = argsWorkspace;
54765
54783
  const supportsNative = supportsCliNativeTranscript(agentStr, provider) && isNativeSourceCanonicalHistory(provider?.nativeHistory);
54766
54784
  const history = supportsNative ? readCliProviderNativeHistory(agentStr, {
54767
54785
  canonicalHistory: provider?.nativeHistory,
@@ -73337,14 +73355,27 @@ ${tail}` : ""
73337
73355
  const nodeId = typeof args?.nodeId === "string" ? args.nodeId.trim() : "";
73338
73356
  let workspace = typeof args?.workspace === "string" ? args.workspace.trim() : "";
73339
73357
  let submoduleIgnorePaths = Array.isArray(args?.submoduleIgnorePaths) ? args.submoduleIgnorePaths.filter((value) => typeof value === "string") : void 0;
73340
- if (!workspace && meshId && nodeId) {
73358
+ let nodeDaemonId;
73359
+ if (meshId && nodeId) {
73341
73360
  const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh);
73342
73361
  const mesh = meshRecord?.mesh;
73343
73362
  const node = mesh?.nodes?.find((n) => n.id === nodeId || n.nodeId === nodeId);
73344
- workspace = typeof node?.workspace === "string" ? node.workspace.trim() : "";
73363
+ if (!workspace) {
73364
+ workspace = typeof node?.workspace === "string" ? node.workspace.trim() : "";
73365
+ }
73345
73366
  if (!submoduleIgnorePaths && Array.isArray(node?.policy?.submoduleIgnorePaths)) {
73346
73367
  submoduleIgnorePaths = node.policy.submoduleIgnorePaths.filter((value) => typeof value === "string");
73347
73368
  }
73369
+ nodeDaemonId = typeof node?.daemonId === "string" ? node.daemonId.trim() : void 0;
73370
+ }
73371
+ const selfDaemonId = this.deps.statusInstanceId;
73372
+ const isRemote = nodeDaemonId && selfDaemonId && nodeDaemonId !== selfDaemonId;
73373
+ if (isRemote && this.deps.dispatchMeshCommand) {
73374
+ const forwarded = await this.deps.dispatchMeshCommand(nodeDaemonId, "fast_forward_mesh_node", {
73375
+ ...typeof args === "object" && args !== null ? args : {},
73376
+ workspace
73377
+ });
73378
+ return forwarded ?? { success: false, error: "no response from remote node" };
73348
73379
  }
73349
73380
  const result = await fastForwardMeshNode({
73350
73381
  meshId: meshId || void 0,
@@ -73382,6 +73413,14 @@ ${tail}` : ""
73382
73413
  }
73383
73414
  let worktreeCleanup;
73384
73415
  if (node?.isLocalWorktree) {
73416
+ const nodeDaemonId = typeof node.daemonId === "string" ? node.daemonId.trim() : void 0;
73417
+ const isRemoteWorktree = nodeDaemonId && nodeDaemonId !== this.deps.statusInstanceId && this.deps.dispatchMeshCommand;
73418
+ if (isRemoteWorktree) {
73419
+ const forwarded = await this.deps.dispatchMeshCommand(nodeDaemonId, "remove_mesh_node", {
73420
+ ...typeof args === "object" && args !== null ? args : {}
73421
+ });
73422
+ return forwarded ?? { success: false, error: "no response from remote node" };
73423
+ }
73385
73424
  const cleanupResult = await this.cleanupLocalWorktreeNode({ mesh, node, nodeId, force: args?.force === true });
73386
73425
  if (cleanupResult.success === false) {
73387
73426
  return {
@@ -73448,6 +73487,13 @@ ${tail}` : ""
73448
73487
  if (!mesh) return { success: false, error: "Mesh not found" };
73449
73488
  const sourceNode = mesh.nodes?.find((n) => n.id === sourceNodeId || n.nodeId === sourceNodeId);
73450
73489
  if (!sourceNode) return { success: false, error: `Source node '${sourceNodeId}' not found in mesh` };
73490
+ const sourceDaemonId = typeof sourceNode.daemonId === "string" ? sourceNode.daemonId.trim() : void 0;
73491
+ if (sourceDaemonId && sourceDaemonId !== this.deps.statusInstanceId && this.deps.dispatchMeshCommand) {
73492
+ const forwarded = await this.deps.dispatchMeshCommand(sourceDaemonId, "clone_mesh_node", {
73493
+ ...typeof args === "object" && args !== null ? args : {}
73494
+ });
73495
+ return forwarded ?? { success: false, error: "no response from remote node" };
73496
+ }
73451
73497
  const repoRoot = sourceNode.repoRoot || sourceNode.workspace;
73452
73498
  const { createWorktree: createWorktree2 } = await Promise.resolve().then(() => (init_git_worktree(), git_worktree_exports));
73453
73499
  const result = await createWorktree2({
@@ -73680,6 +73726,13 @@ ${tail}` : ""
73680
73726
  const node = mesh.nodes?.find((n) => n.id === nodeId || n.nodeId === nodeId);
73681
73727
  if (!node) return { success: false, error: `Node '${nodeId}' not found in mesh` };
73682
73728
  if (!node.isLocalWorktree) return { success: false, error: "Node is not a local worktree node" };
73729
+ const nodeDaemonId = typeof node.daemonId === "string" ? node.daemonId.trim() : void 0;
73730
+ if (nodeDaemonId && nodeDaemonId !== this.deps.statusInstanceId && this.deps.dispatchMeshCommand) {
73731
+ const forwarded = await this.deps.dispatchMeshCommand(nodeDaemonId, "retry_mesh_node_bootstrap", {
73732
+ ...typeof args === "object" && args !== null ? args : {}
73733
+ });
73734
+ return forwarded ?? { success: false, error: "no response from remote node" };
73735
+ }
73683
73736
  const currentBootstrap = node.worktreeBootstrap;
73684
73737
  if (currentBootstrap?.status === "running") {
73685
73738
  return { success: false, error: "Bootstrap is already running for this node" };