Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

feat(sdk): add exec approval action types for client integration

yushend93004025832
diff --git a/packages/sdk/src/actions/exec-approval.ts b/packages/sdk/src/actions/exec-approval.ts
new file mode 100644
index 0000000000..80fb44d5c2
--- /dev/null
+++ b/packages/sdk/src/actions/exec-approval.ts
@@ -0,0 +1,40 @@
+/**
+ * Exec Approval Actions — WebSocket protocol types for exec approval flow
+ */
+
+/** Action name for exec approval requests (Hub → Client) */
+export const ExecApprovalRequestAction = "exec-approval-request" as const;
+
+/** Approval decision types */
+export type ApprovalDecision = "allow-once" | "allow-always" | "deny";
+
+/** Payload for exec approval request (Hub → Client) */
+export interface ExecApprovalRequestPayload {
+ /** Unique approval ID */
+ approvalId: string;
+ /** Agent that initiated the command */
+ agentId: string;
+ /** Shell command requiring approval */
+ command: string;
+ /** Working directory */
+ cwd?: string;
+ /** Evaluated risk level */
+ riskLevel: "safe" | "needs-review" | "dangerous";
+ /** Reasons for the risk assessment */
+ riskReasons: string[];
+ /** When this approval expires (ms since epoch) */
+ expiresAtMs: number;
+}
+
+/** Params for resolveExecApproval RPC (Client → Hub) */
+export interface ResolveExecApprovalParams {
+ /** The approval ID to resolve */
+ approvalId: string;
+ /** User decision */
+ decision: ApprovalDecision;
+}
+
+/** Result of resolveExecApproval RPC */
+export interface ResolveExecApprovalResult {
+ ok: boolean;
+}
diff --git a/packages/sdk/src/actions/index.ts b/packages/sdk/src/actions/index.ts
index 045254643f..2265d893af 100644
--- a/packages/sdk/src/actions/index.ts
+++ b/packages/sdk/src/actions/index.ts
@@ -39,3 +39,11 @@ export {
extractTextFromEvent,
extractThinkingFromEvent,
} from "./stream";
+
+export {
+ ExecApprovalRequestAction,
+ type ApprovalDecision,
+ type ExecApprovalRequestPayload,
+ type ResolveExecApprovalParams,
+ type ResolveExecApprovalResult,
+} from "./exec-approval";