Commit 233b388
committed
fix(appkit): apply review feedback to agents plugin
PR #304 agentic review applied (P1 + cheap P2):
- Approval gate now honours the modern `effect` field (write/update/
destructive), matching the documented contract on ToolAnnotations.
Previously a tool authored with `effect: "destructive"` and no legacy
`destructive: true` boolean bypassed the gate.
- Sub-agent tool calls share the parent's RunState, so the per-run
tool-call budget and the destructive-tool approval gate apply to
nested sub-agent calls — not only the top-level adapter.
- /invocations enforces `maxConcurrentStreamsPerUser`. Without this a
client could bypass the cap by switching from /chat to /invocations.
- /cancel uses a Zod schema instead of a raw `as` cast, matching the
validation pattern of the sibling routes.
- agents.reload() builds the registry into a fresh Map and only swaps
on success. A malformed markdown file no longer wipes the live
registry and breaks in-flight requests.
- consumeAdapterStream and normalizeToolResult are wired into the four
call sites that previously inlined the same accumulation /
serialization logic (top-level _streamAgent, runSubAgent,
dispatchToolCall, runAgent).
- load-agents.ts uses fs.promises so reload() does not block the event
loop.
- Pin js-yaml to 4.1.1 (drop the caret), matching the rest of appkit's
pinned deps.
Tests cover the approval-gate `effect` matrix (destructive/write/update
trigger; read/undefined skip), the deny path, the shared budget across
top-level + sub-agent dispatches, and the /invocations rate-limit gate.
Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>1 parent a20ab5e commit 233b388
8 files changed
Lines changed: 647 additions & 217 deletions
File tree
- packages/appkit
- src
- core/agent
- plugins/agents
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
106 | | - | |
| 107 | + | |
107 | 108 | | |
108 | 109 | | |
109 | 110 | | |
| |||
138 | 139 | | |
139 | 140 | | |
140 | 141 | | |
141 | | - | |
142 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
143 | 150 | | |
144 | | - | |
145 | | - | |
146 | 151 | | |
147 | 152 | | |
148 | 153 | | |
| |||
174 | 179 | | |
175 | 180 | | |
176 | 181 | | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
181 | 192 | | |
182 | | - | |
183 | 193 | | |
184 | 194 | | |
185 | 195 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
81 | | - | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| |||
0 commit comments