A copy is kept after this task ends. Agents in later chats can use it.
{targets.length === 0 ? (
There's no vault here you can save to.
) : (
targets.map((target) => (
void run(async () => {
await onSaveTo(saving, target.vault);
setSaving(null);
})
}
>
{target.icon}
{target.label}
{target.vault.name}
))
)}
{failure ? (
{failure}
) : null}
>
);
}
const selectable = (vaults ?? []).filter((vault) => vault.selectable);
const all = policy.mode === "all" && !narrowedByParent;
const toggle = (vault: SessionSecretsVaultRow) => {
const current = new Set(
(vaults ?? []).filter((each) => each.selected && each.selectable).map((each) => each.id),
);
if (current.has(vault.id)) current.delete(vault.id);
else current.add(vault.id);
return { mode: "selected" as const, vaultIds: [...current] };
};
return (
<>
{loading && !vaults ? (
) : error && !vaults ? (
{vaultErrorText(error, "Couldn't load secrets.")}
{onRetry ? (
Try again
) : null}
) : (
<>
{taskItems ? (
This task
{taskItems.length === 0 ? (
Logins an agent creates during this task show up here.
) : (
taskItems.map((item) => (
setSaving(item)}
>
{item.name}
Save to…
))
)}
) : null}
Vaults this chat can use
{narrowedByParent ? (
Narrowed by the parent session. Vaults it left out can't be added here.
) : (
void run(() =>
onPolicyChange(
all
? { mode: "selected", vaultIds: selectable.map((vault) => vault.id) }
: { mode: "all" },
),
)
}
>
All vaults
{all ? "Including vaults added later" : "Only the vaults checked below"}
)}
{(vaults ?? []).map((vault) => (
void run(() => onPolicyChange(toggle(vault)))}
>
{vault.name}
{!vault.selectable ? (
Not in parent
) : null}
{vault.selected ? : null}
))}
{!canEdit ? (
Only people who can control this chat change this.
) : null}
{failure ? (
{failure}
) : null}
{onManage ? (
<>
Manage secrets
>
) : null}
>
)}
>
);
}
/** The panel for a chat that exists, from its secrets view. */
export function sessionSecretsRows(
view: SessionSecretsView | null,
): SessionSecretsVaultRow[] | null {
return view ? view.reachableVaults : null;
}