@adhdev/daemon-core 0.9.82-rc.226 → 0.9.82-rc.228

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
@@ -22436,7 +22436,7 @@ function buildCliSession(state, options) {
22436
22436
  mode: state.mode,
22437
22437
  resume: state.resume,
22438
22438
  activeChat,
22439
- ...state.activeInteractivePrompt ? { activeInteractivePrompt: state.activeInteractivePrompt } : {},
22439
+ activeInteractivePrompt: state.activeInteractivePrompt ?? null,
22440
22440
  ...summaryMetadata && { summaryMetadata },
22441
22441
  ...includeSessionMetadata && {
22442
22442
  capabilities: state.mode === "terminal" ? PTY_SESSION_CAPABILITIES : CLI_CHAT_SESSION_CAPABILITIES,
@@ -22451,7 +22451,8 @@ function buildCliSession(state, options) {
22451
22451
  lastUpdated: state.lastUpdated,
22452
22452
  settings: state.settings,
22453
22453
  ...coordinator && { coordinator },
22454
- ...meshQueueStats && { meshQueueStats }
22454
+ ...meshQueueStats && { meshQueueStats },
22455
+ ...state.settings?.spawnedSessionVisibility === "hidden" && { surfaceHidden: true }
22455
22456
  };
22456
22457
  }
22457
22458
  function buildAcpSession(state, options) {
@@ -22491,7 +22492,8 @@ function buildAcpSession(state, options) {
22491
22492
  lastUpdated: state.lastUpdated,
22492
22493
  settings: state.settings,
22493
22494
  ...coordinator && { coordinator },
22494
- ...meshQueueStats && { meshQueueStats }
22495
+ ...meshQueueStats && { meshQueueStats },
22496
+ ...state.settings?.spawnedSessionVisibility === "hidden" && { surfaceHidden: true }
22495
22497
  };
22496
22498
  }
22497
22499
  function buildSessionEntries(allStates, cdpManagers, options = {}) {
@@ -30904,7 +30906,7 @@ var CliProviderInstance = class {
30904
30906
  const latestStatus = this.adapter.getStatus({ allowParse: false });
30905
30907
  const latestAutoApproveActive = latestStatus.status === "waiting_approval" && this.shouldAutoApprove();
30906
30908
  const externalNativeFinal = this.getExternalNativeFinalReconciliation(void 0, latestStatus);
30907
- const latestVisibleStatus = externalNativeFinal && isCliGeneratingLikeStatus(latestStatus.status) ? "idle" : latestAutoApproveActive ? "generating" : latestStatus.status;
30909
+ const latestVisibleStatus = externalNativeFinal && isCliGeneratingLikeStatus(latestStatus.status) ? "idle" : latestAutoApproveActive || this.autoApproveBusy ? "generating" : latestStatus.status;
30908
30910
  LOG.debug("CLI", `[${this.type}] flush attempt: adapterStatus=${latestStatus.status} latestVisible=${latestVisibleStatus} externalNativeFinal=${!!externalNativeFinal} generatingStartedAt=${this.generatingStartedAt} isWaitingForResponse=${!!this.adapter?.isWaitingForResponse} hasPartial=${!!this.adapter.getPartialResponse?.()}`);
30909
30911
  if (latestVisibleStatus !== "idle") {
30910
30912
  LOG.info("CLI", `[${this.type}] cancelled pending completed (resumed ${latestVisibleStatus})`);
@@ -31000,7 +31002,7 @@ var CliProviderInstance = class {
31000
31002
  this.autoApproveBusy = false;
31001
31003
  this.autoApproveBusyTimer = null;
31002
31004
  this.lastAutoApprovalSignature = "";
31003
- }, 2e3);
31005
+ }, 5e3);
31004
31006
  this.recordAutoApproval(modal?.message, buttonLabel, now);
31005
31007
  setTimeout(() => {
31006
31008
  this.adapter.resolveModal(buttonIndex);
@@ -33381,6 +33383,7 @@ var DaemonCliManager = class {
33381
33383
  transport: "pty",
33382
33384
  adapterKey: key,
33383
33385
  instanceKey: key,
33386
+ workspace: resolvedDir,
33384
33387
  // attachExisting === true means we're restoring an already-spawned
33385
33388
  // hosted runtime after a daemon restart, not starting a fresh PTY.
33386
33389
  // The real spawn time is in the past and we don't have it on the
@@ -33444,7 +33447,8 @@ ${installInfo}`
33444
33447
  providerType: normalizedType,
33445
33448
  transport: "acp",
33446
33449
  adapterKey: key,
33447
- instanceKey: key
33450
+ instanceKey: key,
33451
+ workspace: resolvedDir
33448
33452
  });
33449
33453
  this.adapters.set(key, {
33450
33454
  cliType: normalizedType,
@@ -43464,14 +43468,27 @@ ${tail}` : ""
43464
43468
  const nodeId = typeof args?.nodeId === "string" ? args.nodeId.trim() : "";
43465
43469
  let workspace = typeof args?.workspace === "string" ? args.workspace.trim() : "";
43466
43470
  let submoduleIgnorePaths = Array.isArray(args?.submoduleIgnorePaths) ? args.submoduleIgnorePaths.filter((value) => typeof value === "string") : void 0;
43467
- if (!workspace && meshId && nodeId) {
43471
+ let nodeDaemonId;
43472
+ if (meshId && nodeId) {
43468
43473
  const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh);
43469
43474
  const mesh = meshRecord?.mesh;
43470
43475
  const node = mesh?.nodes?.find((n) => n.id === nodeId || n.nodeId === nodeId);
43471
- workspace = typeof node?.workspace === "string" ? node.workspace.trim() : "";
43476
+ if (!workspace) {
43477
+ workspace = typeof node?.workspace === "string" ? node.workspace.trim() : "";
43478
+ }
43472
43479
  if (!submoduleIgnorePaths && Array.isArray(node?.policy?.submoduleIgnorePaths)) {
43473
43480
  submoduleIgnorePaths = node.policy.submoduleIgnorePaths.filter((value) => typeof value === "string");
43474
43481
  }
43482
+ nodeDaemonId = typeof node?.daemonId === "string" ? node.daemonId.trim() : void 0;
43483
+ }
43484
+ const selfDaemonId = this.deps.statusInstanceId;
43485
+ const isRemote = nodeDaemonId && selfDaemonId && nodeDaemonId !== selfDaemonId;
43486
+ if (isRemote && this.deps.dispatchMeshCommand) {
43487
+ const forwarded = await this.deps.dispatchMeshCommand(nodeDaemonId, "fast_forward_mesh_node", {
43488
+ ...typeof args === "object" && args !== null ? args : {},
43489
+ workspace
43490
+ });
43491
+ return forwarded ?? { success: false, error: "no response from remote node" };
43475
43492
  }
43476
43493
  const result = await fastForwardMeshNode({
43477
43494
  meshId: meshId || void 0,
@@ -43509,6 +43526,14 @@ ${tail}` : ""
43509
43526
  }
43510
43527
  let worktreeCleanup;
43511
43528
  if (node?.isLocalWorktree) {
43529
+ const nodeDaemonId = typeof node.daemonId === "string" ? node.daemonId.trim() : void 0;
43530
+ const isRemoteWorktree = nodeDaemonId && nodeDaemonId !== this.deps.statusInstanceId && this.deps.dispatchMeshCommand;
43531
+ if (isRemoteWorktree) {
43532
+ const forwarded = await this.deps.dispatchMeshCommand(nodeDaemonId, "remove_mesh_node", {
43533
+ ...typeof args === "object" && args !== null ? args : {}
43534
+ });
43535
+ return forwarded ?? { success: false, error: "no response from remote node" };
43536
+ }
43512
43537
  const cleanupResult = await this.cleanupLocalWorktreeNode({ mesh, node, nodeId, force: args?.force === true });
43513
43538
  if (cleanupResult.success === false) {
43514
43539
  return {
@@ -43575,6 +43600,13 @@ ${tail}` : ""
43575
43600
  if (!mesh) return { success: false, error: "Mesh not found" };
43576
43601
  const sourceNode = mesh.nodes?.find((n) => n.id === sourceNodeId || n.nodeId === sourceNodeId);
43577
43602
  if (!sourceNode) return { success: false, error: `Source node '${sourceNodeId}' not found in mesh` };
43603
+ const sourceDaemonId = typeof sourceNode.daemonId === "string" ? sourceNode.daemonId.trim() : void 0;
43604
+ if (sourceDaemonId && sourceDaemonId !== this.deps.statusInstanceId && this.deps.dispatchMeshCommand) {
43605
+ const forwarded = await this.deps.dispatchMeshCommand(sourceDaemonId, "clone_mesh_node", {
43606
+ ...typeof args === "object" && args !== null ? args : {}
43607
+ });
43608
+ return forwarded ?? { success: false, error: "no response from remote node" };
43609
+ }
43578
43610
  const repoRoot = sourceNode.repoRoot || sourceNode.workspace;
43579
43611
  const { createWorktree: createWorktree2 } = await Promise.resolve().then(() => (init_git_worktree(), git_worktree_exports));
43580
43612
  const result = await createWorktree2({
@@ -43807,6 +43839,13 @@ ${tail}` : ""
43807
43839
  const node = mesh.nodes?.find((n) => n.id === nodeId || n.nodeId === nodeId);
43808
43840
  if (!node) return { success: false, error: `Node '${nodeId}' not found in mesh` };
43809
43841
  if (!node.isLocalWorktree) return { success: false, error: "Node is not a local worktree node" };
43842
+ const nodeDaemonId = typeof node.daemonId === "string" ? node.daemonId.trim() : void 0;
43843
+ if (nodeDaemonId && nodeDaemonId !== this.deps.statusInstanceId && this.deps.dispatchMeshCommand) {
43844
+ const forwarded = await this.deps.dispatchMeshCommand(nodeDaemonId, "retry_mesh_node_bootstrap", {
43845
+ ...typeof args === "object" && args !== null ? args : {}
43846
+ });
43847
+ return forwarded ?? { success: false, error: "no response from remote node" };
43848
+ }
43810
43849
  const currentBootstrap = node.worktreeBootstrap;
43811
43850
  if (currentBootstrap?.status === "running") {
43812
43851
  return { success: false, error: "Bootstrap is already running for this node" };