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

Function createHITLMiddleware

examples/human-in-the-loop/main.go:104–124  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

102}
103
104func createHITLMiddleware() (*middleware.HumanInTheLoopMiddleware, error) {
105 return middleware.NewHumanInTheLoopMiddleware(&middleware.HumanInTheLoopMiddlewareConfig{
106 // 配置需要审核的工具
107 InterruptOn: map[string]any{
108 "Bash": map[string]any{
109 "message": "⚠️ Shell 命令执行需要审核,请确认命令安全性",
110 "allowed_decisions": []string{"approve", "reject", "edit"},
111 },
112 "Write": map[string]any{
113 "message": "📝 文件写入操作需要审核",
114 "allowed_decisions": []string{"approve", "reject", "edit"},
115 },
116 "fs_delete": map[string]any{
117 "message": "🗑️ 文件删除操作需要审核",
118 "allowed_decisions": []string{"approve", "reject"},
119 },
120 },
121 // 智能审核处理器
122 ApprovalHandler: smartApprovalHandler,
123 })
124}
125
126func smartApprovalHandler(ctx context.Context, req *middleware.ReviewRequest) ([]middleware.Decision, error) {
127 fmt.Println("\n" + strings.Repeat("=", 70))

Callers 1

mainFunction · 0.85

Calls 1

Tested by

no test coverage detected