diff --git a/docs/AGENT-FIRST-VALIDATION.md b/docs/AGENT-FIRST-VALIDATION.md
new file mode 100644
index 0000000..b8e7285
--- /dev/null
+++ b/docs/AGENT-FIRST-VALIDATION.md
@@ -0,0 +1,64 @@
+# Agent-first onboarding and installed SB validation
+
+2026-11-13. Baseline: `5aade2bbd37ec2aaccb89e56b254fee05573686e`, published SB 0.2.6.
+
+## Product correction
+
+KeepMind SB is shared context for agents in the user's AI application. The primary onboarding action now opens agent integration instructions. It neither configures the internal chat provider nor requires a manual note/password. Today and the personal desktop/compact navigation prioritize connections; memory empty states explain agent-generated context. Manual capture remains an optional utility accessible from Memory and its existing shortcut.
+
+Opening instructions does **not** establish or verify a connection. Existing MCP/GitHub configuration, encryption, authorization and recovery remain enforced. Protection is configured through Settings. Removing it from onboarding does not unlock a vault or migrate data. Internal chat AI remains optional in Settings.
+
+## Installed native app
+
+Tested a disposable copy of the installed app, with matching `app.asar` SHA-256 `76afdfc16c459c7ece6004e5795ca28d6bacfcf9ab1a7349814ba9668a42813e`. Main-process assertions verified the effective temporary user-data directory before inputs. Synthetic account, project and encrypted source only. Keychain storage was replaced with an in-memory test store; OS Keychain integration was not tested.
+
+Observed through macOS accessibility/UI automation:
+
+- Invalid login rejected; valid synthetic login opened Today. Found raw Electron IPC error text on invalid credentials. Fixed with a Portuguese actionable alert and retry regression test.
+- Today → resume project retained objective, next step and accepted decision.
+- Project → source opened the full original synthetic source with path and history warning.
+- Returning to Projects retained the selected project. Resume context → use in conversation prepared a draft without sending it to an AI provider.
+- Native navigation responded without observed stalls. No FPS benchmark or long-session performance claim.
+
+Isolation limitation: before the fixed-profile launcher was installed, macOS launched the test copy twice without its intended profile arguments. Both were stopped before clicks/typing. No personal content was intentionally edited, but those launches may have updated caches; byte-for-byte preservation of the personal profile is **not** claimed. Subsequent inputs were confined to the verified disposable profile. The installed app bundle was not modified by these tests.
+
+## Changed renderer validation
+
+- Build and TypeScript passed.
+- Vitest: 305 passed, 2 existing skips.
+- Existing `npm run test:experience` extended, 11 journeys passed: navigation, draft/error/retry, project resume, full source, answer source, reduced motion/avatar preference, keyboard focus, responsive onboarding and actual onboarding-to-integrations route.
+- Header/footer/action visibility checked at 1440×900, 1024×640 and 390×844. Rendered preview inspected visually through CUA; compact screenshot reviewed separately. Main content scrolls; actions remain reachable.
+- Security component tests still require recovery acknowledgement and preserve credentials after an unlock failure. No crypto gate removed.
+- Corp brain build/selfcheck, CRM browser batch and release gate/report checks passed.
+- Jev advisory review (`jev-1.14.0`, 1879 input/78 output tokens) found agent-first focus and honest instruction-vs-connection wording, each choice probability 1.0. This is not proof of functionality; report retained.
+
+An initial smoke run used the old built renderer; rebuilt before successful rerun. An older app test expected the removed primary Capture button; updated to exercise the retained capture shortcut. No production AI connection, real credentials, email, or external agent writes were tested. New changes were validated in the renderer, not installed over the user's application.
+
+## Reproduce
+
+Reuse the existing batch rather than a new runner:
+
+```sh
+npm run build
+npm run typecheck
+TMPDIR=/private/tmp npm test
+npm run test:experience
+npm run corp:build-brain
+npm run corp:check
+TMPDIR=/private/tmp npm run test:crm-browser
+node scripts/check-release-gates.mjs --reports
+```
+
+Aggregate report: [experience-report.json](evidence/agent-first/experience-report.json).
+
+
+
+
+
+## Default neural background (PR #22 follow-up)
+
+Neurons are enabled by default for profiles without a saved background preference. An explicit saved opt-out is preserved. Rendering is capped at 30 fps (including 120 Hz displays), with at most 96 neurons and 20 simultaneous pulses. Slower drift/pulses, clamped activity boost and 34% canvas opacity keep decoration subordinate to text/cards. Neighbor recomputation runs at most once per 600 ms. Hidden documents pause the loop; reduced motion or disabling the background removes it and releases the frame/resize work.
+
+Validation: build/typecheck passed; 307 unit tests passed, two existing skips. The extended experience batch passed 12 journeys, including actual canvas content changing, non-intercepting pointer events, navigation with animation enabled, and canvas removal under system reduced motion. A deterministic 120 Hz simulation asserts no more than 30 canvas draws per second, pause/resume and cleanup. Visual review of the synthetic Today renderer confirmed visible, subdued neurons and readable cards. This is not a hardware FPS/battery benchmark; no change was installed into the user's personal app/profile.
+
+
diff --git a/docs/evidence/agent-first/experience-report.json b/docs/evidence/agent-first/experience-report.json
new file mode 100644
index 0000000..9e9242b
--- /dev/null
+++ b/docs/evidence/agent-first/experience-report.json
@@ -0,0 +1,54 @@
+{
+ "fixture": "synthetic in-memory demo; no external services",
+ "checks": [
+ {
+ "name": "Hoje and five primary destinations",
+ "result": "passed"
+ },
+ {
+ "name": "Default neural background animates without intercepting navigation and honors reduced motion",
+ "result": "passed"
+ },
+ {
+ "name": "Capture failure, draft and retry",
+ "result": "passed"
+ },
+ {
+ "name": "Memory search failure, retry and full source",
+ "result": "passed"
+ },
+ {
+ "name": "Project continuation and screenshot",
+ "result": "passed"
+ },
+ {
+ "name": "Chat running and cancellation",
+ "result": "passed"
+ },
+ {
+ "name": "Reduced motion and avatar preference",
+ "result": "passed"
+ },
+ {
+ "name": "Relacionamentos navigation",
+ "result": "passed"
+ },
+ {
+ "name": "Rotinas navigation",
+ "result": "passed"
+ },
+ {
+ "name": "Narrow viewport navigation and focus",
+ "result": "passed"
+ },
+ {
+ "name": "Answer evidence opens original memory without losing the conversation",
+ "result": "passed"
+ },
+ {
+ "name": "Onboarding keeps header and actions reachable at desktop and narrow sizes",
+ "result": "passed"
+ }
+ ],
+ "errors": []
+}
diff --git a/docs/evidence/agent-first/neurons-background.png b/docs/evidence/agent-first/neurons-background.png
new file mode 100644
index 0000000..7e45569
Binary files /dev/null and b/docs/evidence/agent-first/neurons-background.png differ
diff --git a/docs/evidence/agent-first/onboarding-compact.png b/docs/evidence/agent-first/onboarding-compact.png
new file mode 100644
index 0000000..a37ffd7
Binary files /dev/null and b/docs/evidence/agent-first/onboarding-compact.png differ
diff --git a/docs/evidence/agent-first/onboarding-desktop.png b/docs/evidence/agent-first/onboarding-desktop.png
new file mode 100644
index 0000000..23531a2
Binary files /dev/null and b/docs/evidence/agent-first/onboarding-desktop.png differ
diff --git a/docs/evidence/agent-first/semantic-review.json b/docs/evidence/agent-first/semantic-review.json
new file mode 100644
index 0000000..a1071a5
--- /dev/null
+++ b/docs/evidence/agent-first/semantic-review.json
@@ -0,0 +1,46 @@
+{
+ "summary": {
+ "requested": 1,
+ "completed": 1,
+ "failed": 0,
+ "skipped": 0,
+ "input_tokens": 1879,
+ "output_tokens": 78
+ },
+ "results": [
+ {
+ "index": 0,
+ "ok": true,
+ "attempts": 1,
+ "seconds": 0.293,
+ "response": {
+ "model": "jev-1.14.0",
+ "answers": {
+ "agent_focus": {
+ "type": "choice",
+ "choice": "yes",
+ "confidence": 1.0,
+ "probabilities": {
+ "yes": 1.0,
+ "no": 0.0
+ }
+ },
+ "connection_claim": {
+ "type": "choice",
+ "choice": "honest_instructions",
+ "confidence": 1.0,
+ "probabilities": {
+ "claims_connected": 0.0,
+ "honest_instructions": 1.0,
+ "unclear": 0.0
+ }
+ }
+ },
+ "usage": {
+ "input_tokens": 1879,
+ "output_tokens": 78
+ }
+ }
+ }
+ ]
+}
diff --git a/scripts/experience-smoke.mjs b/scripts/experience-smoke.mjs
index c6ed2b3..1f73427 100644
--- a/scripts/experience-smoke.mjs
+++ b/scripts/experience-smoke.mjs
@@ -40,6 +40,9 @@ try {
const unsubscribe = () => () => {}
const bridge = {
getConfig: async () => config,
+ setConfig: async patch => { Object.assign(config, patch); return config },
+ mcpStatus: async () => ({ running: [], allTools: [] }),
+ connectInfo: async () => ({ mcpScript: '/synthetic/keepmind-mcp.mjs', memoryDir: '/synthetic/memory', repoUrl: null }),
crm: async action => { if (action !== 'snapshot') throw Error('Prévia somente leitura'); return { revision:0,space:'synthetic',contacts:[],interactions:[],commitments:[],opportunities:[],drafts:[],settings:{commercialEnabled:false,autoPrepare:true,allowAutomaticSend:false},insights:[],duplicates:[],merges:[],capabilities:{canWrite:false,canConfigure:false,canSend:false,boards:[{id:'personal',label:'Prévia'}]} } },
authState: async () => ({ needsSetup: false, user: { id: 'synthetic', name: 'Demo', email: 'demo@example.invalid' } }),
memorySecurityStatus: async () => ({ space: 'personal', configured: true, unlocked: true }),
@@ -74,8 +77,23 @@ try {
await page.getByText('Projeto sintético', { exact: true }).first().waitFor()
await page.screenshot({ path: `${artifacts}/desktop-hoje.png`, fullPage: true })
})
+ await check('Default neural background animates without intercepting navigation and honors reduced motion', async () => {
+ await page.emulateMedia({ reducedMotion: 'no-preference' })
+ const field = page.locator('canvas.neural-field')
+ await field.waitFor()
+ assert.equal(await field.getAttribute('aria-hidden'), 'true')
+ assert.equal(await field.evaluate(el => getComputedStyle(el).pointerEvents), 'none')
+ const first = await field.evaluate(el => el.toDataURL())
+ // Wait for actual changed canvas content, not simply a mounted blank canvas.
+ await page.waitForFunction(first => document.querySelector('canvas.neural-field')?.toDataURL() !== first, first)
+ await go('Memória'); await go('Hoje')
+ await page.getByRole('heading', { name: 'Continue de onde parou' }).waitFor()
+ await page.screenshot({path:`${artifacts}/neural-background.png`})
+ await page.emulateMedia({ reducedMotion: 'reduce' })
+ await field.waitFor({state:'detached'})
+ })
await check('Capture failure, draft and retry', async () => {
- await page.locator('.sidebar-capture').click()
+ await page.keyboard.press('Control+Shift+m')
const dialog = page.getByRole('dialog', { name: 'Capturar uma ideia' })
const field = dialog.getByLabel('O que você quer lembrar?')
assert.equal(await field.evaluate(el => el === document.activeElement), true)
@@ -214,7 +232,7 @@ try {
assert(bounds.header.top >= 0 && bounds.footer.bottom <= height + 1, `Header/footer clipped at ${width}x${height}: ${JSON.stringify(bounds)}`)
assert(bounds.heading.top >= bounds.main.top && bounds.heading.bottom <= bounds.main.bottom, 'Heading clipped')
assert(!bounds.overflow, 'Horizontal overflow')
- for (const name of ['Voltar','Configurar depois','Configurar e continuar']) {
+ for (const name of ['Voltar','Explorar primeiro','Conectar meus agentes']) {
const box = await page.getByRole('button',{name,exact:true}).boundingBox()
assert(box && box.y >= 0 && box.y + box.height <= height + 1 && box.x >= 0 && box.x + box.width <= width + 1, `Action outside viewport: ${name}`)
}
@@ -222,11 +240,16 @@ try {
}
const focused = new Set()
for(let i=0;i<24;i++){await page.keyboard.press('Tab');focused.add(await page.evaluate(()=>document.activeElement?.textContent?.trim()))}
- for(const name of ['Voltar','Configurar depois','Configurar e continuar'])assert(focused.has(name),`Keyboard cannot reach ${name}`)
+ for(const name of ['Voltar','Explorar primeiro','Conectar meus agentes'])assert(focused.has(name),`Keyboard cannot reach ${name}`)
await page.emulateMedia({reducedMotion:'reduce'})
assert.equal(await page.locator('.wizard').evaluate(el=>getComputedStyle(el).animationName),'none')
- await page.getByRole('button',{name:'Configurar depois',exact:true}).click()
+ await page.getByRole('button',{name:'Voltar',exact:true}).click()
assert.equal(await page.evaluate(()=>document.activeElement?.id),'wizard-title')
+ await page.getByRole('button',{name:'Começar →',exact:true}).click()
+ assert.equal(await page.locator('textarea,input[type=password]').count(),0)
+ await page.getByRole('button',{name:'Conectar meus agentes',exact:true}).click()
+ await page.getByRole('heading',{name:'Conecte seus agentes',exact:true}).waitFor()
+ await page.getByRole('heading',{name:'Cursor Composer',exact:true}).waitFor()
})
assert.deepEqual(errors, [], `Browser errors: ${errors.join('; ')}`)
} catch (error) {
diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx
index 5bbccc2..7263f23 100644
--- a/src/renderer/src/App.tsx
+++ b/src/renderer/src/App.tsx
@@ -163,7 +163,7 @@ export default function App() {
return () => { window.removeEventListener('keydown', onKey); offCapture?.() }
}, [config?.onboardingDone, authState?.user, dialog])
- const ready = async (intent?: { view: 'chat' | 'graph' | 'memory' | 'settings'; query?: string; path?: string }) => {
+ const ready = async (intent?: { view: 'chat' | 'graph' | 'memory' | 'settings' | 'connectors'; query?: string; path?: string }) => {
await loadConfig()
if (intent) navigate(intent.view === 'graph' ? 'memory' : intent.view, { query: intent.query, path: intent.path })
}
@@ -188,16 +188,16 @@ export default function App() {
{view !== 'graph' && }
-
+
{vaultLocked &&
Desbloqueie sua memória para guardar e consultar informações. navigate('settings')}>Desbloquear
}
{(window as any).__KEEPMIND_DEMO__ &&
Prévia com dados fictícios. Use o aplicativo para guardar sua memória.
}
Abrindo {label.toLowerCase()}… }>
- {view === 'today' &&
setDialog('capture')} />}
+ {view === 'today' && setDialog('capture')} />}
{visited.includes('projects') && navigate('memory', { path })} unsupported={!!corp} initialProjectId={projectId} initialProjectRequest={projectRequest} onResume={text => navigate('chat', { query: text })} /> }
{visited.includes('relationships') && navigate('chat', { query: text })} onOpenSource={path => navigate('memory', { path })} />
}
{visited.includes('chat') && navigate('memory', { path })} />
}
diff --git a/src/renderer/src/components/Connectors.tsx b/src/renderer/src/components/Connectors.tsx
index 725e85e..b8299b5 100644
--- a/src/renderer/src/components/Connectors.tsx
+++ b/src/renderer/src/components/Connectors.tsx
@@ -104,9 +104,9 @@ export default function Connectors({ onActivity, onToast }: Props) {
Connect
-
Agentes
+
Conecte seus agentes
- Every agent that writes to memory leaves the file in Activity and a line in Today.
+ Conecte sua aplicação de IA para que os agentes consultem e registrem contexto. Confira os registros e as fontes em Hoje e Atividade.
setShowCustom(s => !s)}>
@@ -114,7 +114,8 @@ export default function Connectors({ onActivity, onToast }: Props) {
- {!info && Loading connection details…
}
+ As instruções abaixo não confirmam uma conexão ativa. Após configurar sua aplicação, peça ao agente para consultar a memória e confira o resultado. A proteção e as permissões são gerenciadas em Configurações.
+ {!info && Carregando instruções de conexão…
}
{agents.map(a => (
diff --git a/src/renderer/src/components/Login.tsx b/src/renderer/src/components/Login.tsx
index 6972b24..d16b578 100644
--- a/src/renderer/src/components/Login.tsx
+++ b/src/renderer/src/components/Login.tsx
@@ -23,7 +23,7 @@ export default function Login({ needsSetup, googleConfigured, onDone }: Props) {
else await window.sb.authLogin(email, password)
onDone()
} catch (e: any) {
- setError(e?.message ?? String(e))
+ setError(/Invalid email or password/i.test(String(e?.message ?? e)) ? 'E-mail ou senha incorretos. Confira os dados e tente novamente.' : mode === 'register' ? 'Não foi possível criar a conta. Confira os dados e tente novamente.' : 'Não foi possível entrar. Tente novamente.')
} finally { setBusy(false) }
}
@@ -33,7 +33,7 @@ export default function Login({ needsSetup, googleConfigured, onDone }: Props) {
await window.sb.authGoogleLogin()
onDone()
} catch (e: any) {
- setError(e?.message ?? String(e))
+ setError('Não foi possível entrar com o Google. Tente novamente.')
setGoogleWaiting(false)
}
}
@@ -73,7 +73,7 @@ export default function Login({ needsSetup, googleConfigured, onDone }: Props) {
onKeyDown={e => e.key === 'Enter' && submit()} />
- {error && {error}
}
+ {error && {error}
}
{busy ? 'WORKING…' : mode === 'register' ? 'CREATE ACCOUNT' : 'SIGN IN'}
diff --git a/src/renderer/src/components/Memory.tsx b/src/renderer/src/components/Memory.tsx
index 59bf849..aded4ba 100644
--- a/src/renderer/src/components/Memory.tsx
+++ b/src/renderer/src/components/Memory.tsx
@@ -127,7 +127,7 @@ export default function Memory({ compact = false, initialRequest, refreshToken,
const hasQuery = query.trim().length >= 2
return
- {!compact &&
Seu conhecimento
Memória Encontre o que você guardou e confira a fonte completa.
Explorar conexões Capturar
}
+ {!compact &&
Seu conhecimento
Memória Consulte o contexto registrado e confira a fonte completa.
Explorar conexões Capturar
}
{compact ? 'Buscar na memória' : 'O que você quer encontrar?'} { setQuery(e.target.value); setSelected(null) }} placeholder="Busque um assunto ou pergunte o que era válido em uma data…" />
{searchMode &&
{searchMode}
}
{notice &&
{notice}
}
@@ -135,7 +135,7 @@ export default function Memory({ compact = false, initialRequest, refreshToken,
{state === 'loading' && {hasQuery ? 'Buscando na memória…' : 'Carregando…'}
}
{state === 'error' && A memória não pôde ser consultada. Isso não significa que ela esteja vazia.
setRetry(r => r + 1)}>Tentar novamente }
- {state === 'ready' && !hits.length && {hasQuery ? 'Nenhuma memória encontrada para essa busca.' : compact ? 'Digite pelo menos duas letras para buscar.' : query ? 'Digite pelo menos duas letras para buscar.' : 'Sua memória começa com uma primeira ideia.'}
{hasQuery ? 'Tente outro termo ou guarde o contexto que está faltando.' : 'Você pode guardar um fato, um objetivo ou uma ideia.'}
Capturar uma ideia }
+ {state === 'ready' && !hits.length && {hasQuery ? 'Nenhuma memória encontrada para essa busca.' : compact ? 'Digite pelo menos duas letras para buscar.' : query ? 'Digite pelo menos duas letras para buscar.' : 'Ainda não há contexto registrado.'}
{hasQuery ? 'Tente outro termo ou confira se o agente registrou esse contexto.' : 'Os agentes conectados podem registrar decisões e resultados durante o trabalho.'}
}
{state === 'ready' && hits.length > 0 && {hits.length} {hasQuery ? 'resultado(s)' : 'arquivo(s) disponíveis'}
}
{hits.slice(0, visibleCount).map((hit, i) => { focusSource.current = true; setSelected(hit.path) }} aria-pressed={selected === hit.path} disabled={saving}>{sourceLabel(hit.path, hit.title)} {hit.snippet && {hit.snippet} }{hit.path} )}
{hits.length > visibleCount && setVisibleCount(n => n + 50)}>Mostrar mais ({hits.length - visibleCount} restantes) }
diff --git a/src/renderer/src/components/MemorySecurity.tsx b/src/renderer/src/components/MemorySecurity.tsx
index 797033e..68d6c30 100644
--- a/src/renderer/src/components/MemorySecurity.tsx
+++ b/src/renderer/src/components/MemorySecurity.tsx
@@ -59,7 +59,8 @@ export default function MemorySecurity({ onStatusChange, setupOnly = false, onBl
finally { inFlight.current = false; setBusy(false) }
}
return
-
{setupOnly ? 'Proteja sua memória antes de guardar' : 'Proteção da memória'}
+
{setupOnly ? 'Configure a proteção da memória' : 'Proteção da memória'}
+
A criptografia protege o contexto registrado pelos agentes. Esta senha desbloqueia a memória; ela não é uma chave de API da sua aplicação de IA.
{status ? status.unlocked ? 'Memória desbloqueada.' : 'Memória bloqueada.' : 'Verificando a proteção da memória…'}
{recovery ?
Guarde esta chave de recuperação em um local seguro, fora do aplicativo. Ela é exibida apenas agora. Sem a senha e a chave, você poderá perder o acesso aos dados.
diff --git a/src/renderer/src/components/NeuralField.tsx b/src/renderer/src/components/NeuralField.tsx
index 785bfe2..505deb7 100644
--- a/src/renderer/src/components/NeuralField.tsx
+++ b/src/renderer/src/components/NeuralField.tsx
@@ -55,12 +55,12 @@ export default function NeuralField({ activity = 0 }: { activity?: number }) {
canvas.width = Math.max(1, Math.floor(w * scale))
canvas.height = Math.max(1, Math.floor(h * scale))
ctx.setTransform(scale, 0, 0, scale, 0, 0)
- const count = Math.min(130, Math.max(60, Math.floor((w * h) / 16000)))
+ const count = Math.min(96, Math.max(36, Math.floor((w * h) / 16000)))
neurons = Array.from({ length: count }, () => ({
x: Math.random() * w,
y: Math.random() * h,
- vx: (Math.random() - 0.5) * 0.28,
- vy: (Math.random() - 0.5) * 0.28,
+ vx: (Math.random() - 0.5) * 0.18,
+ vy: (Math.random() - 0.5) * 0.18,
r: 1.3 + Math.random() * 1.8,
phase: Math.random() * Math.PI * 2,
charge: Math.random()
@@ -87,14 +87,14 @@ export default function NeuralField({ activity = 0 }: { activity?: number }) {
const fire = (from: number, chained: boolean) => {
const outs = neighbors[from]
- if (!outs?.length) return
+ if (!outs?.length || sparks.length >= 20) return
const b = outs[Math.floor(Math.random() * outs.length)]
if (sparks.some(s => s.a === from && s.b === b)) return
sparks.push({
a: from,
b,
t: 0,
- speed: (chained ? 0.0034 : 0.0022) + Math.random() * 0.0016,
+ speed: (chained ? 0.0010 : 0.0007) + Math.random() * 0.0004,
chained
})
}
@@ -102,13 +102,16 @@ export default function NeuralField({ activity = 0 }: { activity?: number }) {
const frame = (now: number) => {
if (document.hidden) { raf = 0; return }
raf = requestAnimationFrame(frame)
- const dt = Math.min(now - last, 32)
+ // Cap decorative rendering at 30 fps, including high-refresh displays.
+ if (now - last < 1000 / 30) return
+ const dt = Math.min(now - last, 50)
last = now
- if (now - neighborAt > 280) {
+ if (now - neighborAt > 600) {
rebuildNeighbors()
neighborAt = now
}
- const boost = 1 + actRef.current * 1.4
+ const activity = Math.max(0, Math.min(1, actRef.current))
+ const boost = 1 + activity * 0.35
ctx.clearRect(0, 0, w, h)
for (const n of neurons) {
@@ -118,7 +121,7 @@ export default function NeuralField({ activity = 0 }: { activity?: number }) {
if (n.x > w + 30) n.x = -30
if (n.y < -30) n.y = h + 30
if (n.y > h + 30) n.y = -30
- n.charge *= 0.985
+ n.charge *= Math.pow(0.985, dt / (1000 / 60))
}
ctx.lineWidth = 1
@@ -186,7 +189,7 @@ export default function NeuralField({ activity = 0 }: { activity?: number }) {
ctx.fill()
}
- const minSparks = 7 + Math.round(actRef.current * 6)
+ const minSparks = 4 + Math.round(activity * 3)
let guard = 0
while (sparks.length < minSparks && neurons.length > 4 && guard < 24) {
fire(Math.floor(Math.random() * neurons.length), false)
diff --git a/src/renderer/src/components/Today.tsx b/src/renderer/src/components/Today.tsx
index c922195..42a1f3a 100644
--- a/src/renderer/src/components/Today.tsx
+++ b/src/renderer/src/components/Today.tsx
@@ -1,10 +1,10 @@
import { useCallback, useEffect, useRef, useState } from 'react'
import { sourceLabel, updatedLabel } from '../lib/sourceLabels'
-import { IconChat, IconDoc, IconSparkle } from './icons'
+import { IconChat, IconPlug, IconSparkle } from './icons'
type View = 'projects' | 'chat' | 'graph' | 'automations' | 'connectors' | 'settings' | 'activity' | 'answer-benchmark' | 'relationships'
-type Props = { refreshToken?: number; onToast?: (m: string, k?: 'info' | 'error' | 'success') => void; onNavigate?: (view: View, detail?: { projectId?: string; query?: string; path?: string; contactId?: string }) => void; onCapture?: () => void }
+type Props = { personal?: boolean; refreshToken?: number; onToast?: (m: string, k?: 'info' | 'error' | 'success') => void; onNavigate?: (view: View, detail?: { projectId?: string; query?: string; path?: string; contactId?: string }) => void; onCapture?: () => void }
type Entry = { ts: string | number; verb: string; sentence: string; path?: string }
type Pending = { id: string; name: string; instruction: string }
type Fact = { id: string; text: string; since: string; origin: string; source: string; previous: string }
@@ -13,7 +13,7 @@ type Data = { projects: Project[]; pending: Pending[]; facts: Fact[]; policy: {
const initial: Data = { projects: [], pending: [], facts: [], policy: null, ledger: [], health: null, sleeps: [], score: null }
const labels: Record
= { projects: 'projetos', pending: 'aprovações de automação', facts: 'propostas de fatos', policy: 'política', ledger: 'atividade', health: 'indicadores', sleeps: 'consolidação', score: 'verificações' }
-export default function Today({ onToast, onNavigate, onCapture, refreshToken }: Props) {
+export default function Today({ onToast, onNavigate, refreshToken, personal = true }: Props) {
const [crm, setCrm] = useState(null)
const [crmError, setCrmError] = useState(false)
const [crmLoading, setCrmLoading] = useState(false)
@@ -76,12 +76,12 @@ export default function Today({ onToast, onNavigate, onCapture, refreshToken }:
{Object.keys(errors).length > 0 && Algumas informações não puderam ser carregadas Indisponível: {(Object.keys(errors) as (keyof Data)[]).map(key => labels[key]).join(', ')}.
{ setLoading(true); void load() }}>Tentar novamente }
{data.projects.some(p => p.error) && Um ou mais projetos estão indisponíveis. Os demais continuam acessíveis em Projetos.
}
- Guardar uma ideia Uma decisão, promessa ou algo para lembrar.
+ onNavigate?.(personal ? 'connectors' : 'activity')}>{personal ? 'Conectar meus agentes' : 'Acompanhar atividade'} {personal ? 'Sua aplicação de IA consulta e registra contexto.' : 'Confira o que foi registrado no workspace.'}
onNavigate?.('chat', { query: 'O que posso retomar a partir da minha memória? Cite as fontes e diferencie decisões confirmadas de propostas.' })}>Encontrar contexto Prepare uma pergunta e confira as fontes.
onNavigate?.('relationships')}>Preparar um acompanhamento Reveja conversas e próximos contatos.
Retome seus projetos onNavigate?.('projects')}>Ver todos os projetos
- {loading && !project ? Carregando projetos…
: project ? {projects.slice(0, 3).map(project =>
{project.title} Objetivo: {project.objective || 'Ainda não definido'}
Próximo passo: {project.nextStep || 'Ainda não definido'}
onNavigate?.('projects', { projectId: project.id })}>Retomar projeto {updatedLabel(project.updatedAt)} )}
: !errors.projects && !data.projects.some(p => p.error) && Comece com algo que importa Registre uma ideia ou crie um projeto para ter um próximo passo à mão.
Fazer primeira captura onNavigate?.('projects')}>Criar projeto
}
+ {loading && !project ? Carregando projetos…
: project ? {projects.slice(0, 3).map(project =>
{project.title} Objetivo: {project.objective || 'Ainda não definido'}
Próximo passo: {project.nextStep || 'Ainda não definido'}
onNavigate?.('projects', { projectId: project.id })}>Retomar projeto {updatedLabel(project.updatedAt)} )}
: !errors.projects && !data.projects.some(p => p.error) && Seu próximo projeto começa na sua aplicação de IA Conecte seus agentes para consultar e registrar contexto durante o trabalho. Os projetos registrados no KeepMind aparecem aqui.
{personal && onNavigate?.('connectors')}>Configurar conexão } onNavigate?.('projects')}>Criar projeto
}
PRECISA DE VOCÊ
{reviews.map((r, i) => {r.project.title} {r.text}
onNavigate?.('projects', { projectId: r.project.id })}>Abrir revisão )}
@@ -92,7 +92,7 @@ export default function Today({ onToast, onNavigate, onCapture, refreshToken }:
{(crm || crmError || crmLoading) && RELACIONAMENTOS
Próximos contatos {crmLoading ?
Carregando…
: crmError ? <>
Não foi possível carregar os acompanhamentos.
void loadCrm()}>Tentar novamente > : <>{(crm?.insights ?? []).slice(0, 3).map((item: any, i: number) =>
{item.text}
{item.contactId &&
onNavigate?.('relationships', { contactId: item.contactId })}>Ver contexto }
)}{!crm?.insights?.length &&
Nenhum acompanhamento pendente agora.
}
onNavigate?.('relationships')}>Abrir relacionamentos >}
}
RESULTADOS RECENTES
- {data.ledger.length > 0 ? {data.ledger.slice(0, 8).map((e, i) =>
{e.sentence} {new Date(e.ts).toLocaleString('pt-BR')}{e.path ? ` · Fonte: ${sourceLabel(e.path)}` : ''} {e.path && onNavigate?.('graph', { path: e.path })}>Consultar fonte }
)}
: !loading && !errors.ledger && Os resultados aparecerão aqui quando houver atividade.
Registrar uma ideia }
+ {data.ledger.length > 0 ? {data.ledger.slice(0, 8).map((e, i) =>
{e.sentence} {new Date(e.ts).toLocaleString('pt-BR')}{e.path ? ` · Fonte: ${sourceLabel(e.path)}` : ''} {e.path && onNavigate?.('graph', { path: e.path })}>Consultar fonte }
)}
: !loading && !errors.ledger && Os resultados aparecerão aqui quando houver atividade.
Depois de trabalhar com um agente conectado, confira aqui os registros e suas fontes.
}
Indicadores e diagnóstico Eventos recentes: {errors.ledger ? 'indisponível' : data.ledger.length} · Escritas em 7 dias: {health?.writes7d ?? '—'} · Arquivos: {health?.mdFiles ?? '—'} · Automações: {health ? `${health.automationsEnabled}/${health.automationsTotal}` : '—'}
{data.sleeps[0] &&
Última consolidação: {data.sleeps[0].date}
}{data.score?.last &&
Verificações de recuperação: {data.score.last.hit}/{data.score.last.total}
}
onNavigate?.('activity')}>Ver atividade
diff --git a/src/renderer/src/components/Wizard.tsx b/src/renderer/src/components/Wizard.tsx
index ddcda07..ca7f917 100644
--- a/src/renderer/src/components/Wizard.tsx
+++ b/src/renderer/src/components/Wizard.tsx
@@ -1,145 +1,65 @@
import { useEffect, useRef, useState } from 'react'
import KeepMindAvatar from './KeepMindAvatar'
-import MemorySecurity from './MemorySecurity'
-import { BrainMark, IconChat, IconDoc, IconPlug, IconSettings, IconShield, IconSparkle } from './icons'
+import { BrainMark, IconDoc, IconPlug, IconShield } from './icons'
interface Props {
config: any
- onDone: (intent?: { view: 'chat' | 'graph' | 'settings'; query?: string; path?: string }) => void | Promise
+ onDone: (intent?: { view: 'connectors' | 'settings'; query?: string; path?: string }) => void | Promise
onToast: (msg: string, kind?: 'info' | 'error' | 'success') => void
}
-const providers = [
- { id: 'local', name: 'Local', detail: 'No seu computador', requirement: 'Download de modelo', Icon: IconShield },
- { id: 'codex', name: 'Codex / ChatGPT', detail: 'Use sua sessão Codex', requirement: 'Login no Codex', Icon: IconChat },
- { id: 'claude-oauth', name: 'Claude (login)', detail: 'Conecte sua conta Claude', requirement: 'Token de acesso', Icon: IconChat },
- { id: 'anthropic', name: 'Claude API', detail: 'Use a API da Anthropic', requirement: 'Chave de API', Icon: IconPlug },
- { id: 'openai', name: 'OpenAI', detail: 'Use os modelos da OpenAI', requirement: 'Chave de API', Icon: IconPlug },
- { id: 'grok', name: 'Grok', detail: 'Use os modelos da xAI', requirement: 'Chave de API', Icon: IconSparkle },
- { id: 'gemini', name: 'Gemini', detail: 'Use os modelos do Google', requirement: 'Chave de API', Icon: IconSparkle },
- { id: 'ollama', name: 'Ollama', detail: 'Conecte seu próprio servidor', requirement: 'Ollama em execução', Icon: IconSettings }
-] as const
-const steps = ['Boas-vindas', 'Sua IA', 'Primeira ideia', 'Tudo pronto']
-const titles = ['Um lugar para lembrar e retomar', 'Escolha uma IA. Sua memória continua sua.', 'Guarde algo que importa para você', 'Sua memória já começou']
+const steps = ['Seu second brain', 'Conecte seus agentes']
+const titles = ['Sua IA continua de onde vocês pararam', 'Conecte a aplicação de IA que você já usa']
-
-export default function Wizard({ config, onDone, onToast }: Props) {
+export default function Wizard({ onDone }: Props) {
const [step, setStep] = useState(0)
+ const [busy, setBusy] = useState(false)
+ const [error, setError] = useState('')
+ const inFlight = useRef(false)
const heading = useRef(null)
const scrollArea = useRef(null)
useEffect(() => {
if (scrollArea.current) scrollArea.current.scrollTop = 0
heading.current?.focus({ preventScroll: true })
}, [step])
- const [provider, setProvider] = useState(config?.ai?.provider ?? 'local')
- const [apiKey, setApiKey] = useState(config?.ai?.apiKey ?? '')
- const [model, setModel] = useState(config?.ai?.model ?? '')
- const [baseUrl, setBaseUrl] = useState(config?.ai?.baseUrl ?? '')
- const providerDrafts = useRef>({})
- const [localStatus, setLocalStatus] = useState(null)
- const [progress, setProgress] = useState(null)
- const [codexStatus, setCodexStatus] = useState(null)
- const [busy, setBusy] = useState(false)
- const inFlight = useRef(false)
- const [error, setError] = useState('')
- const [capture, setCapture] = useState('')
- const [saved, setSaved] = useState('')
- const [memoryReady, setMemoryReady] = useState(null)
- const [securityError, setSecurityError] = useState('')
- const [securityBlocked, setSecurityBlocked] = useState(false)
- const checkMemory = async () => {
- if (typeof window.sb.memorySecurityStatus !== 'function' || typeof window.sb.securitySetup !== 'function' || typeof window.sb.securityUnlock !== 'function') { setMemoryReady(true); return }
- setSecurityError(''); setMemoryReady(null)
- try { const status = await window.sb.memorySecurityStatus(); setMemoryReady(status.unlocked === true) }
- catch { setSecurityError('Não foi possível verificar a proteção da memória.'); setMemoryReady(null) }
- }
- useEffect(() => {
- void checkMemory()
- window.sb.localLlmStatus().then(setLocalStatus).catch(() => {})
- window.sb.aiCodexStatus?.().then(setCodexStatus).catch(() => {})
- return window.sb.onLocalLlmProgress?.(setProgress)
- }, [])
- const selectProvider = (id: string) => {
- providerDrafts.current[provider] = { apiKey, model, baseUrl }
- const draft = providerDrafts.current[id] ?? { apiKey: id === config?.ai?.provider ? config?.ai?.apiKey ?? '' : '', model: id === config?.ai?.provider ? config?.ai?.model ?? '' : '', baseUrl: id === config?.ai?.provider ? config?.ai?.baseUrl ?? '' : '' }
- setProvider(id); setApiKey(draft.apiKey); setModel(draft.model); setBaseUrl(draft.baseUrl); setError('')
- }
- const configure = async () => {
+ const finish = async (connect: boolean) => {
if (inFlight.current) return
inFlight.current = true; setBusy(true); setError('')
try {
- if (provider === 'local') {
- const modelId = model || localStatus?.config?.modelId || 'qwen2.5-3b'
- await window.sb.updateLocalLlm({ modelId })
- await window.sb.localLlmEnsure(modelId)
- await window.sb.updateAi({ provider: 'local', model: modelId, apiKey: undefined, baseUrl: undefined })
- } else {
- const available: any = await window.sb.aiProviders()
- // Configuration patches merge in the store. Explicitly clear another
- // provider's credentials/endpoint rather than inheriting them silently.
- const patch = { provider, apiKey: apiKey || undefined, model: model || available.find((p: any) => p.id === provider)?.models?.[0], baseUrl: (provider === 'ollama' || provider === config?.ai?.provider) ? baseUrl || undefined : undefined }
- const result = await window.sb.aiTest(patch)
- if (!result.ok) throw new Error(result.error || 'Não foi possível conectar.')
- await window.sb.updateAi(patch)
- }
- onToast('Provedor configurado.', 'success'); setStep(2)
- } catch (e) { setError(String((e as Error)?.message ?? e)) }
- finally { inFlight.current = false; setBusy(false); setProgress(null) }
+ await window.sb.setConfig({ onboardingDone: true })
+ await onDone(connect ? { view: 'connectors' } : undefined)
+ } catch {
+ setError('Não foi possível concluir a configuração. Tente novamente.')
+ inFlight.current = false; setBusy(false)
+ }
}
- const save = async () => {
- const text = capture.trim()
- if (inFlight.current || text.length < 3 || memoryReady !== true) return
- inFlight.current = true; setBusy(true); setError('')
- try {
- const result = await window.sb.brainCapture(text)
- if (typeof result === 'string' && /escreva uma frase|could not|erro|error/i.test(result)) throw new Error(result)
- setSaved(text); setStep(3); onToast(typeof result === 'string' ? result : 'Captura salva.', 'success')
- } catch (e) { setError(String((e as Error)?.message ?? e)) }
- finally { inFlight.current = false; setBusy(false) }
- }
- const finish = async (intent?: { view: 'chat' | 'graph' | 'settings'; query?: string; path?: string }) => {
- if (inFlight.current) return
- inFlight.current = true; setBusy(true); setError('')
- try { await window.sb.setConfig({ onboardingDone: true }); await onDone(intent) }
- catch (e) { setError(String((e as Error)?.message ?? e)); inFlight.current = false; setBusy(false) }
- }
- const selected = providers.find(item => item.id === provider) ?? providers[0]
- const SelectedIcon = selected.Icon
return