+ {JSON.stringify(value, null, 2)}
+
+ + {descriptor.sessionId} +
++ Session: {String(state.session?.status ?? 'unknown')} · Root turn:{' '} + {String(state.turn?.status ?? 'unknown')} · Connection:{' '} + {state.connection} +
+ {state.error && ( ++ {state.error} +
+ )} + {state.turn?.error != null && ( ++ {state.connection === 'connecting' + ? 'Loading session history…' + : state.session + ? 'No saved items yet.' + : 'Run this cell or Connect to load session history.'} +
+ )} + {state.items.map((item, index) => ( ++ Unsupported or malformed agent monitor output. Edit and rerun the cell. +
+ ) +} diff --git a/app/src/components/KeyVault/KeyVaultPanel.test.tsx b/app/src/components/KeyVault/KeyVaultPanel.test.tsx new file mode 100644 index 00000000..f0529b27 --- /dev/null +++ b/app/src/components/KeyVault/KeyVaultPanel.test.tsx @@ -0,0 +1,112 @@ +import { webcrypto } from 'node:crypto' +import { + cleanup, + fireEvent, + render, + screen, + waitFor, +} from '@testing-library/react' +import { afterEach, beforeEach, expect, it, vi } from 'vitest' + +import KeyVaultPanel from './KeyVaultPanel' +import { KeyVault, VAULT_STORAGE_KEY } from '../../lib/keyvault/store' + +beforeEach(() => { + localStorage.clear() + vi.stubGlobal('crypto', webcrypto) +}) +afterEach(() => { + cleanup() + vi.unstubAllGlobals() +}) + +it('loads saved values into a masked editor and clears drafts on cancel or lock', async () => { + const vault = new KeyVault() + await vault.unlock('long test passphrase', true) + await vault.saveKey('openai-api', 'saved-test-key') + render(+ Named keys for your notebook integrations. +
++ Encrypted in this browser for this Runme site. Keys are never included + in notebook files or Drive sync. +
+ {snapshot.status !== 'unlocked' ? ( + + ) : ( + <> + ++ Unlocked for this tab. Run only trusted browser JavaScript while + your keys are available. +
+{key}
++ Remove this saved key? Keep a copy if you will need it + again. +
+ + ++ No keys yet. Add your first named key below. +
+ )} + ++ Use in a browser JS cell: +
+
+ {'agents.setKey(keyvault.getKey("openai-api"))'}
+
+ >
+ )}
+ {error && (
+ + {error} +
+ )} + {notice && ( ++ {notice} +
+ )} +