Views
No views yet
tool_spec(工具定义),tool_call(待审批的Agent工具调用请求),risk_profile(工具执行可能带来的风险),task_context(当前任务简介,包含任务目标、执行状态),session_evidence(包含近几次工具使用状态和loop_guard),user_policy(用户自定义审批策略)的提示词,并返回包含审批结果的JSON
典型的输入可能类似于:1{
2 "schema_version": "tinadec.approval_request.v1",
3 "request_id": "apr_v4_004",
4 "tool_spec": {
5 "tool_id": "git_merge",
6 "summary": "执行 Git 合并操作,支持 start/continue/abort。",
7 "params_summary": {
8 "repository_path": "可选,仓库路径",
9 "action": "start | continue | abort,默认 start",
10 "source": "合并来源分支或引用",
11 "target": "目标分支,默认当前分支",
12 "strategy": "合并策略,默认 recursive"
13 },
14 "constraints": [
15 "mutating=true",
16 "remote_impact=false",
17 "requires_approval=true",
18 "confirm_field=confirm_merge"
19 ]
20 },
21 "tool_call": {
22 "provider_call_id": "call_v4_004",
23 "tool_id": "git_merge",
24 "params": {
25 "repository_path": "d:/DevData/TinadecOffice",
26 "action": "start",
27 "source": "origin/main",
28 "target": "feat/mcp-merge",
29 "strategy": "recursive"
30 }
31 },
32 "risk_profile": {
33 "tool_id": "git_merge",
34 "risk": "medium",
35 "requires_approval": true,
36 "confirm_field": "confirm_merge",
37 "mutating": true,
38 "remote_impact": false,
39 "reversible": true,
40 "reversibility_note": "可 abort 撤销",
41 "domain": "git",
42 "source": "tinadec_tools",
43 "capabilities": ["git.write", "git.merge"],
44 "hard_rules": {
45 "matched_deny": [],
46 "matched_auto_approve": [],
47 "must_deny": false
48 }
49 },
50 "task_context": {
51 "goal": "通过 MCP 工具辅助解决跨仓库合并冲突",
52 "current_task_node": "合并 main 到 feat/mcp-merge",
53 "task_status": "in_progress",
54 "progress_summary": "本地有 3 个未提交改动,需要先处理",
55 "allowed_scope": {
56 "paths": ["src/"],
57 "branches": ["feat/mcp-merge"],
58 "remotes": ["origin"]
59 }
60 },
61 "session_evidence": {
62 "recent_tool_results": [
63 {
64 "tool_id": "git_status",
65 "success": true,
66 "summary": "branch=feat/mcp-merge, 3 unstaged files, 0 staged"
67 },
68 {
69 "tool_id": "git_diff",
70 "success": true,
71 "summary": "3 files modified: src/core/SessionManager.cs, src/web/App.tsx, tests/SessionTests.cs"
72 }
73 ],
74 "loop_guard": {
75 "should_continue": true,
76 "reason": "ok",
77 "repeat_call_count": 0,
78 "iteration": 2,
79 "tool_call_total": 3
80 },
81 "consecutive_failures": 0
82 },
83 "user_policy": {
84 "delegation_mode": true,
85 "delegation_level": "medium",
86 "auto_approve_hints": ["本地 git 操作"],
87 "never_auto": ["git_push", "mcp_invoke"],
88 "max_auto_risk": "medium",
89 "notes": "合并前先提交本地改动"
90 },
91 "model_constraints": {
92 "allowed_decisions": ["approve", "deny"],
93 "output_schema": "tinadec.approval_decision.v1",
94 "deny_when_uncertain": true
95 }
96}[!TIP] 事实上,完整的输入包含系统提示词和此处的输入JSON,并应采用ChatML格式传入和处理符号转义,这里仅作示例,完整的原始输入可以参考此处
1 "user_policy": {
2 "delegation_mode": true,
3 "delegation_level": "medium",
4 "auto_approve_hints": ["..."],
5 "never_auto": ["...", "..."],
6 "max_auto_risk": "medium",
7 "notes": "..."
8 }delegation_level,自动批准auto_approve_hints,从不自动批准never_auto和最高自动批准的工具风险等级max_auto_risknotes字段,允许使用自然语言控制审批策略,如“严格审查远程操作”,“暂时不要push,只在本地commit”,“放行所有可回滚操作”...模型会遵守这些指令,并将其视为最高优先级(前提是Core没有直接在审批前拦截这个请求)
[!TIP] 不建议在notes中写入过多的规则,这样会导致