MCPcopy Create free account
hub / github.com/astercloud/aster / approve

Function approve

ui/src/stores/approval.ts:37–68  ·  view source on GitHub ↗
(requestId: string)

Source from the content-addressed store, hash-verified

35 * 批准请求
36 */
37 const approve = async (requestId: string) => {
38 const request = pendingApprovals.value.get(requestId);
39 if (!request) {
40 console.warn(`Approval request ${requestId} not found`);
41 return;
42 }
43
44 // 记录到历史
45 approvalHistory.value.push({
46 ...request,
47 decision: "approved",
48 decidedAt: Date.now(),
49 });
50
51 // 发送到后端
52 const { getInstance } = useWebSocket();
53 const ws = getInstance();
54 if (ws) {
55 ws.send({
56 type: "permission_decision",
57 payload: {
58 request_id: requestId,
59 decision: "approve",
60 },
61 });
62 } else {
63 console.error("WebSocket not connected, cannot send approval decision");
64 }
65
66 // 从待审批列表中移除
67 pendingApprovals.value.delete(requestId);
68 };
69
70 /**
71 * 拒绝请求

Callers

nothing calls this directly

Calls 5

useWebSocketFunction · 0.90
getInstanceFunction · 0.85
getMethod · 0.45
sendMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected