feat(hook): add pi support#1741
Conversation
|
@aeppling Any thoughts on this? |
Co-authored-by: Jean du Plessis <jeandp@gmail.com>
|
I tested Pi 0.74.0 locally with an RTK extension using the current Smoke results:
Two suggestions:
|
Hi @zicochaos , thanks for taking the time. Would you prefer me to completely remove the I was thinking about covering |
|
hope this one will really be merged 🙏 |
chore: sync the codebase after mergew
|
@aeppling @jeanduplessis Any chance to get this one reviewed and merged? |
|
Sorry mate, I'm not a maintainer on this repo. Just a curious bystander hoping this gets merged so I can stop using workarounds. |
|
@pszymkowiak Seems quite some people would like to see this one added, any chance to review it? |
|
@gitbluf just curious as a rtk and pi user, there's already a bunch of rtk extensions available. I've been using myself https://github.com/MasuRii/pi-rtk-optimizer for example. What's the benefit to make this integration in rtk vs a pi extension? thanks. |
Hi, probably best to see #401 |
|
Thanks @gitbluf — tested the install/uninstall lifecycle and the 1.
Please guard both directory creation and file removal behind 2. Add dry-run tests 3. semgrep Nit: the Ping me once dry-run is fixed. |
|
@pszymkowiak Thanks for the review, I've just pushed the new commit addressing your comments. |
|
@gitbluf conflicts |
Resolved. |
|
OOOOOH !!!! 🚀 🚀 🚀 |
|
Hey @gitbluf Thanks for this PR :) I've looked into PI agent as well as your code, here are some questions so we can implement this the best way possible. Blocking question: Cross-agent permission leakage (the extension imposes Claude's config on Pi)How permissions flow today: hooks/pi/rtk.ts shells to rtk rewrite, which calls permissions::check_command() → load_permission_rules(). That loader reads deny/ask/allow only from Claude Code settings and returns a verdict via exit code (2=deny, 3=ask/default, 0=allow+rewrite, 1=no-rewrite). The extension then maps exit 2 → { block: true }. Why this is wrong for Pi: Pi has no native permission model; its settings schema has no permissions/approval/allow/deny/sandbox option; gating only exists if an extension adds it apparenlty. So we apparently have two options here :
I could be wrong, never used PI Agent before, but it seems that for permissions it should be handled by extensions like https://github.com/MasuRii/pi-permission-system ? Happy to discuss about this and what should this PI extension responsible for. RTK should be as transparent as possible and reflect the CLI/agent native behavior on exit codes and permissions PI provide some tools to build permissions flows and ask user, but this can be delegated to various extensions. Note : i'm aware the permission leak issue is a current design issue in RTK and should be fixed, however we should not propagate this more. Once we have a proper solution for this i'll complete the review so we can merge this asap |
|
PR look clean and already had a review so this should be resolvable quickly for a release :) |
|
@aeppling Thanks for the review. You assumption is correct for the Pi agent that the handling of permissions should be handled by another extension(could be the one you shared). I would say that the main goals of this extensions should be to handle rewrites and stay as lean as possible as to not intervene with (or break) other extensions -- best effort. |
|
Thanks for the reply, agreed on the direction Here are some things to be addressed to match our approach Concrete change set for hooks/pi/rtk.ts:Remove the deny path (exit 2 → { block: true }) and the false/moot "Pi has no per-tool confirmation UI" line. lean/robust practicesPR #2022 add some interesting point for robust integration, these could serve the "stay lean / don't interfere" eg: Consider replacing the hand-rolled spawn+timeout+settle with pi.exec: it returns { stdout, stderr, code, killed } without throwing on non-zero exit, so you keep stdout for every exit code (including exit 3's rewrite) Standardize with codebase
Docs adjustement
PI Agent extensions compatibilitySince there are others extensions like the permissions one i shared, we should ensure RTK does not bypass any extensions. |
|
If anything i'm open to discuss here |
|
@aeppling That's really not nice of you...
4 peoples here are reviewed the code... And now you're asking to "lean/robust practices" at a PR opened yesterday... really ? |
|
@aeppling I'm using it with couple of other extensions atm, and current implementation doesn't colide with them. Currently afk, but I'll address your suggestions a bit later today, and ping you when it's done for the review. So just keep an eye out on the notification 🙂 Thanks |
|
@gitbluf thanks ! @borrougagnou I get the eagerness to ship this, and that's exactly why I want it consistent with the codebase and other integrations before it lands. This is the PR I'm moving forward with. Neither PR was mergeable exactly as-is, I started the review here, and the author is aware of original issue, Pi context, and the other PR. Thanks for the reviews and the patience. |
|
@aeppling Should be done now. |
|
Hey @gitbluf All look good to me, Will be released in RTK 0.42 |
Summary
Test plan
Issue #401
I also saw PR #750 is open, but it seems abandoned.