Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

refactor: keep Ollama create output normalization module-private (#13124)

Adam Eivy52b8f1bee089
diff --git a/server/services/ollamaSafetensorsImport.js b/server/services/ollamaSafetensorsImport.js
index 3162e34146..8d4e8185b8 100644
--- a/server/services/ollamaSafetensorsImport.js
+++ b/server/services/ollamaSafetensorsImport.js
@@ -24,9 +24,9 @@ import { atomicWrite, safeJSONParse, sleep } from '../lib/fileUtils.js'
import { killWithEscalation } from '../lib/killWithEscalation.js'
import { findOpenFileHolders } from '../lib/openFileHolders.js'
-export const STAGING_PREFIX = 'portos-ollama-hf-import-'
+const STAGING_PREFIX = 'portos-ollama-hf-import-'
const MARKER_NAME = 'portos-import.json'
-export const CREATE_IDLE_LIMIT_MS = 10 * 60_000
+const CREATE_IDLE_LIMIT_MS = 10 * 60_000
const CREATE_CHECK_INTERVAL_MS = 15_000
const CREATE_KILL_GRACE_MS = 10_000
// After SIGKILL a live child exits within milliseconds; still being there this
@@ -46,7 +46,7 @@ const RATE_RE = /\b\d+(?:\.\d+)?\s?[KMGT]?i?B\/s\b/gi
const DURATION_RE = /\b(?:\d+h)?(?:\d+m)?\d+(?:\.\d+)?(?:ms|s)\b|\b\d+h\d+m\b|\b\d+m\b/g
/** Complete output segments, reduced to the text that changes only on real progress. */
-export function normalizeCreateOutput(text) {
+function normalizeCreateOutput(text) {
return String(text).replace(ANSI_RE, '').split(/[\r\n]+/)
.map((line) => line.replace(SPINNER_RE, '').replace(RATE_RE, '').replace(DURATION_RE, '').replace(/\s+/g, ' ').trim())
.filter(Boolean)