feat(desktop): per-persona isolated opencode credential store - #2
Conversation
Custom credentials isolate a persona's opencode harness auth store in a machine-local credential store; opt-in and secrets never live on the shareable persona definition. Spawn and model discovery share one isolation gate, the XDG roots are reserved keys, and the UI reaches the store only through the new IPC surface with an edit-mode-only section. Signed-off-by: Lorenzo Barasti <782103+lbarasti@users.noreply.github.com>
Match the Environment variables editor's visual vocabulary: row shells (PERSONA_FIELD_SHELL_CLASS, min-h-11 flex rows), font-mono control inputs, and the shared Button component (ghost icon remove, outline Add key) instead of hand-rolled buttons and a bespoke grid. Signed-off-by: Lorenzo Barasti <782103+lbarasti@users.noreply.github.com>
|
Review from Fizz (posted here at Lorenzo's request; findings noted for follow-up, not blocking the merge). Solid overall: the shared spawn/discovery gate, path-sanitized dir names with the hash suffix, 0600 atomic writes, and the path-based cores that make the logic testable are all nice calls. Observations, biggest first:
|
Summary
Per-persona custom credentials for opencode agents, isolated from the shareable persona definition:
managed_agents/credentials.rs): the per-persona opt-in and the secrets live in the desktop-managed store (XDG pair injected at spawn) — never on the persona definition, never inenv_vars, never in any persona payload.tauriAgentCredentials.ts→get/set/clear_persona_opencode_credential+set_persona_opencode_credentials_enabled): returns provider ids, paths, and the opt-in flag — never keys.apply_spawn_isolation/extend_env_with_isolation): discovery runs against the agent's isolated auth store, so the model list reflects what the agent can authenticate with; opt-in without a provisioned key falls back to the owner's default credentials. Both apply the XDG pair after user env; both keys are now reserved.PersonaOpencodeCredentialsSectionrenders only via thePersonaOpencodeCredentialsSlotgate (isOpencodeRuntime, never an inline id comparison) and only in edit mode. Dialog submit path refactored overpersonaSubmitBaseInput/personaNamePoolInputhelpers.Rule 18 in
desktop/src/features/agents/AGENTS.mddocuments the contract.Testing
cargo check/cargo test(managed_agents::credentialstests pass, including persona-id traversal rejection, deterministic dir naming, and opt-in marker round-trip)pnpm --dir desktop typecheck— clean🤖 Generated with opencode