@adhdev/daemon-core 0.9.76-rc.64 → 0.9.76-rc.66

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
@@ -37,6 +37,7 @@ var init_repo_mesh_types = __esm({
37
37
  requireApprovalForDestructiveGit: true,
38
38
  dirtyWorkspaceBehavior: "warn",
39
39
  maxParallelTasks: 2,
40
+ spawnedSessionVisibility: "visible",
40
41
  sessionCleanupOnNodeRemove: "preserve"
41
42
  };
42
43
  }
@@ -469,6 +470,9 @@ function mergeMeshPolicy(base, patch) {
469
470
  if (!SESSION_CLEANUP_MODES.has(String(policy.sessionCleanupOnNodeRemove))) {
470
471
  policy.sessionCleanupOnNodeRemove = "preserve";
471
472
  }
473
+ if (!SPAWNED_SESSION_VISIBILITY_MODES.has(String(policy.spawnedSessionVisibility))) {
474
+ policy.spawnedSessionVisibility = "visible";
475
+ }
472
476
  return policy;
473
477
  }
474
478
  function listMeshes() {
@@ -573,13 +577,14 @@ function updateNode(meshId, nodeId, opts) {
573
577
  saveMeshConfig(config);
574
578
  return node;
575
579
  }
576
- var SESSION_CLEANUP_MODES;
580
+ var SESSION_CLEANUP_MODES, SPAWNED_SESSION_VISIBILITY_MODES;
577
581
  var init_mesh_config = __esm({
578
582
  "src/config/mesh-config.ts"() {
579
583
  "use strict";
580
584
  init_config();
581
585
  init_repo_mesh_types();
582
586
  SESSION_CLEANUP_MODES = /* @__PURE__ */ new Set(["preserve", "stop", "delete_stopped", "stop_and_delete"]);
587
+ SPAWNED_SESSION_VISIBILITY_MODES = /* @__PURE__ */ new Set(["visible", "hidden"]);
583
588
  }
584
589
  });
585
590
 
@@ -15146,8 +15151,32 @@ function materializeImageDataPart(part, index, dir) {
15146
15151
  fs6.mkdirSync(dir, { recursive: true });
15147
15152
  const filePath = path16.join(dir, safeInputImageBasename(index, part.mimeType));
15148
15153
  fs6.writeFileSync(filePath, Buffer.from(rawData, "base64"));
15154
+ cleanupStaleMaterializedImages(dir);
15149
15155
  return filePath;
15150
15156
  }
15157
+ var MATERIALIZED_IMAGE_MAX_AGE_MS = 60 * 60 * 1e3;
15158
+ var MATERIALIZED_IMAGE_CLEANUP_INTERVAL_MS = 5 * 60 * 1e3;
15159
+ var lastMaterializedImageCleanupAt = 0;
15160
+ function cleanupStaleMaterializedImages(dir) {
15161
+ const now = Date.now();
15162
+ if (now - lastMaterializedImageCleanupAt < MATERIALIZED_IMAGE_CLEANUP_INTERVAL_MS) return;
15163
+ lastMaterializedImageCleanupAt = now;
15164
+ try {
15165
+ const entries = fs6.readdirSync(dir);
15166
+ for (const entry of entries) {
15167
+ if (!entry.startsWith("adhdev-input-image-")) continue;
15168
+ const fullPath = path16.join(dir, entry);
15169
+ try {
15170
+ const stat2 = fs6.statSync(fullPath);
15171
+ if (now - stat2.mtimeMs > MATERIALIZED_IMAGE_MAX_AGE_MS) {
15172
+ fs6.unlinkSync(fullPath);
15173
+ }
15174
+ } catch {
15175
+ }
15176
+ }
15177
+ } catch {
15178
+ }
15179
+ }
15151
15180
  function buildCliStructuredInputPrompt(input, options = {}) {
15152
15181
  const promptParts = [];
15153
15182
  const imageRefs = [];
@@ -15174,7 +15203,10 @@ function buildCliStructuredInputPrompt(input, options = {}) {
15174
15203
  resourceRefs.push([part.name, part.text, part.uri].filter(Boolean).join("\n"));
15175
15204
  }
15176
15205
  });
15177
- if (input.textFallback.trim()) promptParts.push(input.textFallback.trim());
15206
+ const hasExplicitTextParts = input.parts.some((part) => part.type === "text" && part.text.trim());
15207
+ if (!hasExplicitTextParts && input.textFallback.trim()) {
15208
+ promptParts.push(input.textFallback.trim());
15209
+ }
15178
15210
  const ordered = [
15179
15211
  ...imageRefs,
15180
15212
  ...promptParts,
@@ -20703,7 +20735,7 @@ import * as yaml from "js-yaml";
20703
20735
  // src/commands/mesh-coordinator.ts
20704
20736
  import { execFileSync as execFileSync2 } from "child_process";
20705
20737
  import { createHash as createHash2 } from "crypto";
20706
- import { existsSync as existsSync15, readdirSync as readdirSync6, realpathSync as realpathSync2 } from "fs";
20738
+ import { existsSync as existsSync15, readdirSync as readdirSync7, realpathSync as realpathSync2 } from "fs";
20707
20739
  import { createRequire as createRequire2 } from "module";
20708
20740
  import * as os17 from "os";
20709
20741
  import { dirname as dirname4, isAbsolute as isAbsolute11, join as join18, resolve as resolve13 } from "path";
@@ -20888,7 +20920,7 @@ function addNodeCandidatesFromPath(pathValue, addCandidate) {
20888
20920
  function addNodeCandidatesFromNvm(homeDir, addCandidate) {
20889
20921
  const versionsDir = join18(homeDir, ".nvm", "versions", "node");
20890
20922
  try {
20891
- const versionDirs = readdirSync6(versionsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareNodeVersionNamesDescending);
20923
+ const versionDirs = readdirSync7(versionsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareNodeVersionNamesDescending);
20892
20924
  for (const versionDir of versionDirs) {
20893
20925
  addCandidate(join18(versionsDir, versionDir, "bin", "node"));
20894
20926
  }
@@ -21035,7 +21067,10 @@ function setupMeshEventForwarding(components) {
21035
21067
  const workspace = readNonEmptyString(state.workspace);
21036
21068
  if (!workspace) return;
21037
21069
  const settings = state.settings && typeof state.settings === "object" ? state.settings : {};
21070
+ if (readNonEmptyString(settings.meshCoordinatorFor)) return;
21038
21071
  const meshIdFromRuntime = readNonEmptyString(settings.meshNodeFor);
21072
+ const isMeshDelegate = Boolean(meshIdFromRuntime || settings.launchedByCoordinator);
21073
+ if (!isMeshDelegate) return;
21039
21074
  const mesh = meshIdFromRuntime ? getMesh(meshIdFromRuntime) : getMeshByRepo(workspace);
21040
21075
  const meshId = meshIdFromRuntime || readNonEmptyString(mesh?.id);
21041
21076
  if (!meshId) return;
@@ -23525,7 +23560,7 @@ function prepareSessionChatTailUpdate(input) {
23525
23560
  };
23526
23561
  }
23527
23562
  const fullMessages = normalizeChatMessages(Array.isArray(result.messages) ? result.messages : []);
23528
- const messages = filterUserFacingChatMessages(fullMessages);
23563
+ const messages = fullMessages;
23529
23564
  const title = typeof result.title === "string" ? result.title : void 0;
23530
23565
  const activeModal = normalizeChatTailActiveModal(result.activeModal);
23531
23566
  const status = typeof result.status === "string" ? result.status : "idle";