adhdev 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.js CHANGED
@@ -46,6 +46,7 @@ var init_repo_mesh_types = __esm({
46
46
  requireApprovalForDestructiveGit: true,
47
47
  dirtyWorkspaceBehavior: "warn",
48
48
  maxParallelTasks: 2,
49
+ spawnedSessionVisibility: "visible",
49
50
  sessionCleanupOnNodeRemove: "preserve"
50
51
  };
51
52
  }
@@ -2370,6 +2371,9 @@ function mergeMeshPolicy(base, patch) {
2370
2371
  if (!SESSION_CLEANUP_MODES.has(String(policy.sessionCleanupOnNodeRemove))) {
2371
2372
  policy.sessionCleanupOnNodeRemove = "preserve";
2372
2373
  }
2374
+ if (!SPAWNED_SESSION_VISIBILITY_MODES.has(String(policy.spawnedSessionVisibility))) {
2375
+ policy.spawnedSessionVisibility = "visible";
2376
+ }
2373
2377
  return policy;
2374
2378
  }
2375
2379
  function listMeshes() {
@@ -2474,7 +2478,7 @@ function updateNode(meshId, nodeId, opts) {
2474
2478
  saveMeshConfig(config2);
2475
2479
  return node;
2476
2480
  }
2477
- var import_fs2, import_path2, import_crypto3, SESSION_CLEANUP_MODES;
2481
+ var import_fs2, import_path2, import_crypto3, SESSION_CLEANUP_MODES, SPAWNED_SESSION_VISIBILITY_MODES;
2478
2482
  var init_mesh_config = __esm({
2479
2483
  "../../oss/packages/daemon-core/src/config/mesh-config.ts"() {
2480
2484
  "use strict";
@@ -2484,6 +2488,7 @@ var init_mesh_config = __esm({
2484
2488
  init_config();
2485
2489
  init_repo_mesh_types();
2486
2490
  SESSION_CLEANUP_MODES = /* @__PURE__ */ new Set(["preserve", "stop", "delete_stopped", "stop_and_delete"]);
2491
+ SPAWNED_SESSION_VISIBILITY_MODES = /* @__PURE__ */ new Set(["visible", "hidden"]);
2487
2492
  }
2488
2493
  });
2489
2494
 
@@ -16207,8 +16212,29 @@ function materializeImageDataPart(part, index, dir) {
16207
16212
  fs6.mkdirSync(dir, { recursive: true });
16208
16213
  const filePath = path16.join(dir, safeInputImageBasename(index, part.mimeType));
16209
16214
  fs6.writeFileSync(filePath, Buffer.from(rawData, "base64"));
16215
+ cleanupStaleMaterializedImages(dir);
16210
16216
  return filePath;
16211
16217
  }
16218
+ function cleanupStaleMaterializedImages(dir) {
16219
+ const now = Date.now();
16220
+ if (now - lastMaterializedImageCleanupAt < MATERIALIZED_IMAGE_CLEANUP_INTERVAL_MS) return;
16221
+ lastMaterializedImageCleanupAt = now;
16222
+ try {
16223
+ const entries = fs6.readdirSync(dir);
16224
+ for (const entry of entries) {
16225
+ if (!entry.startsWith("adhdev-input-image-")) continue;
16226
+ const fullPath = path16.join(dir, entry);
16227
+ try {
16228
+ const stat5 = fs6.statSync(fullPath);
16229
+ if (now - stat5.mtimeMs > MATERIALIZED_IMAGE_MAX_AGE_MS) {
16230
+ fs6.unlinkSync(fullPath);
16231
+ }
16232
+ } catch {
16233
+ }
16234
+ }
16235
+ } catch {
16236
+ }
16237
+ }
16212
16238
  function buildCliStructuredInputPrompt(input, options = {}) {
16213
16239
  const promptParts = [];
16214
16240
  const imageRefs = [];
@@ -16235,7 +16261,10 @@ function buildCliStructuredInputPrompt(input, options = {}) {
16235
16261
  resourceRefs.push([part.name, part.text, part.uri].filter(Boolean).join("\n"));
16236
16262
  }
16237
16263
  });
16238
- if (input.textFallback.trim()) promptParts.push(input.textFallback.trim());
16264
+ const hasExplicitTextParts = input.parts.some((part) => part.type === "text" && part.text.trim());
16265
+ if (!hasExplicitTextParts && input.textFallback.trim()) {
16266
+ promptParts.push(input.textFallback.trim());
16267
+ }
16239
16268
  const ordered = [
16240
16269
  ...imageRefs,
16241
16270
  ...promptParts,
@@ -16318,7 +16347,7 @@ async function waitForCliAdapterReady(adapter, options) {
16318
16347
  }
16319
16348
  throw new Error(`CLI runtime did not become ready within ${timeoutMs}ms`);
16320
16349
  }
16321
- var os14, path16, crypto3, fs6, import_node_module, IMAGE_MIME_EXTENSIONS, CachedDatabaseSync, CliProviderInstance;
16350
+ var os14, path16, crypto3, fs6, import_node_module, IMAGE_MIME_EXTENSIONS, MATERIALIZED_IMAGE_MAX_AGE_MS, MATERIALIZED_IMAGE_CLEANUP_INTERVAL_MS, lastMaterializedImageCleanupAt, CachedDatabaseSync, CliProviderInstance;
16322
16351
  var init_cli_provider_instance = __esm({
16323
16352
  "../../oss/packages/daemon-core/src/providers/cli-provider-instance.ts"() {
16324
16353
  "use strict";
@@ -16349,6 +16378,9 @@ var init_cli_provider_instance = __esm({
16349
16378
  "image/tiff": ".tiff",
16350
16379
  "image/svg+xml": ".svg"
16351
16380
  };
16381
+ MATERIALIZED_IMAGE_MAX_AGE_MS = 60 * 60 * 1e3;
16382
+ MATERIALIZED_IMAGE_CLEANUP_INTERVAL_MS = 5 * 60 * 1e3;
16383
+ lastMaterializedImageCleanupAt = 0;
16352
16384
  CachedDatabaseSync = null;
16353
16385
  CliProviderInstance = class {
16354
16386
  constructor(provider, workingDir, cliArgs = [], instanceId, transportFactory, options) {
@@ -42846,7 +42878,10 @@ function setupMeshEventForwarding(components) {
42846
42878
  const workspace = readNonEmptyString(state.workspace);
42847
42879
  if (!workspace) return;
42848
42880
  const settings = state.settings && typeof state.settings === "object" ? state.settings : {};
42881
+ if (readNonEmptyString(settings.meshCoordinatorFor)) return;
42849
42882
  const meshIdFromRuntime = readNonEmptyString(settings.meshNodeFor);
42883
+ const isMeshDelegate = Boolean(meshIdFromRuntime || settings.launchedByCoordinator);
42884
+ if (!isMeshDelegate) return;
42850
42885
  const mesh = meshIdFromRuntime ? getMesh(meshIdFromRuntime) : getMeshByRepo(workspace);
42851
42886
  const meshId = meshIdFromRuntime || readNonEmptyString(mesh?.id);
42852
42887
  if (!meshId) return;
@@ -45402,7 +45437,7 @@ function prepareSessionChatTailUpdate(input) {
45402
45437
  };
45403
45438
  }
45404
45439
  const fullMessages = normalizeChatMessages(Array.isArray(result.messages) ? result.messages : []);
45405
- const messages = filterUserFacingChatMessages(fullMessages);
45440
+ const messages = fullMessages;
45406
45441
  const title = typeof result.title === "string" ? result.title : void 0;
45407
45442
  const activeModal = normalizeChatTailActiveModal(result.activeModal);
45408
45443
  const status = typeof result.status === "string" ? result.status : "idle";
@@ -63438,7 +63473,7 @@ var init_adhdev_daemon = __esm({
63438
63473
  init_version();
63439
63474
  init_src();
63440
63475
  init_runtime_defaults();
63441
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.76-rc.64" });
63476
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.76-rc.66" });
63442
63477
  AdhdevDaemon = class _AdhdevDaemon {
63443
63478
  localHttpServer = null;
63444
63479
  localWss = null;