Open source CapCut alternative.
TypeScript
Use shared local LLM default config
David Le239a8dd7ff4a
diff --git a/apps/Donkey/Sources/DonkeyAI/AIModelRegistry.swift b/apps/Donkey/Sources/DonkeyAI/AIModelRegistry.swiftindex 06bb3c5c..889bbd30 100644--- a/apps/Donkey/Sources/DonkeyAI/AIModelRegistry.swift+++ b/apps/Donkey/Sources/DonkeyAI/AIModelRegistry.swift@@ -104,11 +104,11 @@ public struct AIModelRegistry: Codable, Equatable, Sendable {public static let defaultHybridPlanner = AIModelRegistry(entries: [AIModelRegistryEntry(- id: "local-runtime-task-intent-qwen3-0-6b",+ id: "local-runtime-task-intent-qwen2-5-0-5b-instruct",role: .taskIntent,provider: .localRuntime,- modelID: "qwen3-0.6b-q4_0",- endpoint: URL(string: "local://qwen3-0.6b-q4_0/task-intent")!,+ modelID: "qwen2.5-0.5b-instruct-q4_k_m",+ endpoint: URL(string: "local://qwen2.5-0.5b-instruct-q4_k_m/task-intent")!,capabilities: [.textInput, .structuredOutputs],timeoutMS: 20_000,promptVersion: "task-intent-v1",diff --git a/apps/Donkey/Sources/DonkeyRuntime/LocalModelRuntimeSetup.swift b/apps/Donkey/Sources/DonkeyRuntime/LocalModelRuntimeSetup.swiftindex 9e12de52..c0b71ce6 100644--- a/apps/Donkey/Sources/DonkeyRuntime/LocalModelRuntimeSetup.swift+++ b/apps/Donkey/Sources/DonkeyRuntime/LocalModelRuntimeSetup.swift@@ -468,7 +468,7 @@ public struct LocalModelRuntimeSetupManager: Sendable {displayName: "Local command parser LLM",environmentVariableName: "DONKEY_LOCAL_LLM_RUNNER",expectedExecutableRelativePath: "bin/donkey-local-llm",- modelName: "qwen3-0.6b-q4_0",+ modelName: "qwen2.5-0.5b-instruct-q4_k_m",downloadPageURL: nil,manifestURL: Self.defaultPackageManifestURL(for: .localLLM),installSteps: [diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/AIHarnessAdapterTests.swift b/apps/Donkey/Tests/DonkeyRuntimeTests/AIHarnessAdapterTests.swiftindex b83bc7a6..21a089db 100644--- a/apps/Donkey/Tests/DonkeyRuntimeTests/AIHarnessAdapterTests.swift+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/AIHarnessAdapterTests.swift@@ -4,7 +4,7 @@ import DonkeyRuntimeimport Foundationimport Testing-private let defaultLocalRuntimeModelID = "qwen3-0.6b-q4_0"+private let defaultLocalRuntimeModelID = "qwen2.5-0.5b-instruct-q4_k_m"// Only used in explicit Ollama adapter unit tests; it is not a default runtime dependency.private let explicitOllamaFixtureModelID = "qwen3:8b"@@ -83,7 +83,7 @@ struct AIHarnessAdapterTests {))- #expect(selected.id == "local-runtime-task-intent-qwen3-0-6b")+ #expect(selected.id == "local-runtime-task-intent-qwen2-5-0-5b-instruct")#expect(selected.role == .taskIntent)#expect(selected.provider == .localRuntime)#expect(selected.modelID == defaultLocalRuntimeModelID)diff --git a/apps/Donkey/Tests/DonkeyRuntimeTests/LocalModelRuntimeSetupTests.swift b/apps/Donkey/Tests/DonkeyRuntimeTests/LocalModelRuntimeSetupTests.swiftindex 41bc193b..55c906ed 100644--- a/apps/Donkey/Tests/DonkeyRuntimeTests/LocalModelRuntimeSetupTests.swift+++ b/apps/Donkey/Tests/DonkeyRuntimeTests/LocalModelRuntimeSetupTests.swift@@ -373,7 +373,7 @@ struct LocalModelRuntimeSetupTests {relativePath: "bin/donkey-local-llm",runtimeID: "local-llm",runtimeVersion: "1.2.3",- modelID: "qwen3-0.6b-q4_0",+ modelID: "qwen2.5-0.5b-instruct-q4_k_m",metadataJSON: #"{"modelWeights.status":"missing","modelWeights.provider":"donkey-managed-download"}"#)let manager = try LocalModelRuntimeSetupManager(baseDirectory: root)@@ -382,7 +382,7 @@ struct LocalModelRuntimeSetupTests {executableURL: healthExecutable,downloadedDirectory: download,runtimeVersion: "1.2.3",- modelID: "qwen3-0.6b-q4_0",+ modelID: "qwen2.5-0.5b-instruct-q4_k_m",sidecarProtocolVersion: "v1")diff --git a/config/local-llm-models.json b/config/local-llm-models.jsonnew file mode 100644index 00000000..30789916--- /dev/null+++ b/config/local-llm-models.json@@ -0,0 +1,15 @@+{+ "runtimeRequirements": [+ "llama-cpp-python>=0.3,<0.4"+ ],+ "defaultModel": {+ "id": "qwen2.5-0.5b-instruct-q4_k_m",+ "displayName": "Qwen2.5 0.5B Instruct Q4_K_M",+ "modelID": "qwen2.5-0.5b-instruct-q4_k_m",+ "filename": "qwen2.5-0.5b-instruct-q4_k_m.gguf",+ "downloadURL": "https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct-GGUF/resolve/df5bf01389a39c743ab467d734bf501681e041c5/qwen2.5-0.5b-instruct-q4_k_m.gguf",+ "sha256": "74a4da8c9fdbcd15bd1f6d01d621410d31c6fc00986f5eb687824e7b93d7a9db",+ "expectedSizeMB": 491,+ "notes": "Packaged default; instruction-tuned Qwen2.5 small model."+ }+}diff --git a/docs/guides/install-donkey.md b/docs/guides/install-donkey.mdindex 9e169615..41dcdd65 100644--- a/docs/guides/install-donkey.md+++ b/docs/guides/install-donkey.md@@ -85,14 +85,20 @@ On first launch, Donkey opens setup and starts installing required local runtimeEach sidecar supports setup-time model weight preparation. During setup, Donkey calls the sidecar with `prepareModelWeights`; the sidecar downloads or warms the configured model cache and reports cached/downloaded status before health check. The local command-parser LLM is setup-managed too: Donkey packages a `local-llm` sidecar whose release manifest must include a model-weight download URL, checksum, and local inference backend requirement. The default package uses a Donkey-managed GGUF weight download with a `llama-cpp-python` backend. Actionable prompt turns are parsed through `DONKEY_LOCAL_LLM_RUNNER`; if that local runtime is unavailable, task-intent parsing fails clearly. Donkey does not fall back to a user-managed Ollama daemon. The Parakeet runner can fetch the Hugging Face snapshot when `huggingface_hub` is available and transcribes through NVIDIA NeMo when the local Python backend is installed.-Configure model-weight URLs when packaging:+The packaged local command-parser model lives in+`config/local-llm-models.json`. Change that file when updating the product+default; packaging and dev runtime refresh both read it. Eval-only candidate+lists live with the eval fixtures under `evals/task-intent/`. Set+`DONKEY_LOCAL_LLM_MODEL_CONFIG` to test a different runtime-default config file.++Override model-weight URLs when packaging:```bashDONKEY_PARAKEET_MODEL_URL="https://..." \DONKEY_PARAKEET_MODEL_SHA256="..." \DONKEY_YOLO_MODEL_URL="https://..." \DONKEY_YOLO_MODEL_SHA256="..." \-DONKEY_LOCAL_LLM_MODEL_ID="qwen3-0.6b-q4_0" \+DONKEY_LOCAL_LLM_MODEL_ID="qwen2.5-0.5b-instruct-q4_k_m" \DONKEY_LOCAL_LLM_MODEL_URL="https://..." \DONKEY_LOCAL_LLM_MODEL_SHA256="..." \./scripts/package-donkey-app.shdiff --git a/scripts/package-donkey-app.sh b/scripts/package-donkey-app.shindex 585e5a93..ba504ce6 100755--- a/scripts/package-donkey-app.sh+++ b/scripts/package-donkey-app.sh@@ -15,6 +15,7 @@ SPARKLE_FEED_URL="${DONKEY_SPARKLE_FEED_URL:-}"SPARKLE_PUBLIC_ED_KEY="${DONKEY_SPARKLE_PUBLIC_ED_KEY:-}"RUNTIME_MANIFEST_PUBLIC_KEYS="${DONKEY_RUNTIME_MANIFEST_PUBLIC_KEYS:-}"RUNTIME_REQUIRE_CRYPTO_SIGNATURES="${DONKEY_RUNTIME_REQUIRE_CRYPTO_SIGNATURES:-0}"+LOCAL_LLM_MODEL_CONFIG="${DONKEY_LOCAL_LLM_MODEL_CONFIG:-$ROOT_DIR/config/local-llm-models.json}"CONTENTS_DIR="$APP_DIR/Contents"MACOS_DIR="$CONTENTS_DIR/MacOS"RESOURCES_DIR="$CONTENTS_DIR/Resources"@@ -30,6 +31,35 @@ export CLANG_MODULE_CACHE_PATH="$CACHE_DIR/clang"export SWIFTPM_CACHE_PATH="$CACHE_DIR/swiftpm"export HOME="$CACHE_DIR/home"+load_local_llm_model_defaults() {+ local config_path="$1"+ python3 - "$config_path" <<'PY'+import json+import shlex+import sys+from pathlib import Path++config_path = Path(sys.argv[1])+config = json.loads(config_path.read_text())+model = config.get("defaultModel")+if not isinstance(model, dict):+ raise SystemExit(f"defaultModel not found in {config_path}")+requirements = config.get("runtimeRequirements") if isinstance(config.get("runtimeRequirements"), list) else []+requirements_text = "\n".join(str(item) for item in requirements if str(item).strip())+values = {+ "LOCAL_LLM_MODEL_ID_DEFAULT": str(model.get("modelID") or ""),+ "LOCAL_LLM_MODEL_URL_DEFAULT": str(model.get("downloadURL") or ""),+ "LOCAL_LLM_MODEL_SHA256_DEFAULT": str(model.get("sha256") or model.get("expectedSHA256") or ""),+ "LOCAL_LLM_MODEL_FILENAME_DEFAULT": str(model.get("filename") or "model.gguf"),+ "LOCAL_LLM_RUNTIME_REQUIREMENTS": requirements_text,+}+for key, value in values.items():+ print(f"{key}={shlex.quote(value)}")+PY+}++eval "$(load_local_llm_model_defaults "$LOCAL_LLM_MODEL_CONFIG")"+manifest_download_url_entry() {local runtime_id="$1"local relative_path="$2"@@ -208,7 +238,7 @@ mkdir -p "$RUNTIME_PACKAGE_DIR"make_runtime_package "parakeet-transcriber" "donkey-parakeet-transcriber" "nvidia/parakeet-tdt-0.6b-v3" "voiceTranscription" "${DONKEY_PARAKEET_MODEL_URL:-}" "${DONKEY_PARAKEET_MODEL_SHA256:-}" "${DONKEY_PARAKEET_MODEL_FILENAME:-parakeet-model.bin}" $'huggingface_hub>=0.25,<1'make_runtime_package "yolo-segmenter" "donkey-yolo-segmenter" "ultralytics/yolo26n-seg" "screenshotSegmentation" "${DONKEY_YOLO_MODEL_URL:-}" "${DONKEY_YOLO_MODEL_SHA256:-}" "${DONKEY_YOLO_MODEL_FILENAME:-yolo26n-seg.pt}" $'ultralytics>=8.3,<9\nopencv-python-headless>=4.10,<5'make_binary_runtime_package "ui-understander" "donkey-ui-understander" "$UI_UNDERSTANDER_EXECUTABLE" "apple-vision-text-recognition" "uiUnderstanding"-make_runtime_package "local-llm" "donkey-local-llm" "${DONKEY_LOCAL_LLM_MODEL_ID:-qwen3-0.6b-q4_0}" "localLLM" "${DONKEY_LOCAL_LLM_MODEL_URL:-https://huggingface.co/ggml-org/Qwen3-0.6B-GGUF/resolve/main/Qwen3-0.6B-Q4_0.gguf}" "${DONKEY_LOCAL_LLM_MODEL_SHA256:-da2572f16c06133561ce56accaa822216f2391ef4d37fba427801cd6736417d4}" "${DONKEY_LOCAL_LLM_MODEL_FILENAME:-Qwen3-0.6B-Q4_0.gguf}" $'llama-cpp-python>=0.3,<0.4'+make_runtime_package "local-llm" "donkey-local-llm" "${DONKEY_LOCAL_LLM_MODEL_ID:-$LOCAL_LLM_MODEL_ID_DEFAULT}" "localLLM" "${DONKEY_LOCAL_LLM_MODEL_URL:-$LOCAL_LLM_MODEL_URL_DEFAULT}" "${DONKEY_LOCAL_LLM_MODEL_SHA256:-$LOCAL_LLM_MODEL_SHA256_DEFAULT}" "${DONKEY_LOCAL_LLM_MODEL_FILENAME:-$LOCAL_LLM_MODEL_FILENAME_DEFAULT}" "$LOCAL_LLM_RUNTIME_REQUIREMENTS"RESOURCE_BUNDLE="$(find "$BUILD_DIR/.build" -path "*/release/Donkey_Donkey.bundle" -type d | head -n 1 || true)"if [ -n "$RESOURCE_BUNDLE" ]; thendiff --git a/scripts/run-donkey-dev.sh b/scripts/run-donkey-dev.shindex 5e321079..8e8d7ec3 100755--- a/scripts/run-donkey-dev.sh+++ b/scripts/run-donkey-dev.sh@@ -10,6 +10,7 @@ DEV_RUNTIME_SETUP_SCRIPT="$ROOT_DIR/scripts/setup-dev-local-runtimes.py"PACKAGE_SCRIPT="$ROOT_DIR/scripts/package-donkey-app.sh"DEV_RUNTIME_PACKAGE_DIR="${DONKEY_DEV_RUNTIME_PACKAGE_DIR:-$ROOT_DIR/dist/LocalRuntimePackages}"DEV_RUNTIME_ENV_FILE="${DONKEY_DEV_RUNTIME_ENV_FILE:-$ROOT_DIR/dist/donkey-dev-runtime-manifests.env}"+LOCAL_LLM_MODEL_CONFIG="${DONKEY_LOCAL_LLM_MODEL_CONFIG:-$ROOT_DIR/config/local-llm-models.json}"LOG_PID=""cleanup() {@@ -70,12 +71,14 @@ dev_runtime_packages_need_refresh() {if [ ! -d "$DEV_RUNTIME_PACKAGE_DIR" ]; thenreturn 0fi- python3 - "$DEV_RUNTIME_PACKAGE_DIR" <<'PY'+ python3 - "$DEV_RUNTIME_PACKAGE_DIR" "$LOCAL_LLM_MODEL_CONFIG" <<'PY'import json+import osimport sysfrom pathlib import Pathpackage_dir = Path(sys.argv[1])+config_path = Path(sys.argv[2])expected_runtimes = {"local-llm", "parakeet-transcriber", "ui-understander", "yolo-segmenter"}for runtime_id in expected_runtimes:if not (package_dir / runtime_id / "manifest.json").exists():@@ -90,6 +93,28 @@ except Exception:metadata = manifest.get("metadata") if isinstance(manifest.get("metadata"), dict) else {}files = manifest.get("files") if isinstance(manifest.get("files"), list) else []requirements_path = package_dir / "local-llm" / "requirements.txt"+try:+ config = json.loads(config_path.read_text())+except Exception:+ raise SystemExit(0)+model = config.get("defaultModel")+if not isinstance(model, dict):+ raise SystemExit(0)+expected_model_id = os.environ.get("DONKEY_LOCAL_LLM_MODEL_ID") or str(model.get("modelID") or "")+expected_model_url = os.environ.get("DONKEY_LOCAL_LLM_MODEL_URL") or str(model.get("downloadURL") or "")+expected_model_sha256 = (+ os.environ.get("DONKEY_LOCAL_LLM_MODEL_SHA256")+ or str(model.get("sha256") or model.get("expectedSHA256") or "")+)+expected_model_filename = os.environ.get("DONKEY_LOCAL_LLM_MODEL_FILENAME") or str(model.get("filename") or "")+if str(manifest.get("modelID") or "") != expected_model_id:+ raise SystemExit(0)+if str(metadata.get("modelWeights.downloadURL") or "") != expected_model_url:+ raise SystemExit(0)+if str(metadata.get("modelWeights.sha256") or "") != expected_model_sha256:+ raise SystemExit(0)+if str(metadata.get("modelWeights.filename") or "") != expected_model_filename:+ raise SystemExit(0)if not str(metadata.get("modelWeights.downloadURL") or "").strip():raise SystemExit(0)if not str(metadata.get("modelWeights.sha256") or "").strip():