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

protocol.ts · 104 lines · 2.5 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 * Wire contract with the ori backend, mirroring internal/bridge/protocol.go.
3 *
4 * ACP payloads (session updates, permission requests) arrive verbatim from
5 * the agent, so their shapes follow https://agentclientprotocol.com.
6 */
7
8/** An ACP content block; only text blocks are rendered in this version. */
9export interface AcpContentBlock {
10 type: string;
11 text?: string;
12 [key: string]: unknown;
13}
14
15/** One piece of tool-call output: nested content, a file diff, or a terminal. */
16export interface AcpToolCallContent {
17 type: string;
18 content?: AcpContentBlock;
19 path?: string;
20 oldText?: string | null;
21 newText?: string;
22 terminalId?: string;
23}
24
25/** A file location a tool call touches (Zed uses this to "follow the agent"). */
26export interface AcpToolCallLocation {
27 path: string;
28 line?: number;
29}
30
31/** One entry of the agent's execution plan. */
32export interface AcpPlanEntry {
33 content: string;
34 priority: string;
35 status: string;
36}
37
38/** One choice offered by a permission request. */
39export interface AcpPermissionOption {
40 optionId: string;
41 name: string;
42 kind: string;
43}
44
45/** The ACP payload of a session/request_permission call. */
46export interface AcpPermissionRequest {
47 sessionId?: string;
48 toolCall?: {
49 toolCallId?: string;
50 title?: string | null;
51 kind?: string;
52 [key: string]: unknown;
53 };
54 options?: AcpPermissionOption[];
55}
56
57/**
58 * One ACP session/update notification payload, discriminated by
59 * sessionUpdate. Message/thought chunks use `content` as a single block;
60 * tool calls use it as an array of AcpToolCallContent.
61 */
62export interface AcpSessionUpdate {
63 sessionUpdate: string;
64 content?: AcpContentBlock | AcpToolCallContent[];
65 toolCallId?: string;
66 title?: string | null;
67 kind?: string;
68 status?: string;
69 locations?: AcpToolCallLocation[];
70 entries?: AcpPlanEntry[];
71 [key: string]: unknown;
72}
73
74/** A message sent by the server over the WebSocket. */
75export interface ServerMessage {
76 type:
77 | "hello"
78 | "user_message"
79 | "session_update"
80 | "permission_request"
81 | "permission_resolved"
82 | "turn_started"
83 | "turn_ended"
84 | "error";
85 sessionId?: string;
86 turnActive?: boolean;
87 update?: AcpSessionUpdate;
88 requestId?: string;
89 request?: AcpPermissionRequest;
90 text?: string;
91 stopReason?: string;
92 message?: string;
93}
94
95/** A message the browser sends to the server. */
96export type ClientMessage =
97 | { type: "prompt"; text: string }
98 | { type: "cancel" }
99 | {
100 type: "permission_response";
101 requestId: string;
102 optionId?: string;
103 cancelled?: boolean;
104 };