Commit 239b705
committed
types(mcp): narrow the CLI's closed-set guards, and discover the contract's modules (#9773)
Two things the merge with #9762 exposed, now that the action-class and autonomy-level lists are
readonly literal tuples rather than `string[]`:
- The CLI validated `<action>` and `<level>` with `LIST.includes(value)` and then passed the still-
`string` value to a typed request. `includes` returns a boolean and narrows nothing, so the check
ran and the type system learned nothing from it. `isOneOf` is the same check written as a type
predicate, so a validated value arrives at the API as the union it was just proved to be.
- The generator resolved a copied schema's constants against a hardcoded pair of contract modules.
That is a hand-maintained list by another name, and it fails in the quietest way available: a
constant that moves between modules yields a generated file referencing a name it never imported.
It now reads the contract's source directory, so a constant can move -- or a module can appear --
without this script knowing anything about it.
Regression test pins the discovery against wherever PUBLIC_SURFACE_SKIP_REASONS lives, rather than
against the module it happens to live in today.1 parent 6cd6fa3 commit 239b705
4 files changed
Lines changed: 60 additions & 12 deletions
File tree
- packages
- loopover-contract/src
- loopover-mcp/bin
- scripts
- test/unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
581 | 582 | | |
582 | 583 | | |
583 | 584 | | |
584 | | - | |
585 | | - | |
| 585 | + | |
| 586 | + | |
586 | 587 | | |
587 | 588 | | |
588 | 589 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2801 | 2801 | | |
2802 | 2802 | | |
2803 | 2803 | | |
2804 | | - | |
| 2804 | + | |
2805 | 2805 | | |
2806 | 2806 | | |
2807 | 2807 | | |
| |||
2824 | 2824 | | |
2825 | 2825 | | |
2826 | 2826 | | |
2827 | | - | |
2828 | | - | |
| 2827 | + | |
| 2828 | + | |
2829 | 2829 | | |
2830 | 2830 | | |
2831 | 2831 | | |
| |||
4368 | 4368 | | |
4369 | 4369 | | |
4370 | 4370 | | |
| 4371 | + | |
| 4372 | + | |
| 4373 | + | |
| 4374 | + | |
| 4375 | + | |
| 4376 | + | |
| 4377 | + | |
| 4378 | + | |
| 4379 | + | |
| 4380 | + | |
| 4381 | + | |
4371 | 4382 | | |
4372 | 4383 | | |
4373 | 4384 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
| 313 | + | |
318 | 314 | | |
319 | 315 | | |
320 | 316 | | |
| |||
426 | 422 | | |
427 | 423 | | |
428 | 424 | | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
429 | 446 | | |
430 | 447 | | |
431 | 448 | | |
432 | 449 | | |
433 | 450 | | |
434 | 451 | | |
| 452 | + | |
435 | 453 | | |
436 | | - | |
| 454 | + | |
437 | 455 | | |
438 | 456 | | |
| 457 | + | |
439 | 458 | | |
440 | 459 | | |
441 | 460 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
149 | 151 | | |
150 | 152 | | |
151 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
152 | 169 | | |
153 | 170 | | |
154 | 171 | | |
| |||
0 commit comments