-
Notifications
You must be signed in to change notification settings - Fork 3.8k
docs(pi): describe handler folder layout #6367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
62d20ff
cc38817
a685801
d411532
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # PI Handler | ||
|
|
||
| Implements the PI block executor. Each sub-mode delegates to a dedicated backend while sharing common infrastructure. | ||
|
|
||
| ## Folder layout | ||
|
|
||
| | Path | Responsibility | | ||
| | --- | --- | | ||
| | `pi-handler.ts` | Single dispatcher — reads the block's mode and routes to the correct backend | | ||
| | `core/backend.ts` | Backend contracts — all run-params types, `PiRunContext`, `PiRunResult`, and `PiBackendRun` | | ||
| | `core/context.ts` | Skills-resolution and memory helpers (`resolvePiSkills`, `loadPiMemory`, `buildPiPrompt`, `appendPiMemory`) | | ||
| | `core/events.ts` | Streaming event helpers | | ||
| | `core/keys.ts` | API-key resolution utilities | | ||
| | `core/pi-sdk.ts` | Thin wrapper around the PI SDK client | | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not just a thin SDK client wrapper: it dynamically loads the SDK, converts backend-neutral tool specs, creates the model runtime, resolves models, and builds the sealed resource loader. Please describe those SDK integration utilities more accurately; also capitalize the name as |
||
| | `core/redaction.ts` | Secret redaction for logs and responses | | ||
| | `cloud/shared.ts` | Shared GitHub and sandbox utilities (repo helpers, polling, etc.) | | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| | `cloud/github-pr.ts` | Low-level GitHub PR API wrappers | | ||
| | `cloud/authoring/backend.ts` | Create PR and Update PR implementation | | ||
| | `cloud/review/backend.ts` | Review Code implementation | | ||
| | `cloud/review/tools.ts` | Tool definitions injected into the review agent | | ||
| | `cloud/review/tools-script.ts` | Script loaded by the review tools | | ||
| | `cloud/babysit/backend.ts` | PR review / check continuation (babysit mode) | | ||
| | `cloud/babysit/github.ts` | GitHub status/check polling helpers | | ||
| | `cloud/babysit/round.ts` | Single babysit iteration logic | | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| | `local/backend.ts` | Local Dev mode — SSH-connected local machine | | ||
| | `local/sim-tools.ts` | Sim-side tool implementations | | ||
| | `local/ssh-tools.ts` | SSH tool implementations | | ||
| | `search/tool.ts` | Search tool definition | | ||
| | `search/normalize.ts` | Result normalisation | | ||
| | `search/extension-source.ts` | Extension-based source adapter | | ||
|
|
||
| ## Dispatch flow | ||
|
|
||
| `pi-handler.ts` is the sole entry point registered in the executor. It inspects the block's `mode` field and calls the matching backend's `run()` method. All backends receive a typed `PiRunContext` (from `core/backend.ts`) and stream incremental events back through `core/events.ts`. | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The backends do not expose |
||
|
|
||
| <!-- memory-probe: Path | Responsibility --> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Stray memory probe commentLow Severity A Reviewed by Cursor Bugbot for commit d411532. Configure here. |
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use
Pirather thanPIhere. The registered block is named “Pi Coding Agent,” and the implementation consistently uses “Pi” for both the product and SDK.