Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(audit): desktop-100 round — 59 confirmed findings across the cloud tier

purple3c6584dba73e
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 26e02256..13545658 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -20,11 +20,13 @@ permissions:
#
# Sidecar: every platform must build the bundled llama.cpp `llama-server`
# BEFORE tauri-action runs — tauri-build hard-fails on a missing externalBin.
-# The build is cached on (LLAMA_TAG × triple); it only recompiles when the
-# pin in scripts/build-llama.sh moves.
+# The build is cached on (hash of scripts/build-llama.sh × triple); it only
+# recompiles when the script (tag pin or cmake flags) changes.
env:
- # Windows Vulkan SDK for the GGML_VULKAN sidecar build. Version pinned;
- # bump together with the llama.cpp tag. (LunarG keeps old versions up.)
+ # Vulkan SDK pin for the GGML_VULKAN sidecar builds: the Windows lane uses
+ # the full installer version, the Linux lane derives the 3-part family for
+ # LunarG's jammy apt repo. Bump together with the llama.cpp tag; LunarG
+ # keeps old versions up.
VULKAN_SDK_VERSION: '1.4.313.2'
jobs:
@@ -99,24 +101,33 @@ jobs:
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: .llama-build
- key: llama-b6231-${{ matrix.sidecar_triple }}-v1
+ key: llama-${{ hashFiles('scripts/build-llama.sh') }}-${{ matrix.sidecar_triple }}-v1
- name: Install Vulkan SDK (Windows)
if: matrix.platform == 'windows-latest'
shell: pwsh
run: |
- curl.exe -o "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" -L `
- "https://sdk.lunarg.com/sdk/download/${env:VULKAN_SDK_VERSION}/windows/VulkanSDK-${env:VULKAN_SDK_VERSION}-Installer.exe"
+ # LunarG's 1.4.x Windows installer is vulkansdk-windows-X64-<ver>.exe —
+ # the old VulkanSDK-<ver>-Installer.exe name 404s.
+ curl.exe -fL --retry 3 -o "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" `
+ "https://sdk.lunarg.com/sdk/download/${env:VULKAN_SDK_VERSION}/windows/vulkansdk-windows-X64-${env:VULKAN_SDK_VERSION}.exe"
+ if ($LASTEXITCODE -ne 0) { throw "Vulkan SDK download failed" }
& "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install
Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_SDK_VERSION}"
- name: Install Vulkan toolchain (Linux)
if: matrix.platform == 'ubuntu-22.04'
run: |
- sudo apt-get install -y libvulkan-dev glslc || {
- # glslc is not in every 22.04 mirror set — fall back to shaderc.
- sudo apt-get install -y libvulkan-dev shaderc
- }
+ # Jammy ships no glslc/shaderc binary packages, and ggml's Vulkan
+ # backend hard-requires glslc — install the SDK from LunarG's jammy
+ # repo, pinned to the same family as the Windows lane.
+ family="${VULKAN_SDK_VERSION%.*}"
+ wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc \
+ | sudo tee /etc/apt/trusted.gpg.d/lunarg.asc >/dev/null
+ sudo wget -qO "/etc/apt/sources.list.d/lunarg-vulkan-${family}-jammy.list" \
+ "https://packages.lunarg.com/vulkan/${family}/lunarg-vulkan-${family}-jammy.list"
+ sudo apt-get update
+ sudo apt-get install -y vulkan-sdk
- name: Build llama-server sidecar
shell: bash
diff --git a/.github/workflows/sidecar-windows.yml b/.github/workflows/sidecar-windows.yml
index 1b0d48cc..fec5f37d 100644
--- a/.github/workflows/sidecar-windows.yml
+++ b/.github/workflows/sidecar-windows.yml
@@ -33,13 +33,16 @@ jobs:
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: .llama-build
- key: llama-b6231-x86_64-pc-windows-msvc-v1
+ key: llama-${{ hashFiles('scripts/build-llama.sh') }}-x86_64-pc-windows-msvc-v1
- name: Install Vulkan SDK
shell: pwsh
run: |
- curl.exe -o "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" -L `
- "https://sdk.lunarg.com/sdk/download/${env:VULKAN_SDK_VERSION}/windows/VulkanSDK-${env:VULKAN_SDK_VERSION}-Installer.exe"
+ # LunarG's 1.4.x Windows installer is vulkansdk-windows-X64-<ver>.exe —
+ # the old VulkanSDK-<ver>-Installer.exe name 404s.
+ curl.exe -fL --retry 3 -o "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" `
+ "https://sdk.lunarg.com/sdk/download/${env:VULKAN_SDK_VERSION}/windows/vulkansdk-windows-X64-${env:VULKAN_SDK_VERSION}.exe"
+ if ($LASTEXITCODE -ne 0) { throw "Vulkan SDK download failed" }
& "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install
Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_SDK_VERSION}"
@@ -47,13 +50,23 @@ jobs:
shell: bash
run: bash scripts/build-llama.sh x86_64-pc-windows-msvc
- - name: Boot smoke — /health on an ephemeral port
+ - name: Boot smoke — real model load + /health
shell: pwsh
run: |
$bin = "src-tauri\bin\llama-server-x86_64-pc-windows-msvc.exe"
if (-not (Test-Path $bin)) { throw "sidecar binary missing" }
& $bin --version
- $proc = Start-Process -FilePath $bin -ArgumentList "--host","127.0.0.1","--port","8129","--models",".llama-build" -PassThru -NoNewWindow
+ if ($LASTEXITCODE -ne 0) { throw "llama-server --version exited $LASTEXITCODE" }
+ # Tiny (~1.2 MB) public GGUF so /health proves a real model load,
+ # not just the HTTP layer. Lands in .llama-build, so the sidecar
+ # cache step keeps it across runs.
+ $model = ".llama-build\stories260K.gguf"
+ if (-not (Test-Path $model)) {
+ curl.exe -fsSL --retry 3 -o $model `
+ "https://huggingface.co/ggml-org/models/resolve/main/tinyllamas/stories260K.gguf"
+ if ($LASTEXITCODE -ne 0) { throw "smoke model download failed" }
+ }
+ $proc = Start-Process -FilePath $bin -ArgumentList "--host","127.0.0.1","--port","8129","-m",$model -PassThru -NoNewWindow
$ok = $false
foreach ($i in 1..40) {
Start-Sleep -Milliseconds 400
@@ -64,7 +77,7 @@ jobs:
}
Stop-Process -Id $proc.Id -Force -ErrorAction SilentlyContinue
if (-not $ok) { throw "llama-server /health never came up" }
- Write-Host "OK - sidecar boots and answers /health"
+ Write-Host "OK - sidecar boots, loads a model and answers /health"
- name: Upload sidecar artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
diff --git a/e2e/cloud-create.spec.ts b/e2e/cloud-create.spec.ts
index e5214645..e4391c36 100644
--- a/e2e/cloud-create.spec.ts
+++ b/e2e/cloud-create.spec.ts
@@ -41,7 +41,8 @@ test('cloud render: submit → poll → gallery, meter + utility intents present
await page.getByRole('button', { name: /^Create$/ }).last().click()
// The mocked job succeeds on the first poll; the image lands in the gallery.
- await expect(page.locator('img[src^="data:image"]').first()).toBeVisible({ timeout: 30_000 })
+ // Cloud results keep their remote signed URL (no base64 persistence).
+ await expect(page.locator('img[src*="/e2e/result.png"]').first()).toBeVisible({ timeout: 30_000 })
})
test('media_live=false: generate shows the honest coming-soon message', async ({ page }) => {
diff --git a/scripts/build-llama.sh b/scripts/build-llama.sh
index a0c50a7a..dc8a3f86 100755
--- a/scripts/build-llama.sh
+++ b/scripts/build-llama.sh
@@ -25,8 +25,10 @@
set -euo pipefail
# --- Pinned, reproducible llama.cpp revision -------------------------------
-# Bump deliberately and re-test; do not float. llama.cpp tags are build numbers.
-LLAMA_TAG="${LLAMA_TAG:-b6231}"
+# Bump deliberately and re-test; do not float. llama.cpp tags are build numbers
+# and upstream SKIPS numbers whose CI failed — verify the tag exists first:
+# git ls-remote --tags https://github.com/ggml-org/llama.cpp.git 'refs/tags/<tag>'
+LLAMA_TAG="${LLAMA_TAG:-b9949}"
LLAMA_REPO="${LLAMA_REPO:-https://github.com/ggml-org/llama.cpp.git}"
# --- Paths -----------------------------------------------------------------
@@ -54,9 +56,12 @@ host_triple() {
}
# Map a Rust target triple → cmake flags for a static, GPU-embedded llama-server.
+# LLAMA_OPENSSL=OFF: no HTTPS/downloader deps — the app manages model files.
+# LLAMA_BUILD_UI/USE_PREBUILT_UI=OFF: headless sidecar — no npm build and no
+# HF asset fetch at compile time.
cmake_flags_for() {
local triple="$1"
- local common="-DBUILD_SHARED_LIBS=OFF -DLLAMA_CURL=OFF -DGGML_NATIVE=OFF -DCMAKE_BUILD_TYPE=Release"
+ local common="-DBUILD_SHARED_LIBS=OFF -DLLAMA_OPENSSL=OFF -DLLAMA_BUILD_UI=OFF -DLLAMA_USE_PREBUILT_UI=OFF -DGGML_NATIVE=OFF -DCMAKE_BUILD_TYPE=Release"
case "$triple" in
aarch64-apple-darwin)
echo "$common -DGGML_METAL=ON -DGGML_METAL_EMBED_LIBRARY=ON -DCMAKE_OSX_ARCHITECTURES=arm64" ;;
@@ -116,14 +121,17 @@ build_triple() {
log "installed → $out"
}
-# Boot the host binary and probe /health + /v1/models on an ephemeral port.
+# Boot the host binary and probe /health on an ephemeral port. Without a
+# model llama-server starts in router mode (no weights loaded), so /health
+# answers 200 on any machine.
check_binary() {
local triple; triple="$(host_triple)"
local bin="$BIN_DIR/$(out_name_for "$triple")"
[ -x "$bin" ] || die "no built binary at $bin — build first"
+ "$bin" --version >/dev/null 2>&1 || die "$bin --version failed"
local port=8129
- log "boot check: $bin on 127.0.0.1:$port (no model, /health only)"
- "$bin" --host 127.0.0.1 --port "$port" --models "$CACHE_DIR" >/dev/null 2>&1 &
+ log "boot check: $bin on 127.0.0.1:$port (no model — router mode, /health only)"
+ "$bin" --host 127.0.0.1 --port "$port" >/dev/null 2>&1 &
local pid=$!
trap 'kill "$pid" 2>/dev/null || true' EXIT
local ok=""
diff --git a/src-tauri/Entitlements.plist b/src-tauri/Entitlements.plist
new file mode 100644
index 00000000..38672e1d
--- /dev/null
+++ b/src-tauri/Entitlements.plist
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!--
+ Hardened Runtime entitlements (referenced via bundle.macOS.entitlements in
+ tauri.conf.json; derived from the proven LU-Labs bridge set).
+
+ - allow-jit + allow-unsigned-executable-memory: WKWebView JavaScriptCore JIT.
+ - disable-library-validation: whisper/voice sidecar loads Python dylibs not
+ signed with our identity.
+ - network.client: Ollama/LM-Studio probes, Hugging Face + Civitai downloads.
+ - network.server: remote-access bridge listens on port 19191.
+ - device.audio-input: microphone for dictation/voice — required in a
+ notarized Hardened Runtime build even with NSMicrophoneUsageDescription.
+-->
+<plist version="1.0">
+<dict>
+ <key>com.apple.security.cs.allow-jit</key>
+ <true/>
+ <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
+ <true/>
+ <key>com.apple.security.cs.disable-library-validation</key>
+ <true/>
+
+ <key>com.apple.security.network.client</key>
+ <true/>
+ <key>com.apple.security.network.server</key>
+ <true/>
+
+ <key>com.apple.security.device.audio-input</key>
+ <true/>
+</dict>
+</plist>
diff --git a/src-tauri/Info.plist b/src-tauri/Info.plist
new file mode 100644
index 00000000..8e8224c8
--- /dev/null
+++ b/src-tauri/Info.plist
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!-- Tauri v2 auto-merges this file into the generated bundle Info.plist
+ (the bundler looks for an Info.plist next to tauri.conf.json). Without
+ NSMicrophoneUsageDescription macOS TCC denies getUserMedia outright, so
+ dictation/voice never even shows the permission prompt. -->
+<plist version="1.0">
+<dict>
+ <key>NSMicrophoneUsageDescription</key>
+ <string>Voice chat and dictation transcribe your speech locally on this device.</string>
+</dict>
+</plist>
diff --git a/src-tauri/gen/schemas/macOS-schema.json b/src-tauri/gen/schemas/macOS-schema.json
new file mode 100644
index 00000000..eb1bac8d
--- /dev/null
+++ b/src-tauri/gen/schemas/macOS-schema.json
@@ -0,0 +1,2618 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "CapabilityFile",
+ "description": "Capability formats accepted in a capability file.",
+ "anyOf": [
+ {
+ "description": "A single capability.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/Capability"
+ }
+ ]
+ },
+ {
+ "description": "A list of capabilities.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/Capability"
+ }
+ },
+ {
+ "description": "A list of capabilities.",
+ "type": "object",
+ "required": [
+ "capabilities"
+ ],
+ "properties": {
+ "capabilities": {
+ "description": "The list of capabilities.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/Capability"
+ }
+ }
+ }
+ }
+ ],
+ "definitions": {
+ "Capability": {
+ "description": "A grouping and boundary mechanism developers can use to isolate access to the IPC layer.\n\nIt controls application windows' and webviews' fine grained access to the Tauri core, application, or plugin commands. If a webview or its window is not matching any capability then it has no access to the IPC layer at all.\n\nThis can be done to create groups of windows, based on their required system access, which can reduce impact of frontend vulnerabilities in less privileged windows. Windows can be added to a capability by exact name (e.g. `main-window`) or glob patterns like `*` or `admin-*`. A Window can have none, one, or multiple associated capabilities.\n\n## Example\n\n```json { \"identifier\": \"main-user-files-write\", \"description\": \"This capability allows the `main` window on macOS and Windows access to `filesystem` write related commands and `dialog` commands to enable programmatic access to files selected by the user.\", \"windows\": [ \"main\" ], \"permissions\": [ \"core:default\", \"dialog:open\", { \"identifier\": \"fs:allow-write-text-file\", \"allow\": [{ \"path\": \"$HOME/test.txt\" }] }, ], \"platforms\": [\"macOS\",\"windows\"] } ```",
+ "type": "object",
+ "required": [
+ "identifier",
+ "permissions"
+ ],
+ "properties": {
+ "identifier": {
+ "description": "Identifier of the capability.\n\n## Example\n\n`main-user-files-write`",
+ "type": "string"
+ },
+ "description": {
+ "description": "Description of what the capability is intended to allow on associated windows.\n\nIt should contain a description of what the grouped permissions should allow.\n\n## Example\n\nThis capability allows the `main` window access to `filesystem` write related commands and `dialog` commands to enable programmatic access to files selected by the user.",
+ "default": "",
+ "type": "string"
+ },
+ "remote": {
+ "description": "Configure remote URLs that can use the capability permissions.\n\nThis setting is optional and defaults to not being set, as our default use case is that the content is served from our local application.\n\n:::caution Make sure you understand the security implications of providing remote sources with local system access. :::\n\n## Example\n\n```json { \"urls\": [\"https://*.mydomain.dev\"] } ```",
+ "anyOf": [
+ {
+ "$ref": "#/definitions/CapabilityRemote"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
+ "local": {
+ "description": "Whether this capability is enabled for local app URLs or not. Defaults to `true`.",
+ "default": true,
+ "type": "boolean"
+ },
+ "windows": {
+ "description": "List of windows that are affected by this capability. Can be a glob pattern.\n\nIf a window label matches any of the patterns in this list, the capability will be enabled on all the webviews of that window, regardless of the value of [`Self::webviews`].\n\nOn multiwebview windows, prefer specifying [`Self::webviews`] and omitting [`Self::windows`] for a fine grained access control.\n\n## Example\n\n`[\"main\"]`",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "webviews": {
+ "description": "List of webviews that are affected by this capability. Can be a glob pattern.\n\nThe capability will be enabled on all the webviews whose label matches any of the patterns in this list, regardless of whether the webview's window label matches a pattern in [`Self::windows`].\n\n## Example\n\n`[\"sub-webview-one\", \"sub-webview-two\"]`",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "permissions": {
+ "description": "List of permissions attached to this capability.\n\nMust include the plugin name as prefix in the form of `${plugin-name}:${permission-name}`. For commands directly implemented in the application itself only `${permission-name}` is required.\n\n## Example\n\n```json [ \"core:default\", \"shell:allow-open\", \"dialog:open\", { \"identifier\": \"fs:allow-write-text-file\", \"allow\": [{ \"path\": \"$HOME/test.txt\" }] } ] ```",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/PermissionEntry"
+ },
+ "uniqueItems": true
+ },
+ "platforms": {
+ "description": "Limit which target platforms this capability applies to.\n\nBy default all platforms are targeted.\n\n## Example\n\n`[\"macOS\",\"windows\"]`",
+ "type": [
+ "array",
+ "null"
+ ],
+ "items": {
+ "$ref": "#/definitions/Target"
+ }
+ }
+ }
+ },
+ "CapabilityRemote": {
+ "description": "Configuration for remote URLs that are associated with the capability.",
+ "type": "object",
+ "required": [
+ "urls"
+ ],
+ "properties": {
+ "urls": {
+ "description": "Remote domains this capability refers to using the [URLPattern standard](https://urlpattern.spec.whatwg.org/).\n\n## Examples\n\n- \"https://*.mydomain.dev\": allows subdomains of mydomain.dev - \"https://mydomain.dev/api/*\": allows any subpath of mydomain.dev/api",
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "PermissionEntry": {
+ "description": "An entry for a permission value in a [`Capability`] can be either a raw permission [`Identifier`] or an object that references a permission and extends its scope.",
+ "anyOf": [
+ {
+ "description": "Reference a permission or permission set by identifier.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/Identifier"
+ }
+ ]
+ },
+ {
+ "description": "Reference a permission or permission set by identifier and extends its scope.",
+ "type": "object",
+ "allOf": [
+ {
+ "if": {
+ "properties": {
+ "identifier": {
+ "anyOf": [
+ {
+ "description": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`",
+ "type": "string",
+ "const": "shell:default",
+ "markdownDescription": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`"
+ },
+ {
+ "description": "Enables the execute command without any pre-configured scope.",
+ "type": "string",
+ "const": "shell:allow-execute",
+ "markdownDescription": "Enables the execute command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the kill command without any pre-configured scope.",
+ "type": "string",
+ "const": "shell:allow-kill",
+ "markdownDescription": "Enables the kill command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the open command without any pre-configured scope.",
+ "type": "string",
+ "const": "shell:allow-open",
+ "markdownDescription": "Enables the open command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the spawn command without any pre-configured scope.",
+ "type": "string",
+ "const": "shell:allow-spawn",
+ "markdownDescription": "Enables the spawn command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the stdin_write command without any pre-configured scope.",
+ "type": "string",
+ "const": "shell:allow-stdin-write",
+ "markdownDescription": "Enables the stdin_write command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the execute command without any pre-configured scope.",
+ "type": "string",
+ "const": "shell:deny-execute",
+ "markdownDescription": "Denies the execute command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the kill command without any pre-configured scope.",
+ "type": "string",
+ "const": "shell:deny-kill",
+ "markdownDescription": "Denies the kill command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the open command without any pre-configured scope.",
+ "type": "string",
+ "const": "shell:deny-open",
+ "markdownDescription": "Denies the open command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the spawn command without any pre-configured scope.",
+ "type": "string",
+ "const": "shell:deny-spawn",
+ "markdownDescription": "Denies the spawn command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the stdin_write command without any pre-configured scope.",
+ "type": "string",
+ "const": "shell:deny-stdin-write",
+ "markdownDescription": "Denies the stdin_write command without any pre-configured scope."
+ }
+ ]
+ }
+ }
+ },
+ "then": {
+ "properties": {
+ "allow": {
+ "items": {
+ "title": "ShellScopeEntry",
+ "description": "Shell scope entry.",
+ "anyOf": [
+ {
+ "type": "object",
+ "required": [
+ "cmd",
+ "name"
+ ],
+ "properties": {
+ "args": {
+ "description": "The allowed arguments for the command execution.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/ShellScopeEntryAllowedArgs"
+ }
+ ]
+ },
+ "cmd": {
+ "description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
+ "type": "string"
+ },
+ "name": {
+ "description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
+ "type": "string"
+ }
+ },
+ "additionalProperties": false
+ },
+ {
+ "type": "object",
+ "required": [
+ "name",
+ "sidecar"
+ ],
+ "properties": {
+ "args": {
+ "description": "The allowed arguments for the command execution.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/ShellScopeEntryAllowedArgs"
+ }
+ ]
+ },
+ "name": {
+ "description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
+ "type": "string"
+ },
+ "sidecar": {
+ "description": "If this command is a sidecar command.",
+ "type": "boolean"
+ }
+ },
+ "additionalProperties": false
+ }
+ ]
+ }
+ },
+ "deny": {
+ "items": {
+ "title": "ShellScopeEntry",
+ "description": "Shell scope entry.",
+ "anyOf": [
+ {
+ "type": "object",
+ "required": [
+ "cmd",
+ "name"
+ ],
+ "properties": {
+ "args": {
+ "description": "The allowed arguments for the command execution.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/ShellScopeEntryAllowedArgs"
+ }
+ ]
+ },
+ "cmd": {
+ "description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
+ "type": "string"
+ },
+ "name": {
+ "description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
+ "type": "string"
+ }
+ },
+ "additionalProperties": false
+ },
+ {
+ "type": "object",
+ "required": [
+ "name",
+ "sidecar"
+ ],
+ "properties": {
+ "args": {
+ "description": "The allowed arguments for the command execution.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/ShellScopeEntryAllowedArgs"
+ }
+ ]
+ },
+ "name": {
+ "description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
+ "type": "string"
+ },
+ "sidecar": {
+ "description": "If this command is a sidecar command.",
+ "type": "boolean"
+ }
+ },
+ "additionalProperties": false
+ }
+ ]
+ }
+ }
+ }
+ },
+ "properties": {
+ "identifier": {
+ "description": "Identifier of the permission or permission set.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/Identifier"
+ }
+ ]
+ }
+ }
+ },
+ {
+ "properties": {
+ "identifier": {
+ "description": "Identifier of the permission or permission set.",
+ "allOf": [
+ {
+ "$ref": "#/definitions/Identifier"
+ }
+ ]
+ },
+ "allow": {
+ "description": "Data that defines what is allowed by the scope.",
+ "type": [
+ "array",
+ "null"
+ ],
+ "items": {
+ "$ref": "#/definitions/Value"
+ }
+ },
+ "deny": {
+ "description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.",
+ "type": [
+ "array",
+ "null"
+ ],
+ "items": {
+ "$ref": "#/definitions/Value"
+ }
+ }
+ }
+ }
+ ],
+ "required": [
+ "identifier"
+ ]
+ }
+ ]
+ },
+ "Identifier": {
+ "description": "Permission identifier",
+ "oneOf": [
+ {
+ "description": "Default core plugins set.\n#### This default permission set includes:\n\n- `core:path:default`\n- `core:event:default`\n- `core:window:default`\n- `core:webview:default`\n- `core:app:default`\n- `core:image:default`\n- `core:resources:default`\n- `core:menu:default`\n- `core:tray:default`",
+ "type": "string",
+ "const": "core:default",
+ "markdownDescription": "Default core plugins set.\n#### This default permission set includes:\n\n- `core:path:default`\n- `core:event:default`\n- `core:window:default`\n- `core:webview:default`\n- `core:app:default`\n- `core:image:default`\n- `core:resources:default`\n- `core:menu:default`\n- `core:tray:default`"
+ },
+ {
+ "description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`",
+ "type": "string",
+ "const": "core:app:default",
+ "markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`"
+ },
+ {
+ "description": "Enables the app_hide command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:allow-app-hide",
+ "markdownDescription": "Enables the app_hide command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the app_show command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:allow-app-show",
+ "markdownDescription": "Enables the app_show command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the bundle_type command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:allow-bundle-type",
+ "markdownDescription": "Enables the bundle_type command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the default_window_icon command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:allow-default-window-icon",
+ "markdownDescription": "Enables the default_window_icon command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the fetch_data_store_identifiers command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:allow-fetch-data-store-identifiers",
+ "markdownDescription": "Enables the fetch_data_store_identifiers command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the identifier command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:allow-identifier",
+ "markdownDescription": "Enables the identifier command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the name command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:allow-name",
+ "markdownDescription": "Enables the name command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the register_listener command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:allow-register-listener",
+ "markdownDescription": "Enables the register_listener command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the remove_data_store command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:allow-remove-data-store",
+ "markdownDescription": "Enables the remove_data_store command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the remove_listener command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:allow-remove-listener",
+ "markdownDescription": "Enables the remove_listener command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_app_theme command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:allow-set-app-theme",
+ "markdownDescription": "Enables the set_app_theme command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_dock_visibility command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:allow-set-dock-visibility",
+ "markdownDescription": "Enables the set_dock_visibility command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the tauri_version command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:allow-tauri-version",
+ "markdownDescription": "Enables the tauri_version command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the version command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:allow-version",
+ "markdownDescription": "Enables the version command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the app_hide command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:deny-app-hide",
+ "markdownDescription": "Denies the app_hide command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the app_show command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:deny-app-show",
+ "markdownDescription": "Denies the app_show command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the bundle_type command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:deny-bundle-type",
+ "markdownDescription": "Denies the bundle_type command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the default_window_icon command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:deny-default-window-icon",
+ "markdownDescription": "Denies the default_window_icon command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the fetch_data_store_identifiers command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:deny-fetch-data-store-identifiers",
+ "markdownDescription": "Denies the fetch_data_store_identifiers command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the identifier command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:deny-identifier",
+ "markdownDescription": "Denies the identifier command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the name command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:deny-name",
+ "markdownDescription": "Denies the name command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the register_listener command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:deny-register-listener",
+ "markdownDescription": "Denies the register_listener command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the remove_data_store command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:deny-remove-data-store",
+ "markdownDescription": "Denies the remove_data_store command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the remove_listener command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:deny-remove-listener",
+ "markdownDescription": "Denies the remove_listener command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_app_theme command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:deny-set-app-theme",
+ "markdownDescription": "Denies the set_app_theme command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_dock_visibility command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:deny-set-dock-visibility",
+ "markdownDescription": "Denies the set_dock_visibility command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the tauri_version command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:deny-tauri-version",
+ "markdownDescription": "Denies the tauri_version command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the version command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:app:deny-version",
+ "markdownDescription": "Denies the version command without any pre-configured scope."
+ },
+ {
+ "description": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-listen`\n- `allow-unlisten`\n- `allow-emit`\n- `allow-emit-to`",
+ "type": "string",
+ "const": "core:event:default",
+ "markdownDescription": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-listen`\n- `allow-unlisten`\n- `allow-emit`\n- `allow-emit-to`"
+ },
+ {
+ "description": "Enables the emit command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:event:allow-emit",
+ "markdownDescription": "Enables the emit command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the emit_to command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:event:allow-emit-to",
+ "markdownDescription": "Enables the emit_to command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the listen command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:event:allow-listen",
+ "markdownDescription": "Enables the listen command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the unlisten command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:event:allow-unlisten",
+ "markdownDescription": "Enables the unlisten command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the emit command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:event:deny-emit",
+ "markdownDescription": "Denies the emit command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the emit_to command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:event:deny-emit-to",
+ "markdownDescription": "Denies the emit_to command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the listen command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:event:deny-listen",
+ "markdownDescription": "Denies the listen command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the unlisten command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:event:deny-unlisten",
+ "markdownDescription": "Denies the unlisten command without any pre-configured scope."
+ },
+ {
+ "description": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-from-bytes`\n- `allow-from-path`\n- `allow-rgba`\n- `allow-size`",
+ "type": "string",
+ "const": "core:image:default",
+ "markdownDescription": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-from-bytes`\n- `allow-from-path`\n- `allow-rgba`\n- `allow-size`"
+ },
+ {
+ "description": "Enables the from_bytes command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:image:allow-from-bytes",
+ "markdownDescription": "Enables the from_bytes command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the from_path command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:image:allow-from-path",
+ "markdownDescription": "Enables the from_path command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the new command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:image:allow-new",
+ "markdownDescription": "Enables the new command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the rgba command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:image:allow-rgba",
+ "markdownDescription": "Enables the rgba command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the size command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:image:allow-size",
+ "markdownDescription": "Enables the size command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the from_bytes command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:image:deny-from-bytes",
+ "markdownDescription": "Denies the from_bytes command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the from_path command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:image:deny-from-path",
+ "markdownDescription": "Denies the from_path command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the new command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:image:deny-new",
+ "markdownDescription": "Denies the new command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the rgba command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:image:deny-rgba",
+ "markdownDescription": "Denies the rgba command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the size command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:image:deny-size",
+ "markdownDescription": "Denies the size command without any pre-configured scope."
+ },
+ {
+ "description": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-append`\n- `allow-prepend`\n- `allow-insert`\n- `allow-remove`\n- `allow-remove-at`\n- `allow-items`\n- `allow-get`\n- `allow-popup`\n- `allow-create-default`\n- `allow-set-as-app-menu`\n- `allow-set-as-window-menu`\n- `allow-text`\n- `allow-set-text`\n- `allow-is-enabled`\n- `allow-set-enabled`\n- `allow-set-accelerator`\n- `allow-set-as-windows-menu-for-nsapp`\n- `allow-set-as-help-menu-for-nsapp`\n- `allow-is-checked`\n- `allow-set-checked`\n- `allow-set-icon`",
+ "type": "string",
+ "const": "core:menu:default",
+ "markdownDescription": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-append`\n- `allow-prepend`\n- `allow-insert`\n- `allow-remove`\n- `allow-remove-at`\n- `allow-items`\n- `allow-get`\n- `allow-popup`\n- `allow-create-default`\n- `allow-set-as-app-menu`\n- `allow-set-as-window-menu`\n- `allow-text`\n- `allow-set-text`\n- `allow-is-enabled`\n- `allow-set-enabled`\n- `allow-set-accelerator`\n- `allow-set-as-windows-menu-for-nsapp`\n- `allow-set-as-help-menu-for-nsapp`\n- `allow-is-checked`\n- `allow-set-checked`\n- `allow-set-icon`"
+ },
+ {
+ "description": "Enables the append command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:allow-append",
+ "markdownDescription": "Enables the append command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the create_default command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:allow-create-default",
+ "markdownDescription": "Enables the create_default command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the get command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:allow-get",
+ "markdownDescription": "Enables the get command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the insert command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:allow-insert",
+ "markdownDescription": "Enables the insert command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the is_checked command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:allow-is-checked",
+ "markdownDescription": "Enables the is_checked command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the is_enabled command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:allow-is-enabled",
+ "markdownDescription": "Enables the is_enabled command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the items command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:allow-items",
+ "markdownDescription": "Enables the items command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the new command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:allow-new",
+ "markdownDescription": "Enables the new command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the popup command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:allow-popup",
+ "markdownDescription": "Enables the popup command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the prepend command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:allow-prepend",
+ "markdownDescription": "Enables the prepend command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the remove command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:allow-remove",
+ "markdownDescription": "Enables the remove command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the remove_at command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:allow-remove-at",
+ "markdownDescription": "Enables the remove_at command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_accelerator command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:allow-set-accelerator",
+ "markdownDescription": "Enables the set_accelerator command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_as_app_menu command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:allow-set-as-app-menu",
+ "markdownDescription": "Enables the set_as_app_menu command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_as_help_menu_for_nsapp command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:allow-set-as-help-menu-for-nsapp",
+ "markdownDescription": "Enables the set_as_help_menu_for_nsapp command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_as_window_menu command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:allow-set-as-window-menu",
+ "markdownDescription": "Enables the set_as_window_menu command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_as_windows_menu_for_nsapp command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:allow-set-as-windows-menu-for-nsapp",
+ "markdownDescription": "Enables the set_as_windows_menu_for_nsapp command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_checked command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:allow-set-checked",
+ "markdownDescription": "Enables the set_checked command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_enabled command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:allow-set-enabled",
+ "markdownDescription": "Enables the set_enabled command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_icon command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:allow-set-icon",
+ "markdownDescription": "Enables the set_icon command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_text command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:allow-set-text",
+ "markdownDescription": "Enables the set_text command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the text command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:allow-text",
+ "markdownDescription": "Enables the text command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the append command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:deny-append",
+ "markdownDescription": "Denies the append command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the create_default command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:deny-create-default",
+ "markdownDescription": "Denies the create_default command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the get command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:deny-get",
+ "markdownDescription": "Denies the get command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the insert command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:deny-insert",
+ "markdownDescription": "Denies the insert command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the is_checked command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:deny-is-checked",
+ "markdownDescription": "Denies the is_checked command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the is_enabled command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:deny-is-enabled",
+ "markdownDescription": "Denies the is_enabled command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the items command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:deny-items",
+ "markdownDescription": "Denies the items command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the new command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:deny-new",
+ "markdownDescription": "Denies the new command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the popup command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:deny-popup",
+ "markdownDescription": "Denies the popup command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the prepend command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:deny-prepend",
+ "markdownDescription": "Denies the prepend command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the remove command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:deny-remove",
+ "markdownDescription": "Denies the remove command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the remove_at command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:deny-remove-at",
+ "markdownDescription": "Denies the remove_at command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_accelerator command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:deny-set-accelerator",
+ "markdownDescription": "Denies the set_accelerator command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_as_app_menu command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:deny-set-as-app-menu",
+ "markdownDescription": "Denies the set_as_app_menu command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_as_help_menu_for_nsapp command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:deny-set-as-help-menu-for-nsapp",
+ "markdownDescription": "Denies the set_as_help_menu_for_nsapp command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_as_window_menu command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:deny-set-as-window-menu",
+ "markdownDescription": "Denies the set_as_window_menu command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_as_windows_menu_for_nsapp command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:deny-set-as-windows-menu-for-nsapp",
+ "markdownDescription": "Denies the set_as_windows_menu_for_nsapp command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_checked command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:deny-set-checked",
+ "markdownDescription": "Denies the set_checked command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_enabled command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:deny-set-enabled",
+ "markdownDescription": "Denies the set_enabled command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_icon command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:deny-set-icon",
+ "markdownDescription": "Denies the set_icon command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_text command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:deny-set-text",
+ "markdownDescription": "Denies the set_text command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the text command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:menu:deny-text",
+ "markdownDescription": "Denies the text command without any pre-configured scope."
+ },
+ {
+ "description": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-resolve-directory`\n- `allow-resolve`\n- `allow-normalize`\n- `allow-join`\n- `allow-dirname`\n- `allow-extname`\n- `allow-basename`\n- `allow-is-absolute`",
+ "type": "string",
+ "const": "core:path:default",
+ "markdownDescription": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-resolve-directory`\n- `allow-resolve`\n- `allow-normalize`\n- `allow-join`\n- `allow-dirname`\n- `allow-extname`\n- `allow-basename`\n- `allow-is-absolute`"
+ },
+ {
+ "description": "Enables the basename command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:path:allow-basename",
+ "markdownDescription": "Enables the basename command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the dirname command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:path:allow-dirname",
+ "markdownDescription": "Enables the dirname command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the extname command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:path:allow-extname",
+ "markdownDescription": "Enables the extname command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the is_absolute command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:path:allow-is-absolute",
+ "markdownDescription": "Enables the is_absolute command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the join command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:path:allow-join",
+ "markdownDescription": "Enables the join command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the normalize command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:path:allow-normalize",
+ "markdownDescription": "Enables the normalize command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the resolve command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:path:allow-resolve",
+ "markdownDescription": "Enables the resolve command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the resolve_directory command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:path:allow-resolve-directory",
+ "markdownDescription": "Enables the resolve_directory command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the basename command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:path:deny-basename",
+ "markdownDescription": "Denies the basename command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the dirname command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:path:deny-dirname",
+ "markdownDescription": "Denies the dirname command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the extname command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:path:deny-extname",
+ "markdownDescription": "Denies the extname command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the is_absolute command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:path:deny-is-absolute",
+ "markdownDescription": "Denies the is_absolute command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the join command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:path:deny-join",
+ "markdownDescription": "Denies the join command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the normalize command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:path:deny-normalize",
+ "markdownDescription": "Denies the normalize command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the resolve command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:path:deny-resolve",
+ "markdownDescription": "Denies the resolve command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the resolve_directory command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:path:deny-resolve-directory",
+ "markdownDescription": "Denies the resolve_directory command without any pre-configured scope."
+ },
+ {
+ "description": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-close`",
+ "type": "string",
+ "const": "core:resources:default",
+ "markdownDescription": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-close`"
+ },
+ {
+ "description": "Enables the close command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:resources:allow-close",
+ "markdownDescription": "Enables the close command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the close command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:resources:deny-close",
+ "markdownDescription": "Denies the close command without any pre-configured scope."
+ },
+ {
+ "description": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-get-by-id`\n- `allow-remove-by-id`\n- `allow-set-icon`\n- `allow-set-menu`\n- `allow-set-tooltip`\n- `allow-set-title`\n- `allow-set-visible`\n- `allow-set-temp-dir-path`\n- `allow-set-icon-as-template`\n- `allow-set-show-menu-on-left-click`",
+ "type": "string",
+ "const": "core:tray:default",
+ "markdownDescription": "Default permissions for the plugin, which enables all commands.\n#### This default permission set includes:\n\n- `allow-new`\n- `allow-get-by-id`\n- `allow-remove-by-id`\n- `allow-set-icon`\n- `allow-set-menu`\n- `allow-set-tooltip`\n- `allow-set-title`\n- `allow-set-visible`\n- `allow-set-temp-dir-path`\n- `allow-set-icon-as-template`\n- `allow-set-show-menu-on-left-click`"
+ },
+ {
+ "description": "Enables the get_by_id command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:tray:allow-get-by-id",
+ "markdownDescription": "Enables the get_by_id command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the new command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:tray:allow-new",
+ "markdownDescription": "Enables the new command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the remove_by_id command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:tray:allow-remove-by-id",
+ "markdownDescription": "Enables the remove_by_id command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_icon command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:tray:allow-set-icon",
+ "markdownDescription": "Enables the set_icon command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_icon_as_template command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:tray:allow-set-icon-as-template",
+ "markdownDescription": "Enables the set_icon_as_template command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_menu command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:tray:allow-set-menu",
+ "markdownDescription": "Enables the set_menu command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_show_menu_on_left_click command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:tray:allow-set-show-menu-on-left-click",
+ "markdownDescription": "Enables the set_show_menu_on_left_click command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_temp_dir_path command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:tray:allow-set-temp-dir-path",
+ "markdownDescription": "Enables the set_temp_dir_path command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_title command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:tray:allow-set-title",
+ "markdownDescription": "Enables the set_title command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_tooltip command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:tray:allow-set-tooltip",
+ "markdownDescription": "Enables the set_tooltip command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_visible command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:tray:allow-set-visible",
+ "markdownDescription": "Enables the set_visible command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the get_by_id command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:tray:deny-get-by-id",
+ "markdownDescription": "Denies the get_by_id command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the new command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:tray:deny-new",
+ "markdownDescription": "Denies the new command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the remove_by_id command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:tray:deny-remove-by-id",
+ "markdownDescription": "Denies the remove_by_id command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_icon command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:tray:deny-set-icon",
+ "markdownDescription": "Denies the set_icon command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_icon_as_template command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:tray:deny-set-icon-as-template",
+ "markdownDescription": "Denies the set_icon_as_template command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_menu command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:tray:deny-set-menu",
+ "markdownDescription": "Denies the set_menu command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_show_menu_on_left_click command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:tray:deny-set-show-menu-on-left-click",
+ "markdownDescription": "Denies the set_show_menu_on_left_click command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_temp_dir_path command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:tray:deny-set-temp-dir-path",
+ "markdownDescription": "Denies the set_temp_dir_path command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_title command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:tray:deny-set-title",
+ "markdownDescription": "Denies the set_title command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_tooltip command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:tray:deny-set-tooltip",
+ "markdownDescription": "Denies the set_tooltip command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_visible command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:tray:deny-set-visible",
+ "markdownDescription": "Denies the set_visible command without any pre-configured scope."
+ },
+ {
+ "description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-webviews`\n- `allow-webview-position`\n- `allow-webview-size`\n- `allow-internal-toggle-devtools`",
+ "type": "string",
+ "const": "core:webview:default",
+ "markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-webviews`\n- `allow-webview-position`\n- `allow-webview-size`\n- `allow-internal-toggle-devtools`"
+ },
+ {
+ "description": "Enables the clear_all_browsing_data command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:allow-clear-all-browsing-data",
+ "markdownDescription": "Enables the clear_all_browsing_data command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the create_webview command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:allow-create-webview",
+ "markdownDescription": "Enables the create_webview command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the create_webview_window command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:allow-create-webview-window",
+ "markdownDescription": "Enables the create_webview_window command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the get_all_webviews command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:allow-get-all-webviews",
+ "markdownDescription": "Enables the get_all_webviews command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the internal_toggle_devtools command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:allow-internal-toggle-devtools",
+ "markdownDescription": "Enables the internal_toggle_devtools command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the print command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:allow-print",
+ "markdownDescription": "Enables the print command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the reparent command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:allow-reparent",
+ "markdownDescription": "Enables the reparent command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_webview_auto_resize command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:allow-set-webview-auto-resize",
+ "markdownDescription": "Enables the set_webview_auto_resize command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_webview_background_color command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:allow-set-webview-background-color",
+ "markdownDescription": "Enables the set_webview_background_color command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_webview_focus command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:allow-set-webview-focus",
+ "markdownDescription": "Enables the set_webview_focus command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_webview_position command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:allow-set-webview-position",
+ "markdownDescription": "Enables the set_webview_position command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_webview_size command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:allow-set-webview-size",
+ "markdownDescription": "Enables the set_webview_size command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_webview_zoom command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:allow-set-webview-zoom",
+ "markdownDescription": "Enables the set_webview_zoom command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the webview_close command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:allow-webview-close",
+ "markdownDescription": "Enables the webview_close command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the webview_hide command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:allow-webview-hide",
+ "markdownDescription": "Enables the webview_hide command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the webview_position command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:allow-webview-position",
+ "markdownDescription": "Enables the webview_position command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the webview_show command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:allow-webview-show",
+ "markdownDescription": "Enables the webview_show command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the webview_size command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:allow-webview-size",
+ "markdownDescription": "Enables the webview_size command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the clear_all_browsing_data command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:deny-clear-all-browsing-data",
+ "markdownDescription": "Denies the clear_all_browsing_data command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the create_webview command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:deny-create-webview",
+ "markdownDescription": "Denies the create_webview command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the create_webview_window command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:deny-create-webview-window",
+ "markdownDescription": "Denies the create_webview_window command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the get_all_webviews command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:deny-get-all-webviews",
+ "markdownDescription": "Denies the get_all_webviews command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the internal_toggle_devtools command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:deny-internal-toggle-devtools",
+ "markdownDescription": "Denies the internal_toggle_devtools command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the print command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:deny-print",
+ "markdownDescription": "Denies the print command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the reparent command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:deny-reparent",
+ "markdownDescription": "Denies the reparent command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_webview_auto_resize command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:deny-set-webview-auto-resize",
+ "markdownDescription": "Denies the set_webview_auto_resize command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_webview_background_color command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:deny-set-webview-background-color",
+ "markdownDescription": "Denies the set_webview_background_color command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_webview_focus command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:deny-set-webview-focus",
+ "markdownDescription": "Denies the set_webview_focus command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_webview_position command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:deny-set-webview-position",
+ "markdownDescription": "Denies the set_webview_position command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_webview_size command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:deny-set-webview-size",
+ "markdownDescription": "Denies the set_webview_size command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_webview_zoom command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:deny-set-webview-zoom",
+ "markdownDescription": "Denies the set_webview_zoom command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the webview_close command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:deny-webview-close",
+ "markdownDescription": "Denies the webview_close command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the webview_hide command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:deny-webview-hide",
+ "markdownDescription": "Denies the webview_hide command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the webview_position command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:deny-webview-position",
+ "markdownDescription": "Denies the webview_position command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the webview_show command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:deny-webview-show",
+ "markdownDescription": "Denies the webview_show command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the webview_size command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:webview:deny-webview-size",
+ "markdownDescription": "Denies the webview_size command without any pre-configured scope."
+ },
+ {
+ "description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-windows`\n- `allow-scale-factor`\n- `allow-inner-position`\n- `allow-outer-position`\n- `allow-inner-size`\n- `allow-outer-size`\n- `allow-is-fullscreen`\n- `allow-is-minimized`\n- `allow-is-maximized`\n- `allow-is-focused`\n- `allow-is-decorated`\n- `allow-is-resizable`\n- `allow-is-maximizable`\n- `allow-is-minimizable`\n- `allow-is-closable`\n- `allow-is-visible`\n- `allow-is-enabled`\n- `allow-title`\n- `allow-current-monitor`\n- `allow-primary-monitor`\n- `allow-monitor-from-point`\n- `allow-available-monitors`\n- `allow-cursor-position`\n- `allow-theme`\n- `allow-is-always-on-top`\n- `allow-internal-toggle-maximize`",
+ "type": "string",
+ "const": "core:window:default",
+ "markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-get-all-windows`\n- `allow-scale-factor`\n- `allow-inner-position`\n- `allow-outer-position`\n- `allow-inner-size`\n- `allow-outer-size`\n- `allow-is-fullscreen`\n- `allow-is-minimized`\n- `allow-is-maximized`\n- `allow-is-focused`\n- `allow-is-decorated`\n- `allow-is-resizable`\n- `allow-is-maximizable`\n- `allow-is-minimizable`\n- `allow-is-closable`\n- `allow-is-visible`\n- `allow-is-enabled`\n- `allow-title`\n- `allow-current-monitor`\n- `allow-primary-monitor`\n- `allow-monitor-from-point`\n- `allow-available-monitors`\n- `allow-cursor-position`\n- `allow-theme`\n- `allow-is-always-on-top`\n- `allow-internal-toggle-maximize`"
+ },
+ {
+ "description": "Enables the available_monitors command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-available-monitors",
+ "markdownDescription": "Enables the available_monitors command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the center command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-center",
+ "markdownDescription": "Enables the center command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the close command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-close",
+ "markdownDescription": "Enables the close command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the create command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-create",
+ "markdownDescription": "Enables the create command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the current_monitor command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-current-monitor",
+ "markdownDescription": "Enables the current_monitor command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the cursor_position command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-cursor-position",
+ "markdownDescription": "Enables the cursor_position command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the destroy command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-destroy",
+ "markdownDescription": "Enables the destroy command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the get_all_windows command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-get-all-windows",
+ "markdownDescription": "Enables the get_all_windows command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the hide command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-hide",
+ "markdownDescription": "Enables the hide command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the inner_position command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-inner-position",
+ "markdownDescription": "Enables the inner_position command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the inner_size command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-inner-size",
+ "markdownDescription": "Enables the inner_size command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the internal_toggle_maximize command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-internal-toggle-maximize",
+ "markdownDescription": "Enables the internal_toggle_maximize command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the is_always_on_top command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-is-always-on-top",
+ "markdownDescription": "Enables the is_always_on_top command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the is_closable command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-is-closable",
+ "markdownDescription": "Enables the is_closable command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the is_decorated command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-is-decorated",
+ "markdownDescription": "Enables the is_decorated command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the is_enabled command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-is-enabled",
+ "markdownDescription": "Enables the is_enabled command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the is_focused command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-is-focused",
+ "markdownDescription": "Enables the is_focused command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the is_fullscreen command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-is-fullscreen",
+ "markdownDescription": "Enables the is_fullscreen command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the is_maximizable command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-is-maximizable",
+ "markdownDescription": "Enables the is_maximizable command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the is_maximized command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-is-maximized",
+ "markdownDescription": "Enables the is_maximized command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the is_minimizable command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-is-minimizable",
+ "markdownDescription": "Enables the is_minimizable command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the is_minimized command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-is-minimized",
+ "markdownDescription": "Enables the is_minimized command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the is_resizable command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-is-resizable",
+ "markdownDescription": "Enables the is_resizable command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the is_visible command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-is-visible",
+ "markdownDescription": "Enables the is_visible command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the maximize command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-maximize",
+ "markdownDescription": "Enables the maximize command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the minimize command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-minimize",
+ "markdownDescription": "Enables the minimize command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the monitor_from_point command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-monitor-from-point",
+ "markdownDescription": "Enables the monitor_from_point command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the outer_position command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-outer-position",
+ "markdownDescription": "Enables the outer_position command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the outer_size command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-outer-size",
+ "markdownDescription": "Enables the outer_size command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the primary_monitor command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-primary-monitor",
+ "markdownDescription": "Enables the primary_monitor command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the request_user_attention command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-request-user-attention",
+ "markdownDescription": "Enables the request_user_attention command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the scale_factor command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-scale-factor",
+ "markdownDescription": "Enables the scale_factor command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_always_on_bottom command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-always-on-bottom",
+ "markdownDescription": "Enables the set_always_on_bottom command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_always_on_top command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-always-on-top",
+ "markdownDescription": "Enables the set_always_on_top command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_background_color command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-background-color",
+ "markdownDescription": "Enables the set_background_color command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_badge_count command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-badge-count",
+ "markdownDescription": "Enables the set_badge_count command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_badge_label command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-badge-label",
+ "markdownDescription": "Enables the set_badge_label command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_closable command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-closable",
+ "markdownDescription": "Enables the set_closable command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_content_protected command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-content-protected",
+ "markdownDescription": "Enables the set_content_protected command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_cursor_grab command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-cursor-grab",
+ "markdownDescription": "Enables the set_cursor_grab command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_cursor_icon command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-cursor-icon",
+ "markdownDescription": "Enables the set_cursor_icon command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_cursor_position command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-cursor-position",
+ "markdownDescription": "Enables the set_cursor_position command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_cursor_visible command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-cursor-visible",
+ "markdownDescription": "Enables the set_cursor_visible command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_decorations command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-decorations",
+ "markdownDescription": "Enables the set_decorations command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_effects command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-effects",
+ "markdownDescription": "Enables the set_effects command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_enabled command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-enabled",
+ "markdownDescription": "Enables the set_enabled command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_focus command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-focus",
+ "markdownDescription": "Enables the set_focus command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_focusable command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-focusable",
+ "markdownDescription": "Enables the set_focusable command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_fullscreen command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-fullscreen",
+ "markdownDescription": "Enables the set_fullscreen command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_icon command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-icon",
+ "markdownDescription": "Enables the set_icon command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_ignore_cursor_events command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-ignore-cursor-events",
+ "markdownDescription": "Enables the set_ignore_cursor_events command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_max_size command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-max-size",
+ "markdownDescription": "Enables the set_max_size command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_maximizable command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-maximizable",
+ "markdownDescription": "Enables the set_maximizable command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_min_size command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-min-size",
+ "markdownDescription": "Enables the set_min_size command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_minimizable command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-minimizable",
+ "markdownDescription": "Enables the set_minimizable command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_overlay_icon command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-overlay-icon",
+ "markdownDescription": "Enables the set_overlay_icon command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_position command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-position",
+ "markdownDescription": "Enables the set_position command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_progress_bar command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-progress-bar",
+ "markdownDescription": "Enables the set_progress_bar command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_resizable command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-resizable",
+ "markdownDescription": "Enables the set_resizable command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_shadow command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-shadow",
+ "markdownDescription": "Enables the set_shadow command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_simple_fullscreen command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-simple-fullscreen",
+ "markdownDescription": "Enables the set_simple_fullscreen command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_size command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-size",
+ "markdownDescription": "Enables the set_size command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_size_constraints command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-size-constraints",
+ "markdownDescription": "Enables the set_size_constraints command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_skip_taskbar command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-skip-taskbar",
+ "markdownDescription": "Enables the set_skip_taskbar command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_theme command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-theme",
+ "markdownDescription": "Enables the set_theme command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_title command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-title",
+ "markdownDescription": "Enables the set_title command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_title_bar_style command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-title-bar-style",
+ "markdownDescription": "Enables the set_title_bar_style command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the set_visible_on_all_workspaces command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-set-visible-on-all-workspaces",
+ "markdownDescription": "Enables the set_visible_on_all_workspaces command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the show command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-show",
+ "markdownDescription": "Enables the show command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the start_dragging command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-start-dragging",
+ "markdownDescription": "Enables the start_dragging command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the start_resize_dragging command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-start-resize-dragging",
+ "markdownDescription": "Enables the start_resize_dragging command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the theme command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-theme",
+ "markdownDescription": "Enables the theme command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the title command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-title",
+ "markdownDescription": "Enables the title command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the toggle_maximize command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-toggle-maximize",
+ "markdownDescription": "Enables the toggle_maximize command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the unmaximize command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-unmaximize",
+ "markdownDescription": "Enables the unmaximize command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the unminimize command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:allow-unminimize",
+ "markdownDescription": "Enables the unminimize command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the available_monitors command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-available-monitors",
+ "markdownDescription": "Denies the available_monitors command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the center command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-center",
+ "markdownDescription": "Denies the center command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the close command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-close",
+ "markdownDescription": "Denies the close command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the create command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-create",
+ "markdownDescription": "Denies the create command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the current_monitor command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-current-monitor",
+ "markdownDescription": "Denies the current_monitor command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the cursor_position command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-cursor-position",
+ "markdownDescription": "Denies the cursor_position command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the destroy command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-destroy",
+ "markdownDescription": "Denies the destroy command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the get_all_windows command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-get-all-windows",
+ "markdownDescription": "Denies the get_all_windows command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the hide command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-hide",
+ "markdownDescription": "Denies the hide command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the inner_position command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-inner-position",
+ "markdownDescription": "Denies the inner_position command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the inner_size command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-inner-size",
+ "markdownDescription": "Denies the inner_size command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the internal_toggle_maximize command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-internal-toggle-maximize",
+ "markdownDescription": "Denies the internal_toggle_maximize command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the is_always_on_top command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-is-always-on-top",
+ "markdownDescription": "Denies the is_always_on_top command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the is_closable command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-is-closable",
+ "markdownDescription": "Denies the is_closable command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the is_decorated command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-is-decorated",
+ "markdownDescription": "Denies the is_decorated command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the is_enabled command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-is-enabled",
+ "markdownDescription": "Denies the is_enabled command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the is_focused command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-is-focused",
+ "markdownDescription": "Denies the is_focused command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the is_fullscreen command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-is-fullscreen",
+ "markdownDescription": "Denies the is_fullscreen command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the is_maximizable command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-is-maximizable",
+ "markdownDescription": "Denies the is_maximizable command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the is_maximized command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-is-maximized",
+ "markdownDescription": "Denies the is_maximized command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the is_minimizable command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-is-minimizable",
+ "markdownDescription": "Denies the is_minimizable command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the is_minimized command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-is-minimized",
+ "markdownDescription": "Denies the is_minimized command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the is_resizable command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-is-resizable",
+ "markdownDescription": "Denies the is_resizable command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the is_visible command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-is-visible",
+ "markdownDescription": "Denies the is_visible command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the maximize command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-maximize",
+ "markdownDescription": "Denies the maximize command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the minimize command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-minimize",
+ "markdownDescription": "Denies the minimize command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the monitor_from_point command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-monitor-from-point",
+ "markdownDescription": "Denies the monitor_from_point command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the outer_position command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-outer-position",
+ "markdownDescription": "Denies the outer_position command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the outer_size command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-outer-size",
+ "markdownDescription": "Denies the outer_size command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the primary_monitor command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-primary-monitor",
+ "markdownDescription": "Denies the primary_monitor command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the request_user_attention command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-request-user-attention",
+ "markdownDescription": "Denies the request_user_attention command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the scale_factor command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-scale-factor",
+ "markdownDescription": "Denies the scale_factor command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_always_on_bottom command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-always-on-bottom",
+ "markdownDescription": "Denies the set_always_on_bottom command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_always_on_top command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-always-on-top",
+ "markdownDescription": "Denies the set_always_on_top command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_background_color command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-background-color",
+ "markdownDescription": "Denies the set_background_color command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_badge_count command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-badge-count",
+ "markdownDescription": "Denies the set_badge_count command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_badge_label command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-badge-label",
+ "markdownDescription": "Denies the set_badge_label command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_closable command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-closable",
+ "markdownDescription": "Denies the set_closable command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_content_protected command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-content-protected",
+ "markdownDescription": "Denies the set_content_protected command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_cursor_grab command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-cursor-grab",
+ "markdownDescription": "Denies the set_cursor_grab command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_cursor_icon command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-cursor-icon",
+ "markdownDescription": "Denies the set_cursor_icon command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_cursor_position command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-cursor-position",
+ "markdownDescription": "Denies the set_cursor_position command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_cursor_visible command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-cursor-visible",
+ "markdownDescription": "Denies the set_cursor_visible command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_decorations command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-decorations",
+ "markdownDescription": "Denies the set_decorations command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_effects command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-effects",
+ "markdownDescription": "Denies the set_effects command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_enabled command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-enabled",
+ "markdownDescription": "Denies the set_enabled command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_focus command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-focus",
+ "markdownDescription": "Denies the set_focus command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_focusable command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-focusable",
+ "markdownDescription": "Denies the set_focusable command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_fullscreen command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-fullscreen",
+ "markdownDescription": "Denies the set_fullscreen command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_icon command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-icon",
+ "markdownDescription": "Denies the set_icon command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_ignore_cursor_events command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-ignore-cursor-events",
+ "markdownDescription": "Denies the set_ignore_cursor_events command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_max_size command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-max-size",
+ "markdownDescription": "Denies the set_max_size command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_maximizable command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-maximizable",
+ "markdownDescription": "Denies the set_maximizable command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_min_size command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-min-size",
+ "markdownDescription": "Denies the set_min_size command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_minimizable command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-minimizable",
+ "markdownDescription": "Denies the set_minimizable command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_overlay_icon command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-overlay-icon",
+ "markdownDescription": "Denies the set_overlay_icon command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_position command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-position",
+ "markdownDescription": "Denies the set_position command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_progress_bar command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-progress-bar",
+ "markdownDescription": "Denies the set_progress_bar command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_resizable command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-resizable",
+ "markdownDescription": "Denies the set_resizable command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_shadow command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-shadow",
+ "markdownDescription": "Denies the set_shadow command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_simple_fullscreen command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-simple-fullscreen",
+ "markdownDescription": "Denies the set_simple_fullscreen command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_size command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-size",
+ "markdownDescription": "Denies the set_size command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_size_constraints command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-size-constraints",
+ "markdownDescription": "Denies the set_size_constraints command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_skip_taskbar command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-skip-taskbar",
+ "markdownDescription": "Denies the set_skip_taskbar command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_theme command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-theme",
+ "markdownDescription": "Denies the set_theme command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_title command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-title",
+ "markdownDescription": "Denies the set_title command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_title_bar_style command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-title-bar-style",
+ "markdownDescription": "Denies the set_title_bar_style command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the set_visible_on_all_workspaces command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-set-visible-on-all-workspaces",
+ "markdownDescription": "Denies the set_visible_on_all_workspaces command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the show command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-show",
+ "markdownDescription": "Denies the show command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the start_dragging command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-start-dragging",
+ "markdownDescription": "Denies the start_dragging command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the start_resize_dragging command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-start-resize-dragging",
+ "markdownDescription": "Denies the start_resize_dragging command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the theme command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-theme",
+ "markdownDescription": "Denies the theme command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the title command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-title",
+ "markdownDescription": "Denies the title command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the toggle_maximize command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-toggle-maximize",
+ "markdownDescription": "Denies the toggle_maximize command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the unmaximize command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-unmaximize",
+ "markdownDescription": "Denies the unmaximize command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the unminimize command without any pre-configured scope.",
+ "type": "string",
+ "const": "core:window:deny-unminimize",
+ "markdownDescription": "Denies the unminimize command without any pre-configured scope."
+ },
+ {
+ "description": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`",
+ "type": "string",
+ "const": "shell:default",
+ "markdownDescription": "This permission set configures which\nshell functionality is exposed by default.\n\n#### Granted Permissions\n\nIt allows to use the `open` functionality with a reasonable\nscope pre-configured. It will allow opening `http(s)://`,\n`tel:` and `mailto:` links.\n\n#### This default permission set includes:\n\n- `allow-open`"
+ },
+ {
+ "description": "Enables the execute command without any pre-configured scope.",
+ "type": "string",
+ "const": "shell:allow-execute",
+ "markdownDescription": "Enables the execute command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the kill command without any pre-configured scope.",
+ "type": "string",
+ "const": "shell:allow-kill",
+ "markdownDescription": "Enables the kill command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the open command without any pre-configured scope.",
+ "type": "string",
+ "const": "shell:allow-open",
+ "markdownDescription": "Enables the open command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the spawn command without any pre-configured scope.",
+ "type": "string",
+ "const": "shell:allow-spawn",
+ "markdownDescription": "Enables the spawn command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the stdin_write command without any pre-configured scope.",
+ "type": "string",
+ "const": "shell:allow-stdin-write",
+ "markdownDescription": "Enables the stdin_write command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the execute command without any pre-configured scope.",
+ "type": "string",
+ "const": "shell:deny-execute",
+ "markdownDescription": "Denies the execute command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the kill command without any pre-configured scope.",
+ "type": "string",
+ "const": "shell:deny-kill",
+ "markdownDescription": "Denies the kill command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the open command without any pre-configured scope.",
+ "type": "string",
+ "const": "shell:deny-open",
+ "markdownDescription": "Denies the open command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the spawn command without any pre-configured scope.",
+ "type": "string",
+ "const": "shell:deny-spawn",
+ "markdownDescription": "Denies the spawn command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the stdin_write command without any pre-configured scope.",
+ "type": "string",
+ "const": "shell:deny-stdin-write",
+ "markdownDescription": "Denies the stdin_write command without any pre-configured scope."
+ },
+ {
+ "description": "This permission set configures which kind of\nupdater functions are exposed to the frontend.\n\n#### Granted Permissions\n\nThe full workflow from checking for updates to installing them\nis enabled.\n\n\n#### This default permission set includes:\n\n- `allow-check`\n- `allow-download`\n- `allow-install`\n- `allow-download-and-install`",
+ "type": "string",
+ "const": "updater:default",
+ "markdownDescription": "This permission set configures which kind of\nupdater functions are exposed to the frontend.\n\n#### Granted Permissions\n\nThe full workflow from checking for updates to installing them\nis enabled.\n\n\n#### This default permission set includes:\n\n- `allow-check`\n- `allow-download`\n- `allow-install`\n- `allow-download-and-install`"
+ },
+ {
+ "description": "Enables the check command without any pre-configured scope.",
+ "type": "string",
+ "const": "updater:allow-check",
+ "markdownDescription": "Enables the check command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the download command without any pre-configured scope.",
+ "type": "string",
+ "const": "updater:allow-download",
+ "markdownDescription": "Enables the download command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the download_and_install command without any pre-configured scope.",
+ "type": "string",
+ "const": "updater:allow-download-and-install",
+ "markdownDescription": "Enables the download_and_install command without any pre-configured scope."
+ },
+ {
+ "description": "Enables the install command without any pre-configured scope.",
+ "type": "string",
+ "const": "updater:allow-install",
+ "markdownDescription": "Enables the install command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the check command without any pre-configured scope.",
+ "type": "string",
+ "const": "updater:deny-check",
+ "markdownDescription": "Denies the check command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the download command without any pre-configured scope.",
+ "type": "string",
+ "const": "updater:deny-download",
+ "markdownDescription": "Denies the download command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the download_and_install command without any pre-configured scope.",
+ "type": "string",
+ "const": "updater:deny-download-and-install",
+ "markdownDescription": "Denies the download_and_install command without any pre-configured scope."
+ },
+ {
+ "description": "Denies the install command without any pre-configured scope.",
+ "type": "string",
+ "const": "updater:deny-install",
+ "markdownDescription": "Denies the install command without any pre-configured scope."
+ }
+ ]
+ },
+ "Value": {
+ "description": "All supported ACL values.",
+ "anyOf": [
+ {
+ "description": "Represents a null JSON value.",
+ "type": "null"
+ },
+ {
+ "description": "Represents a [`bool`].",
+ "type": "boolean"
+ },
+ {
+ "description": "Represents a valid ACL [`Number`].",
+ "allOf": [
+ {
+ "$ref": "#/definitions/Number"
+ }
+ ]
+ },
+ {
+ "description": "Represents a [`String`].",
+ "type": "string"
+ },
+ {
+ "description": "Represents a list of other [`Value`]s.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/Value"
+ }
+ },
+ {
+ "description": "Represents a map of [`String`] keys to [`Value`]s.",
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/definitions/Value"
+ }
+ }
+ ]
+ },
+ "Number": {
+ "description": "A valid ACL number.",
+ "anyOf": [
+ {
+ "description": "Represents an [`i64`].",
+ "type": "integer",
+ "format": "int64"
+ },
+ {
+ "description": "Represents a [`f64`].",
+ "type": "number",
+ "format": "double"
+ }
+ ]
+ },
+ "Target": {
+ "description": "Platform target.",
+ "oneOf": [
+ {
+ "description": "MacOS.",
+ "type": "string",
+ "enum": [
+ "macOS"
+ ]
+ },
+ {
+ "description": "Windows.",
+ "type": "string",
+ "enum": [
+ "windows"
+ ]
+ },
+ {
+ "description": "Linux.",
+ "type": "string",
+ "enum": [
+ "linux"
+ ]
+ },
+ {
+ "description": "Android.",
+ "type": "string",
+ "enum": [
+ "android"
+ ]
+ },
+ {
+ "description": "iOS.",
+ "type": "string",
+ "enum": [
+ "iOS"
+ ]
+ }
+ ]
+ },
+ "ShellScopeEntryAllowedArg": {
+ "description": "A command argument allowed to be executed by the webview API.",
+ "anyOf": [
+ {
+ "description": "A non-configurable argument that is passed to the command in the order it was specified.",
+ "type": "string"
+ },
+ {
+ "description": "A variable that is set while calling the command from the webview API.",
+ "type": "object",
+ "required": [
+ "validator"
+ ],
+ "properties": {
+ "raw": {
+ "description": "Marks the validator as a raw regex, meaning the plugin should not make any modification at runtime.\n\nThis means the regex will not match on the entire string by default, which might be exploited if your regex allow unexpected input to be considered valid. When using this option, make sure your regex is correct.",
+ "default": false,
+ "type": "boolean"
+ },
+ "validator": {
+ "description": "[regex] validator to require passed values to conform to an expected input.\n\nThis will require the argument value passed to this variable to match the `validator` regex before it will be executed.\n\nThe regex string is by default surrounded by `^...$` to match the full string. For example the `https?://\\w+` regex would be registered as `^https?://\\w+$`.\n\n[regex]: <https://docs.rs/regex/latest/regex/#syntax>",
+ "type": "string"
+ }
+ },
+ "additionalProperties": false
+ }
+ ]
+ },
+ "ShellScopeEntryAllowedArgs": {
+ "description": "A set of command arguments allowed to be executed by the webview API.\n\nA value of `true` will allow any arguments to be passed to the command. `false` will disable all arguments. A list of [`ShellScopeEntryAllowedArg`] will set those arguments as the only valid arguments to be passed to the attached command configuration.",
+ "anyOf": [
+ {
+ "description": "Use a simple boolean to allow all or disable all arguments to this command configuration.",
+ "type": "boolean"
+ },
+ {
+ "description": "A specific set of [`ShellScopeEntryAllowedArg`] that are valid to call for the command configuration.",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/ShellScopeEntryAllowedArg"
+ }
+ }
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src-tauri/src/commands/oauth.rs b/src-tauri/src/commands/oauth.rs
index 528e4f02..af2cf10c 100644
--- a/src-tauri/src/commands/oauth.rs
+++ b/src-tauri/src/commands/oauth.rs
@@ -8,6 +8,7 @@
// verifier held app-side, so a local port-sniffing race gains nothing.
use std::collections::HashMap;
+use std::sync::atomic::{AtomicU64, Ordering};
use std::sync::Mutex;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::TcpListener;
@@ -18,23 +19,45 @@ use tokio::sync::oneshot;
// with another app or a lingering listener.
const PORT_LADDER: [u16; 3] = [17872, 17873, 17874];
+// One armed attempt per port: the oneshot receiver oauth_wait consumes plus
+// the accept task's handle. Aborting the task drops the bound TcpListener,
+// which is the only way to free the port of an abandoned attempt (dropping
+// the receiver alone never wakes a task parked in accept()). The id keeps a
+// stale oauth_wait from tearing down a retry that re-armed the same port.
+static NEXT_ATTEMPT: AtomicU64 = AtomicU64::new(0);
+
+pub struct PendingLogin {
+ id: u64,
+ rx: Option<oneshot::Receiver<String>>,
+ task: tauri::async_runtime::JoinHandle<()>,
+}
+
#[derive(Default)]
-pub struct OauthPending(pub Mutex<HashMap<u16, oneshot::Receiver<String>>>);
+pub struct OauthPending(pub Mutex<HashMap<u16, PendingLogin>>);
const CALLBACK_BODY: &str = "<!doctype html><html><body style=\"font-family:-apple-system,system-ui,sans-serif;background:#161616;color:#e5e5e5;display:flex;align-items:center;justify-content:center;height:100vh;margin:0\"><p>Signed in — you can close this tab and return to LU.</p></body></html>";
+const DENIED_BODY: &str = "<!doctype html><html><body style=\"font-family:-apple-system,system-ui,sans-serif;background:#161616;color:#e5e5e5;display:flex;align-items:center;justify-content:center;height:100vh;margin:0\"><p>Sign-in didn't complete — you can close this tab and try again in LU.</p></body></html>";
/// Bind the first free ladder port and arm a single-shot accept. Returns the
/// port so the frontend can build the redirect URI before opening the browser.
#[tauri::command]
pub async fn oauth_start(state: tauri::State<'_, OauthPending>) -> Result<u16, String> {
+ // Only one sign-in flow at a time: abort every stale attempt first so an
+ // abandoned one (closed browser tab, cancelled wait) releases its ladder
+ // port instead of leaking the listener for the process lifetime.
+ let stale: Vec<PendingLogin> = state.0.lock().unwrap().drain().map(|(_, p)| p).collect();
+ for pending in stale {
+ pending.task.abort();
+ // Wait for the abort to land so the port is actually free to rebind.
+ let _ = pending.task.await;
+ }
for port in PORT_LADDER {
let listener = match TcpListener::bind(("127.0.0.1", port)).await {
Ok(l) => l,
Err(_) => continue, // port taken — try the next rung
};
let (tx, rx) = oneshot::channel::<String>();
- state.0.lock().unwrap().insert(port, rx);
- tauri::async_runtime::spawn(async move {
+ let task = tauri::async_runtime::spawn(async move {
// One request only; the listener drops with this task. If oauth_wait
// times out first, tx.send just errs into the void — harmless.
let Ok((mut stream, _)) = listener.accept().await else { return };
@@ -48,15 +71,28 @@ pub async fn oauth_start(state: tauri::State<'_, OauthPending>) -> Result<u16, S
.and_then(|l| l.split_whitespace().nth(1))
.and_then(|path| path.split_once('?').map(|(_, q)| q.to_string()))
.unwrap_or_default();
+ // Provider denial arrives as error=…&error_description=… — be
+ // honest in the tab; the frontend gets the raw query either way.
+ let body = if query.split('&').any(|kv| kv.starts_with("error=")) {
+ DENIED_BODY
+ } else {
+ CALLBACK_BODY
+ };
let resp = format!(
"HTTP/1.1 200 OK\r\nContent-Type: text/html; charset=utf-8\r\nContent-Length: {}\r\nConnection: close\r\n\r\n{}",
- CALLBACK_BODY.len(),
- CALLBACK_BODY
+ body.len(),
+ body
);
let _ = stream.write_all(resp.as_bytes()).await;
let _ = stream.shutdown().await;
let _ = tx.send(query);
});
+ let id = NEXT_ATTEMPT.fetch_add(1, Ordering::Relaxed);
+ state
+ .0
+ .lock()
+ .unwrap()
+ .insert(port, PendingLogin { id, rx: Some(rx), task });
return Ok(port);
}
Err("no loopback port available (17872-17874) — close the app using them and retry".into())
@@ -70,13 +106,34 @@ pub async fn oauth_wait(
timeout_secs: u64,
state: tauri::State<'_, OauthPending>,
) -> Result<String, String> {
- let rx = state
- .0
- .lock()
- .unwrap()
- .remove(&port)
- .ok_or("no pending oauth listener on that port")?;
- match tokio::time::timeout(std::time::Duration::from_secs(timeout_secs.clamp(10, 900)), rx).await {
+ // Take the receiver but leave the entry, so a concurrent oauth_start
+ // (retry after a UI cancel) can still find and abort the accept task.
+ let (id, rx) = {
+ let mut map = state.0.lock().unwrap();
+ let pending = map
+ .get_mut(&port)
+ .ok_or("no pending oauth listener on that port")?;
+ let rx = pending
+ .rx
+ .take()
+ .ok_or("oauth wait already running on that port")?;
+ (pending.id, rx)
+ };
+ let result =
+ tokio::time::timeout(std::time::Duration::from_secs(timeout_secs.clamp(10, 900)), rx).await;
+ // The attempt is over either way — drop the accept task so the listener
+ // releases the port (no-op if it already served the callback). Only touch
+ // our own attempt: a retry's oauth_start may have drained it and re-armed
+ // the same port already.
+ {
+ let mut map = state.0.lock().unwrap();
+ if map.get(&port).is_some_and(|p| p.id == id) {
+ if let Some(pending) = map.remove(&port) {
+ pending.task.abort();
+ }
+ }
+ }
+ match result {
Ok(Ok(query)) => Ok(query),
Ok(Err(_)) => Err("oauth listener closed before the browser returned".into()),
Err(_) => Err("sign-in timed out — the browser never came back".into()),
diff --git a/src-tauri/src/commands/remote.rs b/src-tauri/src/commands/remote.rs
index df6990f3..01fceb19 100644
--- a/src-tauri/src/commands/remote.rs
+++ b/src-tauri/src/commands/remote.rs
@@ -943,7 +943,7 @@ async fn mobile_landing() -> Html<String> {
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name='theme-color' content='#0e0e0e'>
-<title>Locally Uncensored</title>
+<title>LU</title>
<!-- Bug #5: no third-party requests. System fonts only, inline SVG icons. -->
<!-- Bug #6: restrictive CSP. Self origin only. Inline styles/scripts are
required because the whole page is a single Rust string; data: images
@@ -1361,7 +1361,7 @@ button{-webkit-appearance:none;appearance:none}
// with live Thought/Action/Observation cards streamed into the chat.
// The old "you can't run tools" text was from v2.3.3 before the mobile
// bridge could actually execute them.
- var CODEX_PROMPT = 'You are the Coding Agent, an autonomous coding agent inside Locally Uncensored. You execute coding tasks end-to-end by reading files, writing code, and running shell commands. You MUST use tools — never guess file contents.\n\n=== HARD RULES ===\n\n1. AFTER EVERY TOOL RESULT, your very next message MUST be EITHER (a) another tool call to continue the work, OR (b) the final user-facing summary. Empty assistant messages are a FAILURE.\n\n2. DO NOT stop after the first tool. Real coding tasks take 3-15 tool calls. Stopping after one file_read or one shell_execute without producing the requested artefact = FAILURE. "I have called one tool, that is enough" is NOT a valid stop reason.\n\n3. NEVER say "Now I will create X" / "Next I\'ll write Y" as plain prose and then stop. Do the next step RIGHT NOW as a concrete tool call.\n\n4. When your plan has N steps, execute ALL N steps in one session — each step as a concrete tool call. Plan in tool-call form, not prose-then-stop.\n\n5. The ONLY reasons to stop calling tools: (a) the user task is FULLY done with concrete artefacts on disk, OR (b) you are stuck and genuinely need user input.\n\n=== WORKFLOW ===\n\n1. Understand the task.\n2. Explore (file_list, file_read, file_search) when you need to know existing layout.\n3. Plan changes (in your head, not as a stop point).\n4. Implement (file_write) — chain ALL writes without stopping.\n5. Verify (shell_execute / code_execute / file_read).\n6. Only THEN write a short summary of what you did.\n\n=== FILE & DIRECTORY RULES ===\n\n- file_write AUTOMATICALLY creates any missing parent directories. Never call shell_execute with `mkdir`, `New-Item -ItemType Directory`, `md`, or `os.makedirs` to set up a folder before writing — just file_write the target path directly.\n- All relative paths resolve to the current chat workspace folder. Always pass relative paths (e.g. `client/public/index.html`) — do not hard-code absolute drive paths.\n- shell_execute runs inside the workspace folder by default. Do not `cd` into a parent or sibling folder; prefer relative commands.\n- On Windows, the shell is PowerShell. Quote arguments with spaces. Use forward slashes in paths inside commands. Avoid `mkdir -p` (PowerShell mkdir does not accept -p) — again, just use file_write.\n\n=== GENERAL ===\n\n- Always read a file before modifying it.\n- Chain tool calls: after each tool result, if there is another step left, IMMEDIATELY call the next tool.\n- If a command fails, diagnose and retry with corrected arguments — do not introduce yourself again.\n- After 2-3 failures of the same approach, switch strategy (e.g. file_write instead of shell mkdir) instead of repeating.\n- Be concise in text. All real work happens in tool calls.\n- Respond in the same language the user used in their message.';
+ var CODEX_PROMPT = 'You are the Coding Agent, an autonomous coding agent inside LU. You execute coding tasks end-to-end by reading files, writing code, and running shell commands. You MUST use tools — never guess file contents.\n\n=== HARD RULES ===\n\n1. AFTER EVERY TOOL RESULT, your very next message MUST be EITHER (a) another tool call to continue the work, OR (b) the final user-facing summary. Empty assistant messages are a FAILURE.\n\n2. DO NOT stop after the first tool. Real coding tasks take 3-15 tool calls. Stopping after one file_read or one shell_execute without producing the requested artefact = FAILURE. "I have called one tool, that is enough" is NOT a valid stop reason.\n\n3. NEVER say "Now I will create X" / "Next I\'ll write Y" as plain prose and then stop. Do the next step RIGHT NOW as a concrete tool call.\n\n4. When your plan has N steps, execute ALL N steps in one session — each step as a concrete tool call. Plan in tool-call form, not prose-then-stop.\n\n5. The ONLY reasons to stop calling tools: (a) the user task is FULLY done with concrete artefacts on disk, OR (b) you are stuck and genuinely need user input.\n\n=== WORKFLOW ===\n\n1. Understand the task.\n2. Explore (file_list, file_read, file_search) when you need to know existing layout.\n3. Plan changes (in your head, not as a stop point).\n4. Implement (file_write) — chain ALL writes without stopping.\n5. Verify (shell_execute / code_execute / file_read).\n6. Only THEN write a short summary of what you did.\n\n=== FILE & DIRECTORY RULES ===\n\n- file_write AUTOMATICALLY creates any missing parent directories. Never call shell_execute with `mkdir`, `New-Item -ItemType Directory`, `md`, or `os.makedirs` to set up a folder before writing — just file_write the target path directly.\n- All relative paths resolve to the current chat workspace folder. Always pass relative paths (e.g. `client/public/index.html`) — do not hard-code absolute drive paths.\n- shell_execute runs inside the workspace folder by default. Do not `cd` into a parent or sibling folder; prefer relative commands.\n- On Windows, the shell is PowerShell. Quote arguments with spaces. Use forward slashes in paths inside commands. Avoid `mkdir -p` (PowerShell mkdir does not accept -p) — again, just use file_write.\n\n=== GENERAL ===\n\n- Always read a file before modifying it.\n- Chain tool calls: after each tool result, if there is another step left, IMMEDIATELY call the next tool.\n- If a command fails, diagnose and retry with corrected arguments — do not introduce yourself again.\n- After 2-3 failures of the same approach, switch strategy (e.g. file_write instead of shell mkdir) instead of repeating.\n- Be concise in text. All real work happens in tool calls.\n- Respond in the same language the user used in their message.';
// ── Thinking-compatible prefixes (parity with desktop) ──
var THINKING_COMPATIBLE = ['qwq','deepseek-r1','qwen3.6','qwen3','qwen3.5','qwen3-coder','gemma3','gemma4'];
@@ -1926,7 +1926,7 @@ button{-webkit-appearance:none;appearance:none}
// blocks in chat with "save this as index.html" instead of calling
// file_write. Codex already had its own prompt; this matches the
// strictness for the LU-mode + Agent-on path.
- var AGENT_PROMPT = 'You are an autonomous AI agent inside Locally Uncensored. You execute tasks end-to-end via tools — you do NOT just describe what to do.\n\n=== HARD RULES ===\n\n1. AFTER EVERY TOOL RESULT, your very next message MUST be EITHER (a) another tool call to continue the work, OR (b) the final user-facing summary. There is no middle ground. Empty messages are a FAILURE.\n\n2. DO NOT stop after the FIRST tool. Real tasks take 3-10 tool calls. If the user said "build X" you write the files. If the user said "use every tool" you keep going through every tool. Stopping after one shell_execute or one get_current_time without producing a useful artefact = FAILURE.\n\n3. NEVER produce a code block followed by "save this as X". That is FAILURE — call file_write yourself.\n\n4. NEVER say "Now I will create X" / "Next I will write Y" as plain prose and stop. Do the next step right now as a concrete tool call.\n\n5. The ONLY reasons to stop calling tools: (a) the user task is FULLY done with concrete artefacts on disk / web results returned / etc., OR (b) you are stuck in a way that genuinely needs user input. "I have called one tool, that should be enough" is NOT a valid stop reason.\n\n=== WORKFLOW ===\n\n- Build / create tasks: file_write each artefact directly, chain ALL writes, then write a 1-3 sentence final answer.\n- Read / explore tasks: file_list / file_read first, then proceed.\n- Web tasks: web_search → web_fetch on the best URL → summarize.\n- Multi-tool / "use every tool" tasks: plan the order, then call each tool one at a time, recording the partial result in a final summary file before the visible reply.\n\n=== FILE RULES ===\n\n- file_write AUTOMATICALLY creates missing parent directories — do NOT shell out to mkdir / New-Item / md / os.makedirs first. Just file_write the target path.\n- Relative paths resolve to the current chat workspace folder. Use relative paths (e.g. `index.html`, `src/app.py`); do not hard-code absolute drive letters.\n- After 2-3 failures of the same approach, switch strategy — do not repeat the same broken command. Do not introduce yourself again.\n\nBe concise in prose. All real work happens in tool calls. Respond in the same language the user used in their message.';
+ var AGENT_PROMPT = 'You are an autonomous AI agent inside LU. You execute tasks end-to-end via tools — you do NOT just describe what to do.\n\n=== HARD RULES ===\n\n1. AFTER EVERY TOOL RESULT, your very next message MUST be EITHER (a) another tool call to continue the work, OR (b) the final user-facing summary. There is no middle ground. Empty messages are a FAILURE.\n\n2. DO NOT stop after the FIRST tool. Real tasks take 3-10 tool calls. If the user said "build X" you write the files. If the user said "use every tool" you keep going through every tool. Stopping after one shell_execute or one get_current_time without producing a useful artefact = FAILURE.\n\n3. NEVER produce a code block followed by "save this as X". That is FAILURE — call file_write yourself.\n\n4. NEVER say "Now I will create X" / "Next I will write Y" as plain prose and stop. Do the next step right now as a concrete tool call.\n\n5. The ONLY reasons to stop calling tools: (a) the user task is FULLY done with concrete artefacts on disk / web results returned / etc., OR (b) you are stuck in a way that genuinely needs user input. "I have called one tool, that should be enough" is NOT a valid stop reason.\n\n=== WORKFLOW ===\n\n- Build / create tasks: file_write each artefact directly, chain ALL writes, then write a 1-3 sentence final answer.\n- Read / explore tasks: file_list / file_read first, then proceed.\n- Web tasks: web_search → web_fetch on the best URL → summarize.\n- Multi-tool / "use every tool" tasks: plan the order, then call each tool one at a time, recording the partial result in a final summary file before the visible reply.\n\n=== FILE RULES ===\n\n- file_write AUTOMATICALLY creates missing parent directories — do NOT shell out to mkdir / New-Item / md / os.makedirs first. Just file_write the target path.\n- Relative paths resolve to the current chat workspace folder. Use relative paths (e.g. `index.html`, `src/app.py`); do not hard-code absolute drive letters.\n- After 2-3 failures of the same approach, switch strategy — do not repeat the same broken command. Do not introduce yourself again.\n\nBe concise in prose. All real work happens in tool calls. Respond in the same language the user used in their message.';
// ── System prompt builder ──
function buildSystemPrompt(){
@@ -1966,7 +1966,7 @@ button{-webkit-appearance:none;appearance:none}
el('app').innerHTML =
'<div class="auth-screen">' +
'<img class="auth-mark" src="/LU-monogram-white.png" alt="">' +
- '<div class="auth-logo">LUncensored</div>' +
+ '<div class="auth-logo">LU</div>' +
'<div class="auth-sub">Remote</div>' +
'<form class="auth-form" id="auth-form">' +
'<div>' +
@@ -2089,8 +2089,8 @@ button{-webkit-appearance:none;appearance:none}
'<div class="app-shell">' +
'<div class="app-header">' +
'<button class="icon-btn" onclick="window._toggleDrawer()" aria-label="Menu"><span class="material-symbols-outlined">'+svgIcon('menu')+'</span></button>' +
- '<span class="header-brand" aria-label="LUncensored">' +
- '<img class="header-mark" src="/LU-monogram-white.png" alt="LUncensored">' +
+ '<span class="header-brand" aria-label="LU">' +
+ '<img class="header-mark" src="/LU-monogram-white.png" alt="LU">' +
'</span>' +
modeTag +
'<button class="model-badge" onclick="window._openModelPicker()" aria-label="Select model">' +
@@ -2159,7 +2159,7 @@ button{-webkit-appearance:none;appearance:none}
'<div class="drawer-header">' +
'<span class="drawer-brand">' +
'<img class="drawer-mark" src="/LU-monogram-white.png" alt="">' +
- '<span class="drawer-logo">LUncensored</span>' +
+ '<span class="drawer-logo">LU</span>' +
'</span>' +
'<button class="drawer-close" onclick="window._toggleDrawer()" aria-label="Close"><span class="material-symbols-outlined">'+svgIcon('close')+'</span></button>' +
'</div>' +
@@ -2290,7 +2290,7 @@ button{-webkit-appearance:none;appearance:none}
p.innerHTML =
'<div class="chat-welcome">' +
'<img class="chat-welcome-mark" src="/LU-monogram-white.png" alt="">' +
- '<div class="chat-welcome-logo">LUncensored</div>' +
+ '<div class="chat-welcome-logo">LU</div>' +
'<div class="chat-welcome-tag">'+H(tag)+'</div>' +
'</div>';
return;
@@ -3796,7 +3796,7 @@ fn ensure_lan_firewall_rule(port: u16) {
use std::os::windows::process::CommandExt;
use std::process::Command;
const CREATE_NO_WINDOW: u32 = 0x08000000;
- let name = format!("Locally Uncensored Remote {}", port);
+ let name = format!("LU Remote {}", port);
// Idempotent: drop any prior rule for this name, then add a fresh inbound allow.
let _ = Command::new("netsh")
.args(["advfirewall", "firewall", "delete", "rule", &format!("name={}", name)])
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index 2004646d..ce7f5731 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -24,7 +24,7 @@
}
],
"security": {
- "csp": "default-src 'self' http://ipc.localhost; connect-src 'self' http://ipc.localhost http://tauri.localhost http://localhost:* http://127.0.0.1:* https://lu-labs.ai https://*.supabase.co https://civitai.com https://*.civitai.com https://huggingface.co https://*.huggingface.co https://ollama.com https://openrouter.ai https://api.openai.com https://api.groq.com https://api.together.xyz https://api.deepseek.com https://api.mistral.ai https://api.anthropic.com ws://localhost:8188 ws://127.0.0.1:8188; img-src 'self' data: blob: http://localhost:8188 http://127.0.0.1:8188 https://*.supabase.co https://*.civitai.com https://*.githubusercontent.com; media-src 'self' blob: http://localhost:8188 http://127.0.0.1:8188 https://*.supabase.co https://lu-labs.ai; font-src 'self' data:; style-src 'self' 'unsafe-inline'; script-src 'self' 'wasm-unsafe-eval'"
+ "csp": "default-src 'self' http://ipc.localhost; connect-src 'self' http://ipc.localhost http://tauri.localhost http://localhost:* http://127.0.0.1:* https://lu-labs.ai https://*.supabase.co https://civitai.com https://*.civitai.com https://huggingface.co https://*.huggingface.co https://ollama.com https://openrouter.ai https://api.openai.com https://api.groq.com https://api.together.xyz https://api.deepseek.com https://api.mistral.ai https://api.anthropic.com ws://localhost:* ws://127.0.0.1:*; img-src 'self' data: blob: http://localhost:* http://127.0.0.1:* https://*.supabase.co https://*.civitai.com https://*.githubusercontent.com; media-src 'self' blob: http://localhost:* http://127.0.0.1:* https://*.supabase.co https://lu-labs.ai; font-src 'self' data:; style-src 'self' 'unsafe-inline'; script-src 'self' 'wasm-unsafe-eval'"
}
},
"plugins": {
@@ -60,6 +60,9 @@
"icons/icon.ico",
"icons/icon.png"
],
+ "macOS": {
+ "entitlements": "./Entitlements.plist"
+ },
"windows": {
"nsis": {
"installMode": "both",
diff --git a/src/api/__tests__/mobile-html-content.test.ts b/src/api/__tests__/mobile-html-content.test.ts
index ac469cb4..bd5f5194 100644
--- a/src/api/__tests__/mobile-html-content.test.ts
+++ b/src/api/__tests__/mobile-html-content.test.ts
@@ -75,8 +75,11 @@ describe('mobile_landing HTML › LU branding assets', () => {
expect(matches.length).toBeGreaterThanOrEqual(4)
})
- it('has LUncensored wordmark', () => {
- expect(html).toContain('LUncensored')
+ it('has LU wordmark and no old brand strings', () => {
+ expect(html).toContain('<title>LU</title>')
+ expect(html).toContain('class="auth-logo">LU<')
+ expect(html).not.toContain('LUncensored')
+ expect(html).not.toContain('Locally Uncensored')
})
})
diff --git a/src/api/__tests__/provider-openai.test.ts b/src/api/__tests__/provider-openai.test.ts
index 6e89f6c2..c5044c2f 100644
--- a/src/api/__tests__/provider-openai.test.ts
+++ b/src/api/__tests__/provider-openai.test.ts
@@ -455,6 +455,128 @@ describe('OpenAIProvider', () => {
})
})
+ // Audit finding 17/36: the canned auth/rate-limit texts must be FALLBACKS —
+ // LU Cloud sends honest 403/429 bodies ("closed beta", "monthly credit
+ // budget exhausted") that were being overwritten with dead-end guidance
+ // ("Check Settings > Providers" — lu-cloud has no key field).
+ describe('parseError server-message precedence', () => {
+ it('surfaces a 403 bare-string body verbatim (LU Cloud plan gate)', async () => {
+ const provider = new OpenAIProvider(makeConfig({ name: 'LU Cloud' }))
+ vi.spyOn(globalThis, 'fetch').mockResolvedValueOnce(
+ new Response(JSON.stringify({ error: 'LU Cloud is in closed beta (Max plan only)' }), { status: 403 })
+ )
+ try {
+ await provider.listModels()
+ expect.fail('Should have thrown')
+ } catch (e: any) {
+ expect(e.code).toBe('auth')
+ expect(e.message).toBe('LU Cloud is in closed beta (Max plan only)')
+ }
+ vi.restoreAllMocks()
+ })
+
+ it('surfaces a 429 body verbatim (monthly credit budget)', async () => {
+ const provider = new OpenAIProvider(makeConfig({ name: 'LU Cloud' }))
+ vi.spyOn(globalThis, 'fetch').mockResolvedValueOnce(
+ new Response(JSON.stringify({ error: 'monthly credit budget exhausted' }), { status: 429 })
+ )
+ try {
+ await provider.listModels()
+ expect.fail('Should have thrown')
+ } catch (e: any) {
+ expect(e.code).toBe('rate_limit')
+ expect(e.message).toBe('monthly credit budget exhausted')
+ }
+ vi.restoreAllMocks()
+ })
+
+ it('falls back to the canned texts when the body carries no message', async () => {
+ const provider = new OpenAIProvider(makeConfig())
+ vi.spyOn(globalThis, 'fetch').mockResolvedValueOnce(new Response('{}', { status: 401 }))
+ try {
+ await provider.listModels()
+ expect.fail('Should have thrown')
+ } catch (e: any) {
+ expect(e.code).toBe('auth')
+ expect(e.message).toMatch(/Invalid API key/)
+ }
+ vi.spyOn(globalThis, 'fetch').mockResolvedValueOnce(new Response('', { status: 429 }))
+ try {
+ await provider.listModels()
+ expect.fail('Should have thrown')
+ } catch (e: any) {
+ expect(e.code).toBe('rate_limit')
+ expect(e.message).toMatch(/Rate limited/)
+ }
+ vi.restoreAllMocks()
+ })
+ })
+
+ // Audit finding 10: DeepInfra (LU Cloud) reasoning models stream thinking as
+ // delta.reasoning_content / delta.reasoning — dropping it left the chat in
+ // dead air for the whole reasoning phase.
+ describe('native reasoning channel', () => {
+ it('chatStream yields delta.reasoning_content as thinking', async () => {
+ const provider = new OpenAIProvider(makeConfig())
+ const sse = [
+ 'data: {"choices":[{"delta":{"reasoning_content":"pondering"}}]}',
+ '',
+ 'data: {"choices":[{"delta":{"content":"Hi"}}]}',
+ '',
+ 'data: [DONE]',
+ '',
+ ].join('\n')
+ vi.spyOn(globalThis, 'fetch').mockResolvedValueOnce(new Response(sse, { status: 200 }))
+ const chunks = []
+ for await (const c of provider.chatStream('m', [{ role: 'user', content: 'hi' }])) chunks.push(c)
+ expect(chunks.some(c => c.thinking === 'pondering')).toBe(true)
+ expect(chunks.some(c => c.content === 'Hi')).toBe(true)
+ vi.restoreAllMocks()
+ })
+
+ it('chatStream yields the delta.reasoning variant too', async () => {
+ const provider = new OpenAIProvider(makeConfig())
+ const sse = 'data: {"choices":[{"delta":{"reasoning":"hmm"}}]}\n\ndata: [DONE]\n\n'
+ vi.spyOn(globalThis, 'fetch').mockResolvedValueOnce(new Response(sse, { status: 200 }))
+ const chunks = []
+ for await (const c of provider.chatStream('m', [{ role: 'user', content: 'hi' }])) chunks.push(c)
+ expect(chunks.some(c => c.thinking === 'hmm')).toBe(true)
+ vi.restoreAllMocks()
+ })
+
+ it('chatWithTools maps message.reasoning_content to thinking', async () => {
+ const provider = new OpenAIProvider(makeConfig())
+ vi.spyOn(globalThis, 'fetch').mockResolvedValueOnce(
+ new Response(JSON.stringify({
+ choices: [{ message: { content: 'answer', reasoning_content: 'thought' } }],
+ }), { status: 200 })
+ )
+ const result = await provider.chatWithTools('m', [{ role: 'user', content: 'hi' }], [])
+ expect(result.content).toBe('answer')
+ expect(result.thinking).toBe('thought')
+ vi.restoreAllMocks()
+ })
+ })
+
+ // Audit finding P0: the LU Cloud proxy passes upstream 400 AND 422 through
+ // so the retry-without-the-knob path can engage; the retry only checked 400.
+ describe('retry without reasoning knob', () => {
+ it('retries a 422 without reasoning_effort', async () => {
+ const provider = new OpenAIProvider(makeConfig())
+ const fetchSpy = vi.spyOn(globalThis, 'fetch')
+ .mockResolvedValueOnce(new Response(JSON.stringify({ error: 'inference upstream error' }), { status: 422 }))
+ .mockResolvedValueOnce(new Response(JSON.stringify({ choices: [{ message: { content: 'ok' } }] }), { status: 200 }))
+ const result = await provider.chatWithTools('m', [{ role: 'user', content: 'hi' }], [], { thinking: true })
+ expect(result.content).toBe('ok')
+ expect(fetchSpy).toHaveBeenCalledTimes(2)
+ const firstBody = JSON.parse(fetchSpy.mock.calls[0][1]?.body as string)
+ expect(firstBody.reasoning_effort).toBe('high')
+ const secondBody = JSON.parse(fetchSpy.mock.calls[1][1]?.body as string)
+ expect('reasoning_effort' in secondBody).toBe(false)
+ vi.restoreAllMocks()
+ })
+ })
+
describe('OpenRouter headers', () => {
it('includes OpenRouter-specific headers', async () => {
const provider = new OpenAIProvider(makeConfig({
diff --git a/src/api/cloud/catalog.ts b/src/api/cloud/catalog.ts
index 8b3b2a9a..a541c7e9 100644
--- a/src/api/cloud/catalog.ts
+++ b/src/api/cloud/catalog.ts
@@ -9,6 +9,9 @@ export interface CatalogOps {
removebg: number
eraser: number
upscale_image: number
+ // Per-target image-upscale rates (2k/4k/8k). Optional: older catalog
+ // payloads (persisted cache) carry only the flat 4k figure above.
+ upscale_image_res?: Record<string, number>
upscale_video_per_s: number
upscale_video_min: number
}
diff --git a/src/api/cloud/jobs.ts b/src/api/cloud/jobs.ts
index 8b15594a..56b81261 100644
--- a/src/api/cloud/jobs.ts
+++ b/src/api/cloud/jobs.ts
@@ -115,8 +115,30 @@ export async function refreshResultUrl(jobId: string): Promise<string | null> {
const TERMINAL = new Set(['succeeded', 'failed', 'canceled'])
+function sleep(ms: number, signal?: AbortSignal): Promise<void> {
+ return new Promise<void>((resolve) => {
+ const t = setTimeout(resolve, ms)
+ signal?.addEventListener(
+ 'abort',
+ () => {
+ clearTimeout(t)
+ resolve()
+ },
+ { once: true },
+ )
+ })
+}
+
+/** Consecutive getJob failures pollJob rides out before giving up. */
+const MAX_POLL_FAILURES = 5
+
/** Poll until the job reaches a terminal state, the timeout hits, or the
- * AbortSignal fires. onTick fires on every poll with the fresh job. */
+ * AbortSignal fires. onTick fires on every poll with the fresh job.
+ * A transient getJob failure (network blip, one 5xx, a token-refresh hiccup)
+ * must not detach the client from a 15–45 minute render that keeps running
+ * and billing server-side — the loop retries with backoff and only gives up
+ * after MAX_POLL_FAILURES consecutive errors. Definitive client errors
+ * (4xx except 401/408/429) fail fast. */
export async function pollJob(
id: string,
opts: {
@@ -128,23 +150,29 @@ export async function pollJob(
): Promise<CloudJob> {
const intervalMs = opts.intervalMs ?? 2_500
const deadline = Date.now() + (opts.timeoutMs ?? 15 * 60_000)
+ let failures = 0
for (;;) {
if (opts.signal?.aborted) throw new CloudJobError('polling aborted', 0)
- const job = await getJob(id)
+ let job: CloudJob
+ try {
+ job = await getJob(id)
+ failures = 0
+ } catch (err) {
+ // 401 stays retryable: a failed lazy token refresh yields one mid-poll
+ // and must not tell a signed-in user to sign in.
+ const status = err instanceof CloudJobError ? err.status : 0
+ const definitive =
+ status >= 400 && status < 500 && status !== 401 && status !== 408 && status !== 429
+ failures += 1
+ if (definitive || failures >= MAX_POLL_FAILURES) throw err
+ if (Date.now() >= deadline) throw new CloudJobError('render timed out', 0)
+ await sleep(Math.min(intervalMs * failures, 15_000), opts.signal)
+ continue
+ }
opts.onTick?.(job)
if (TERMINAL.has(job.status)) return job
if (Date.now() >= deadline) throw new CloudJobError('render timed out', 0)
- await new Promise<void>((resolve) => {
- const t = setTimeout(resolve, intervalMs)
- opts.signal?.addEventListener(
- 'abort',
- () => {
- clearTimeout(t)
- resolve()
- },
- { once: true },
- )
- })
+ await sleep(intervalMs, opts.signal)
}
}
diff --git a/src/api/cloud/supabase.ts b/src/api/cloud/supabase.ts
index 093d36f2..a2b9b511 100644
--- a/src/api/cloud/supabase.ts
+++ b/src/api/cloud/supabase.ts
@@ -88,9 +88,14 @@ export function supabaseCloud(): SupabaseClient {
/** Current access token, refreshing an expired session if needed. Null when
* logged out. Called per request — getSession() is cached in-memory and only
- * hits the network when the token actually expired. */
+ * hits the network when the token actually expired. A failed refresh with the
+ * session still in the keychain is a connectivity problem, not a sign-out —
+ * throw so callers don't tell a signed-in user to sign in. */
export async function getAccessToken(): Promise<string | null> {
- const { data } = await supabaseCloud().auth.getSession()
+ const { data, error } = await supabaseCloud().auth.getSession()
+ if (!data.session && error) {
+ throw new Error('LU Cloud unreachable — check your connection.')
+ }
return data.session?.access_token ?? null
}
@@ -100,8 +105,11 @@ export type OAuthProvider = 'google' | 'github'
* 127.0.0.1 loopback port (Rust, fixed ladder registered in the Supabase
* redirect allow-list) → open the provider consent in the SYSTEM browser →
* Supabase redirects to the loopback with ?code= → exchange the PKCE code
- * for a session. Rejects with a readable message on timeout/denial. */
-export async function loginWithProvider(provider: OAuthProvider): Promise<void> {
+ * for a session. Rejects with a readable message on timeout/denial, and
+ * immediately when `signal` aborts (Cancel while waiting for the browser) —
+ * the abandoned Rust wait cleans itself up, and any retry's oauth_start
+ * aborts the stale listener first, so cancelling never wedges the ladder. */
+export async function loginWithProvider(provider: OAuthProvider, signal?: AbortSignal): Promise<void> {
const port = await oauthStart()
const { data, error } = await supabaseCloud().auth.signInWithOAuth({
provider,
@@ -113,7 +121,17 @@ export async function loginWithProvider(provider: OAuthProvider): Promise<void>
if (error) throw new Error(error.message)
if (!data?.url) throw new Error('OAuth start failed — no provider URL')
await openExternal(data.url)
- const query = await oauthWait(port, 300)
+ const wait = oauthWait(port, 300)
+ const query = signal
+ ? await Promise.race([
+ wait,
+ new Promise<never>((_, reject) => {
+ const cancel = () => reject(new Error('Sign-in cancelled.'))
+ if (signal.aborted) cancel()
+ else signal.addEventListener('abort', cancel, { once: true })
+ }),
+ ])
+ : await wait
const params = new URLSearchParams(query)
const code = params.get('code')
if (!code) {
diff --git a/src/api/providers/lu-cloud-provider.ts b/src/api/providers/lu-cloud-provider.ts
index f2d4cf08..60316e0c 100644
--- a/src/api/providers/lu-cloud-provider.ts
+++ b/src/api/providers/lu-cloud-provider.ts
@@ -26,7 +26,16 @@ export class LuCloudProvider implements ProviderClient {
// Fresh delegate per call: the token rotates (~1 h), and OpenAIProvider
// reads apiKey from its config. isLocal:false keeps it off the Rust proxy.
private async delegate(): Promise<OpenAIProvider> {
- const token = await getAccessToken()
+ let token: string | null
+ try {
+ token = await getAccessToken()
+ } catch (e) {
+ throw new ProviderError(
+ e instanceof Error ? e.message : 'LU Cloud unreachable — check your connection.',
+ 'lu-cloud',
+ 'network',
+ )
+ }
if (!token) {
throw new ProviderError('Sign in to your LU Cloud account to chat in the cloud.', 'lu-cloud', 'auth', 401)
}
diff --git a/src/api/providers/openai-provider.ts b/src/api/providers/openai-provider.ts
index 9394d67a..013f1faf 100644
--- a/src/api/providers/openai-provider.ts
+++ b/src/api/providers/openai-provider.ts
@@ -32,6 +32,10 @@ interface OpenAIStreamChunk {
choices?: [{
delta?: {
content?: string
+ // Native reasoning channel — DeepInfra (LU Cloud) reasoning models
+ // stream thinking as `reasoning_content`, some as `reasoning`.
+ reasoning_content?: string
+ reasoning?: string
tool_calls?: {
index: number
id?: string
@@ -46,6 +50,8 @@ interface OpenAIResponse {
choices?: [{
message?: {
content?: string
+ reasoning_content?: string
+ reasoning?: string
tool_calls?: {
id: string
type: 'function'
@@ -198,8 +204,10 @@ export class OpenAIProvider implements ProviderClient {
signal: options?.signal,
} as any)
- // Retry without reasoning_effort if the model/endpoint rejects it.
- if (!res.ok && res.status === 400 && ('reasoning_effort' in body || 'stream_options' in body)) {
+ // Retry without reasoning_effort if the model/endpoint rejects it. The LU
+ // Cloud proxy deliberately passes upstream 400 AND 422 (DeepInfra's
+ // bad-parameter status) through so this path can engage.
+ if (!res.ok && (res.status === 400 || res.status === 422) && ('reasoning_effort' in body || 'stream_options' in body)) {
delete body.reasoning_effort
delete body.stream_options
res = await fetcher(`${this.baseUrl}/chat/completions`, {
@@ -268,6 +276,14 @@ export class OpenAIProvider implements ProviderClient {
const content = choice.delta?.content || ''
+ // Yield native reasoning as `thinking` so the panel fills live —
+ // without this the entire reasoning phase of a cloud reasoner is
+ // silently dropped and the chat sits in dead air (uselu fc55c91).
+ const reasoning = choice.delta?.reasoning_content ?? choice.delta?.reasoning ?? ''
+ if (reasoning) {
+ yield { content: '', thinking: reasoning, done: false }
+ }
+
// Accumulate streamed tool calls
if (choice.delta?.tool_calls) {
for (const tc of choice.delta.tool_calls) {
@@ -304,7 +320,7 @@ export class OpenAIProvider implements ProviderClient {
messages: ChatMessage[],
tools: ToolDefinition[],
options?: ChatOptions,
- ): Promise<{ content: string; toolCalls: ToolCall[]; promptEvalCount?: number; evalCount?: number }> {
+ ): Promise<{ content: string; toolCalls: ToolCall[]; promptEvalCount?: number; evalCount?: number; thinking?: string }> {
const body: Record<string, any> = {
model,
messages: messages.map(m => this.toOpenAIMessage(m)),
@@ -332,7 +348,7 @@ export class OpenAIProvider implements ProviderClient {
signal: options?.signal,
} as any)
- if (!res.ok && res.status === 400 && ('reasoning_effort' in body || 'stream_options' in body)) {
+ if (!res.ok && (res.status === 400 || res.status === 422) && ('reasoning_effort' in body || 'stream_options' in body)) {
delete body.reasoning_effort
delete body.stream_options
res = await fetcher(`${this.baseUrl}/chat/completions`, {
@@ -365,6 +381,7 @@ export class OpenAIProvider implements ProviderClient {
toolCalls,
promptEvalCount: usage?.prompt_tokens,
evalCount: usage?.completion_tokens,
+ thinking: choice?.message?.reasoning_content || choice?.message?.reasoning || undefined,
}
}
@@ -559,6 +576,7 @@ export class OpenAIProvider implements ProviderClient {
private async parseError(res: Response): Promise<ProviderError> {
let message = `${this.config.name}: Request failed`
let code: string = 'network'
+ let hasServerMessage = false
try {
const data = await res.json() as { error?: unknown; message?: string }
@@ -570,22 +588,31 @@ export class OpenAIProvider implements ProviderClient {
// the opaque "Request failed". Handle all three shapes.
if (typeof err === 'string' && err.trim()) {
message = err
+ hasServerMessage = true
} else if (err && typeof err === 'object') {
const eo = err as { message?: string; code?: string }
- if (eo.message) message = eo.message
+ if (eo.message) {
+ message = eo.message
+ hasServerMessage = true
+ }
if (eo.code) code = eo.code
} else if (typeof data.message === 'string' && data.message.trim()) {
message = data.message
+ hasServerMessage = true
}
} catch { /* non-JSON body → keep default */ }
- // Map HTTP status to error code
+ // Map HTTP status to error code. The canned texts are FALLBACKS for
+ // opaque bodies only — a server that sends an honest message (LU Cloud:
+ // "monthly credit budget exhausted", "LU Cloud is in closed beta (Max
+ // plan only)", …) must surface it verbatim, not a wrong API-key /
+ // wait-a-moment hint the user can't act on.
if (res.status === 401 || res.status === 403) {
code = 'auth'
- message = `Invalid API key for ${this.config.name}. Check Settings > Providers.`
+ if (!hasServerMessage) message = `Invalid API key for ${this.config.name}. Check Settings > Providers.`
} else if (res.status === 429) {
code = 'rate_limit'
- message = `Rate limited by ${this.config.name}. Wait a moment and try again.`
+ if (!hasServerMessage) message = `Rate limited by ${this.config.name}. Wait a moment and try again.`
} else if (res.status === 404) {
code = 'not_found'
}
diff --git a/src/api/providers/types.ts b/src/api/providers/types.ts
index c6295180..bfdddc0d 100644
--- a/src/api/providers/types.ts
+++ b/src/api/providers/types.ts
@@ -169,13 +169,15 @@ export interface ProviderClient {
/** Non-streaming chat with tool calling support. The optional
* promptEvalCount/evalCount carry real token usage (consumed context) so
- * the agent/code TokenCounter can show the true fill, not a char/4 estimate. */
+ * the agent/code TokenCounter can show the true fill, not a char/4 estimate.
+ * `thinking` carries native model reasoning (Ollama thinking field, LU Cloud
+ * reasoning_content). */
chatWithTools(
model: string,
messages: ChatMessage[],
tools: ToolDefinition[],
options?: ChatOptions
- ): Promise<{ content: string; toolCalls: ToolCall[]; promptEvalCount?: number; evalCount?: number }>
+ ): Promise<{ content: string; toolCalls: ToolCall[]; promptEvalCount?: number; evalCount?: number; thinking?: string }>
/** List available models from this provider. */
listModels(): Promise<ProviderModel[]>
diff --git a/src/api/voice.ts b/src/api/voice.ts
index 47e53a7f..66a78636 100644
--- a/src/api/voice.ts
+++ b/src/api/voice.ts
@@ -229,14 +229,43 @@ export async function transcribeAudioCloud(audioBlob: Blob): Promise<string> {
return data.text || "";
}
+// The cloud TTS route rejects text over 1500 chars (zod BodySchema) — a
+// typical assistant answer is longer. Split into ≤1400-char pieces on sentence
+// boundaries (hard-splitting any single oversized run) so long messages read
+// aloud instead of 400ing and silently degrading to the local/browser voice.
+const TTS_MAX_CHARS = 1400;
+export function chunkForTts(text: string, max = TTS_MAX_CHARS): string[] {
+ const clean = text.trim();
+ if (clean.length <= max) return clean ? [clean] : [];
+ const parts = clean.split(/(?<=[.!?。!?\n])\s+/);
+ const chunks: string[] = [];
+ let cur = "";
+ for (const p of parts) {
+ if (p.length > max) {
+ if (cur) { chunks.push(cur); cur = ""; }
+ for (let i = 0; i < p.length; i += max) chunks.push(p.slice(i, i + max));
+ continue;
+ }
+ if ((cur ? cur.length + 1 + p.length : p.length) > max) {
+ if (cur) chunks.push(cur);
+ cur = p;
+ } else {
+ cur = cur ? `${cur} ${p}` : p;
+ }
+ }
+ if (cur) chunks.push(cur);
+ return chunks;
+}
+
/** Cloud TTS: /api/voice/tts streams back MP3 (MiniMax Speech-02). Returns an
- * object URL for playNeuralAudio; the handful of clips per session makes
- * revocation bookkeeping not worth it. */
-export async function synthesizeCloud(text: string, voice?: string): Promise<string> {
+ * object URL for playNeuralAudio (which revokes it when the clip settles).
+ * `signal` aborts the in-flight synthesis — the server cancels un-metered. */
+export async function synthesizeCloud(text: string, voice?: string, signal?: AbortSignal): Promise<string> {
const res = await cloudFetch("/api/voice/tts", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ text, ...(voice ? { voice } : {}) }),
+ signal,
});
if (!res.ok) {
const body = await res.json().catch(() => ({}) as { error?: string });
@@ -319,29 +348,40 @@ export async function listInstalledPiperVoices(): Promise<string[]> {
}
let neuralAudio: HTMLAudioElement | null = null;
+let neuralAudioDone: (() => void) | null = null;
-/** Play a WAV data URL; resolves when playback ends. Replaces any current clip. */
+/** Play a WAV data URL or MP3 blob URL; resolves when playback ends (or is
+ * stopped via stopNeuralAudio). Replaces any current clip. Object URLs are
+ * revoked once the clip settles so cloud TTS blobs don't pin memory. */
export function playNeuralAudio(dataUrl: string): Promise<void> {
return new Promise((resolve, reject) => {
stopNeuralAudio();
const audio = new Audio(dataUrl);
- neuralAudio = audio;
- audio.onended = () => {
- if (neuralAudio === audio) neuralAudio = null;
- resolve();
+ const cleanup = () => {
+ if (neuralAudio === audio) { neuralAudio = null; neuralAudioDone = null; }
+ if (dataUrl.startsWith("blob:")) URL.revokeObjectURL(dataUrl);
};
+ neuralAudio = audio;
+ neuralAudioDone = () => { cleanup(); resolve(); };
+ audio.onended = () => { cleanup(); resolve(); };
audio.onerror = () => {
- if (neuralAudio === audio) neuralAudio = null;
+ cleanup();
reject(new Error("neural audio playback failed"));
};
- audio.play().catch(reject);
+ audio.play().catch((err) => { cleanup(); reject(err); });
});
}
export function stopNeuralAudio(): void {
if (neuralAudio) {
try { neuralAudio.pause(); } catch { /* noop */ }
+ // pause() never fires onended — settle the pending playNeuralAudio promise
+ // explicitly (which also revokes a blob: URL) so callers' awaits don't
+ // dangle forever after a Stop click.
+ const done = neuralAudioDone;
neuralAudio = null;
+ neuralAudioDone = null;
+ done?.();
}
}
diff --git a/src/components/auth/AccountPanel.tsx b/src/components/auth/AccountPanel.tsx
index 03d84cbb..d99f2a9c 100644
--- a/src/components/auth/AccountPanel.tsx
+++ b/src/components/auth/AccountPanel.tsx
@@ -4,10 +4,11 @@
// axis everywhere else (Create backend toggle, lu-cloud chat provider) hangs
// off the cloudAuthStore this panel drives via useCloudAuth.
-import { useState } from 'react'
+import { useRef, useState } from 'react'
import { Loader2, LogOut, ExternalLink, Cloud } from 'lucide-react'
import { useCloudAuth } from '../../hooks/useCloudAuth'
import { useCloudAuthStore } from '../../stores/cloudAuthStore'
+import { loginWithProvider } from '../../api/cloud/supabase'
import { CLOUD_BASE } from '../../api/cloud/config'
import { openExternal } from '../../api/backend'
@@ -29,20 +30,27 @@ function Meter({ label, used, limit }: { label: string; used: number; limit: num
}
// Same identities as lu-labs.ai/login — email+password inline, Google/GitHub
-// via the system browser (PKCE loopback in useCloudAuth.loginOAuth).
+// via the system browser (PKCE loopback in loginWithProvider). The browser
+// round-trip can hang on a closed tab, so a Cancel affordance aborts the wait
+// and recovers the buttons instead of spinning out the full timeout.
function OAuthButtons({ onError }: { onError: (msg: string | null) => void }) {
- const { loginOAuth } = useCloudAuth()
+ const { refresh } = useCloudAuth()
const [waiting, setWaiting] = useState<'google' | 'github' | null>(null)
+ const abortRef = useRef<AbortController | null>(null)
const start = async (provider: 'google' | 'github') => {
if (waiting) return
+ const ctrl = new AbortController()
+ abortRef.current = ctrl
setWaiting(provider)
onError(null)
try {
- await loginOAuth(provider)
+ await loginWithProvider(provider, ctrl.signal)
+ await refresh()
} catch (err) {
- onError(err instanceof Error ? err.message : String(err))
+ if (!ctrl.signal.aborted) onError(err instanceof Error ? err.message : String(err))
} finally {
+ abortRef.current = null
setWaiting(null)
}
}
@@ -51,30 +59,41 @@ function OAuthButtons({ onError }: { onError: (msg: string | null) => void }) {
'flex-1 flex items-center justify-center gap-1.5 px-2 py-1.5 rounded text-[0.7rem] font-medium border border-gray-200 dark:border-white/10 bg-gray-100 dark:bg-white/5 text-gray-800 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-white/10 transition-colors disabled:opacity-40'
return (
- <div className="flex items-center gap-2">
- <button type="button" disabled={waiting !== null} onClick={() => void start('google')} className={btn}>
- {waiting === 'google' ? (
- <Loader2 size={11} className="animate-spin" />
- ) : (
- <svg width="11" height="11" viewBox="0 0 24 24" aria-hidden>
- <path fill="#4285F4" d="M23.5 12.3c0-.9-.1-1.5-.3-2.2H12v4.1h6.5c-.1 1.1-.8 2.7-2.4 3.8l3.7 2.9c2.3-2.1 3.7-5.2 3.7-8.6z" />
- <path fill="#34A853" d="M12 24c3.2 0 6-1.1 8-2.9l-3.8-2.9c-1 .7-2.4 1.2-4.2 1.2-3.2 0-6-2.1-6.9-5.1H1.2v3C3.2 21.3 7.3 24 12 24z" />
- <path fill="#FBBC05" d="M5.1 14.3c-.2-.7-.4-1.5-.4-2.3s.1-1.6.4-2.3v-3H1.2C.4 8.3 0 10.1 0 12s.4 3.7 1.2 5.3l3.9-3z" />
- <path fill="#EA4335" d="M12 4.7c1.8 0 3 .8 3.7 1.4L19 3C17 1.1 14.7 0 12 0 7.3 0 3.2 2.7 1.2 6.7l3.9 3C6 6.8 8.8 4.7 12 4.7z" />
- </svg>
- )}
- Google
- </button>
- <button type="button" disabled={waiting !== null} onClick={() => void start('github')} className={btn}>
- {waiting === 'github' ? (
- <Loader2 size={11} className="animate-spin" />
- ) : (
- <svg width="11" height="11" viewBox="0 0 16 16" fill="currentColor" aria-hidden>
- <path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.42 7.42 0 0 1 2-.27c.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z" />
- </svg>
- )}
- GitHub
- </button>
+ <div className="space-y-2">
+ <div className="flex items-center gap-2">
+ <button type="button" disabled={waiting !== null} onClick={() => void start('google')} className={btn}>
+ {waiting === 'google' ? (
+ <Loader2 size={11} className="animate-spin" />
+ ) : (
+ <svg width="11" height="11" viewBox="0 0 24 24" aria-hidden>
+ <path fill="#4285F4" d="M23.5 12.3c0-.9-.1-1.5-.3-2.2H12v4.1h6.5c-.1 1.1-.8 2.7-2.4 3.8l3.7 2.9c2.3-2.1 3.7-5.2 3.7-8.6z" />
+ <path fill="#34A853" d="M12 24c3.2 0 6-1.1 8-2.9l-3.8-2.9c-1 .7-2.4 1.2-4.2 1.2-3.2 0-6-2.1-6.9-5.1H1.2v3C3.2 21.3 7.3 24 12 24z" />
+ <path fill="#FBBC05" d="M5.1 14.3c-.2-.7-.4-1.5-.4-2.3s.1-1.6.4-2.3v-3H1.2C.4 8.3 0 10.1 0 12s.4 3.7 1.2 5.3l3.9-3z" />
+ <path fill="#EA4335" d="M12 4.7c1.8 0 3 .8 3.7 1.4L19 3C17 1.1 14.7 0 12 0 7.3 0 3.2 2.7 1.2 6.7l3.9 3C6 6.8 8.8 4.7 12 4.7z" />
+ </svg>
+ )}
+ Google
+ </button>
+ <button type="button" disabled={waiting !== null} onClick={() => void start('github')} className={btn}>
+ {waiting === 'github' ? (
+ <Loader2 size={11} className="animate-spin" />
+ ) : (
+ <svg width="11" height="11" viewBox="0 0 16 16" fill="currentColor" aria-hidden>
+ <path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.42 7.42 0 0 1 2-.27c.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z" />
+ </svg>
+ )}
+ GitHub
+ </button>
+ </div>
+ {waiting !== null && (
+ <button
+ type="button"
+ onClick={() => abortRef.current?.abort()}
+ className="text-[0.65rem] text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition-colors"
+ >
+ Waiting for the browser… Cancel
+ </button>
+ )}
</div>
)
}
diff --git a/src/components/chat/ABCompare.tsx b/src/components/chat/ABCompare.tsx
index 9f79c798..bba017e8 100644
--- a/src/components/chat/ABCompare.tsx
+++ b/src/components/chat/ABCompare.tsx
@@ -1,6 +1,6 @@
import { useState, useRef, useEffect } from 'react'
import { useCompareStore } from '../../stores/compareStore'
-import { useModelStore } from '../../stores/modelStore'
+import { useModels } from '../../hooks/useModels'
import { useABCompare } from '../../hooks/useABCompare'
import { MarkdownRenderer } from './MarkdownRenderer'
import { ArrowLeft, Send, Square, Zap, Clock, Hash } from 'lucide-react'
@@ -11,7 +11,10 @@ export function ABCompare() {
statsA, statsB, isStreamingA, isStreamingB,
setModelA, setModelB, setComparing, reset,
} = useCompareStore()
- const models = useModelStore((s) => s.models)
+ // appMode-filtered view (useModels choke point) — the raw store keeps the
+ // full list, which leaked paid lu-cloud models into Local mode (and local
+ // models into Cloud mode) in the Compare pickers.
+ const { models } = useModels()
const textModels = models.filter(m => m.type === 'text')
const { sendCompare, stopCompare } = useABCompare()
const [input, setInput] = useState('')
diff --git a/src/components/chat/ChatInput.tsx b/src/components/chat/ChatInput.tsx
index 960b413b..9106be3e 100644
--- a/src/components/chat/ChatInput.tsx
+++ b/src/components/chat/ChatInput.tsx
@@ -73,7 +73,11 @@ export function ChatInput({ onSend, onStop, isGenerating, pendingApproval, onApp
const thinkMode = activeModelMeta && 'thinkMode' in activeModelMeta ? activeModelMeta.thinkMode : undefined
const thinkLockedOn = thinkMode === 'always'
const canThink = thinkMode ? thinkMode === 'toggle' : isThinkingCompatible(activeModel)
- const canSeeImages = isVisionCompatible(activeModel)
+ // Same server-over-heuristic precedence for vision (input_modalities →
+ // supportsVision). The flag is `true` or undefined (never false), so
+ // models without it still fall back to the name heuristic.
+ const serverVision = activeModelMeta && 'supportsVision' in activeModelMeta ? activeModelMeta.supportsVision : undefined
+ const canSeeImages = serverVision !== undefined ? serverVision : isVisionCompatible(activeModel)
useEffect(() => {
if (textareaRef.current) {
diff --git a/src/components/chat/VoiceButton.tsx b/src/components/chat/VoiceButton.tsx
index 202df972..ecbe9262 100644
--- a/src/components/chat/VoiceButton.tsx
+++ b/src/components/chat/VoiceButton.tsx
@@ -12,7 +12,7 @@ interface Props {
}
export function VoiceButton({ onTranscript, onInterim, onRecordingChange, disabled }: Props) {
- const { isRecording, isTranscribing, sttSupported, startRecording, stopRecording, recheckStt } = useVoice()
+ const { isRecording, isTranscribing, sttSupported, sttError, clearSttError, startRecording, stopRecording, recheckStt } = useVoice()
useEffect(() => {
// The startup probe (App.tsx) can run before the persistent Whisper server
@@ -22,6 +22,14 @@ export function VoiceButton({ onTranscript, onInterim, onRecordingChange, disabl
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
+ // Dictation failures (cloud 401/403/413/429/5xx, dead mic) surface as a
+ // transient bubble over the mic instead of the take silently vanishing.
+ useEffect(() => {
+ if (!sttError) return
+ const t = setTimeout(() => clearSttError(), 6000)
+ return () => clearTimeout(t)
+ }, [sttError, clearSttError])
+
const handleClick = async () => {
if (disabled || isTranscribing) return
@@ -33,7 +41,11 @@ export function VoiceButton({ onTranscript, onInterim, onRecordingChange, disabl
}
} else {
onRecordingChange?.(true)
- await startRecording((interim) => onInterim?.(interim))
+ const ok = await startRecording((interim) => onInterim?.(interim))
+ // Roll back the composer's "Recording…" state when the mic never
+ // started (permission denied / no input device) — otherwise Enter-to-
+ // send stays blocked with no recovery path.
+ if (!ok) onRecordingChange?.(false)
}
}
@@ -68,26 +80,36 @@ export function VoiceButton({ onTranscript, onInterim, onRecordingChange, disabl
}
return (
- <motion.button
- onClick={handleClick}
- disabled={disabled}
- className={`p-1.5 rounded-lg transition-all shrink-0 relative ${
- isRecording
- ? "bg-red-100 dark:bg-red-500/20 border border-red-300 dark:border-red-500/40 text-red-600 dark:text-red-400"
- : "hover:bg-gray-100 dark:hover:bg-white/10 text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"
- } disabled:opacity-30 disabled:cursor-not-allowed`}
- data-voice-button
- whileTap={{ scale: 0.9 }}
- aria-label={isRecording ? "Stop recording" : "Start voice input"}
- >
- {isRecording && (
- <motion.span
- className="absolute inset-0 rounded-lg border-2 border-red-500 dark:border-red-400"
- animate={{ scale: [1, 1.15, 1], opacity: [1, 0.4, 1] }}
- transition={{ duration: 1.2, repeat: Infinity, ease: "easeInOut" }}
- />
+ <div className="relative shrink-0">
+ <motion.button
+ onClick={handleClick}
+ disabled={disabled}
+ className={`p-1.5 rounded-lg transition-all shrink-0 relative ${
+ isRecording
+ ? "bg-red-100 dark:bg-red-500/20 border border-red-300 dark:border-red-500/40 text-red-600 dark:text-red-400"
+ : "hover:bg-gray-100 dark:hover:bg-white/10 text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"
+ } disabled:opacity-30 disabled:cursor-not-allowed`}
+ data-voice-button
+ whileTap={{ scale: 0.9 }}
+ aria-label={isRecording ? "Stop recording" : "Start voice input"}
+ >
+ {isRecording && (
+ <motion.span
+ className="absolute inset-0 rounded-lg border-2 border-red-500 dark:border-red-400"
+ animate={{ scale: [1, 1.15, 1], opacity: [1, 0.4, 1] }}
+ transition={{ duration: 1.2, repeat: Infinity, ease: "easeInOut" }}
+ />
+ )}
+ <Mic size={14} />
+ </motion.button>
+ {sttError && (
+ <div
+ role="alert"
+ className="absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 w-max max-w-[240px] bg-red-600/95 dark:bg-red-500/90 text-white text-[0.6rem] leading-snug rounded text-center pointer-events-none z-10"
+ >
+ {sttError}
+ </div>
)}
- <Mic size={14} />
- </motion.button>
+ </div>
)
}
diff --git a/src/components/cloud/CloudGateModal.tsx b/src/components/cloud/CloudGateModal.tsx
index 8188ff1b..c717b198 100644
--- a/src/components/cloud/CloudGateModal.tsx
+++ b/src/components/cloud/CloudGateModal.tsx
@@ -5,6 +5,7 @@
// signed-out → login (email+password + Google/GitHub)
// licensed? no → plan CTA → lu-labs.ai/pricing in the browser
// beta gate (access=no) → closed-beta copy → lu-labs.ai
+// no credit budget → honest copy → lu-labs.ai/account in the browser
// Payment stays on lu-labs.ai (browser) — the app never touches Stripe.
import { useEffect, useRef } from 'react'
@@ -44,6 +45,12 @@ export function CloudGateModal() {
}
}, [available, setOpen, updateSettings])
+ // Re-probe on open — someone staring at this gate shouldn't wait for the
+ // 5-minute background interval to clear a transient quota-fetch failure.
+ useEffect(() => {
+ if (open) void refresh()
+ }, [open, refresh])
+
const linkBtn =
'flex items-center gap-1.5 px-3 py-1.5 rounded text-[0.7rem] font-medium bg-gray-900 text-white dark:bg-white dark:text-gray-900 hover:opacity-90 transition-opacity'
const ghostBtn =
@@ -91,6 +98,34 @@ export function CloudGateModal() {
</button>
</div>
</div>
+ ) : quota === null ? (
+ <div className="space-y-3">
+ <p className="text-[0.75rem] text-gray-600 dark:text-gray-400">
+ Your plan is active, but your usage couldn't be loaded just now, so
+ Cloud mode can't switch on yet. Check your connection and re-check.
+ </p>
+ <div className="flex items-center gap-2">
+ <button className={ghostBtn} onClick={() => void refresh()}>
+ <RefreshCw size={11} /> Re-check
+ </button>
+ </div>
+ </div>
+ ) : quota.limits.credits <= 0 ? (
+ <div className="space-y-3">
+ <p className="text-[0.75rem] text-gray-600 dark:text-gray-400">
+ Your plan is active, but it doesn't include a hosted-compute credit
+ budget, so there's nothing for Cloud mode to run on. Plans with
+ cloud credits are on lu-labs.ai.
+ </p>
+ <div className="flex items-center gap-2">
+ <button className={linkBtn} onClick={() => void openExternal(`${CLOUD_BASE}/account`)}>
+ <ExternalLink size={11} /> Open your account on lu-labs.ai
+ </button>
+ <button className={ghostBtn} onClick={() => void refresh()}>
+ <RefreshCw size={11} /> Re-check
+ </button>
+ </div>
+ </div>
) : (
<p className="text-[0.75rem] text-gray-600 dark:text-gray-400">Checking your account…</p>
)}
diff --git a/src/components/create/experimental/Composer.tsx b/src/components/create/experimental/Composer.tsx
index 5c188509..dd1658c6 100644
--- a/src/components/create/experimental/Composer.tsx
+++ b/src/components/create/experimental/Composer.tsx
@@ -1,9 +1,16 @@
import { useCallback, useRef, useState } from 'react'
import { motion, AnimatePresence } from 'framer-motion'
import { Sparkles, X, History, SlidersHorizontal, Square } from 'lucide-react'
-import { useCreateStore, MODEL_TYPE_DEFAULTS } from '../../../stores/createStore'
+import { useCreateStore, MODEL_TYPE_DEFAULTS, type CreateIntent } from '../../../stores/createStore'
import { useCreateExp } from './CreateContext'
import { intentToJob } from '../../../lib/render/cloud-jobs'
+import {
+ cloudModelById,
+ defaultCloudModel,
+ defaultEditModel,
+ isEditCapable,
+ runCredits,
+} from '../../../stores/cloudCatalogStore'
import { INTENT_MAP } from './intents'
import { ModelChip } from './ModelChip'
import { CreditsMeter } from './CreditsMeter'
@@ -33,6 +40,10 @@ export function Composer({ onOpenAdvanced }: Props) {
const backend = useCreateStore((s) => s.backend)
const targetResolution = useCreateStore((s) => s.targetResolution)
const setTargetResolution = useCreateStore((s) => s.setTargetResolution)
+ const cloudImageModel = useCreateStore((s) => s.cloudImageModel)
+ const cloudVideoModel = useCreateStore((s) => s.cloudVideoModel)
+ const frames = useCreateStore((s) => s.frames)
+ const fps = useCreateStore((s) => s.fps)
const { generate, cancel, quota } = useCreateExp()
// The Create button turns into Cancel in place — a double-click's second
@@ -52,9 +63,30 @@ export function Composer({ onOpenAdvanced }: Props) {
// Single-purpose endpoints (cutout/upscale/eraser): no prompt, no
// generation knobs, no model choice — just the input (+ mask/resolution).
const isUtility = meta.id === 'removebg' || meta.id === 'upscale' || meta.id === 'eraser'
+ const { kind: intentKind, op: intentOp } = intentToJob(intent)
+ // Gate on the exact run's cost (model + op + clip length), the same figure
+ // the CreditsMeter shows — quota.costs[kind] is only the tier's
+ // representative per-kind number and would mis-gate utility ops / pricier
+ // models.
+ const pickedModel =
+ (intentKind === 'video' ? cloudVideoModel : cloudImageModel) || defaultCloudModel(intentKind).id
+ const runSeconds =
+ intentKind === 'video' && (intentOp === 'generate' || intentOp === 'animate') && fps > 0
+ ? frames / fps
+ : undefined
const creditsOk =
backend !== 'cloud' ||
- (quota != null && quota.remaining.credits >= quota.costs[intentToJob(intent).kind])
+ (quota != null &&
+ quota.remaining.credits >=
+ runCredits(intentKind, intentOp, pickedModel, runSeconds, quota.costs[intentKind], targetResolution))
+ // Match useCloudCreate's submit-time edit fallback so the Neg gate reflects
+ // the model the run actually uses, not a t2i model still in the picker.
+ const runModel =
+ intentOp === 'edit' && !isEditCapable(pickedModel) ? (defaultEditModel()?.id ?? pickedModel) : pickedModel
+ // The hosted endpoints only honour negative_prompt for a few families —
+ // hide the toggle (and the collapsed field) where it would be silently
+ // dropped, like the other dead knobs on cloud.
+ const negSupported = backend !== 'cloud' || cloudModelById(runModel)?.negative_prompt === true
const canGenerate =
(!needPrompt || prompt.trim().length > 0) &&
(!meta.needsSource || !!source) &&
@@ -78,7 +110,7 @@ export function Composer({ onOpenAdvanced }: Props) {
)}
<AnimatePresence>
- {showNegative && meta.needsPrompt && (
+ {showNegative && meta.needsPrompt && negSupported && (
<motion.div
initial={{ height: 0, opacity: 0 }}
animate={{ height: 'auto', opacity: 1 }}
@@ -99,13 +131,13 @@ export function Composer({ onOpenAdvanced }: Props) {
{!meta.needsPrompt && (
<div className="px-3.5 py-3 t-body text-gray-500">
- No prompt needed — just hit Create to remove the background.
+ {noPromptHint(meta.id)}
</div>
)}
{/* Action bar */}
<div className="flex items-center gap-1.5 px-2.5 py-2 border-t border-white/[0.05]">
- {meta.needsPrompt && (
+ {meta.needsPrompt && negSupported && (
<button
onClick={toggleNegative}
className={cn('t-control px-2 h-[var(--control-h-sm)] rounded-md transition-colors', showNegative ? 'bg-white/10 text-gray-200' : 'text-gray-500 hover:text-gray-300 hover:bg-white/[0.05]')}
@@ -152,6 +184,20 @@ export function Composer({ onOpenAdvanced }: Props) {
)
}
+// Caption for prompt-less intents so each reads honestly (the old copy said
+// "remove the background" for every one of them — misleading the eraser into
+// a guaranteed "Paint a mask first" error).
+function noPromptHint(id: CreateIntent): string {
+ switch (id) {
+ case 'upscale':
+ return 'No prompt needed — just hit Create to enhance the image.'
+ case 'eraser':
+ return 'No prompt needed — paint a mask over the object to remove, then hit Create.'
+ default:
+ return 'No prompt needed — just hit Create to remove the background.'
+ }
+}
+
// Quality (proxy over steps) + Aspect (image) + Edit strength (edit).
function QuickControls() {
const intent = useCreateStore((s) => s.intent())
diff --git a/src/components/create/experimental/CreditsMeter.tsx b/src/components/create/experimental/CreditsMeter.tsx
index b15b6b4f..e9ee4f1b 100644
--- a/src/components/create/experimental/CreditsMeter.tsx
+++ b/src/components/create/experimental/CreditsMeter.tsx
@@ -1,6 +1,7 @@
import { useCreateStore } from '../../../stores/createStore'
import { useCreateExp } from './CreateContext'
import { intentToJob } from '../../../lib/render/cloud-jobs'
+import { defaultCloudModel, runCredits } from '../../../stores/cloudCatalogStore'
import { Tooltip } from '../ui/Tooltip'
import { openExternal } from '../../../api/backend'
import { CLOUD_BASE } from '../../../api/cloud/config'
@@ -13,10 +14,23 @@ import { cn } from '../ui/cn'
export function CreditsMeter() {
const { quota } = useCreateExp()
const intent = useCreateStore((s) => s.intent())
+ const cloudImageModel = useCreateStore((s) => s.cloudImageModel)
+ const cloudVideoModel = useCreateStore((s) => s.cloudVideoModel)
+ const frames = useCreateStore((s) => s.frames)
+ const fps = useCreateStore((s) => s.fps)
+ const targetResolution = useCreateStore((s) => s.targetResolution)
if (!quota) return null
- const { kind } = intentToJob(intent)
- const cost = quota.costs[kind]
+ const { kind, op } = intentToJob(intent)
+ // Price the exact run the user is about to make — model, op, (for video)
+ // clip length and (for upscale) target resolution — not the tier's
+ // representative per-kind figure; utility ops and pricier models would
+ // otherwise show a wrong number and mis-gate the button. Same figure
+ // Composer's creditsOk gates on.
+ const picked = (kind === 'video' ? cloudVideoModel : cloudImageModel) || defaultCloudModel(kind).id
+ const seconds =
+ kind === 'video' && (op === 'generate' || op === 'animate') && fps > 0 ? frames / fps : undefined
+ const cost = runCredits(kind, op, picked, seconds, quota.costs[kind], targetResolution)
const remaining = quota.remaining.credits
const limit = quota.limits.credits
const enough = remaining >= cost
diff --git a/src/components/create/experimental/GalleryStrip.tsx b/src/components/create/experimental/GalleryStrip.tsx
index a9dd48ae..ee5731ae 100644
--- a/src/components/create/experimental/GalleryStrip.tsx
+++ b/src/components/create/experimental/GalleryStrip.tsx
@@ -1,7 +1,7 @@
import { motion } from 'framer-motion'
import { Trash2, Play } from 'lucide-react'
import { useCreateStore } from '../../../stores/createStore'
-import { galleryItemUrl } from './galleryUrl'
+import { galleryItemUrl, recoverGalleryUrl } from './galleryUrl'
import { cn } from '../ui/cn'
interface Props {
@@ -38,11 +38,11 @@ export function GalleryStrip({ activeId, onSelect }: Props) {
>
{g.type === 'video' ? (
<>
- <video src={galleryItemUrl(g)} muted playsInline className="w-full h-full object-cover" />
+ <video src={galleryItemUrl(g)} muted playsInline onError={() => recoverGalleryUrl(g)} className="w-full h-full object-cover" />
<span className="absolute inset-0 flex items-center justify-center bg-black/20"><Play size={14} className="text-white/90" /></span>
</>
) : (
- <img src={galleryItemUrl(g)} alt="" className="w-full h-full object-cover" />
+ <img src={galleryItemUrl(g)} alt="" onError={() => recoverGalleryUrl(g)} className="w-full h-full object-cover" />
)}
</button>
<button
diff --git a/src/components/create/experimental/Lightbox.tsx b/src/components/create/experimental/Lightbox.tsx
index fc37428e..64806cea 100644
--- a/src/components/create/experimental/Lightbox.tsx
+++ b/src/components/create/experimental/Lightbox.tsx
@@ -3,7 +3,7 @@ import { motion, AnimatePresence } from 'framer-motion'
import { X, Sparkles } from 'lucide-react'
import { useCreateStore, type GalleryItem } from '../../../stores/createStore'
import { useCreateExp } from './CreateContext'
-import { galleryItemUrl } from './galleryUrl'
+import { galleryItemUrl, recoverGalleryUrl } from './galleryUrl'
import { cn } from '../ui/cn'
export function Lightbox({ item, onClose }: { item: GalleryItem | null; onClose: () => void }) {
@@ -57,6 +57,7 @@ export function Lightbox({ item, onClose }: { item: GalleryItem | null; onClose:
controls
autoPlay
loop
+ onError={() => recoverGalleryUrl(item)}
onClick={(e) => e.stopPropagation()}
className="max-w-full max-h-full object-contain rounded-lg"
/>
@@ -67,6 +68,7 @@ export function Lightbox({ item, onClose }: { item: GalleryItem | null; onClose:
exit={{ scale: 0.95 }}
src={galleryItemUrl(item)}
alt={item.prompt}
+ onError={() => recoverGalleryUrl(item)}
onClick={(e) => e.stopPropagation()}
className={cn('max-w-full max-h-full object-contain rounded-lg', item.intent === 'removebg' && 'lu-checker')}
/>
diff --git a/src/components/create/experimental/OutputView.tsx b/src/components/create/experimental/OutputView.tsx
index a33edfcb..0b62705f 100644
--- a/src/components/create/experimental/OutputView.tsx
+++ b/src/components/create/experimental/OutputView.tsx
@@ -1,8 +1,9 @@
import { motion } from 'framer-motion'
import { Cpu, Sparkles, ImageDown, Maximize2, Download, Wand2 } from 'lucide-react'
import { useCreateStore, type GalleryItem, type ProgressPhase } from '../../../stores/createStore'
-import { downloadComfyFile } from '../../../api/backend'
-import { galleryItemUrl } from './galleryUrl'
+import { downloadComfyFile, isTauri } from '../../../api/backend'
+import { refreshResultUrl } from '../../../api/cloud/jobs'
+import { galleryItemUrl, recoverGalleryUrl } from './galleryUrl'
import { cn } from '../ui/cn'
function phaseIcon(phase: ProgressPhase) {
@@ -61,12 +62,63 @@ interface ResultProps {
onSendToEditor?: () => void
}
+function extFor(contentType: string, kind: 'image' | 'video'): string {
+ if (contentType.includes('png')) return 'png'
+ if (contentType.includes('jpeg') || contentType.includes('jpg')) return 'jpg'
+ if (contentType.includes('webp')) return 'webp'
+ if (contentType.includes('mp4')) return 'mp4'
+ if (contentType.includes('webm')) return 'webm'
+ return kind === 'video' ? 'mp4' : 'png'
+}
+
+// Save a gallery item. Local ComfyUI outputs (non-empty filename) go through
+// downloadComfyFile's proxy + native dialog. Cloud items have filename '' —
+// fetch their bytes directly (re-signed first: the stored URL expires ~1 h
+// after the last read); dataUrl items decode in place. Tauri gets the native
+// Save-As dialog (WebView2 blob-anchors are unreliable); failures surface via
+// setError instead of a silent no-op.
+async function downloadGalleryItem(item: GalleryItem): Promise<void> {
+ if (item.filename) return downloadComfyFile(item.filename, item.subfolder)
+ try {
+ let url = item.dataUrl ?? item.remoteUrl
+ if (!item.dataUrl && item.jobId) {
+ url = (await refreshResultUrl(item.jobId)) ?? url
+ }
+ if (!url) throw new Error('no source available for this item')
+ const res = await fetch(url)
+ if (!res.ok) throw new Error(`fetch failed (${res.status})`)
+ const ext = extFor(res.headers.get('content-type') ?? '', item.type)
+ const name = `lu-${item.id}.${ext}`
+ const bytes = new Uint8Array(await res.arrayBuffer())
+ if (!isTauri()) {
+ const blobUrl = URL.createObjectURL(new Blob([bytes]))
+ const a = document.createElement('a')
+ a.href = blobUrl
+ a.download = name
+ document.body.appendChild(a)
+ a.click()
+ document.body.removeChild(a)
+ URL.revokeObjectURL(blobUrl)
+ return
+ }
+ const { invoke } = await import('@tauri-apps/api/core')
+ // Returns the chosen path, or null if the user cancelled — nothing to do then.
+ await invoke('save_binary_file_dialog', {
+ bytes: Array.from(bytes),
+ defaultName: name,
+ extension: ext,
+ extLabel: ext.toUpperCase(),
+ })
+ } catch (err) {
+ useCreateStore
+ .getState()
+ .setError(`Download failed — ${err instanceof Error ? err.message : String(err)}`)
+ }
+}
+
export function ResultView({ item, onFullscreen, onSendToEditor }: ResultProps) {
const url = galleryItemUrl(item)
- // Desktop build: every gallery item is a ComfyUI output (dataUrl was the
- // MLX path, remoteUrl the cloud path — both web-only). downloadComfyFile
- // goes through the native Save-As dialog, which WebView2 blob-anchors can't.
- const download = () => downloadComfyFile(item.filename, item.subfolder)
+ const download = () => void downloadGalleryItem(item)
const isVideo = item.type === 'video'
return (
<div className="flex-1 flex flex-col items-center justify-center p-6 min-h-0">
@@ -78,12 +130,14 @@ export function ResultView({ item, onFullscreen, onSendToEditor }: ResultProps)
loop
autoPlay
muted
+ onError={() => recoverGalleryUrl(item)}
className="max-w-full max-h-[62vh] object-contain rounded-[var(--radius-panel)] border border-white/[0.06]"
/>
) : (
<img
src={url}
alt={item.prompt}
+ onError={() => recoverGalleryUrl(item)}
className={cn('max-w-full max-h-[62vh] object-contain rounded-[var(--radius-panel)] border border-white/[0.06]', item.intent === 'removebg' && 'lu-checker')}
/>
)}
diff --git a/src/components/create/experimental/ParamGroups.tsx b/src/components/create/experimental/ParamGroups.tsx
index bc536620..a4f6e13e 100644
--- a/src/components/create/experimental/ParamGroups.tsx
+++ b/src/components/create/experimental/ParamGroups.tsx
@@ -1,6 +1,7 @@
import { Gauge, Boxes, FlaskConical, RotateCcw, HelpCircle } from 'lucide-react'
import { useCreateStore } from '../../../stores/createStore'
import { useCreateExp } from './CreateContext'
+import { cloudModelById, defaultCloudModel } from '../../../stores/cloudCatalogStore'
import { INTENT_MAP } from './intents'
import { SAMPLERS as SAMPLERS_FALLBACK, SCHEDULERS as SCHEDULERS_FALLBACK } from './badges'
import { Section } from '../ui/Section'
@@ -20,6 +21,16 @@ export function ParamGroups() {
const meta = INTENT_MAP[s.intent()]
const isVideo = meta.isVideo
const isEdit = meta.id === 'edit'
+ const isCloud = s.backend === 'cloud'
+
+ // On cloud the worker only honours steps for images and guidance_scale for
+ // the flux family — hide the sliders elsewhere rather than show a dead
+ // control. Sampler/scheduler/LoRA/VAE/clip-skip/batch have no cloud path at
+ // all (useCloudCreate never sends them), so they're local-only knobs.
+ const cloudModelId =
+ (isVideo ? s.cloudVideoModel : s.cloudImageModel) || defaultCloudModel(isVideo ? 'video' : 'image').id
+ const showSteps = !(isCloud && isVideo)
+ const showCfg = isCloud ? cloudModelById(cloudModelId)?.cfg === true : true
const samplers = samplerList.length ? samplerList : SAMPLERS_FALLBACK
const schedulers = schedulerList.length ? schedulerList : SCHEDULERS_FALLBACK
@@ -31,8 +42,8 @@ export function ParamGroups() {
<Section title="Quality" icon={Gauge} defaultOpen
right={<Button variant="ghost" size="sm" icon={RotateCcw} iconOnly title="Reset to model defaults" onClick={s.resetParamsToModelDefaults} />}
>
- <Slider label="Steps" min={1} max={60} step={1} value={s.steps} onChange={s.setSteps} />
- <Slider label={isVideo ? 'Guidance' : 'CFG scale'} min={0} max={30} step={0.5} value={s.cfgScale} onChange={s.setCfgScale} format={(v) => v.toFixed(1)} />
+ {showSteps && <Slider label="Steps" min={1} max={60} step={1} value={s.steps} onChange={s.setSteps} />}
+ {showCfg && <Slider label={isVideo ? 'Guidance' : 'CFG scale'} min={0} max={30} step={0.5} value={s.cfgScale} onChange={s.setCfgScale} format={(v) => v.toFixed(1)} />}
<div className="grid grid-cols-2 gap-2">
<NumberField label="Width" value={s.width} min={64} max={4096} step={64} mono onChange={(v) => s.setSize(v, s.height)} suffix="px" />
<NumberField label="Height" value={s.height} min={64} max={4096} step={64} mono onChange={(v) => s.setSize(s.width, v)} suffix="px" />
@@ -42,7 +53,9 @@ export function ParamGroups() {
{/* OUTPUT */}
<Section title="Output" icon={Boxes} defaultOpen>
<NumberField label="Seed (−1 = random)" value={s.seed} step={1} mono onRandomize={() => s.setSeed(-1)} onChange={s.setSeed} />
- {!isVideo && <Slider label="Batch size" min={1} max={8} step={1} value={s.batchSize} onChange={s.setBatchSize} />}
+ {/* Batch size has no cloud path — CloudJobParams carries no batch
+ field and useCloudCreate always stamps 1. */}
+ {!isVideo && !isCloud && <Slider label="Batch size" min={1} max={8} step={1} value={s.batchSize} onChange={s.setBatchSize} />}
{isVideo && (
<div className="grid grid-cols-2 gap-2">
<Slider label="Frames" min={1} max={120} step={1} value={s.frames} onChange={s.setFrames} />
@@ -53,12 +66,19 @@ export function ParamGroups() {
{/* EXPERT */}
<Section title="Expert" icon={FlaskConical} defaultOpen={false}>
- <Field label="Sampler" help="The algorithm that turns noise into your image. dpmpp_2m / euler are safe all-rounders.">
- <Select size="sm" options={samplers.map((x) => ({ value: x, label: x }))} value={s.sampler} onChange={s.setSampler} />
- </Field>
- <Field label="Scheduler" help="How the denoise steps are spaced. karras is a good default for SDXL; simple for FLUX.">
- <Select size="sm" options={schedulers.map((x) => ({ value: x, label: x }))} value={s.scheduler} onChange={s.setScheduler} />
- </Field>
+ {/* Sampler/Scheduler are ComfyUI-only knobs — the hosted WaveSpeed
+ endpoints don't accept them, so hide them on the cloud backend
+ rather than let the user tune a control that's silently dropped. */}
+ {!isCloud && (
+ <>
+ <Field label="Sampler" help="The algorithm that turns noise into your image. dpmpp_2m / euler are safe all-rounders.">
+ <Select size="sm" options={samplers.map((x) => ({ value: x, label: x }))} value={s.sampler} onChange={s.setSampler} />
+ </Field>
+ <Field label="Scheduler" help="How the denoise steps are spaced. karras is a good default for SDXL; simple for FLUX.">
+ <Select size="sm" options={schedulers.map((x) => ({ value: x, label: x }))} value={s.scheduler} onChange={s.setScheduler} />
+ </Field>
+ </>
+ )}
{isEdit && (
<Slider label="Denoise (raw)" min={0.05} max={1} step={0.05} value={s.denoise} onChange={s.setDenoise} format={(v) => v.toFixed(2)} />
@@ -67,7 +87,7 @@ export function ParamGroups() {
<Slider label="Mask edge feather" min={0} max={64} step={1} value={s.growMaskBy} onChange={s.setGrowMaskBy} unit="px" />
)}
- {!isVideo && loraList.length > 0 && (
+ {!isCloud && !isVideo && loraList.length > 0 && (
<div className="space-y-1.5">
<div className="t-control text-gray-400">LoRA stack {s.selectedLoras.length > 0 && <span className="t-mono text-gray-600">· {s.selectedLoras.length} active</span>}</div>
<div className="space-y-1 max-h-44 overflow-y-auto scrollbar-thin">
@@ -91,12 +111,12 @@ export function ParamGroups() {
</div>
)}
- {!isVideo && (
+ {!isCloud && !isVideo && (
<Field label="VAE" help="Override the checkpoint's built-in VAE. 'auto' lets the checkpoint decide.">
<Select size="sm" options={vaes.map((v) => ({ value: v, label: v }))} value={s.selectedVae} onChange={s.setSelectedVae} />
</Field>
)}
- {!isVideo && (
+ {!isCloud && !isVideo && (
<Slider label="Skip CLIP layers" min={0} max={12} step={1} value={s.clipSkip} onChange={s.setClipSkip} />
)}
</Section>
diff --git a/src/components/create/experimental/Stage.tsx b/src/components/create/experimental/Stage.tsx
index 846bc964..717cfa11 100644
--- a/src/components/create/experimental/Stage.tsx
+++ b/src/components/create/experimental/Stage.tsx
@@ -24,7 +24,13 @@ export function Stage({ displayed, onOpenMaskEditor, onFullscreen }: Props) {
const sourceSetAt = useCreateStore((s) => s.sourceSetAt)
const setPrompt = useCreateStore((s) => s.setPrompt)
const caps = useCreateStore((s) => s.caps)
- const capReady = meta.capability ? caps[meta.capability] : true
+ const backend = useCreateStore((s) => s.backend)
+ // On the cloud backend the utility ops (background removal, …) run on
+ // WaveSpeed's hosted endpoints — there's no local ComfyUI node to install,
+ // so the capability is always ready. Only the local backend gates on the
+ // node probe (which never runs without a local ComfyUI and would strand
+ // cloud users on a dead "Open Model Manager" card).
+ const capReady = !meta.capability || backend === 'cloud' || !!caps[meta.capability]
// A result counts for the current source only if it was generated after the
// source was loaded — otherwise an older gallery item would hijack the stage.
@@ -182,7 +188,9 @@ function SourcePreview({ onOpenMaskEditor }: { onOpenMaskEditor: () => void }) {
</div>
<p className="t-body text-gray-600 mt-3 text-center max-w-sm">
{meta.id === 'removebg' ? 'Hit Create to cut out the subject and export a transparent PNG.'
- : meta.allowsMask ? 'Paint a mask over what should change, write the edit prompt below, then Create. Or skip the mask for a full image-to-image pass.'
+ : meta.id === 'upscale' ? 'Hit Create to upscale the image.'
+ : meta.id === 'eraser' ? 'Paint a mask over the object to remove, then hit Create.'
+ : meta.allowsMask ? 'Paint a mask over what should change, write the edit prompt below, then Create.'
: 'Describe the motion below, then Create.'}
</p>
</div>
diff --git a/src/components/create/experimental/galleryUrl.ts b/src/components/create/experimental/galleryUrl.ts
index 2e09c7e0..2a66b5b6 100644
--- a/src/components/create/experimental/galleryUrl.ts
+++ b/src/components/create/experimental/galleryUrl.ts
@@ -1,9 +1,25 @@
import { getImageUrl } from '../../../api/comfyui'
-import type { GalleryItem } from '../../../stores/createStore'
+import { refreshResultUrl } from '../../../api/cloud/jobs'
+import { useCreateStore, type GalleryItem } from '../../../stores/createStore'
/** Resolve a gallery item's display URL. Priority mirrors MediaViewer/Gallery:
- * remoteUrl (cloud signed URL) → dataUrl (MLX self-contained PNG) → ComfyUI
- * /view path (filename/subfolder). */
+ * remoteUrl (cloud signed URL) → dataUrl (in-memory self-contained fallback)
+ * → ComfyUI /view path (filename/subfolder). */
export function galleryItemUrl(item: GalleryItem): string {
return item.remoteUrl ?? item.dataUrl ?? getImageUrl(item.filename, item.subfolder)
}
+
+// Cloud signed URLs expire ~1 h after the last read, so a persisted item's
+// media errors on the next session. Re-sign once per item per session (the
+// guard stops an error → refresh → error loop when the job's file is gone
+// for good) and patch the gallery entry so every surface re-renders with
+// the fresh URL.
+const recovered = new Set<string>()
+
+export function recoverGalleryUrl(item: GalleryItem): void {
+ if (!item.jobId || recovered.has(item.id)) return
+ recovered.add(item.id)
+ void refreshResultUrl(item.jobId).then((url) => {
+ if (url) useCreateStore.getState().updateGalleryItem(item.id, { remoteUrl: url })
+ })
+}
diff --git a/src/components/layout/AppShell.tsx b/src/components/layout/AppShell.tsx
index cf3265a7..d7aa099d 100644
--- a/src/components/layout/AppShell.tsx
+++ b/src/components/layout/AppShell.tsx
@@ -22,6 +22,8 @@ import { useModelHealthStore } from '../../stores/modelHealthStore'
import { extractMemoriesFromPair } from '../../hooks/useMemory'
import { detectLocalBackends, type DetectedBackend } from '../../lib/backend-detector'
import { backendCall, isTauri } from '../../api/backend'
+import { idbStorage } from '../../lib/idbStorage'
+import type { AIModel } from '../../types/models'
import { useKeyboardShortcuts } from '../../hooks/useKeyboardShortcuts'
import { useCloudAuth } from '../../hooks/useCloudAuth'
import { useCloudAuthStore, deriveCloudAvailable } from '../../stores/cloudAuthStore'
@@ -30,6 +32,14 @@ import { CloudGateModal } from '../cloud/CloudGateModal'
import { ShortcutsModal } from './ShortcutsModal'
import { Titlebar } from './Titlebar'
+// The backup triad must never write %APPDATA%/store_backup.json before the
+// restore decision — on a post-NSIS boot the first doBackup would otherwise
+// snapshot the wiped localStorage over the only good backup. Resolved on every
+// exit path of the restore effect (intact-store fast path, restore-then-reload,
+// no-backup fallback, browser give-up); module-level so a reload starts fresh.
+let resolveRestoreDecided: () => void = () => {}
+const restoreDecided = new Promise<void>((resolve) => { resolveRestoreDecided = resolve })
+
export function AppShell() {
const { currentView } = useUIStore()
const { settings, updateSettings } = useSettingsStore()
@@ -68,15 +78,21 @@ export function AppShell() {
const allModels = useModelStore((s) => s.models)
useEffect(() => {
const { activeModel, setActiveModel } = useModelStore.getState()
+ // Chat models only — ComfyUI image/video checkpoints share the list but
+ // carry no provider field, so a bare provider check would pin a checkpoint
+ // as the active CHAT model (mirrors the pull auto-activate guard in
+ // useModels; an unprefixed checkpoint name routes to Ollama and fails).
+ const chatCapable = (m: AIModel) => m.type !== 'image' && m.type !== 'video'
const inMode = (name: string | null) => {
if (!name) return false
const m = allModels.find((x) => x.name === name)
- const isCloud = m?.provider === 'lu-cloud'
+ if (!m || !chatCapable(m)) return false
+ const isCloud = m.provider === 'lu-cloud'
return appMode === 'cloud' ? isCloud : !isCloud
}
if (inMode(activeModel)) return
const fallback = allModels.find((m) =>
- appMode === 'cloud' ? m.provider === 'lu-cloud' : m.provider !== 'lu-cloud',
+ chatCapable(m) && (appMode === 'cloud' ? m.provider === 'lu-cloud' : m.provider !== 'lu-cloud'),
)
if (fallback) setActiveModel(fallback.name)
}, [appMode, allModels])
@@ -105,6 +121,10 @@ export function AppShell() {
'lu_cloud_teaser', 'lu_image_tool_noti',
]
const STORE_KEYS_SET = new Set(STORE_KEYS)
+ // These two persist via idbStorage (IndexedDB) since v2.5.0 — the backup
+ // snapshot must read them from there; their localStorage copy is deleted by
+ // the one-time idb migration, so localStorage.getItem returns nothing.
+ const IDB_STORE_KEYS = new Set(['chat-conversations', 'locally-uncensored-memory'])
// Feature FF: reserved key under which memory embeddings ride inside the RAG
// chunk backup file. Never collides with a real documentId (those are UUIDs).
@@ -125,94 +145,124 @@ export function AppShell() {
return ragOnly
}
- // On startup: if localStorage was wiped, restore from %APPDATA% backup
+ // On startup: if localStorage was wiped, restore from %APPDATA% backup.
+ // Tauri v2 sets the global asynchronously via `withGlobalTauri` — on slow
+ // cold-starts the first render beats it (commit 835ce86, same reason the
+ // backup triad polls). A bare isTauri() bail here would skip the restore
+ // permanently and let the triad's first doBackup clobber the backup file
+ // with the freshly-wiped state, so we poll with the same 100 ms × 50 pattern.
useEffect(() => {
- if (!isTauri()) return
- const hasStores = STORE_KEYS.some(k => localStorage.getItem(k))
- const restoreComplete = localStorage.getItem('lu-restore-complete')
- if (hasStores && restoreComplete) {
- // localStorage intact, but IndexedDB might have been wiped (different
- // storage layer, different lifetime). Quietly restore RAG chunks if a
- // backup exists and the live store has none for the documents the
- // localStorage `rag-store` knows about. Best-effort; ignore errors.
- ;(async () => {
- try {
- const data = await backendCall<string | null>('restore_rag_chunks')
- if (!data) return
- const rawParsed = JSON.parse(data)
- if (rawParsed && typeof rawParsed === 'object' && !Array.isArray(rawParsed)) {
- // Feature FF: split memory embeddings out first, then restore the
- // RAG-only chunk portion. memoryEmbedDB.importAll is last-writer-
- // wins; safe to run on an intact-localStorage cold start.
- const parsed = await restoreMemoryVectorsFrom(rawParsed)
- const { exportAllChunks, importAllChunks } = await import('../../lib/ragDB')
- const live = await exportAllChunks()
- // Only import entries the live store is missing — never clobber
- // newer in-app activity with a stale backup.
- const toImport: Record<string, any> = {}
- for (const [docId, chunks] of Object.entries(parsed)) {
- if (!live[docId] && Array.isArray(chunks) && chunks.length > 0) {
- toImport[docId] = chunks
+ const runRestore = () => {
+ const hasStores = STORE_KEYS.some(k => localStorage.getItem(k))
+ const restoreComplete = localStorage.getItem('lu-restore-complete')
+ if (hasStores && restoreComplete) {
+ // localStorage intact, but IndexedDB might have been wiped (different
+ // storage layer, different lifetime). Quietly restore RAG chunks if a
+ // backup exists and the live store has none for the documents the
+ // localStorage `rag-store` knows about. Best-effort; ignore errors.
+ ;(async () => {
+ try {
+ const data = await backendCall<string | null>('restore_rag_chunks')
+ if (data) {
+ const rawParsed = JSON.parse(data)
+ if (rawParsed && typeof rawParsed === 'object' && !Array.isArray(rawParsed)) {
+ // Feature FF: split memory embeddings out first, then restore the
+ // RAG-only chunk portion. memoryEmbedDB.importAll is last-writer-
+ // wins; safe to run on an intact-localStorage cold start.
+ const parsed = await restoreMemoryVectorsFrom(rawParsed)
+ const { exportAllChunks, importAllChunks } = await import('../../lib/ragDB')
+ const live = await exportAllChunks()
+ // Only import entries the live store is missing — never clobber
+ // newer in-app activity with a stale backup.
+ const toImport: Record<string, any> = {}
+ for (const [docId, chunks] of Object.entries(parsed)) {
+ if (!live[docId] && Array.isArray(chunks) && chunks.length > 0) {
+ toImport[docId] = chunks
+ }
+ }
+ if (Object.keys(toImport).length > 0) {
+ await importAllChunks(toImport)
+ }
}
}
- if (Object.keys(toImport).length > 0) {
- await importAllChunks(toImport)
- }
- }
- } catch { /* best-effort */ }
- })()
- return
- }
+ } catch { /* best-effort */ }
+ // Release the triad only after the quiet import read the backup
+ // file — doRagBackup would otherwise overwrite it first.
+ resolveRestoreDecided()
+ })()
+ return
+ }
- setRestoring(true)
+ setRestoring(true)
- // 1. Fast path: check onboarding marker to prevent flash
- backendCall<boolean>('is_onboarding_done').catch(() => false).then(async (markerExists) => {
- // 2. Try full store restore
- try {
- const data = await backendCall<string | null>('restore_stores')
- if (data) {
- const parsed = JSON.parse(data)
- // Validate: must be a plain object with string values, only known keys
- if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
- let restored = 0
- for (const [key, value] of Object.entries(parsed)) {
- if (STORE_KEYS_SET.has(key) && typeof value === 'string' && value) {
- localStorage.setItem(key, value)
- restored++
+ // 1. Fast path: check onboarding marker to prevent flash
+ backendCall<boolean>('is_onboarding_done').catch(() => false).then(async (markerExists) => {
+ // 2. Try full store restore
+ try {
+ const data = await backendCall<string | null>('restore_stores')
+ if (data) {
+ const parsed = JSON.parse(data)
+ // Validate: must be a plain object with string values, only known keys
+ if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
+ let restored = 0
+ for (const [key, value] of Object.entries(parsed)) {
+ if (STORE_KEYS_SET.has(key) && typeof value === 'string' && value) {
+ localStorage.setItem(key, value)
+ restored++
+ }
}
- }
- if (restored > 0) {
- // Pull RAG chunks from %APPDATA% before the reload so the new
- // localStorage references find their embeddings in IndexedDB
- // (Bug V, kj103x 2026-05-23). Best-effort: missing backup =
- // chunks need to be re-indexed by re-uploading docs.
- try {
- const ragData = await backendCall<string | null>('restore_rag_chunks')
- if (ragData) {
- const parsedRag = JSON.parse(ragData)
- if (parsedRag && typeof parsedRag === 'object' && !Array.isArray(parsedRag)) {
- // Feature FF: restore memory embeddings, then RAG chunks.
- const ragOnly = await restoreMemoryVectorsFrom(parsedRag as Record<string, unknown>)
- const { importAllChunks } = await import('../../lib/ragDB')
- await importAllChunks(ragOnly as Record<string, any>)
+ if (restored > 0) {
+ // Pull RAG chunks from %APPDATA% before the reload so the new
+ // localStorage references find their embeddings in IndexedDB
+ // (Bug V, kj103x 2026-05-23). Best-effort: missing backup =
+ // chunks need to be re-indexed by re-uploading docs.
+ try {
+ const ragData = await backendCall<string | null>('restore_rag_chunks')
+ if (ragData) {
+ const parsedRag = JSON.parse(ragData)
+ if (parsedRag && typeof parsedRag === 'object' && !Array.isArray(parsedRag)) {
+ // Feature FF: restore memory embeddings, then RAG chunks.
+ const ragOnly = await restoreMemoryVectorsFrom(parsedRag as Record<string, unknown>)
+ const { importAllChunks } = await import('../../lib/ragDB')
+ await importAllChunks(ragOnly as Record<string, any>)
+ }
}
- }
- } catch { /* best-effort */ }
- localStorage.setItem('lu-restore-complete', '1')
- window.location.reload()
- return
+ } catch { /* best-effort */ }
+ localStorage.setItem('lu-restore-complete', '1')
+ resolveRestoreDecided()
+ window.location.reload()
+ return
+ }
}
}
+ } catch {}
+
+ // 3. No backup available — at least recover onboarding from marker file
+ if (markerExists) {
+ updateSettings({ onboardingDone: true })
}
- } catch {}
+ resolveRestoreDecided()
+ setRestoring(false)
+ })
+ }
- // 3. No backup available — at least recover onboarding from marker file
- if (markerExists) {
- updateSettings({ onboardingDone: true })
+ if (isTauri()) {
+ runRestore()
+ return
+ }
+ let tries = 0
+ const waitForTauri = setInterval(() => {
+ tries++
+ if (isTauri()) {
+ clearInterval(waitForTauri)
+ runRestore()
+ } else if (tries >= 50) {
+ // 5 s elapsed — probably browser dev session, nothing to restore.
+ clearInterval(waitForTauri)
+ resolveRestoreDecided()
}
- setRestoring(false)
- })
+ }, 100)
+ return () => clearInterval(waitForTauri)
}, [])
// Backup stores to %APPDATA% — three-pronged so chat history survives
@@ -230,19 +280,36 @@ export function AppShell() {
// BEFORE the global exists, so we poll for up to 5 s, then arm the triad.
useEffect(() => {
let cleanup: (() => void) | null = null
+ let disposed = false
let tries = 0
- const setupTriad = () => {
- const doBackup = () => {
- const snapshot: Record<string, string> = { __ts: new Date().toISOString() }
- for (const key of STORE_KEYS) {
- const val = localStorage.getItem(key)
- if (val) snapshot[key] = val
- }
- // Always fire — we want backup even if snapshot is mostly empty, and the
- // sentinel tells the restore-flow this is a valid backup.
- localStorage.setItem('lu-restore-complete', '1')
- backendCall('backup_stores', { data: JSON.stringify(snapshot) }).catch(() => {})
+ const setupTriad = async () => {
+ // Never write the first backup before the restore effect decided — a
+ // post-NSIS boot with wiped storage would otherwise snapshot the empty
+ // state over the only good store_backup.json.
+ await restoreDecided
+ if (disposed) return
+
+ let backupInflight = false
+ const doBackup = async () => {
+ // Inflight guard: the 1 s debounce and the 5 s interval can overlap
+ // now that the snapshot awaits IndexedDB reads.
+ if (backupInflight) return
+ backupInflight = true
+ try {
+ const snapshot: Record<string, string> = { __ts: new Date().toISOString() }
+ for (const key of STORE_KEYS) {
+ const val = IDB_STORE_KEYS.has(key)
+ ? await Promise.resolve(idbStorage.getItem(key))
+ : localStorage.getItem(key)
+ if (val) snapshot[key] = val
+ }
+ // Always fire — we want backup even if snapshot is mostly empty, and the
+ // sentinel tells the restore-flow this is a valid backup.
+ localStorage.setItem('lu-restore-complete', '1')
+ backendCall('backup_stores', { data: JSON.stringify(snapshot) }).catch(() => {})
+ } catch { /* best-effort */ }
+ backupInflight = false
}
// Separate, debounced backup for RAG IndexedDB chunks (Bug V, kj103x
@@ -287,7 +354,7 @@ export function AppShell() {
}
})
- doBackup() // first immediate backup
+ void doBackup() // first immediate backup
// Same first-fire convention for RAG chunks so a fresh post-restore
// boot writes a complete snapshot back to disk immediately.
void doRagBackup()
@@ -302,10 +369,10 @@ export function AppShell() {
const unsubChat = useChatStore.subscribe(scheduleBackup)
const onBeforeUnload = () => {
- doBackup()
// Best-effort fire-and-forget — the page is going away, we can't
- // await. The 30 s interval covers the common case; this is the
+ // await. The 5 s / 30 s intervals cover the common case; this is the
// "last write" insurance for changes since the previous interval.
+ void doBackup()
void doRagBackup()
}
window.addEventListener('beforeunload', onBeforeUnload)
@@ -323,7 +390,7 @@ export function AppShell() {
tries++
if (isTauri()) {
clearInterval(waitForTauri)
- setupTriad()
+ void setupTriad()
} else if (tries >= 50) {
// 50 × 100 ms = 5 s. Give up silently — probably browser dev session.
clearInterval(waitForTauri)
@@ -331,6 +398,7 @@ export function AppShell() {
}, 100)
return () => {
+ disposed = true
clearInterval(waitForTauri)
if (cleanup) cleanup()
}
diff --git a/src/components/layout/Sidebar.tsx b/src/components/layout/Sidebar.tsx
index d47b659a..0d074ca5 100644
--- a/src/components/layout/Sidebar.tsx
+++ b/src/components/layout/Sidebar.tsx
@@ -53,6 +53,9 @@ export function Sidebar() {
// when no model is installed/selected, or the model list hasn't
// populated yet. Send the user to the Models page where they can
// install or pick one, instead of a dead click with no feedback.
+ // Cloud mode hides that local-hardware view entirely (the hosted
+ // catalog is just still loading/failed) — stay in chat there.
+ if (useSettingsStore.getState().settings.appMode === 'cloud') return
setView('models')
return
}
diff --git a/src/components/models/BenchmarkView.tsx b/src/components/models/BenchmarkView.tsx
index 478d41aa..a296bfb9 100644
--- a/src/components/models/BenchmarkView.tsx
+++ b/src/components/models/BenchmarkView.tsx
@@ -1,12 +1,15 @@
import { ArrowLeft, Trophy, Zap, Play, Square } from 'lucide-react'
import { useUIStore } from '../../stores/uiStore'
-import { useModelStore } from '../../stores/modelStore'
+import { useModels } from '../../hooks/useModels'
import { useBenchmarkStore, getLatestSpeed, getLeaderboard } from '../../stores/benchmarkStore'
import { useBenchmark } from '../../hooks/useBenchmark'
export function BenchmarkView() {
const { setView } = useUIStore()
- const models = useModelStore((s) => s.models)
+ // appMode-filtered view (useModels choke point) — the raw store also holds
+ // hosted lu-cloud models, which would get a "Run Benchmark" button on this
+ // local-hardware view and burn credits measuring network speed.
+ const { models } = useModels()
const results = useBenchmarkStore((s) => s.results)
const isRunning = useBenchmarkStore((s) => s.isRunning)
const currentModel = useBenchmarkStore((s) => s.currentModel)
diff --git a/src/components/onboarding/Onboarding.tsx b/src/components/onboarding/Onboarding.tsx
index 6da0cf79..26643e1c 100644
--- a/src/components/onboarding/Onboarding.tsx
+++ b/src/components/onboarding/Onboarding.tsx
@@ -1041,6 +1041,7 @@ export function Onboarding() {
name: 'LM Studio',
baseUrl: 'http://localhost:1234/v1',
isLocal: true,
+ managed: false,
})
} else if (s.status === 'error') {
clearInterval(poll)
diff --git a/src/components/settings/SettingsPage.tsx b/src/components/settings/SettingsPage.tsx
index 1499aac2..c29beeb0 100644
--- a/src/components/settings/SettingsPage.tsx
+++ b/src/components/settings/SettingsPage.tsx
@@ -21,6 +21,24 @@ const PIPER_VOICES: { id: string; label: string }[] = [
{ id: 'en_GB-alba-medium', label: 'Alba — UK, female' },
{ id: 'en_GB-northern_english_male-medium', label: 'Northern — UK, male' },
]
+
+// MiniMax Speech-02 system voices for the hosted cloud TTS. The server route
+// (/api/voice/tts) forwards the id verbatim as voice_id and only validates the
+// character set; default is Wise_Woman.
+const CLOUD_TTS_VOICES: { id: string; label: string }[] = [
+ { id: 'Wise_Woman', label: 'Wise Woman — default' },
+ { id: 'Calm_Woman', label: 'Calm Woman' },
+ { id: 'Lively_Girl', label: 'Lively Girl' },
+ { id: 'Lovely_Girl', label: 'Lovely Girl' },
+ { id: 'Sweet_Girl_2', label: 'Sweet Girl' },
+ { id: 'Friendly_Person', label: 'Friendly Person' },
+ { id: 'Deep_Voice_Man', label: 'Deep Voice Man' },
+ { id: 'Casual_Guy', label: 'Casual Guy' },
+ { id: 'Patient_Man', label: 'Patient Man' },
+ { id: 'Determined_Man', label: 'Determined Man' },
+ { id: 'Elegant_Man', label: 'Elegant Man' },
+ { id: 'Young_Knight', label: 'Young Knight' },
+]
import { useAgentModeStore } from '../../stores/agentModeStore'
import { FEATURE_FLAGS } from '../../lib/constants'
import { MemorySettings } from './MemorySettings'
@@ -1214,6 +1232,27 @@ export function SettingsPage() {
{/* ── Voice & Remote tab ────────────────────────── */}
{tab === 'voice-remote' && (<>
<Section title="Speech" defaultOpen>
+ {settings.appMode === 'cloud' ? (<>
+ {/* Cloud mode: dictation + read-aloud are hosted on lu-labs.ai —
+ honest copy (audio leaves the machine, metered), no local
+ install buttons, and a picker for the hosted MiniMax voice. */}
+ <p className="text-[0.55rem] text-gray-500 leading-snug">
+ Cloud mode: dictation and read-aloud run on lu-labs.ai (hosted Whisper speech-to-text + MiniMax text-to-speech) and are metered against your credits. No local installs needed.
+ </p>
+ <InlineToggle label="Read responses aloud" enabled={voiceSettings.ttsEnabled} onChange={() => voiceSettings.updateVoiceSettings({ ttsEnabled: !voiceSettings.ttsEnabled })} icon={<Volume2 size={11} className="text-gray-500" />} />
+ <div className="flex items-center justify-between gap-2">
+ <span className="text-[0.7rem] text-gray-500">Voice</span>
+ <select
+ value={voiceSettings.cloudTtsVoice}
+ onChange={(e) => voiceSettings.updateVoiceSettings({ cloudTtsVoice: e.target.value })}
+ className="max-w-[210px] px-1.5 py-0.5 rounded bg-transparent border border-white/8 text-[0.65rem] text-gray-300 focus:outline-none"
+ >
+ {CLOUD_TTS_VOICES.map((v) => (
+ <option key={v.id} value={v.id}>{v.label}</option>
+ ))}
+ </select>
+ </div>
+ </>) : (<>
<p className="text-[0.55rem] text-gray-500 leading-snug">
Voice runs 100% locally — no cloud. Each engine is a one-time local install.
</p>
@@ -1347,6 +1386,7 @@ export function SettingsPage() {
</p>
</div>
)}
+ </>)}
</Section>
<Section title="Remote Access">
diff --git a/src/hooks/useActiveContextWindow.ts b/src/hooks/useActiveContextWindow.ts
index f8fe868e..c9458eb5 100644
--- a/src/hooks/useActiveContextWindow.ts
+++ b/src/hooks/useActiveContextWindow.ts
@@ -96,12 +96,15 @@ export function useActiveContextWindow(reloadTick = 0): ActiveContext {
}
}
- // ── Cloud / other: fixed context, not adjustable from here. ──
+ // ── Cloud / other: fixed context, not adjustable from here. The
+ // DEFAULT_CONTEXT_CAP and the local num_ctx override are local-runtime
+ // levers — applying them here would falsify the denominator for
+ // 128k-context hosted models. ──
const max = await getModelMaxTokens(activeModel).catch(() => 4096)
if (cancelled) return
setState({
provider: 'cloud',
- contextWindow: effectiveContextWindow(max, override),
+ contextWindow: max,
modelMax: max,
isTrue: false,
adjustable: false,
diff --git a/src/hooks/useAgentChat.ts b/src/hooks/useAgentChat.ts
index 49e97970..1f72ebb8 100644
--- a/src/hooks/useAgentChat.ts
+++ b/src/hooks/useAgentChat.ts
@@ -598,7 +598,12 @@ export function useAgentChat() {
// Checklist: / Confidence Score:) with no tags to strip. Pass
// `undefined` instead so Ollama keeps the model in tagged-
// thinking mode; the stripper removes the tags silently.
- const canThinkAgent = isThinkingCompatible(activeModel)
+ // Server-declared think capability wins over the name-heuristic
+ // (same precedence as useChat): 'always'/'never' cloud models get
+ // no reasoning_effort knob at all; 'toggle' follows the switch.
+ const agentMeta = useModelStore.getState().models.find((m) => m.name === activeModel)
+ const agentThinkMode = agentMeta && 'thinkMode' in agentMeta ? agentMeta.thinkMode : undefined
+ const canThinkAgent = agentThinkMode ? agentThinkMode === 'toggle' : isThinkingCompatible(activeModel)
const plainPlanAgent = isPlainTextPlanner(activeModel)
// forceNoThink: set by the dud-turn recovery below — a thinking model
// (gemma4) dumped its whole answer into the thinking channel and emitted
@@ -834,8 +839,8 @@ export function useAgentChat() {
estimated: false,
})
}
- // Native thinking field from Ollama
- if ((turn as any).thinking) turnThinking = (turn as any).thinking
+ // Native thinking field (Ollama; LU Cloud reasoning_content)
+ if (turn.thinking) turnThinking = turn.thinking
} else {
// ── Hermes XML prompt-based tool calling (Ollama fallback) ──
@@ -861,7 +866,7 @@ export function useAgentChat() {
// toggled Thinking on — thinking-only models (QwQ, DeepSeek-R1)
// emit these tags unconditionally, and we must not surface them
// when the user asked for thinking to be OFF.
- const keepThinking = settings.thinkingEnabled === true && isThinkingCompatible(activeModel)
+ const keepThinking = agentThinkMode === 'always' || (settings.thinkingEnabled === true && canThinkAgent)
turnContent = turnContent.replace(/<think>([\s\S]*?)<\/think>/g, (_match, inner) => {
if (keepThinking) {
turnThinking = turnThinking
@@ -986,9 +991,13 @@ export function useAgentChat() {
// has been generated" as plain text and never called the tool, so the
// user got a confident lie and no media. Every "regenerate" after the
// first clip did exactly this.
+ // Never synthesize a local image/video tool call in cloud mode — the
+ // tools run the LOCAL ComfyUI pipeline, which a cloud-tier user
+ // doesn't have (media belongs to the Create tab there).
const mediaPending =
- (wantsImage && maxImageGen > 0 && imageGenDone === 0) ||
- (wantsVideo && maxVideoGen > 0 && videoGenDone === 0)
+ settings.appMode !== 'cloud' &&
+ ((wantsImage && maxImageGen > 0 && imageGenDone === 0) ||
+ (wantsVideo && maxVideoGen > 0 && videoGenDone === 0))
const emptyTurn = !turnContent.trim()
const fakeGenProse = mediaPending && !emptyTurn && FAKE_MEDIA_GEN_RE.test(turnContent)
if (isFinalTurn && executedCallKeys.size === 0 && (emptyTurn || fakeGenProse)) {
diff --git a/src/hooks/useChat.ts b/src/hooks/useChat.ts
index 48ec23e0..333a1a34 100644
--- a/src/hooks/useChat.ts
+++ b/src/hooks/useChat.ts
@@ -95,9 +95,16 @@ export function useChat() {
return { role: m.role, content: m.content, mediaKind: media?.kind, mediaArgs: media?.args }
})
const route = resolveChatToolRoute(content, !!images?.length, recent)
- if (route) {
+ // Cloud mode has no local ComfyUI pipeline: media intents stay on the
+ // plain-chat path (cloud renders live in the Create tab) instead of
+ // dead-ending in the local image/video tools, and the media pair is
+ // stripped from the curated list so a web/file turn can't call it.
+ const cloudMode = settings.appMode === 'cloud'
+ if (route && !(cloudMode && route.mediaHint)) {
return agentChat.sendAgentMessage(content, images, {
- curatedTools: CHAT_TOOLS,
+ curatedTools: cloudMode
+ ? CHAT_TOOLS.filter((t) => t !== 'image_generate' && t !== 'video_generate')
+ : CHAT_TOOLS,
chatToolsMode: true,
mediaHint: route.mediaHint,
})
@@ -188,9 +195,17 @@ export function useChat() {
// Memory injection is non-critical
}
- // For non-Ollama providers, inject thinking via system prompt
+ // For non-Ollama providers, inject thinking via system prompt — but only
+ // for models where the Think toggle actually applies. Server-declared
+ // think capability (LU Cloud models carry thinkMode from /models) wins
+ // over the local name-heuristic: 'always' reasoners use their native
+ // channel untouched, 'never' instruct models get nothing (the blanket
+ // injection made them burn billed tokens on reasoning we then discard).
const providerId = getProviderIdFromModel(activeModel)
- if (settings.thinkingEnabled && providerId !== 'ollama') {
+ const activeMeta = useModelStore.getState().models.find((m) => m.name === activeModel)
+ const thinkMode = activeMeta && 'thinkMode' in activeMeta ? activeMeta.thinkMode : undefined
+ const canThink = thinkMode ? thinkMode === 'toggle' : isThinkingCompatible(activeModel)
+ if (settings.thinkingEnabled && providerId !== 'ollama' && canThink) {
systemPrompt = (systemPrompt || '') + '\n\nBefore answering, reason through your thinking inside <think></think> tags. Your thinking will be hidden from the user. After thinking, provide your answer outside the tags.'
}
@@ -257,14 +272,11 @@ export function useChat() {
// the tags silently and keepThinking=false below drops the native
// thinking field, so the user sees a clean answer without a
// planning preamble.
- // Server-declared think capability (LU Cloud models carry thinkMode from
- // /models): 'always'/'never' models get no reasoning_effort at all — the
- // upstream reasons (or not) regardless, and forcing 'minimal' on an
- // always-thinker can 4xx. 'toggle' and unknown fall through to the
- // name-heuristic + settings switch.
- const activeMeta = useModelStore.getState().models.find((m) => m.name === activeModel)
- const thinkMode = activeMeta && 'thinkMode' in activeMeta ? activeMeta.thinkMode : undefined
- const canThink = thinkMode ? thinkMode === 'toggle' : isThinkingCompatible(activeModel)
+ // Server-declared think capability (resolved above, alongside the
+ // system-prompt injection): 'always'/'never' models get no
+ // reasoning_effort at all — the upstream reasons (or not) regardless,
+ // and forcing 'minimal' on an always-thinker can 4xx. 'toggle' and
+ // unknown fall through to the name-heuristic + settings switch.
const plainTextPlanner = isPlainTextPlanner(activeModel)
const useThinking: boolean | undefined = canThink
? (settings.thinkingEnabled === false && plainTextPlanner
@@ -299,7 +311,7 @@ export function useChat() {
try {
yield* provider.chatStream(modelId, messages, chatOpts)
} catch (err: any) {
- if (useThinking !== undefined && (err?.message?.includes('does not support thinking') || err?.statusCode === 400)) {
+ if (useThinking !== undefined && (err?.message?.includes('does not support thinking') || err?.statusCode === 400 || err?.statusCode === 422)) {
yield* provider.chatStream(modelId, messages, { ...chatOpts, thinking: undefined })
} else {
throw err
@@ -311,6 +323,16 @@ export function useChat() {
let frameScheduled = false
let firstChunk = true
+ // Thinking visibility is driven by the toggle. When OFF, we still
+ // have to parse <think>…</think> so the state-machine closes
+ // correctly, but we discard the captured text instead of rendering
+ // it. Thinking-native models (QwQ, DeepSeek-R1) emit tags / the
+ // native `thinking` field regardless of the `think: true` flag —
+ // without this gate the block would show up even with the toggle OFF.
+ // 'always' reasoners surface their native channel unconditionally —
+ // their thinking can't be turned off, so hiding it would just burn
+ // tokens invisibly.
+ const keepThinking = useThinking === true || thinkMode === 'always'
// Reasoning we'd otherwise throw away (Think toggle OFF). Kept so a
// thought-only completion — model reasons, emits ZERO content, stops —
// can still explain itself instead of rendering as a silent empty
@@ -332,15 +354,8 @@ export function useChat() {
useModelStore.getState().setIsModelLoading(false)
}
- // Thinking visibility is driven by the toggle. When OFF, we still
- // have to parse <think>…</think> so the state-machine closes
- // correctly, but we discard the captured text instead of rendering
- // it. Thinking-native models (QwQ, DeepSeek-R1) emit tags / the
- // native `thinking` field regardless of the `think: true` flag —
- // without this gate the block would show up even with the toggle OFF.
- const keepThinking = useThinking === true
-
- // Ollama native thinking field (Gemma 4, Qwen 3.5, etc.)
+ // Ollama native thinking field (Gemma 4, Qwen 3.5, etc.) or the
+ // cloud reasoning channel (delta.reasoning_content via the provider).
if (chunk.thinking && keepThinking) {
thinkingRef.current += chunk.thinking
} else if (chunk.thinking) {
@@ -377,24 +392,30 @@ export function useChat() {
}
}
- if (!frameScheduled) {
- frameScheduled = true
- requestAnimationFrame(() => {
- const cId = convId!
- const mId = assistantMessage.id
- // Always strip non-canonical thinking markers (Gemma channel
- // tags, `<thought>`, `<reasoning>`, `<reflect>`, `<deepthink>`)
- // from the streaming bubble. The canonical `<think>…</think>`
- // is already handled by the char-by-char state-machine above,
- // so we leave those alone here.
- const displayContent = stripNonCanonicalTags(contentRef.current)
- useChatStore.getState().updateMessageContent(cId, mId, displayContent)
- if (keepThinking && thinkingRef.current) {
- useChatStore.getState().updateMessageThinking(cId, mId, thinkingRef.current)
- }
- frameScheduled = false
- })
- }
+ }
+
+ // Coalesced store flush (≤1 per animation frame) for BOTH the answer
+ // and the reasoning block — so the Thinking panel fills live during
+ // the reasoning-only phase too (cloud reasoners stream all their
+ // thinking before the first answer token; previously the flush only
+ // ran on content chunks and the chat sat in dead air).
+ if ((chunk.content || (chunk.thinking && keepThinking)) && !frameScheduled) {
+ frameScheduled = true
+ requestAnimationFrame(() => {
+ const cId = convId!
+ const mId = assistantMessage.id
+ // Always strip non-canonical thinking markers (Gemma channel
+ // tags, `<thought>`, `<reasoning>`, `<reflect>`, `<deepthink>`)
+ // from the streaming bubble. The canonical `<think>…</think>`
+ // is already handled by the char-by-char state-machine above,
+ // so we leave those alone here.
+ const displayContent = stripNonCanonicalTags(contentRef.current)
+ useChatStore.getState().updateMessageContent(cId, mId, displayContent)
+ if (keepThinking && thinkingRef.current) {
+ useChatStore.getState().updateMessageThinking(cId, mId, thinkingRef.current)
+ }
+ frameScheduled = false
+ })
}
if (chunk.done) {
@@ -435,7 +456,7 @@ export function useChat() {
// leaving the user staring at silent dead air forever.
if (!abort.signal.aborted && contentRef.current.trim() === "") {
const captured = (thinkingRef.current || finalStripThinkingTags(hiddenThinking, false)).trim()
- if (captured && useThinking === true) {
+ if (captured && keepThinking) {
// Thinking ON: surface the reasoning so the empty bubble explains
// itself (MessageBubble renders it + a nudge) instead of dead air.
useChatStore
diff --git a/src/hooks/useCloudAuth.ts b/src/hooks/useCloudAuth.ts
index 76a64d20..c8364646 100644
--- a/src/hooks/useCloudAuth.ts
+++ b/src/hooks/useCloudAuth.ts
@@ -1,11 +1,12 @@
// Account lifecycle for the LU Cloud tier: keychain session restore on boot,
-// email+password login/logout, and a 5-minute /api/me + quota probe while
-// signed in. Also auto-enables the 'lu-cloud' chat provider whenever the
-// account has token budget, so cloud models appear in the chat picker without
-// any manual provider setup.
+// email+password login/logout, and a 5-minute /api/me + quota probe. Also
+// auto-enables the 'lu-cloud' chat provider whenever the account has token
+// budget, so cloud models appear in the chat picker without any manual
+// provider setup.
import { useCallback, useEffect, useRef } from 'react'
-import { supabaseCloud, loginWithProvider, type OAuthProvider } from '../api/cloud/supabase'
+import { supabaseCloud } from '../api/cloud/supabase'
+import { CloudJobError } from '../api/cloud/client'
import { getMe, getQuota } from '../api/cloud/jobs'
import { useCloudAuthStore, deriveCloudAvailable } from '../stores/cloudAuthStore'
import { refreshCatalog } from '../stores/cloudCatalogStore'
@@ -22,6 +23,7 @@ async function probeAccount(): Promise<void> {
if (!me.user) {
store.setSignedOut()
syncChatProvider()
+ syncAppMode()
return
}
const licenseActive = me.license?.status === 'active'
@@ -30,19 +32,30 @@ async function probeAccount(): Promise<void> {
const tier = me.license?.tier ?? null
let quota: CloudQuota | null = null
if (licenseActive && access) {
- // Gated accounts would just 403 here — skip the round-trip.
- quota = await getQuota().catch(() => null)
+ // Gated accounts would just 403 here — skip the round-trip. A transient
+ // quota-fetch failure keeps the last-known quota instead of collapsing
+ // the whole cloud axis; only an auth/gate rejection clears it.
+ quota = await getQuota().catch((err) =>
+ err instanceof CloudJobError && (err.status === 401 || err.status === 403)
+ ? null
+ : useCloudAuthStore.getState().quota,
+ )
void refreshCatalog()
}
store.setSignedIn({ id: me.user.id, email: me.user.email }, { licenseActive, tier, access, quota })
syncChatProvider()
syncAppMode()
- } catch {
- // 401 = no/expired session; network = cloud unreachable. Either way the
- // cloud axis is off for now — local features are unaffected.
- store.setSignedOut()
- syncChatProvider()
- syncAppMode()
+ } catch (err) {
+ // Only a definitive auth rejection (401/403) signs out. Network errors,
+ // 5xx and timeouts are transient: keep the session and let the next
+ // interval tick retry. The boot probe still resolves to signed-out so the
+ // UI never hangs in 'probing'.
+ const authFailure = err instanceof CloudJobError && (err.status === 401 || err.status === 403)
+ if (authFailure || useCloudAuthStore.getState().status === 'probing') {
+ store.setSignedOut()
+ syncChatProvider()
+ syncAppMode()
+ }
}
}
@@ -79,9 +92,10 @@ export function useCloudAuth() {
if (armed.current) return
armed.current = true
void probeAccount()
- const timer = setInterval(() => {
- if (useCloudAuthStore.getState().status === 'signed-in') void probeAccount()
- }, REFRESH_MS)
+ // Probe on every tick regardless of status: an offline boot or a
+ // transient failure self-heals once connectivity returns, instead of
+ // stranding the app signed-out until a manual re-probe.
+ const timer = setInterval(() => void probeAccount(), REFRESH_MS)
return () => clearInterval(timer)
}, [])
@@ -98,14 +112,6 @@ export function useCloudAuth() {
await probeAccount()
}, [])
- // Google/GitHub via system browser + PKCE loopback (same identities as
- // lu-labs.ai). The browser round-trip can take a while — callers show a
- // "waiting for browser" state until this resolves.
- const loginOAuth = useCallback(async (provider: OAuthProvider): Promise<void> => {
- await loginWithProvider(provider)
- await probeAccount()
- }, [])
-
const logout = useCallback(async (): Promise<void> => {
await supabaseCloud().auth.signOut().catch(() => {})
useCloudAuthStore.getState().setSignedOut()
@@ -117,5 +123,5 @@ export function useCloudAuth() {
await probeAccount()
}, [])
- return { status, user, login, signup, loginOAuth, logout, refresh }
+ return { status, user, login, signup, logout, refresh }
}
diff --git a/src/hooks/useCloudCreate.ts b/src/hooks/useCloudCreate.ts
index e0032193..bd693176 100644
--- a/src/hooks/useCloudCreate.ts
+++ b/src/hooks/useCloudCreate.ts
@@ -5,12 +5,12 @@
// gallery) mirrors the local path so every downstream component works
// unchanged. useCreate itself is untouched: the seam lives in CreateExpProvider.
//
-// Desktop delta vs uselu: image results are downloaded into a self-contained
-// dataUrl gallery item (signed URLs expire — the local copy never rots and
-// works offline). Videos would blow localStorage as base64, so they keep
-// remoteUrl + jobId and re-sign lazily via refreshResultUrl().
+// Desktop delta vs uselu: results keep remoteUrl + jobId in the persisted
+// gallery — multi-MB base64 dataUrls would blow the localStorage quota and
+// kill all create-store persistence. Signed URLs expire ~1 h after the last
+// read, so playback surfaces re-sign lazily via refreshResultUrl().
-import { useCallback, useRef } from 'react'
+import { useCallback } from 'react'
import { useCreateStore, type GalleryItem } from '../stores/createStore'
import { intentToJob } from '../lib/render/cloud-jobs'
import {
@@ -22,7 +22,12 @@ import {
CloudJobError,
type CloudJobParams,
} from '../api/cloud/jobs'
-import { defaultCloudModel, cloudMediaLive } from '../stores/cloudCatalogStore'
+import {
+ defaultCloudModel,
+ defaultEditModel,
+ isEditCapable,
+ cloudMediaLive,
+} from '../stores/cloudCatalogStore'
import { checkPromptSafety, SAFETY_BLOCK_MESSAGE } from '../lib/render/safety'
async function dataUrlToBlob(dataUrl: string): Promise<Blob> {
@@ -30,25 +35,15 @@ async function dataUrlToBlob(dataUrl: string): Promise<Blob> {
return res.blob()
}
-async function fetchAsDataUrl(url: string): Promise<string | null> {
- try {
- const res = await fetch(url)
- if (!res.ok) return null
- const blob = await res.blob()
- return await new Promise<string | null>((resolve) => {
- const reader = new FileReader()
- reader.onload = () => resolve(typeof reader.result === 'string' ? reader.result : null)
- reader.onerror = () => resolve(null)
- reader.readAsDataURL(blob)
- })
- } catch {
- return null
- }
-}
+// The in-flight job handle lives at module scope, matching the lifetime of the
+// generate() closure (which keeps polling across view switches). Instance refs
+// died with the Create view's remount, leaving the Cancel button a no-op
+// mid-render. At most one cloud job runs per app (the store-level isGenerating
+// gate), so a singleton is correct.
+let activeJobId: string | null = null
+let activeAbort: AbortController | null = null
export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {
- const activeJob = useRef<string | null>(null)
- const abort = useRef<AbortController | null>(null)
const { onQuotaChange } = opts
const generate = useCallback(async () => {
@@ -56,8 +51,12 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {
if (s.isGenerating) return
const intent = s.intent()
const { kind, op } = intentToJob(intent)
- const model =
+ const picked =
(kind === 'video' ? s.cloudVideoModel : s.cloudImageModel) || defaultCloudModel(kind).id
+ // Edit needs an i2i-capable model; the picker may still hold a t2i-only
+ // one the user chose for a generate — fall back so the submit never 400s.
+ const model =
+ op === 'edit' && !isEditCapable(picked) ? (defaultEditModel()?.id ?? picked) : picked
s.setError(null)
if (!cloudMediaLive()) {
@@ -84,6 +83,11 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {
s.setIsGenerating(true)
s.setProgressPhase('queued')
s.setProgress(5, 'Uploading inputs…')
+ // Arm the aborter BEFORE the upload/submit awaits so a Cancel click during
+ // "Uploading inputs…" (seconds for large sources/masks) actually stops the
+ // run before any credits are claimed — not only once polling has started.
+ const ac = new AbortController()
+ activeAbort = ac
try {
// Utility endpoints (removebg/upscale/eraser) take no generation knobs —
@@ -129,10 +133,13 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {
params.mask_path = await uploadInput(await dataUrlToBlob(s.mask.url), 'mask')
}
+ // Bail before the (credit-claiming) submit if the user cancelled while
+ // we were uploading inputs.
+ if (ac.signal.aborted) return
+
s.setProgress(10, 'Submitting to the render queue…')
const { id } = await submitCloudJob({ kind, model, prompt: s.prompt, params })
- activeJob.current = id
- abort.current = new AbortController()
+ activeJobId = id
onQuotaChange?.()
if (s.prompt.trim()) s.addToPromptHistory(s.prompt.trim())
@@ -142,7 +149,7 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {
// deadline than images.
const job = await pollJob(id, {
timeoutMs: kind === 'video' ? 45 * 60_000 : 15 * 60_000,
- signal: abort.current.signal,
+ signal: ac.signal,
onTick: (j) => {
const st = useCreateStore.getState()
const elapsed = Math.round((Date.now() - startedAt) / 1000)
@@ -160,8 +167,6 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {
if (job.status === 'succeeded' && job.result_url) {
st.setProgressPhase('complete')
st.setProgress(100, 'Complete!')
- // Images: pull the bytes now — the local copy never expires.
- const dataUrl = kind === 'image' ? await fetchAsDataUrl(job.result_url) : null
st.addToGallery({
id: job.id,
type: kind,
@@ -180,7 +185,7 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {
height: s.height,
batchSize: 1,
createdAt: Date.now(),
- ...(dataUrl ? { dataUrl } : { remoteUrl: job.result_url }),
+ remoteUrl: job.result_url,
attestation: job.attestation,
jobId: job.id,
intent,
@@ -198,14 +203,16 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {
} else if (err instanceof CloudJobError && err.status === 401) {
st.setError('Sign in to your LU Cloud account to render in the cloud.')
} else if (err instanceof CloudJobError && err.message === 'render timed out') {
- st.setError('Still rendering — this is taking longer than expected. It will appear in your history when it completes.')
+ // The desktop app has no jobs-history view — point at the account
+ // page instead of promising an in-app surface that doesn't exist.
+ st.setError('Still rendering — this is taking longer than expected. When it completes you can view it in your account at lu-labs.ai.')
} else if (!(err instanceof CloudJobError && err.message === 'polling aborted')) {
st.setError(err instanceof Error ? err.message : String(err))
}
onQuotaChange?.()
} finally {
- activeJob.current = null
- abort.current = null
+ activeJobId = null
+ activeAbort = null
const st = useCreateStore.getState()
st.setIsGenerating(false)
st.setProgress(0)
@@ -213,8 +220,8 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {
}, [onQuotaChange])
const cancel = useCallback(async () => {
- const id = activeJob.current
- abort.current?.abort() // stop polling immediately either way
+ const id = activeJobId
+ activeAbort?.abort() // stop polling immediately either way
if (!id) return
try {
await cancelJob(id)
@@ -236,11 +243,17 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {
s.setIsGenerating(true)
s.setProgressPhase('queued')
s.setProgress(5, 'Fetching the source clip…')
+ // Same pre-await arming as generate(): a Cancel during the re-sign
+ // window must stop the run before the credit-claiming submit.
+ const ac = new AbortController()
+ activeAbort = ac
try {
// Fresh signed URL — the stored one expires ~1 h after the last read.
const sourceJob = await getJob(item.jobId)
if (!sourceJob.result_url) throw new Error('The source clip has expired — re-render it first.')
+ if (ac.signal.aborted) return
+
s.setProgress(10, 'Submitting to the render queue…')
const { id } = await submitCloudJob({
kind: 'video',
@@ -248,14 +261,13 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {
prompt: '',
params: { op: 'upscale', source_url: sourceJob.result_url, target_resolution: targetResolution },
})
- activeJob.current = id
- abort.current = new AbortController()
+ activeJobId = id
onQuotaChange?.()
const startedAt = Date.now()
const job = await pollJob(id, {
timeoutMs: 45 * 60_000,
- signal: abort.current.signal,
+ signal: ac.signal,
onTick: (j) => {
const st = useCreateStore.getState()
const elapsed = Math.round((Date.now() - startedAt) / 1000)
@@ -295,8 +307,8 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {
}
onQuotaChange?.()
} finally {
- activeJob.current = null
- abort.current = null
+ activeJobId = null
+ activeAbort = null
const st = useCreateStore.getState()
st.setIsGenerating(false)
st.setProgress(0)
diff --git a/src/hooks/useCloudSession.ts b/src/hooks/useCloudSession.ts
index 971f571e..d13ff21a 100644
--- a/src/hooks/useCloudSession.ts
+++ b/src/hooks/useCloudSession.ts
@@ -4,6 +4,7 @@
import { useCallback } from 'react'
import { useCloudAuthStore, deriveCloudAvailable } from '../stores/cloudAuthStore'
+import { CloudJobError } from '../api/cloud/client'
import { getQuota } from '../api/cloud/jobs'
import type { CloudQuota } from '../lib/render/cloud-jobs'
@@ -26,8 +27,13 @@ export function useCloudSession(): CloudSession {
try {
const q = await getQuota()
useCloudAuthStore.getState().setQuota(q)
- } catch {
- useCloudAuthStore.getState().setQuota(null)
+ } catch (err) {
+ // A transient failure (network, 5xx) keeps the last-known quota so a
+ // blip after a render doesn't silently pin Create to local; only an
+ // auth/gate rejection clears it.
+ if (err instanceof CloudJobError && (err.status === 401 || err.status === 403)) {
+ useCloudAuthStore.getState().setQuota(null)
+ }
}
}, [])
diff --git a/src/hooks/useCodex.ts b/src/hooks/useCodex.ts
index f23254e5..9ba6c98e 100644
--- a/src/hooks/useCodex.ts
+++ b/src/hooks/useCodex.ts
@@ -183,6 +183,19 @@ function isSystemPromptEcho(content: string): boolean {
)
}
+// Server-declared think capability (LU Cloud models carry thinkMode from
+// /models) wins over the local name-heuristic — same precedence as
+// useChat/useAgentChat: 'always' reasoners keep their native channel,
+// 'never' models get no think prompting or knobs.
+function codexThinkMode(model: string) {
+ const meta = useModelStore.getState().models.find((m) => m.name === model)
+ return meta && 'thinkMode' in meta ? meta.thinkMode : undefined
+}
+function codexCanThink(model: string): boolean {
+ const mode = codexThinkMode(model)
+ return mode ? mode === 'toggle' : isThinkingCompatible(model)
+}
+
export function useCodex() {
const [isRunning, setIsRunning] = useState(false)
const abortRef = useRef<AbortController | null>(null)
@@ -368,8 +381,9 @@ export function useCodex() {
}
}
- // For non-Ollama providers, inject thinking via system prompt
- if (settings.thinkingEnabled && providerId !== 'ollama') {
+ // For non-Ollama providers, inject thinking via system prompt — only for
+ // models where the Think toggle actually applies (thinkMode gate).
+ if (settings.thinkingEnabled && providerId !== 'ollama' && codexCanThink(activeModel)) {
systemPrompt += '\n\nBefore answering, reason through your thinking inside <think></think> tags. Your thinking will be hidden from the user. After thinking, provide your answer outside the tags.'
}
@@ -592,7 +606,7 @@ export function useCodex() {
let turnContent = ''
// Plain-text-planner escape for Gemma 3/4 — see useChat.ts.
- const canThinkCx = isThinkingCompatible(activeModel)
+ const canThinkCx = codexCanThink(activeModel)
const plainPlanCx = isPlainTextPlanner(activeModel)
const thinkOptCx: boolean | undefined = canThinkCx
? (settings.thinkingEnabled === false && plainPlanCx
@@ -684,7 +698,9 @@ export function useCodex() {
lastUserMsg: lastUserMsg.slice(0, 120),
})
- const keepThinking = settings.thinkingEnabled === true && isThinkingCompatible(activeModel)
+ const keepThinking =
+ codexThinkMode(activeModel) === 'always' ||
+ (settings.thinkingEnabled === true && codexCanThink(activeModel))
if (providerId === 'ollama') {
// ── Streaming path for Ollama ──────────────────────────────
@@ -877,7 +893,9 @@ export function useCodex() {
// (Gemma channel tags, <thought>, <reasoning>, etc.) are always
// stripped — they are never user-facing content.
{
- const keepThinking = settings.thinkingEnabled === true && isThinkingCompatible(activeModel)
+ const keepThinking =
+ codexThinkMode(activeModel) === 'always' ||
+ (settings.thinkingEnabled === true && codexCanThink(activeModel))
turnContent = turnContent.replace(/<think>([\s\S]*?)<\/think>/g, (_m, inner) => {
if (keepThinking) {
thinkingContent += (thinkingContent ? '\n\n' : '') + inner
diff --git a/src/hooks/useModels.ts b/src/hooks/useModels.ts
index 020a3c4e..71821f9a 100644
--- a/src/hooks/useModels.ts
+++ b/src/hooks/useModels.ts
@@ -7,7 +7,11 @@ import { useModelStore } from '../stores/modelStore'
import { useProviderStore } from '../stores/providerStore'
import { useSettingsStore } from '../stores/settingsStore'
import { getEnabledProviders, prefixModelName, getProviderIdFromModel } from '../api/providers'
-import { listBundledModels, bundledToAIModels, activateBuiltinModel, isManagedBuiltinActive } from '../api/engine'
+import {
+ listBundledModels, bundledToAIModels, activateBuiltinModel, isManagedBuiltinActive,
+ bundledEngineStatus, bundledEmbedStatus, startBundledEmbed,
+} from '../api/engine'
+import type { BundledModel } from '../api/engine'
import type { PullProgress, AIModel, ModelCategory, ImageModel, VideoModel, CloudModel } from '../types/models'
const VIDEO_PATTERNS = [/wan/, /svd/, /animatediff/, /animate/, /video/, /cogvideo/, /ltx/i, /framepack/, /mochi/, /cosmos/, /hunyuan/, /pyramidflow/, /allegro/]
@@ -25,6 +29,35 @@ function isEmbeddingModel(name: string): boolean {
return EMBEDDING_PATTERNS.some((p) => p.test(lower))
}
+// Boot-resume for the managed built-in engine (2.5.7): the llama-server
+// children are reaped on app quit and nothing on the Rust side respawns them,
+// so after a relaunch the persisted active model points at a dead
+// 127.0.0.1:8127 (and RAG at a dead 8128) until the user re-picks the model.
+// Runs at most once per app session (fetchModels fires repeatedly), and only
+// starts a server that reports running:false.
+let builtinResumeAttempted = false
+
+async function resumeBuiltinEngines(bundled: BundledModel[]) {
+ try {
+ const status = await bundledEngineStatus()
+ const { activeModel } = useModelStore.getState()
+ if (
+ !status.running && activeModel &&
+ getProviderIdFromModel(activeModel) === 'openai' &&
+ bundled.some((m) => prefixModelName('openai', m.name) === activeModel)
+ ) {
+ await activateBuiltinModel(activeModel)
+ }
+ } catch { /* engine unavailable — non-critical */ }
+ try {
+ const embed = bundled.find((m) => isEmbeddingModel(m.name))
+ if (embed) {
+ const embedStatus = await bundledEmbedStatus()
+ if (!embedStatus.running) await startBundledEmbed(embed.path)
+ }
+ } catch { /* embeddings server unavailable — non-critical */ }
+}
+
export function useModels() {
const {
models: allModels, activeModel, activePulls, categoryFilter,
@@ -112,8 +145,13 @@ export function useModels() {
// backend or non-Tauri dev context just yields no built-in models.
if (managedBuiltin) {
try {
- const bundled = bundledToAIModels(await listBundledModels())
+ const bundledRaw = await listBundledModels()
+ const bundled = bundledToAIModels(bundledRaw)
allModels.push(...bundled.filter(m => !isEmbeddingModel(m.name)))
+ if (!builtinResumeAttempted) {
+ builtinResumeAttempted = true
+ void resumeBuiltinEngines(bundledRaw)
+ }
} catch { /* engine command unavailable — non-critical */ }
}
const ollamaEnabled = useProviderStore.getState().providers.ollama.enabled
diff --git a/src/hooks/useVoice.ts b/src/hooks/useVoice.ts
index 674f4b0f..acb5b861 100644
--- a/src/hooks/useVoice.ts
+++ b/src/hooks/useVoice.ts
@@ -1,4 +1,4 @@
-import { useCallback, useRef } from "react";
+import { useCallback, useEffect, useRef } from "react";
import { useVoiceStore } from "../stores/voiceStore";
import { useSettingsStore } from "../stores/settingsStore";
import { useCloudAuthStore, deriveCloudAvailable } from "../stores/cloudAuthStore";
@@ -8,6 +8,7 @@ import {
synthesizeNeural,
synthesizeExternal,
synthesizeCloud,
+ chunkForTts,
playNeuralAudio,
stopNeuralAudio,
isSpeechSynthesisSupported,
@@ -20,8 +21,22 @@ import {
transcribeAudioCloud,
type AudioRecorder,
} from "../api/voice";
+import { CloudJobError } from "../api/cloud/client";
import { log } from "../lib/logger";
+// Honest, actionable copy for dictation failures. The cloud route's own error
+// strings (403 "your plan does not include cloud voice", 429 "monthly credit
+// budget exhausted") are already human-readable — pass those through.
+function sttErrorMessage(err: unknown): string {
+ if (err instanceof CloudJobError) {
+ if (err.status === 401) return "Signed out — sign in again to use cloud dictation";
+ if (err.status === 413) return "Recording too long — try a shorter take";
+ if (err.status >= 500) return "Cloud transcription is unavailable right now — try again";
+ return err.message;
+ }
+ return "Transcription failed — check the microphone and try again";
+}
+
export function useVoice() {
const store = useVoiceStore();
const recorderRef = useRef<AudioRecorder | null>(null);
@@ -30,6 +45,32 @@ export function useVoice() {
// (CPU Whisper) transcriptions never pile up.
const streamTimerRef = useRef<ReturnType<typeof setInterval> | null>(null);
const interimBusyRef = useRef(false);
+ // Speak-generation counter + abort plumbing: a Stop click bumps the counter
+ // and aborts the in-flight cloud synthesis, so audio that resolves late is
+ // dropped instead of playing over the idle button state.
+ const speakGenRef = useRef(0);
+ const speakAbortRef = useRef<AbortController | null>(null);
+
+ // Unmount teardown (e.g. view switch mid-dictation): kill the interim
+ // transcribe interval and stop the recorder — recorder.stop() releases the
+ // mic tracks and closes the AudioContext. Without this the leaked interval
+ // keeps POSTing WAV snapshots forever, the mic stays hot, and the stuck
+ // store.isRecording can never be cleared.
+ useEffect(
+ () => () => {
+ if (streamTimerRef.current) {
+ clearInterval(streamTimerRef.current);
+ streamTimerRef.current = null;
+ }
+ const rec = recorderRef.current;
+ recorderRef.current = null;
+ if (rec?.isRecording()) {
+ void rec.stop().catch(() => {});
+ useVoiceStore.getState().setRecording(false);
+ }
+ },
+ [],
+ );
// Cloud mode routes voice through the metered lu-labs.ai endpoints — no
// local Whisper/Piper install needed, both buttons just work.
@@ -72,9 +113,10 @@ export function useVoice() {
* so slow CPU transcriptions never queue up.
*/
const startRecording = useCallback(
- async (onInterim?: (text: string) => void) => {
- if (recorderRef.current?.isRecording()) return;
+ async (onInterim?: (text: string) => void): Promise<boolean> => {
+ if (recorderRef.current?.isRecording()) return true;
+ store.setSttError(null);
const recorder = createAudioRecorder();
recorderRef.current = recorder;
@@ -107,11 +149,14 @@ export function useVoice() {
}
}, 1400);
}
+ return true;
} catch (err) {
log.error("Failed to start recording", { err });
if (streamTimerRef.current) { clearInterval(streamTimerRef.current); streamTimerRef.current = null; }
interimBusyRef.current = false;
recorderRef.current = null;
+ store.setSttError("Microphone unavailable — check mic permissions for LU in System Settings");
+ return false;
}
},
[store, cloudVoice],
@@ -120,7 +165,12 @@ export function useVoice() {
const stopRecording = useCallback(async (): Promise<string> => {
if (streamTimerRef.current) { clearInterval(streamTimerRef.current); streamTimerRef.current = null; }
interimBusyRef.current = false;
- if (!recorderRef.current) return "";
+ if (!recorderRef.current) {
+ // A leaked take (recorder lost to an unmount) can leave the flag stuck —
+ // clear it so the mic button doesn't stay red forever.
+ store.setRecording(false);
+ return "";
+ }
try {
// Stop recording and get the final WAV of the whole take.
@@ -138,6 +188,7 @@ export function useVoice() {
return transcript;
} catch (err) {
log.error("Whisper transcription error", { err });
+ store.setSttError(sttErrorMessage(err));
return "";
} finally {
store.setTranscribing(false);
@@ -147,6 +198,7 @@ export function useVoice() {
store.setRecording(false);
store.setTranscribing(false);
recorderRef.current = null;
+ store.setSttError("Recording failed — try again");
return "";
}
}, [store, cloudVoice]);
@@ -164,16 +216,29 @@ export function useVoice() {
const externalReady = store.ttsMode === "external" && !!store.externalTtsUrl.trim();
if (!cloudVoice && !externalReady && !store.ttsAvailable && !ttsSupported) return;
+ const gen = ++speakGenRef.current;
+ const controller = new AbortController();
+ speakAbortRef.current = controller;
+ const stopped = () => gen !== speakGenRef.current;
+
store.setSpeaking(true);
try {
// Cloud mode: hosted MiniMax TTS first; a failure (offline, 429)
- // falls through to whatever local engine exists.
+ // falls through to whatever local engine exists. The server caps text
+ // at 1500 chars, so long answers are chunked at sentence boundaries
+ // and the MP3s played strictly sequentially — Stop cancels the whole
+ // queue via the generation counter + the fetch abort.
if (cloudVoice) {
try {
- const url = await synthesizeCloud(text, store.cloudTtsVoice || undefined);
- await playNeuralAudio(url);
+ for (const chunk of chunkForTts(text)) {
+ if (stopped()) return;
+ const url = await synthesizeCloud(chunk, store.cloudTtsVoice || undefined, controller.signal);
+ if (stopped()) return;
+ await playNeuralAudio(url);
+ }
return;
} catch (err) {
+ if (stopped()) return; // Stop click aborted the fetch — no fallback
log.error("Cloud TTS failed, falling back to local engines", { err });
}
}
@@ -181,26 +246,31 @@ export function useVoice() {
if (externalReady) {
try {
const url = await synthesizeExternal(text, store.externalTtsUrl.trim(), store.externalTtsVoice || undefined);
+ if (stopped()) return;
await playNeuralAudio(url);
return;
} catch (err) {
+ if (stopped()) return;
log.error("External TTS failed, falling back to browser voices", { err });
}
} else if (store.ttsAvailable) {
try {
const url = await synthesizeNeural(text, store.piperVoice);
+ if (stopped()) return;
await playNeuralAudio(url);
return;
} catch (err) {
+ if (stopped()) return;
log.error("Neural TTS failed, falling back to browser voices", { err });
}
}
- if (!ttsSupported) return;
+ if (!ttsSupported || stopped()) return;
let voice: SpeechSynthesisVoice | undefined;
if (store.ttsVoice) {
const voices = await getVoicesAsync();
voice = voices.find((v) => v.name === store.ttsVoice);
}
+ if (stopped()) return;
if (streaming) {
await speakStreaming(text, voice, store.ttsRate, store.ttsPitch);
} else {
@@ -209,7 +279,8 @@ export function useVoice() {
} catch (err) {
log.error("Speech synthesis error", { err });
} finally {
- store.setSpeaking(false);
+ // A newer speak/stop already owns the flag — don't clobber it.
+ if (!stopped()) store.setSpeaking(false);
}
},
[store, ttsSupported, cloudVoice]
@@ -219,16 +290,26 @@ export function useVoice() {
const speakTextStreaming = useCallback((text: string) => speakInternal(text, true), [speakInternal]);
const stopSpeaking = useCallback(() => {
+ // Invalidate the running speak generation (drops queued cloud chunks and
+ // any synthesis that resolves late) and abort the in-flight cloud fetch —
+ // the server cancels un-metered on a client abort.
+ speakGenRef.current++;
+ speakAbortRef.current?.abort();
+ speakAbortRef.current = null;
stopNeuralAudio();
stopSpeakingApi();
store.setSpeaking(false);
}, [store]);
+ const clearSttError = useCallback(() => store.setSttError(null), [store]);
+
return {
isRecording: store.isRecording,
isTranscribing: store.isTranscribing,
isSpeaking: store.isSpeaking,
transcript: store.transcript,
+ sttError: store.sttError,
+ clearSttError,
sttSupported,
ttsSupported,
ttsAvailable,
diff --git a/src/lib/context-compaction.ts b/src/lib/context-compaction.ts
index c796735f..30da6c63 100644
--- a/src/lib/context-compaction.ts
+++ b/src/lib/context-compaction.ts
@@ -10,6 +10,7 @@
import { getModelContext } from '../api/ollama'
import { getProviderForModel, getProviderIdFromModel } from '../api/providers'
+import { useModelStore } from '../stores/modelStore'
import type { OllamaChatMessage } from '../types/agent-mode'
// ── Token Estimation ────────────────────────────────────────────
@@ -47,6 +48,18 @@ export async function getModelMaxTokens(modelName: string): Promise<number> {
try {
const providerId = getProviderIdFromModel(modelName)
+ if (providerId === 'lu-cloud') {
+ // LU Cloud ships the real context_length via /models; the model store
+ // carries it as contextLength. Without this branch the prefixed name
+ // fell into the Ollama path → /api/show 404 → 4096 for EVERY cloud
+ // model (TokenCounter pinned red at 4.1k).
+ const meta = useModelStore.getState().models.find((m) => m.name === modelName)
+ const ctx = meta && 'contextLength' in meta ? meta.contextLength : undefined
+ if (ctx && ctx > 0) return ctx
+ const { provider, modelId } = getProviderForModel(modelName)
+ return await provider.getContextLength(modelId)
+ }
+
if (providerId === 'openai' || providerId === 'anthropic') {
// Use provider's getContextLength for cloud models
const { provider, modelId } = getProviderForModel(modelName)
diff --git a/src/stores/__tests__/cloudCatalogStore.test.ts b/src/stores/__tests__/cloudCatalogStore.test.ts
index 9f2d5f58..a4cdefe7 100644
--- a/src/stores/__tests__/cloudCatalogStore.test.ts
+++ b/src/stores/__tests__/cloudCatalogStore.test.ts
@@ -3,8 +3,10 @@ import {
useCloudCatalogStore,
cloudModelsFor,
defaultCloudModel,
+ defaultEditModel,
isEditCapable,
cloudMediaLive,
+ runCredits,
} from '../cloudCatalogStore'
import { CLOUD_MODEL_SEED } from '../../lib/render/cloud-models'
import type { CloudCatalog } from '../../api/cloud/catalog'
@@ -14,7 +16,14 @@ const serverCatalog: CloudCatalog = {
{ id: 'flux-9', label: 'Flux 9', kind: 'image', edit: true, cfg: true, credits: { base: 300 } },
{ id: 'wan-9', label: 'Wan 9', kind: 'video', clip: { short: 5, long: 8 }, credits: { base: 8000, long: 13000 } },
],
- ops: { removebg: 1000, eraser: 2500, upscale_image: 1000, upscale_video_per_s: 500, upscale_video_min: 2500 },
+ ops: {
+ removebg: 1000,
+ eraser: 2500,
+ upscale_image: 1000,
+ upscale_image_res: { '2k': 1000, '4k': 1000, '8k': 4000 },
+ upscale_video_per_s: 500,
+ upscale_video_min: 2500,
+ },
voice: { stt: 600, tts_per_1k_chars: 8000 },
media_live: false,
tier: 'hosted-max',
@@ -59,4 +68,53 @@ describe('cloudCatalogStore', () => {
const negPrompt = CLOUD_MODEL_SEED.filter((m) => m.negative_prompt).map((m) => m.id)
expect(negPrompt).toEqual(['wan-2.2-720p', 'wan-2.2-fast', 'hunyuan-video'])
})
+
+ it('defaultEditModel resolves the first edit-capable image model (seed and server)', () => {
+ expect(defaultEditModel()?.id).toBe('flux-dev')
+ useCloudCatalogStore.getState().setCatalog(serverCatalog)
+ expect(defaultEditModel()?.id).toBe('flux-9')
+ })
+
+ describe('runCredits', () => {
+ it('falls back to the quota figure before any catalog fetch (seed has no prices)', () => {
+ expect(runCredits('image', 'generate', 'flux-schnell', undefined, 300)).toBe(300)
+ expect(runCredits('image', 'eraser', 'flux-schnell', undefined, 300)).toBe(300)
+ })
+
+ it('prices utility ops from the catalog ops table', () => {
+ useCloudCatalogStore.getState().setCatalog(serverCatalog)
+ expect(runCredits('image', 'removebg', 'flux-9', undefined, 300)).toBe(1000)
+ expect(runCredits('image', 'eraser', 'flux-9', undefined, 300)).toBe(2500)
+ expect(runCredits('image', 'upscale', 'flux-9', undefined, 300)).toBe(1000)
+ })
+
+ it('prices image upscale per target resolution, flat 4k when the res table is absent', () => {
+ useCloudCatalogStore.getState().setCatalog(serverCatalog)
+ expect(runCredits('image', 'upscale', 'flux-9', undefined, 300, '8k')).toBe(4000)
+ expect(runCredits('image', 'upscale', 'flux-9', undefined, 300, '2k')).toBe(1000)
+ // Older persisted catalog without the res table → flat 4k figure.
+ useCloudCatalogStore.getState().setCatalog({
+ ...serverCatalog,
+ ops: { ...serverCatalog.ops, upscale_image_res: undefined },
+ })
+ expect(runCredits('image', 'upscale', 'flux-9', undefined, 300, '8k')).toBe(1000)
+ })
+
+ it('prices generates per model, booking the long clip rate from 6.5 s', () => {
+ useCloudCatalogStore.getState().setCatalog(serverCatalog)
+ expect(runCredits('image', 'generate', 'flux-9', undefined, 300)).toBe(300)
+ expect(runCredits('video', 'generate', 'wan-9', 5, 40000)).toBe(8000)
+ expect(runCredits('video', 'generate', 'wan-9', 8, 40000)).toBe(13000)
+ })
+
+ it('edit coerces onto the edit-capable model like the submit does', () => {
+ useCloudCatalogStore.getState().setCatalog(serverCatalog)
+ expect(runCredits('image', 'edit', 'some-t2i-only', undefined, 999)).toBe(300)
+ })
+
+ it('unknown model falls back to the quota figure', () => {
+ useCloudCatalogStore.getState().setCatalog(serverCatalog)
+ expect(runCredits('image', 'generate', 'not-in-catalog', undefined, 321)).toBe(321)
+ })
+ })
})
diff --git a/src/stores/__tests__/createStore.test.ts b/src/stores/__tests__/createStore.test.ts
index 82909afb..42acc5ca 100644
--- a/src/stores/__tests__/createStore.test.ts
+++ b/src/stores/__tests__/createStore.test.ts
@@ -1,5 +1,25 @@
import { describe, it, expect, vi, beforeEach } from 'vitest'
+// The vitest env is 'node' (no DOM). zustand persist reads window.localStorage
+// (createJSONStorage default) at store-module load; without it the persist API
+// is never attached and the partialize test below cannot reach getOptions().
+// Install a Map-backed store BEFORE the hoisted import (same pattern as
+// providerStore.keychain.test.ts, hoisted because static imports run first).
+vi.hoisted(() => {
+ const map = new Map<string, string>()
+ const ls = {
+ getItem: (k: string) => (map.has(k) ? map.get(k)! : null),
+ setItem: (k: string, v: string) => { map.set(k, String(v)) },
+ removeItem: (k: string) => { map.delete(k) },
+ clear: () => { map.clear() },
+ key: (i: number) => [...map.keys()][i] ?? null,
+ get length() { return map.size },
+ }
+ ;(globalThis as unknown as { localStorage: unknown }).localStorage = ls
+ const g = globalThis as unknown as { window?: Record<string, unknown> }
+ g.window = Object.assign(g.window ?? {}, { localStorage: ls })
+})
+
// Mock comfyui before importing the store
vi.mock('../../api/comfyui', () => ({
classifyModel: vi.fn((name: string) => {
@@ -445,6 +465,48 @@ describe('createStore', () => {
})
})
+ // ── updateGalleryItem ──────────────────────────────────────
+
+ describe('updateGalleryItem', () => {
+ it('patches the matching item in place', () => {
+ useCreateStore.getState().addToGallery(makeGalleryItem('a'))
+ useCreateStore.getState().addToGallery(makeGalleryItem('b'))
+ useCreateStore.getState().updateGalleryItem('a', { remoteUrl: 'https://signed/new' })
+ const gallery = useCreateStore.getState().gallery
+ expect(gallery.find(g => g.id === 'a')?.remoteUrl).toBe('https://signed/new')
+ expect(gallery.find(g => g.id === 'b')?.remoteUrl).toBeUndefined()
+ expect(gallery).toHaveLength(2)
+ })
+
+ it('does nothing when id does not exist', () => {
+ useCreateStore.getState().addToGallery(makeGalleryItem('a'))
+ useCreateStore.getState().updateGalleryItem('nope', { remoteUrl: 'x' })
+ expect(useCreateStore.getState().gallery[0].remoteUrl).toBeUndefined()
+ })
+ })
+
+ // ── persistence: media bytes never hit localStorage ────────
+
+ describe('partialize', () => {
+ it('strips dataUrl from persisted gallery items, keeps remoteUrl + jobId', () => {
+ useCreateStore.getState().addToGallery({
+ ...makeGalleryItem('a'),
+ dataUrl: 'data:image/png;base64,AAAA',
+ remoteUrl: 'https://signed/a',
+ jobId: 'job-a',
+ })
+ const { partialize } = useCreateStore.persist.getOptions()
+ const persisted = partialize!(useCreateStore.getState()) as {
+ gallery: Array<Record<string, unknown>>
+ }
+ expect(persisted.gallery[0].dataUrl).toBeUndefined()
+ expect(persisted.gallery[0].remoteUrl).toBe('https://signed/a')
+ expect(persisted.gallery[0].jobId).toBe('job-a')
+ // in-memory item keeps its dataUrl for the current session
+ expect(useCreateStore.getState().gallery[0].dataUrl).toBe('data:image/png;base64,AAAA')
+ })
+ })
+
// ── removeFromGallery / clearGallery ───────────────────────
describe('removeFromGallery', () => {
diff --git a/src/stores/__tests__/providerStore.keychain.test.ts b/src/stores/__tests__/providerStore.keychain.test.ts
index 54d13981..f0a1fcc7 100644
--- a/src/stores/__tests__/providerStore.keychain.test.ts
+++ b/src/stores/__tests__/providerStore.keychain.test.ts
@@ -120,6 +120,28 @@ describe('providerStore keychain (H5)', () => {
expect(secretDelete).toHaveBeenCalledWith('anthropic')
})
+ it('does not revert concurrent provider changes made while hydrate awaits the vault', async () => {
+ // Locked-keychain scenario: the first secret_get blocks (macOS unlock
+ // prompt) while the app keeps running — e.g. useCloudAuth enables the
+ // lu-cloud provider. The final set() must overlay only the vault-loaded
+ // keys, never replace the providers map with a pre-await snapshot.
+ let release!: (value: string | null) => void
+ secretGet.mockImplementation((id: string) => {
+ if (id === 'ollama') return new Promise<string | null>((resolve) => { release = resolve })
+ return Promise.resolve(null)
+ })
+ const useStore = await freshStore()
+ const hydrating = useStore.getState().hydrateProviderKeys()
+
+ // Concurrent write while the first probe is still pending.
+ useStore.getState().setProviderConfig('lu-cloud', { enabled: true })
+ release('sk-vault-ollama')
+ await hydrating
+
+ expect(useStore.getState().providers['lu-cloud'].enabled).toBe(true)
+ expect(useStore.getState().getProviderApiKey('ollama')).toBe('sk-vault-ollama')
+ })
+
it('keeps the obfuscated key in localStorage when the vault WRITE fails (no silent loss on restart)', async () => {
secretGet.mockResolvedValue(null) // keychain usable but empty
secretSet.mockRejectedValue(new Error('credential store locked'))
diff --git a/src/stores/cloudCatalogStore.ts b/src/stores/cloudCatalogStore.ts
index 1ffdcc38..3c10004e 100644
--- a/src/stores/cloudCatalogStore.ts
+++ b/src/stores/cloudCatalogStore.ts
@@ -7,7 +7,7 @@
import { create } from 'zustand'
import { persist } from 'zustand/middleware'
import { CLOUD_MODEL_SEED, type CloudModel } from '../lib/render/cloud-models'
-import type { RenderKind } from '../lib/render/cloud-jobs'
+import type { RenderKind, RenderOp } from '../lib/render/cloud-jobs'
import { getCatalog, type CatalogOps, type CloudCatalog } from '../api/cloud/catalog'
interface CloudCatalogState {
@@ -69,6 +69,45 @@ export function isEditCapable(id: string): boolean {
return cloudModelById(id)?.edit === true
}
+/** First edit-capable image model in the catalog (flux-dev today) — the
+ * submit-time fallback when the picker holds a t2i-only model for an edit. */
+export function defaultEditModel(): CloudModel | undefined {
+ return useCloudCatalogStore.getState().models.find((m) => m.kind === 'image' && m.edit)
+}
+
+/** Credits the upcoming run draws, priced from the server catalog: per-op
+ * utility rates, per-model base/long clip rates (the long rate books from
+ * ~6.5 s, mirroring the server's mediaCredits split). Edit coerces onto the
+ * edit-capable model exactly like useCloudCreate's submit, so gate + meter
+ * price the model the run actually uses. Falls back to the quota's
+ * representative per-kind figure when the catalog carries no price
+ * (seed/offline). */
+export function runCredits(
+ kind: RenderKind,
+ op: RenderOp,
+ pickedModel: string,
+ seconds: number | undefined,
+ fallback: number,
+ resolution?: string,
+): number {
+ const { ops } = useCloudCatalogStore.getState()
+ if (op === 'removebg' || op === 'eraser' || op === 'upscale') {
+ const upscale =
+ ops && kind === 'image'
+ ? ((resolution && ops.upscale_image_res?.[resolution]) || ops.upscale_image)
+ : ops?.upscale_image
+ const rate = ops ? { removebg: ops.removebg, eraser: ops.eraser, upscale }[op] : undefined
+ return rate ?? fallback
+ }
+ const model =
+ op === 'edit' && !isEditCapable(pickedModel) ? (defaultEditModel()?.id ?? pickedModel) : pickedModel
+ const credits = cloudModelById(model)?.credits
+ if (!credits) return fallback
+ return kind === 'video' && seconds !== undefined && seconds >= 6.5
+ ? (credits.long ?? credits.base)
+ : credits.base
+}
+
/** Media-live switch from the server (MEDIA_LIVE env). Unknown = live so the
* first-ever session doesn't false-block before the catalog arrives. */
export function cloudMediaLive(): boolean {
diff --git a/src/stores/createStore.ts b/src/stores/createStore.ts
index ffbb1535..3f72d2cd 100644
--- a/src/stores/createStore.ts
+++ b/src/stores/createStore.ts
@@ -112,7 +112,8 @@ export interface GalleryItem {
resolvedCLIP?: string
/** Self-contained PNG data URL for backends that don't serve files over
* ComfyUI's /view route (e.g. MLX on Apple Silicon). When set, display +
- * download read from this instead of filename/subfolder. */
+ * download read from this instead of filename/subfolder. In-memory only —
+ * partialize strips it so media bytes never hit the localStorage quota. */
dataUrl?: string
/** Cloud jobs: signed result URL from the render queue. Display prefers
* `remoteUrl` → `dataUrl` → the ComfyUI /view path (filename/subfolder). */
@@ -243,6 +244,8 @@ interface CreateState {
setError: (error: string | null) => void
setLastGenTime: (time: string | null) => void
addToGallery: (item: GalleryItem) => void
+ /** Patch a gallery item in place (e.g. a lazily re-signed remoteUrl). */
+ updateGalleryItem: (id: string, patch: Partial<GalleryItem>) => void
removeFromGallery: (id: string) => void
clearGallery: () => void
addToPromptHistory: (prompt: string) => void
@@ -454,6 +457,8 @@ export const useCreateStore = create<CreateState>()(
setError: (error) => set({ error }),
setLastGenTime: (time) => set({ lastGenTime: time }),
addToGallery: (item) => set((s) => ({ gallery: [item, ...s.gallery].slice(0, 200) })),
+ updateGalleryItem: (id, patch) =>
+ set((s) => ({ gallery: s.gallery.map((g) => (g.id === id ? { ...g, ...patch } : g)) })),
removeFromGallery: (id) => set((s) => ({ gallery: s.gallery.filter((g) => g.id !== id) })),
clearGallery: () => set({ gallery: [] }),
addToPromptHistory: (prompt) => set((s) => {
@@ -483,7 +488,11 @@ export const useCreateStore = create<CreateState>()(
frames: state.frames,
fps: state.fps,
denoise: state.denoise,
- gallery: state.gallery,
+ // Media bytes never go to localStorage — a handful of multi-MB base64
+ // dataUrls would blow the origin quota (~5-10 MB in WebView2/WKWebView)
+ // and every subsequent set() would throw, killing ALL create-store
+ // persistence. Cloud items carry remoteUrl + jobId and re-sign lazily.
+ gallery: state.gallery.map(({ dataUrl, ...g }) => g),
promptHistory: state.promptHistory,
// ── redesign additions (advanced params only; runtime inputs
// source/mask/backend/caps stay unpersisted). No version bump: these
diff --git a/src/stores/modelStore.ts b/src/stores/modelStore.ts
index 54aca7c4..ad3d0b16 100644
--- a/src/stores/modelStore.ts
+++ b/src/stores/modelStore.ts
@@ -51,11 +51,16 @@ export const useModelStore = create<ModelState>()(
// first-launch behavior so a user is never stuck with no
// selection while a model exists.
const stillValid = !!state.activeModel && models.some((m) => m.name === state.activeModel)
+ // Chat models only for the auto-select — ComfyUI image/video
+ // checkpoints share this list and must never become the active CHAT
+ // model (an unprefixed checkpoint name routes to Ollama and every
+ // send fails with model-not-found).
+ const firstChat = models.find((m) => m.type !== 'image' && m.type !== 'video')
return {
models,
activeModel: stillValid
? state.activeModel
- : (models.length > 0 ? models[0].name : null),
+ : (firstChat ? firstChat.name : null),
}
}),
diff --git a/src/stores/providerStore.ts b/src/stores/providerStore.ts
index b62ffa96..b50fe40d 100644
--- a/src/stores/providerStore.ts
+++ b/src/stores/providerStore.ts
@@ -193,18 +193,20 @@ export const useProviderStore = create<ProviderState>()(
// RESOLVES (even returning null) proves the vault is usable here; a
// reject on the very first probe means no keychain (web build, or Linux
// "unsupported") → stay on the localStorage path and do nothing.
- const next = { ...get().providers }
+ const loaded: Partial<Record<ProviderId, string>> = {}
let usable: boolean | null = null
for (const id of PROVIDER_IDS) {
try {
const stored = await secretGet(id)
usable = true
if (stored != null && stored !== '') {
- next[id] = { ...next[id], apiKey: obfuscate(stored) }
+ loaded[id] = stored
} else {
// Nothing in the vault yet. Migrate an existing localStorage key
- // (an upgrading user) into the vault, once.
- const existing = deobfuscate(next[id]?.apiKey || '')
+ // (an upgrading user) into the vault, once. Read the CURRENT
+ // store value — a key set while an earlier secret_get awaited
+ // must not be missed.
+ const existing = deobfuscate(get().providers[id]?.apiKey || '')
if (existing) {
// Migrate the old localStorage key into the vault. If the write
// fails, mark it so partialize keeps the localStorage copy (no loss).
@@ -218,10 +220,21 @@ export const useProviderStore = create<ProviderState>()(
}
if (!usable) return
keychainReady = true
- // Apply loaded keys and re-persist; partialize (now that keychainReady
- // is true) strips the redundant localStorage copy. clearProviderCache
- // rebuilds any client constructed during startup with an empty key.
- set({ providers: next })
+ // Overlay ONLY the vault-loaded keys onto the LIVE state and re-persist.
+ // A whole-map snapshot taken before the awaits would revert every
+ // concurrent write (e.g. useCloudAuth enabling lu-cloud, or a Settings
+ // edit, while a locked macOS keychain blocked secret_get for minutes).
+ // partialize (now that keychainReady is true) strips the redundant
+ // localStorage copy. clearProviderCache rebuilds any client constructed
+ // during startup with an empty key.
+ set((s) => ({
+ providers: Object.fromEntries(
+ Object.entries(s.providers).map(([id, p]) => {
+ const key = loaded[id as ProviderId]
+ return key !== undefined ? [id, { ...p, apiKey: obfuscate(key) }] : [id, p]
+ }),
+ ) as Record<ProviderId, ProviderConfig>,
+ }))
clearProviderCache()
},
}),
diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.ts
index faffd766..c8621172 100644
--- a/src/stores/settingsStore.ts
+++ b/src/stores/settingsStore.ts
@@ -26,7 +26,11 @@ import { DEFAULT_SETTINGS, BUILT_IN_PERSONAS } from '../lib/constants'
// full picker to come FIRST again on both image AND video. Clearing the saved
// picks once on upgrade makes the picker the default until the user deliberately
// saves a model again via the picker's Remember.
-const STORE_VERSION = 10
+// v11 (2.5.7): added settings.appMode (global Local/Cloud switch, default
+// 'local'). Same additive merge backfills it — without the bump, v10 blobs
+// skip migrate entirely and the header ModeSwitch renders with appMode
+// undefined, highlighting neither Local nor Cloud.
+const STORE_VERSION = 11
interface SettingsState {
settings: Settings
diff --git a/src/stores/voiceStore.ts b/src/stores/voiceStore.ts
index aca245ce..07e6b485 100644
--- a/src/stores/voiceStore.ts
+++ b/src/stores/voiceStore.ts
@@ -15,6 +15,10 @@ interface VoiceState {
// Whether local neural TTS (Piper) is installed + a voice model is present.
// Same transient/probe model as sttAvailable.
ttsAvailable: boolean;
+ /** Last dictation/transcription failure (human-readable, e.g. the cloud
+ * route's 429 "monthly credit budget exhausted") — shown by VoiceButton
+ * instead of silently dropping the take. Transient. */
+ sttError: string | null;
// Persisted settings
sttEnabled: boolean;
@@ -42,6 +46,7 @@ interface VoiceState {
setTranscript: (transcript: string) => void;
setSttAvailable: (available: boolean) => void;
setTtsAvailable: (available: boolean) => void;
+ setSttError: (error: string | null) => void;
setPiperVoice: (voice: string) => void;
updateVoiceSettings: (
settings: Partial<{
@@ -73,6 +78,7 @@ export const useVoiceStore = create<VoiceState>()(
transcript: "",
sttAvailable: false,
ttsAvailable: false,
+ sttError: null,
// Persisted settings — voice OFF by default (David 2026-06-07:
// "tts und stt standardmäßig AUS und nicht immer automatisch vorlesen").
@@ -98,6 +104,7 @@ export const useVoiceStore = create<VoiceState>()(
setTranscript: (transcript) => set({ transcript }),
setSttAvailable: (available) => set({ sttAvailable: available }),
setTtsAvailable: (available) => set({ ttsAvailable: available }),
+ setSttError: (error) => set({ sttError: error }),
setPiperVoice: (voice) => set({ piperVoice: voice }),
updateVoiceSettings: (settings) => set((state) => ({ ...state, ...settings })),
@@ -108,6 +115,7 @@ export const useVoiceStore = create<VoiceState>()(
isTranscribing: false,
isSpeaking: false,
transcript: "",
+ sttError: null,
}),
resetVoiceDefaults: () =>