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

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
@@ -15146,8 +15146,32 @@ function materializeImageDataPart(part, index, dir) {
15146
15146
  fs6.mkdirSync(dir, { recursive: true });
15147
15147
  const filePath = path16.join(dir, safeInputImageBasename(index, part.mimeType));
15148
15148
  fs6.writeFileSync(filePath, Buffer.from(rawData, "base64"));
15149
+ cleanupStaleMaterializedImages(dir);
15149
15150
  return filePath;
15150
15151
  }
15152
+ var MATERIALIZED_IMAGE_MAX_AGE_MS = 60 * 60 * 1e3;
15153
+ var MATERIALIZED_IMAGE_CLEANUP_INTERVAL_MS = 5 * 60 * 1e3;
15154
+ var lastMaterializedImageCleanupAt = 0;
15155
+ function cleanupStaleMaterializedImages(dir) {
15156
+ const now = Date.now();
15157
+ if (now - lastMaterializedImageCleanupAt < MATERIALIZED_IMAGE_CLEANUP_INTERVAL_MS) return;
15158
+ lastMaterializedImageCleanupAt = now;
15159
+ try {
15160
+ const entries = fs6.readdirSync(dir);
15161
+ for (const entry of entries) {
15162
+ if (!entry.startsWith("adhdev-input-image-")) continue;
15163
+ const fullPath = path16.join(dir, entry);
15164
+ try {
15165
+ const stat2 = fs6.statSync(fullPath);
15166
+ if (now - stat2.mtimeMs > MATERIALIZED_IMAGE_MAX_AGE_MS) {
15167
+ fs6.unlinkSync(fullPath);
15168
+ }
15169
+ } catch {
15170
+ }
15171
+ }
15172
+ } catch {
15173
+ }
15174
+ }
15151
15175
  function buildCliStructuredInputPrompt(input, options = {}) {
15152
15176
  const promptParts = [];
15153
15177
  const imageRefs = [];
@@ -15174,7 +15198,10 @@ function buildCliStructuredInputPrompt(input, options = {}) {
15174
15198
  resourceRefs.push([part.name, part.text, part.uri].filter(Boolean).join("\n"));
15175
15199
  }
15176
15200
  });
15177
- if (input.textFallback.trim()) promptParts.push(input.textFallback.trim());
15201
+ const hasExplicitTextParts = input.parts.some((part) => part.type === "text" && part.text.trim());
15202
+ if (!hasExplicitTextParts && input.textFallback.trim()) {
15203
+ promptParts.push(input.textFallback.trim());
15204
+ }
15178
15205
  const ordered = [
15179
15206
  ...imageRefs,
15180
15207
  ...promptParts,
@@ -20703,7 +20730,7 @@ import * as yaml from "js-yaml";
20703
20730
  // src/commands/mesh-coordinator.ts
20704
20731
  import { execFileSync as execFileSync2 } from "child_process";
20705
20732
  import { createHash as createHash2 } from "crypto";
20706
- import { existsSync as existsSync15, readdirSync as readdirSync6, realpathSync as realpathSync2 } from "fs";
20733
+ import { existsSync as existsSync15, readdirSync as readdirSync7, realpathSync as realpathSync2 } from "fs";
20707
20734
  import { createRequire as createRequire2 } from "module";
20708
20735
  import * as os17 from "os";
20709
20736
  import { dirname as dirname4, isAbsolute as isAbsolute11, join as join18, resolve as resolve13 } from "path";
@@ -20888,7 +20915,7 @@ function addNodeCandidatesFromPath(pathValue, addCandidate) {
20888
20915
  function addNodeCandidatesFromNvm(homeDir, addCandidate) {
20889
20916
  const versionsDir = join18(homeDir, ".nvm", "versions", "node");
20890
20917
  try {
20891
- const versionDirs = readdirSync6(versionsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareNodeVersionNamesDescending);
20918
+ const versionDirs = readdirSync7(versionsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort(compareNodeVersionNamesDescending);
20892
20919
  for (const versionDir of versionDirs) {
20893
20920
  addCandidate(join18(versionsDir, versionDir, "bin", "node"));
20894
20921
  }
@@ -21035,7 +21062,10 @@ function setupMeshEventForwarding(components) {
21035
21062
  const workspace = readNonEmptyString(state.workspace);
21036
21063
  if (!workspace) return;
21037
21064
  const settings = state.settings && typeof state.settings === "object" ? state.settings : {};
21065
+ if (readNonEmptyString(settings.meshCoordinatorFor)) return;
21038
21066
  const meshIdFromRuntime = readNonEmptyString(settings.meshNodeFor);
21067
+ const isMeshDelegate = Boolean(meshIdFromRuntime || settings.launchedByCoordinator);
21068
+ if (!isMeshDelegate) return;
21039
21069
  const mesh = meshIdFromRuntime ? getMesh(meshIdFromRuntime) : getMeshByRepo(workspace);
21040
21070
  const meshId = meshIdFromRuntime || readNonEmptyString(mesh?.id);
21041
21071
  if (!meshId) return;
@@ -23525,7 +23555,7 @@ function prepareSessionChatTailUpdate(input) {
23525
23555
  };
23526
23556
  }
23527
23557
  const fullMessages = normalizeChatMessages(Array.isArray(result.messages) ? result.messages : []);
23528
- const messages = filterUserFacingChatMessages(fullMessages);
23558
+ const messages = fullMessages;
23529
23559
  const title = typeof result.title === "string" ? result.title : void 0;
23530
23560
  const activeModal = normalizeChatTailActiveModal(result.activeModal);
23531
23561
  const status = typeof result.status === "string" ? result.status : "idle";