nandi/oripublic Fork 0
2434cc7fb724f02b34c0189dfd5fb30c1a8a68e3
Commits
Clone
git clone https://git.rickub.com/nandi/ori.git
git clone ssh://git@rickub.com/nandi/ori.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

forked from bots-garden/ori

PermissionPrompt.tsx · 46 lines · 1.2 KBTypeScript Blame HistoryRaw
✨ Introduce new feature(s): ACP web client — Go backend (agent, bridge, httpserver, mockagent) + React SPA (Zed-like agent panel), tests, quality gate PASS 2434cc7 k33g yesterday1/**
2 * PermissionPrompt asks the user to approve or reject a sensitive agent
3 * action, offering exactly the options the agent proposed (allow once,
4 * always, reject, ...), like Zed's permission bar.
5 *
6 * @example
7 * <PermissionPrompt
8 * request={{ requestId: "perm-1", title: "Run `make test`", options: [
9 * { optionId: "allow", name: "Allow", kind: "allow_once" }] }}
10 * onRespond={(requestId, optionId) => console.log(requestId, optionId)}
11 * />
12 */
13
14import type { PermissionRequestState } from "../reducer";
15
16interface PermissionPromptProps {
17 request: PermissionRequestState;
18 onRespond: (requestId: string, optionId: string) => void;
19}
20
21export function PermissionPrompt({
22 request,
23 onRespond,
24}: PermissionPromptProps) {
25 return (
26 <div
27 className="permission"
28 role="alertdialog"
29 aria-label="permission request"
30 >
31 <p className="permission-title">🔐 {request.title}</p>
32 <div className="permission-options">
33 {request.options.map((option) => (
34 <button
35 key={option.optionId}
36 type="button"
37 className={`permission-option permission-${option.kind}`}
38 onClick={() => onRespond(request.requestId, option.optionId)}
39 >
40 {option.name}
41 </button>
42 ))}
43 </div>
44 </div>
45 );
46}