Skip to content

dist:win fails on fresh clone: three missing exports (safe-storage, FIM helpers, executionSessionManager singleton) #10

Description

@getsov75-maker

Summary

npm run dist:win on a fresh clone of main (commit 811f017) fails at the Rollup bundling step with three separate "missing export" or "missing file" errors. Each looks like a caller was committed without its callee. I hit them in sequence — fixing one revealed the next.

Environment: Windows 11, Node 20.19.5 (.nvmrc), fresh git clone --depth 1, npm install succeeded, npm run dist:win with SkipTypecheck fallback (electron-vite build + electron-builder --win).

Bug 1 — Missing apps/desktop/src/renderer/lib/filesystem/safe-storage.ts

Error:

Could not resolve "./safe-storage" from "apps/desktop/src/renderer/lib/filesystem/dirty-buffer-manager.ts"

Root cause: dirty-buffer-manager.ts:1 imports safeSetItem, safeGetItem, safeRemoveItem from ./safe-storage, but the folder apps/desktop/src/renderer/lib/filesystem/ only contains four files (FileContentCache.ts, dirty-buffer-manager.ts, file-watcher.ts, filesystem.ts). The sibling safe-storage.ts was never committed here.

The actual implementation exists at apps/desktop/src/renderer/lib/security/safe-storage.ts (and there's already a re-export at apps/desktop/src/renderer/lib/safe-storage.ts).

Local workaround (creates a re-export at the expected path):

// apps/desktop/src/renderer/lib/filesystem/safe-storage.ts
export * from "../security/safe-storage"

Bug 2 — Missing FIM helper exports in runtime/completion/FIMFormatter.ts

Error:

"getFIMModelName" is not exported by "apps/desktop/src/renderer/runtime/completion/FIMFormatter.ts",
imported by "apps/desktop/src/renderer/lib/completion/completion-ai.ts"

Root cause: completion-ai.ts:3 imports four symbols from FIMFormatter:

import { formatFIMPrompt, formatStandardPrompt, getFIMModelName, parseFIMCompletion, type FIMRequest } from "@/runtime/completion/FIMFormatter"

But FIMFormatter.ts only exports buildFIMBody, parseFIMResponse, truncatePrefix, truncateSuffix, plus the types FIMRequest, FIMResponse, FIMProviderConfig, and the FIM_LANGUAGE_MAP constant. The four functions consumed by completion-ai.ts do not exist anywhere in the repo (I ran search/code across the whole tree — zero matches other than the caller).

Additionally, the FIMRequest interface in FIMFormatter.ts requires a maxLines: number field, but completion-ai.ts constructs FIMRequest values without it — so even after adding the missing functions, FIMRequest.maxLines should be optional.

Local workaround (appended to FIMFormatter.ts, choosing safe defaults):

export function getFIMModelName(model: string): string {
  const m = (model || "").toLowerCase()
  if (m.includes("deepseek")) return "deepseek-coder"
  if (m.includes("codellama")) return "codellama"
  if (m.includes("qwen")) return "qwen-coder"
  if (m.includes("starcoder")) return "starcoder"
  if (m.includes("codestral")) return "codestral"
  return "starcoder"
}

export function formatFIMPrompt(req: { prefix: string; suffix: string }, fimModel: string): string {
  const p = req.prefix.length > 3000 ? req.prefix.slice(-3000) : req.prefix
  const s = req.suffix.length > 1500 ? req.suffix.slice(0, 1500) : req.suffix
  switch (fimModel) {
    case "deepseek-coder": return `<fim_begin>${p}<fim_hole>${s}<fim_end>`
    case "codellama":      return `<PRE> ${p} <SUF>${s} <MID>`
    case "codestral":      return `[SUFFIX]${s}[PREFIX]${p}`
    default:               return `<fim_prefix>${p}<fim_suffix>${s}<fim_middle>`
  }
}

export function formatStandardPrompt(req: { prefix: string; suffix: string }): string {
  return `${req.prefix}<CURSOR>${req.suffix}`
}

export function parseFIMCompletion(text: string, _fimModel: string): string {
  let out = text
  for (const stop of ["<fim_end>", "<fim_middle>", "<|endoftext|>", "<EOT>", "<MID>"]) {
    const idx = out.indexOf(stop)
    if (idx !== -1) out = out.slice(0, idx)
  }
  return out.trim()
}

(These are stopgap implementations — the real ones may have been more sophisticated.)

Bug 3 — Missing singleton export in runtime/sessions/ExecutionSessionManager.ts

Error:

"executionSessionManager" is not exported by "apps/desktop/src/renderer/runtime/sessions/ExecutionSessionManager.ts",
imported by "apps/desktop/src/renderer/components/workspace/MultiFileComposerPane.tsx"

Root cause: MultiFileComposerPane.tsx:8 imports the lowercase executionSessionManager (the singleton instance), but ExecutionSessionManager.ts only exports the class itself. Every other caller in the codebase (chat-panel.tsx, ChatSession.tsx, RuntimeHealthPanel.tsx, main.tsx, etc.) works around this by creating a local const:

const executionSessionManager = ExecutionSessionManager.getInstance()

MultiFileComposerPane.tsx is the only file that expects the singleton to be exported by name.

Local workaround (one line added to ExecutionSessionManager.ts):

export const executionSessionManager = ExecutionSessionManager.getInstance()

Suggested fixes upstream

  • Bug 1: Either commit the real filesystem/safe-storage.ts if it was intentionally a separate implementation, or update dirty-buffer-manager.ts:1 to import from @/lib/security/safe-storage (or @/lib/safe-storage).
  • Bug 2: Restore the four missing FIM helpers with the original implementations, and make FIMRequest.maxLines optional so completion-ai.ts typechecks.
  • Bug 3: Add export const executionSessionManager = ExecutionSessionManager.getInstance() at the bottom of ExecutionSessionManager.ts, and drop the duplicate local consts in the six other files that reinvent it.

Meta-observation

All three bugs share the same shape: a caller was committed without its callee. The README's own "Codebase Audit" section flags 34 runtime subdirectories, 53 root lib files, and 15 files over 30 KB — this refactor-in-progress footprint is likely responsible. Consider gating main on a green npm run build in CI to catch these before publish.

What I ran

Node v20.19.5
npm v11.13.0
Windows 11 x64
git clone --depth 1 https://github.com/patil-shubham-dev/AgenticOS.git
npm install                                    # succeeded
npx electron-vite build                        # failed with each bug above in sequence

Happy to open PRs for the three workarounds if it helps.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions