Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,66 @@ jobs:
writeFileSync('frontend/src-tauri/tauri.release.conf.json', JSON.stringify(config));
NODE

# Windows code signing, so SmartScreen doesn't warn on first launch.
# Either a code-signing certificate (.pfx, base64 in WINDOWS_CERTIFICATE)
# or Azure Trusted Signing (AZURE_* secrets and variables); with neither,
# the installers stay unsigned as before. Updater artifacts are signed
# with the Tauri key either way.
- name: Configure Windows signing
if: runner.os == 'Windows'
shell: pwsh
env:
WIN_CERT: ${{ secrets.WINDOWS_CERTIFICATE }}
WIN_CERT_PASS: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
AZ_TENANT: ${{ secrets.AZURE_TENANT_ID }}
AZ_CLIENT: ${{ secrets.AZURE_CLIENT_ID }}
AZ_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZ_ENDPOINT: ${{ vars.AZURE_SIGNING_ENDPOINT }}
AZ_ACCOUNT: ${{ vars.AZURE_SIGNING_ACCOUNT }}
AZ_PROFILE: ${{ vars.AZURE_SIGNING_PROFILE }}
run: |
$configPath = 'frontend/src-tauri/tauri.release.conf.json'
$config = Get-Content $configPath -Raw | ConvertFrom-Json
$windows = $null
if ($env:WIN_CERT) {
$pfx = Join-Path $env:RUNNER_TEMP 'locus-signing.pfx'
[IO.File]::WriteAllBytes($pfx, [Convert]::FromBase64String($env:WIN_CERT))
$password = ConvertTo-SecureString $env:WIN_CERT_PASS -AsPlainText -Force
$cert = Import-PfxCertificate -FilePath $pfx -CertStoreLocation Cert:\CurrentUser\My -Password $password
Remove-Item $pfx -Force
$windows = @{
certificateThumbprint = $cert.Thumbprint
digestAlgorithm = 'sha256'
timestampUrl = 'http://timestamp.digicert.com'
}
Write-Host "Windows signing configured with certificate $($cert.Subject)"
} elseif ($env:AZ_SECRET) {
$missing = @('AZ_TENANT', 'AZ_CLIENT', 'AZ_ENDPOINT', 'AZ_ACCOUNT', 'AZ_PROFILE') |
Where-Object { -not [Environment]::GetEnvironmentVariable($_) }
if ($missing) {
Write-Host "::error::AZURE_CLIENT_SECRET is set but these are missing: $($missing -join ', ')"
exit 1
}
cargo install trusted-signing-cli --locked
"AZURE_TENANT_ID=$env:AZ_TENANT" >> $env:GITHUB_ENV
"AZURE_CLIENT_ID=$env:AZ_CLIENT" >> $env:GITHUB_ENV
"AZURE_CLIENT_SECRET=$env:AZ_SECRET" >> $env:GITHUB_ENV
$windows = @{
signCommand = "trusted-signing-cli -e $env:AZ_ENDPOINT -a $env:AZ_ACCOUNT -c $env:AZ_PROFILE -d Locus %1"
}
Write-Host 'Windows signing configured with Azure Trusted Signing'
} else {
if ('${{ github.ref }}' -like 'refs/tags/*') {
Write-Host '::warning::No Windows signing secrets; releasing unsigned Windows installers (SmartScreen will warn)'
}
Write-Host 'No Windows signing configured, skipping code signing'
}
if ($windows) {
$config.bundle | Add-Member -NotePropertyName windows -NotePropertyValue $windows -Force
# WriteAllText writes UTF-8 without a byte-order mark, which Tauri needs.
[IO.File]::WriteAllText((Resolve-Path $configPath), ($config | ConvertTo-Json -Depth 10))
}

- name: Configure Apple signing
if: runner.os == 'macOS'
env:
Expand Down
26 changes: 26 additions & 0 deletions docs/development/release-checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,29 @@ Run at least one failure scenario per release; rotate which one.
- All pytest tests pass: `uv run pytest tests/`
- All bats tests pass: see `.github/workflows/bash-tests.yml`
- Container integration matrix is green: see `.github/workflows/installer-integration.yml`

## Code signing

Without signing secrets, `desktop.yml` still releases, but Windows SmartScreen and macOS Gatekeeper warn on first launch. Add the secrets under **Settings > Secrets and variables > Actions** in the repository, and the next `desktop-v*` tag is signed.

### Windows

Use one of these. If both are set, the certificate wins.

- **Code-signing certificate (.pfx).** An OV or EV certificate from a certificate authority.
- Secret `WINDOWS_CERTIFICATE`: the .pfx file, base64-encoded (`[Convert]::ToBase64String([IO.File]::ReadAllBytes("cert.pfx"))`).
- Secret `WINDOWS_CERTIFICATE_PASSWORD`: its password.
- **Azure Trusted Signing.** Usually the cheapest option. Create a Trusted Signing account and certificate profile, and an app registration with the *Trusted Signing Certificate Profile Signer* role.
- Secrets `AZURE_TENANT_ID`, `AZURE_CLIENT_ID` and `AZURE_CLIENT_SECRET`.
- Variables `AZURE_SIGNING_ENDPOINT` (for example `https://eus.codesigning.azure.net`), `AZURE_SIGNING_ACCOUNT` and `AZURE_SIGNING_PROFILE`.

The "Configure Windows signing" step adds the certificate's thumbprint, or a `trusted-signing-cli` sign command, to `tauri.release.conf.json`. Installers are signed with SHA-256 and timestamped.

### macOS

Needs an Apple Developer ID Application certificate and notarization credentials:

- Secrets `APPLE_CERTIFICATE` (the .p12, base64-encoded), `APPLE_CERTIFICATE_PASSWORD` and `APPLE_SIGNING_IDENTITY` (for example `Developer ID Application: Name (TEAMID)`).
- Secrets `APPLE_ID`, `APPLE_PASSWORD` (an app-specific password for that Apple ID) and `APPLE_TEAM_ID`.

The workflow checks the notarization credentials before building, so a bad one fails in seconds rather than at the end.
78 changes: 78 additions & 0 deletions frontend/src/components/Chat/AgentModelHint.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { useEffect, useState } from 'react';
import { toast } from 'sonner';
import { fetchAgentModel, fetchModels, pullModel, type AgentModelRecommendation } from '../../lib/api';
import { modelSizeBillions, shouldSuggestAgentModel } from '../../lib/model-capabilities';
import { useAppStore } from '../../lib/store';

/**
* In Agent mode with a small model, suggest the model that works best on
* this computer, with one click to use it (downloading it first if needed).
*/
export function AgentModelHint({ selectedModel }: { selectedModel: string }) {
const [rec, setRec] = useState<AgentModelRecommendation | null>(null);
const [busy, setBusy] = useState(false);

useEffect(() => {
let cancelled = false;
fetchAgentModel()
.then((r) => {
if (!cancelled) setRec(r);
})
.catch(() => {});
return () => {
cancelled = true;
};
}, []);

if (!rec) return null;
if (!rec.model) {
if (modelSizeBillions(selectedModel) === null) return null;
return (
<div className="text-[11px] leading-snug" style={{ color: 'var(--color-text-tertiary)' }}>
{rec.reason}
</div>
);
}
if (!shouldSuggestAgentModel(selectedModel, rec.model)) return null;

const useIt = async () => {
const app = useAppStore.getState();
if (rec.installed) {
app.setSelectedModel(rec.model);
return;
}
setBusy(true);
const id = toast.loading(`Downloading ${rec.model}. This can take a few minutes…`);
try {
await pullModel(rec.model);
app.setModels(await fetchModels());
app.setSelectedModel(rec.model);
setRec({ ...rec, installed: true });
toast.success(`Now using ${rec.model} for Agent mode.`, { id });
} catch (err: any) {
toast.error(err?.message || `Couldn't download ${rec.model}.`, { id });
} finally {
setBusy(false);
}
};

return (
<div
className="flex flex-wrap items-center gap-2 text-[11px] leading-snug"
style={{ color: 'var(--color-text-tertiary)' }}
>
<span>
{selectedModel} often misses tool calls. {rec.reason}
</span>
<button
type="button"
onClick={useIt}
disabled={busy}
className="px-2 py-0.5 rounded-md cursor-pointer disabled:cursor-default disabled:opacity-50"
style={{ border: '1px solid var(--color-accent)', color: 'var(--color-accent)' }}
>
{busy ? 'Downloading…' : rec.installed ? `Use ${rec.model}` : `Download and use ${rec.model}`}
</button>
</div>
);
}
71 changes: 58 additions & 13 deletions frontend/src/components/Chat/InputArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@ import { Send, Square, Paperclip, Search, Globe, Bot, FolderCode, X } from 'luci
import { toast } from 'sonner';
import { useAppStore, generateId } from '../../lib/store';
import { streamChat, streamResearch } from '../../lib/sse';
import { fetchSavings, getBase, isTauri, stopAgentRun } from '../../lib/api';
import { answerApproval, fetchSavings, getBase, isTauri, stopAgentRun } from '../../lib/api';
import { listConnectors, getSyncStatus } from '../../lib/connectors-api';
import { serializeToolCallArguments } from '../../lib/tool-call';
import { isSmallForAgent } from '../../lib/model-capabilities';
import { stoppedSummary } from '../../lib/agent-stop';
import { approvalQuestion, canAnswerByVoice, parseYesNo } from '../../lib/voice-approval';
import { speakAndWait, useTtsStore } from '../../lib/tts';
import {
engineFromCompletionChunk,
resolveChatEngine,
} from '../../lib/chat-telemetry';
import { MicButton } from './MicButton';
import { AgentModelHint } from './AgentModelHint';
import { AttachmentChip } from './AttachmentChip';
import { useSpeech } from '../../hooks/useSpeech';
import { useHandsFree } from '../../hooks/useHandsFree';
import { useWakeWord } from '../../hooks/useWakeWord';
import {
apiAttachmentFields,
deletePayloads,
Expand Down Expand Up @@ -237,10 +240,41 @@ export function InputArea() {
cancelRecording,
} = useSpeech();

// Hands-free turns answer approvals aloud: Locus reads the step out and
// listens for yes or no. Commands and code still need a click.
const askApprovalAloud = useCallback(
async (tc: ToolCallInfo) => {
if (!tc.approvalId || !speechAvailable) return;
const spoke = await speakAndWait(`approval-${tc.approvalId}`, approvalQuestion(tc));
if (!spoke || !canAnswerByVoice(tc)) return;
const heard = await new Promise<string>((resolve) => {
void startRecording({
onEndOfSpeech: (reason) => {
if (reason === 'no_speech') {
cancelRecording();
resolve('');
} else {
stopRecording().then(resolve, () => resolve(''));
}
},
});
});
const answer = parseYesNo(heard);
if (!answer) {
void speakAndWait(`approval-${tc.approvalId}-retry`, "Sorry, I didn't catch that. Please answer on screen.");
return;
}
await answerApproval(tc.approvalId, answer === 'yes' ? 'approve' : 'deny').catch(() => false);
},
[speechAvailable, startRecording, stopRecording, cancelRecording],
);

// Hands-free: the transcript goes out through the prompt queue, which
// sends it as soon as no reply is streaming.
const handsFree = useAppStore((s) => s.settings.handsFree);
useHandsFree({
const wakeWord = useAppStore((s) => s.settings.wakeWord);
const ttsState = useTtsStore((s) => s.state);
const { listen: listenHandsFree } = useHandsFree({
enabled: handsFree,
available: speechAvailable,
state: speechState,
Expand All @@ -249,6 +283,20 @@ export function InputArea() {
cancelRecording,
send: (text) => useAppStore.getState().queuePrompt(text),
});
// "Hey Locus": a command said with it goes straight out; the name alone
// starts listening.
useWakeWord({
enabled: handsFree && wakeWord,
busy: speechState !== 'idle' || streamState.isStreaming || ttsState !== 'idle',
onWake: (command) => {
if (command) {
useAppStore.getState().setSpeakNextReply(true);
useAppStore.getState().queuePrompt(command);
} else {
void listenHandsFree();
}
},
});

// Abort in-flight stream when the user switches models mid-generation.
// This prevents errors from trying to continue a stream with a stale model.
Expand Down Expand Up @@ -591,7 +639,7 @@ export function InputArea() {
} else if (eventName === 'approval_required') {
try {
const data = JSON.parse(sseEvent.data);
toolCalls.push({
const pending: ToolCallInfo = {
id: generateId(),
tool: data.tool,
arguments: serializeToolCallArguments(data.arguments),
Expand All @@ -600,7 +648,10 @@ export function InputArea() {
risk: data.risk,
canAlways: Boolean(data.can_always),
preview: data.preview || undefined,
});
};
toolCalls.push(pending);
// A hands-free turn asks aloud too (the buttons still work).
if (useAppStore.getState().speakNextReply) void askApprovalAloud(pending);
setStreamState({
phase: 'Waiting for your approval...',
activeToolCalls: [...toolCalls],
Expand Down Expand Up @@ -817,6 +868,7 @@ export function InputArea() {
setLastAssistantWebSearch,
agentMode,
projectDir,
askApprovalAloud,
]);

const queuedPrompt = useAppStore((s) => s.queuedPrompt);
Expand Down Expand Up @@ -931,14 +983,7 @@ export function InputArea() {
)}
</div>
</div>
{agentMode && selectedModel && isSmallForAgent(selectedModel) && (
<div
className="text-[11px] leading-snug"
style={{ color: 'var(--color-text-tertiary)' }}
>
Small models like {selectedModel} often miss tool calls. A 4B or larger model works better in Agent mode.
</div>
)}
{agentMode && selectedModel && <AgentModelHint selectedModel={selectedModel} />}
{deepResearch && corpusSync.syncing && corpusSync.itemsSynced > 0 && (
<div
className="text-[11px] leading-snug"
Expand Down
33 changes: 27 additions & 6 deletions frontend/src/components/CommandPalette.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { useState, useRef, useEffect, useCallback } from 'react';
import { Search, Cpu, X, Download, Loader2, Trash2, Check, Cloud, Key, Eye, EyeOff } from 'lucide-react';
import { toast } from 'sonner';
import { useAppStore } from '../lib/store';
import {
pullModel,
deleteModel,
formatBytes,
fetchModels,
preloadModel,
isTauri,
Expand Down Expand Up @@ -202,20 +204,31 @@ export function CommandPalette() {
}
};

// Uninstalling takes two clicks: the first asks, the second confirms.
const [confirmDelete, setConfirmDelete] = useState<string | null>(null);
const handleDelete = async (modelId: string) => {
if (confirmDelete !== modelId) {
setConfirmDelete(modelId);
toast(`Click the bin again to uninstall ${modelId} from this computer.`);
return;
}
setConfirmDelete(null);
setDeleting(modelId);
try {
await deleteModel(modelId);
const { freedBytes } = await deleteModel(modelId);
useAppStore.getState().addLogEntry({
timestamp: Date.now(), level: 'info', category: 'model',
message: `Deleted ${modelId}`,
message: `Uninstalled ${modelId}`,
});
await refreshModels();
if (selectedModel === modelId) {
const remaining = models.filter((m) => m.id !== modelId);
if (remaining.length > 0) setSelectedModel(remaining[0].id);
}
} catch {} finally {
toast.success(`Uninstalled ${modelId}${freedBytes ? ` and freed ${formatBytes(freedBytes)}` : ''}.`);
} catch (err: any) {
toast.error(err?.message || `Couldn't uninstall ${modelId}.`);
} finally {
setDeleting(null);
}
};
Expand Down Expand Up @@ -400,10 +413,18 @@ export function CommandPalette() {
onClick={() => handleDelete(model.id)}
disabled={isDeleting}
className="p-1 rounded transition-colors cursor-pointer"
style={{ color: 'var(--color-text-tertiary)', opacity: 0 }}
title="Delete model"
style={{
color: confirmDelete === model.id ? 'var(--color-error)' : 'var(--color-text-tertiary)',
opacity: confirmDelete === model.id ? 1 : 0.5,
}}
title={confirmDelete === model.id ? `Click again to uninstall ${model.id}` : `Uninstall ${model.id}`}
aria-label={`Uninstall ${model.id}`}
onMouseEnter={(e) => { e.currentTarget.style.opacity = '1'; e.currentTarget.style.color = 'var(--color-error)'; }}
onMouseLeave={(e) => { e.currentTarget.style.opacity = '0'; e.currentTarget.style.color = 'var(--color-text-tertiary)'; }}
onMouseLeave={(e) => {
if (confirmDelete === model.id) return;
e.currentTarget.style.opacity = '0.5';
e.currentTarget.style.color = 'var(--color-text-tertiary)';
}}
>
{isDeleting ? <Loader2 size={14} className="animate-spin" /> : <Trash2 size={14} />}
</button>
Expand Down
Loading
Loading