Commit 4266931
authored
refactor: consolidate permission boundaries into permission.ask hook (#29)
* refactor: consolidate permission boundaries into permission.ask hook
Loops are autonomous and cannot answer permission prompts. The previous
approach patched subagent session permissions after session.created
fired, which had race conditions and mutated session state for
observability only. Replace it with a synchronous decision at opencode's
permission.ask plugin hook so the loop's session ruleset and the hook
agree by construction.
Permission boundaries
- Add evaluatePermissionRuleset(rules, request) returning allow/deny/ask
by finding the last matching rule (mirrors opencode session-level
semantics)
- Add createLoopPermissionAskHook factory that resolves the active loop
via sessionLoopResolver and sets output.status based on
buildLoopPermissionRuleset()
- Wire 'permission.ask' into the plugin hooks in src/index.ts
- Remove createLoopPermissionRejectHook patching path and PATCHED_SESSIONS
cache; drop redundant patcher tests, add unit and integration tests for
the new hook
Plan metadata + loop name editing
- Unify plan title and loop name extraction into a single metadata helper
- Allow editing the loop name from the execute plan dialog, persisting
through tui-execution-preferences and loops-repo
- Add migration 131_add_loop_model_variants.sql for model variant storage
Housekeeping
- Bump version to 0.4.6
- Refresh README, docs/api, docs/architecture, docs/modules to match
- Add tui-models helpers and tui-client variants tests
* docs: update architecture and loop system documentation for permission boundaries refactor
* docs: update API documentation and media assets
* refactor: remove unused showLoops config option from TuiConfig
* refactor: remove dead code and shrink barrel exports
- Delete unused src/utils/plan-patch.ts and src/utils/session-stats.ts
- Remove unused zod and @opentui/keymap dependencies
- Drop unused exports: truncateMiddle, formatDuration (format.ts),
resolveCurrentGitBranch, fetchLoopByName
- Shrink barrel re-exports in src/loop/index.ts, src/storage/index.ts,
src/hooks/index.ts; consumers import from source modules directly
- Drop LOOP_BLOCKED_TOOLS and extractPlanTitle re-exports in plan-approval.ts
- Drop unused Phase type alias in src/loop/state.ts
- Drop ModelUsage and LoopSessionOutput re-exports in loop-format.ts
- Add test/utils/tui-client-variants.test.ts to vitest include
so buildPromptModelSelection coverage actually runs
- Update docs/modules.md to drop references to deleted files1 parent 2173c27 commit 4266931
104 files changed
Lines changed: 2362 additions & 6665 deletions
File tree
- docs
- api
- _media
- functions
- interfaces
- variables
- src
- agents
- constants
- hooks
- loop
- sandbox
- services
- storage
- migrations
- repos
- tools
- tui
- utils
- test
- helpers
- hooks
- loop
- sandbox
- services
- tools
- tui
- utils
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
41 | 49 | | |
42 | 50 | | |
43 | 51 | | |
| |||
213 | 221 | | |
214 | 222 | | |
215 | 223 | | |
| 224 | + | |
216 | 225 | | |
217 | 226 | | |
218 | 227 | | |
| |||
278 | 287 | | |
279 | 288 | | |
280 | 289 | | |
| 290 | + | |
281 | 291 | | |
282 | 292 | | |
283 | 293 | | |
| |||
432 | 442 | | |
433 | 443 | | |
434 | 444 | | |
435 | | - | |
| 445 | + | |
436 | 446 | | |
437 | 447 | | |
438 | 448 | | |
| |||
533 | 543 | | |
534 | 544 | | |
535 | 545 | | |
536 | | - | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
537 | 561 | | |
538 | | - | |
| 562 | + | |
539 | 563 | | |
540 | | - | |
541 | | - | |
| 564 | + | |
542 | 565 | | |
543 | | - | |
| 566 | + | |
| 567 | + | |
544 | 568 | | |
545 | 569 | | |
546 | 570 | | |
547 | | - | |
| 571 | + | |
548 | 572 | | |
549 | | - | |
550 | | - | |
551 | | - | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
552 | 576 | | |
553 | 577 | | |
554 | 578 | | |
555 | | - | |
| 579 | + | |
556 | 580 | | |
557 | 581 | | |
558 | 582 | | |
559 | | - | |
| 583 | + | |
560 | 584 | | |
561 | 585 | | |
562 | 586 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
2 | 6 | | |
3 | 7 | | |
4 | 8 | | |
5 | 9 | | |
6 | 10 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | | - | |
13 | | - | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
15 | 32 | | |
| 33 | + | |
16 | 34 | | |
17 | | - | |
18 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
19 | 42 | | |
20 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
21 | 50 | | |
0 commit comments