agent-control-plane-core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +194 -0
- package/bin/amp-hook.mjs +21 -0
- package/bin/claude-hook.mjs +20 -0
- package/bin/codex-hook.mjs +20 -0
- package/bin/gemini-hook.mjs +19 -0
- package/bin/hook-runtime.mjs +69 -0
- package/package.json +109 -0
- package/src/adapters/amp.mjs +82 -0
- package/src/adapters/claude.mjs +227 -0
- package/src/adapters/codex.mjs +149 -0
- package/src/adapters/gemini.mjs +175 -0
- package/src/conformance.mjs +121 -0
- package/src/control-plane.mjs +299 -0
- package/src/fixtures/amp.json +121 -0
- package/src/fixtures/claude.json +328 -0
- package/src/fixtures/codex.json +222 -0
- package/src/fixtures/gemini.json +187 -0
- package/src/index.mjs +17 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
{
|
|
2
|
+
"agent": "gemini",
|
|
3
|
+
"cases": [
|
|
4
|
+
{
|
|
5
|
+
"name": "BeforeTool run_shell_command, full meta, all verdicts",
|
|
6
|
+
"native": {
|
|
7
|
+
"hook_event_name": "BeforeTool",
|
|
8
|
+
"session_id": "g1",
|
|
9
|
+
"cwd": "/w",
|
|
10
|
+
"transcript_path": "/t.json",
|
|
11
|
+
"timestamp": "2026-01-01T00:00:00Z",
|
|
12
|
+
"tool_name": "run_shell_command",
|
|
13
|
+
"tool_input": {
|
|
14
|
+
"command": "echo hi"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"event": {
|
|
18
|
+
"schema_version": 1,
|
|
19
|
+
"event": "pre_tool",
|
|
20
|
+
"tool": "run_shell_command",
|
|
21
|
+
"input": {
|
|
22
|
+
"command": "echo hi"
|
|
23
|
+
},
|
|
24
|
+
"this_call_vetoable": true,
|
|
25
|
+
"meta": {
|
|
26
|
+
"agent": "gemini",
|
|
27
|
+
"native_event": "BeforeTool",
|
|
28
|
+
"integration_mode": "external_hook",
|
|
29
|
+
"primary_gate_present": true,
|
|
30
|
+
"passthrough": {
|
|
31
|
+
"timestamp": "2026-01-01T00:00:00Z"
|
|
32
|
+
},
|
|
33
|
+
"session_id": "g1",
|
|
34
|
+
"cwd": "/w",
|
|
35
|
+
"transcript_path": "/t.json"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"render": {
|
|
39
|
+
"allow": {
|
|
40
|
+
"verdict": {
|
|
41
|
+
"decision": "allow"
|
|
42
|
+
},
|
|
43
|
+
"native": {
|
|
44
|
+
"transport": "external_hook",
|
|
45
|
+
"exit_code": 0,
|
|
46
|
+
"enforced": false
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"deny": {
|
|
50
|
+
"verdict": {
|
|
51
|
+
"decision": "deny",
|
|
52
|
+
"reason": "blocked destructive command"
|
|
53
|
+
},
|
|
54
|
+
"native": {
|
|
55
|
+
"transport": "external_hook",
|
|
56
|
+
"exit_code": 2,
|
|
57
|
+
"enforced": true
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"ask": {
|
|
61
|
+
"verdict": {
|
|
62
|
+
"decision": "ask",
|
|
63
|
+
"reason": "confirm"
|
|
64
|
+
},
|
|
65
|
+
"native": {
|
|
66
|
+
"transport": "external_hook",
|
|
67
|
+
"exit_code": 0,
|
|
68
|
+
"enforced": false,
|
|
69
|
+
"stdout": {
|
|
70
|
+
"decision": "deny",
|
|
71
|
+
"reason": "confirm"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"mutation": {
|
|
76
|
+
"verdict": {
|
|
77
|
+
"decision": "allow",
|
|
78
|
+
"mutated_input": {
|
|
79
|
+
"command": "echo safe"
|
|
80
|
+
},
|
|
81
|
+
"additional_context": "normalized"
|
|
82
|
+
},
|
|
83
|
+
"native": {
|
|
84
|
+
"transport": "external_hook",
|
|
85
|
+
"exit_code": 0,
|
|
86
|
+
"enforced": false,
|
|
87
|
+
"stdout": {
|
|
88
|
+
"hookSpecificOutput": {
|
|
89
|
+
"tool_input": {
|
|
90
|
+
"command": "echo safe"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"systemMessage": "normalized"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"name": "BeforeTool bare, mcp_context + original_request_name pass through",
|
|
101
|
+
"native": {
|
|
102
|
+
"hook_event_name": "BeforeTool",
|
|
103
|
+
"tool_name": "read_file",
|
|
104
|
+
"tool_input": {
|
|
105
|
+
"path": "/etc/hosts"
|
|
106
|
+
},
|
|
107
|
+
"mcp_context": {
|
|
108
|
+
"server": "fs"
|
|
109
|
+
},
|
|
110
|
+
"original_request_name": "fs__read_file"
|
|
111
|
+
},
|
|
112
|
+
"event": {
|
|
113
|
+
"schema_version": 1,
|
|
114
|
+
"event": "pre_tool",
|
|
115
|
+
"tool": "read_file",
|
|
116
|
+
"input": {
|
|
117
|
+
"path": "/etc/hosts"
|
|
118
|
+
},
|
|
119
|
+
"this_call_vetoable": true,
|
|
120
|
+
"meta": {
|
|
121
|
+
"agent": "gemini",
|
|
122
|
+
"native_event": "BeforeTool",
|
|
123
|
+
"integration_mode": "external_hook",
|
|
124
|
+
"primary_gate_present": true,
|
|
125
|
+
"passthrough": {
|
|
126
|
+
"mcp_context": {
|
|
127
|
+
"server": "fs"
|
|
128
|
+
},
|
|
129
|
+
"original_request_name": "fs__read_file"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"render": {
|
|
134
|
+
"allow": {
|
|
135
|
+
"verdict": {
|
|
136
|
+
"decision": "allow"
|
|
137
|
+
},
|
|
138
|
+
"native": {
|
|
139
|
+
"transport": "external_hook",
|
|
140
|
+
"exit_code": 0,
|
|
141
|
+
"enforced": false
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"name": "AfterTool folds tool_response into response",
|
|
148
|
+
"native": {
|
|
149
|
+
"hook_event_name": "AfterTool",
|
|
150
|
+
"tool_name": "run_shell_command",
|
|
151
|
+
"tool_input": {
|
|
152
|
+
"command": "ls"
|
|
153
|
+
},
|
|
154
|
+
"tool_response": "file1\nfile2"
|
|
155
|
+
},
|
|
156
|
+
"event": {
|
|
157
|
+
"schema_version": 1,
|
|
158
|
+
"event": "post_tool",
|
|
159
|
+
"tool": "run_shell_command",
|
|
160
|
+
"input": {
|
|
161
|
+
"command": "ls"
|
|
162
|
+
},
|
|
163
|
+
"this_call_vetoable": true,
|
|
164
|
+
"meta": {
|
|
165
|
+
"agent": "gemini",
|
|
166
|
+
"native_event": "AfterTool",
|
|
167
|
+
"integration_mode": "external_hook",
|
|
168
|
+
"primary_gate_present": true,
|
|
169
|
+
"passthrough": {}
|
|
170
|
+
},
|
|
171
|
+
"response": "file1\nfile2"
|
|
172
|
+
},
|
|
173
|
+
"render": {
|
|
174
|
+
"allow": {
|
|
175
|
+
"verdict": {
|
|
176
|
+
"decision": "allow"
|
|
177
|
+
},
|
|
178
|
+
"native": {
|
|
179
|
+
"transport": "external_hook",
|
|
180
|
+
"exit_code": 0,
|
|
181
|
+
"enforced": false
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
]
|
|
187
|
+
}
|
package/src/index.mjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agent-control-plane-core — vendor-neutral control-plane contract for coding agents.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports the normalized {@link ToolCallEvent}/{@link Verdict} contract, the
|
|
5
|
+
* transport-agnostic core (integration modes + {@link NativeResponse}), the
|
|
6
|
+
* reference adapters, and the conformance harness every adapter must pass.
|
|
7
|
+
* Individual adapters are also reachable at the subpath exports
|
|
8
|
+
* `agent-control-plane-core/claude`, `/codex`, `/amp`, `/gemini`, and the
|
|
9
|
+
* harness at `/conformance`.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export * from "./control-plane.mjs";
|
|
13
|
+
export { claudeAdapter, HookEvent } from "./adapters/claude.mjs";
|
|
14
|
+
export { codexAdapter } from "./adapters/codex.mjs";
|
|
15
|
+
export { ampAdapter } from "./adapters/amp.mjs";
|
|
16
|
+
export { geminiAdapter } from "./adapters/gemini.mjs";
|
|
17
|
+
export { runAdapterConformance } from "./conformance.mjs";
|