Commit 8b0e346
committed
refactor: schema-driven prompting via Pydantic JSON Schema
Refactors prompting to be JSON-Schema-first. prompt_for_schema() now uses Pydantic model_json_schema() and tool schemas and Pydantic models go through the same prompting path. Removes the custom x-* hint fields and replaces them with schema-based prompting heuristics (including array-of-strings CSV input and optional object include gating). Fixes default rendering to distinguish “default key present” vs absent and renders defaults via json.dumps.
Adds validate_schema() for early JSON Schema validation, updates tools execute to fail fast on empty IDs and to accept string-encoded schemas when they decode to an object, and restores recursive dict key-type validation for nested Pydantic models. Updates tests accordingly and adjusts interrogate exclusions for generated cforge/_version.py. Cleans up .gitignore duplicates.1 parent d5e2042 commit 8b0e346
9 files changed
Lines changed: 393 additions & 187 deletions
File tree
- cforge
- commands/resources
- common
- tests
- commands/resources
- common
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
| |||
35 | 34 | | |
36 | 35 | | |
37 | 36 | | |
38 | | - | |
39 | 37 | | |
40 | 38 | | |
41 | 39 | | |
| |||
74 | 72 | | |
75 | 73 | | |
76 | 74 | | |
77 | | - | |
78 | 75 | | |
79 | | - | |
80 | 76 | | |
81 | 77 | | |
82 | 78 | | |
| |||
99 | 95 | | |
100 | 96 | | |
101 | 97 | | |
102 | | - | |
103 | 98 | | |
104 | 99 | | |
105 | 100 | | |
106 | 101 | | |
107 | 102 | | |
108 | 103 | | |
109 | | - | |
110 | 104 | | |
111 | 105 | | |
112 | 106 | | |
113 | 107 | | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | 108 | | |
118 | 109 | | |
119 | 110 | | |
120 | 111 | | |
121 | 112 | | |
122 | 113 | | |
123 | | - | |
124 | 114 | | |
125 | 115 | | |
126 | 116 | | |
| |||
165 | 155 | | |
166 | 156 | | |
167 | 157 | | |
168 | | - | |
169 | 158 | | |
170 | 159 | | |
171 | 160 | | |
| |||
199 | 188 | | |
200 | 189 | | |
201 | 190 | | |
202 | | - | |
203 | | - | |
204 | 191 | | |
205 | 192 | | |
206 | 193 | | |
| |||
231 | 218 | | |
232 | 219 | | |
233 | 220 | | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | 221 | | |
238 | 222 | | |
239 | 223 | | |
| |||
244 | 228 | | |
245 | 229 | | |
246 | 230 | | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | 231 | | |
251 | 232 | | |
252 | 233 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
| 22 | + | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
189 | 192 | | |
190 | | - | |
191 | 193 | | |
192 | 194 | | |
193 | 195 | | |
| |||
196 | 198 | | |
197 | 199 | | |
198 | 200 | | |
199 | | - | |
| 201 | + | |
200 | 202 | | |
201 | 203 | | |
202 | 204 | | |
| |||
212 | 214 | | |
213 | 215 | | |
214 | 216 | | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
215 | 225 | | |
216 | 226 | | |
217 | 227 | | |
| |||
0 commit comments