From 62d20ff416a71e9cc3fdc5e994954dd5ac2e453b Mon Sep 17 00:00:00 2001 From: Sim Pi Agent Date: Fri, 7 Aug 2026 03:25:02 +0000 Subject: [PATCH 1/4] docs(pi): describe handler folder layout --- apps/sim/executor/handlers/pi/README.md | 42 +++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 apps/sim/executor/handlers/pi/README.md diff --git a/apps/sim/executor/handlers/pi/README.md b/apps/sim/executor/handlers/pi/README.md new file mode 100644 index 00000000000..c925364ebbb --- /dev/null +++ b/apps/sim/executor/handlers/pi/README.md @@ -0,0 +1,42 @@ +# PI Handler + +Implements the PI block executor. Each sub-mode delegates to a dedicated backend while sharing common infrastructure. + +## Folder layout + +``` +pi/ +├── pi-handler.ts # Single dispatcher — reads the block's mode and routes to the correct backend +├── core/ # Shared contracts and infrastructure +│ ├── backend.ts # Base backend interface and shared execution logic +│ ├── context.ts # Request context type passed to every backend +│ ├── events.ts # Streaming event helpers +│ ├── keys.ts # API-key resolution utilities +│ ├── pi-sdk.ts # Thin wrapper around the PI SDK client +│ └── redaction.ts # Secret redaction for logs and responses +├── cloud/ # Cloud mode — GitHub-hosted sandboxes +│ ├── shared.ts # Shared GitHub and sandbox utilities (repo helpers, polling, etc.) +│ ├── github-pr.ts # Low-level GitHub PR API wrappers +│ ├── authoring/ # Create PR and Update PR implementation +│ │ └── backend.ts +│ ├── review/ # Review Code implementation +│ │ ├── backend.ts +│ │ ├── tools.ts # Tool definitions injected into the review agent +│ │ └── tools-script.ts +│ └── babysit/ # PR review / check continuation (babysit mode) +│ ├── backend.ts +│ ├── github.ts # GitHub status/check polling helpers +│ └── round.ts # Single babysit iteration logic +├── local/ # Local Dev mode — SSH-connected local machine +│ ├── backend.ts +│ ├── sim-tools.ts # Sim-side tool implementations +│ └── ssh-tools.ts # SSH tool implementations +└── search/ # Shared search support used across modes + ├── tool.ts # Search tool definition + ├── normalize.ts # Result normalisation + └── 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 `PiContext` (from `core/context.ts`) and stream incremental events back through `core/events.ts`. From cc388174bcfc38bb39842de2a5e177553c85bc3c Mon Sep 17 00:00:00 2001 From: Sim Pi Agent Date: Fri, 7 Aug 2026 03:31:16 +0000 Subject: [PATCH 2/4] Pi Babysit: address PR #6367 feedback --- apps/sim/executor/handlers/pi/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/sim/executor/handlers/pi/README.md b/apps/sim/executor/handlers/pi/README.md index c925364ebbb..7347c7001ac 100644 --- a/apps/sim/executor/handlers/pi/README.md +++ b/apps/sim/executor/handlers/pi/README.md @@ -8,8 +8,8 @@ Implements the PI block executor. Each sub-mode delegates to a dedicated backend pi/ ├── pi-handler.ts # Single dispatcher — reads the block's mode and routes to the correct backend ├── core/ # Shared contracts and infrastructure -│ ├── backend.ts # Base backend interface and shared execution logic -│ ├── context.ts # Request context type passed to every backend +│ ├── backend.ts # Backend contracts — all run-params types, PiRunContext, PiRunResult, and PiBackendRun +│ ├── context.ts # Skills-resolution and memory helpers (resolvePiSkills, loadPiMemory, buildPiPrompt, appendPiMemory) │ ├── events.ts # Streaming event helpers │ ├── keys.ts # API-key resolution utilities │ ├── pi-sdk.ts # Thin wrapper around the PI SDK client @@ -39,4 +39,4 @@ pi/ ## 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 `PiContext` (from `core/context.ts`) and stream incremental events back through `core/events.ts`. +`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`. From a685801053fc1fb4511db05356c6dc2473ddc067 Mon Sep 17 00:00:00 2001 From: Sim Pi Agent Date: Fri, 7 Aug 2026 03:42:14 +0000 Subject: [PATCH 3/4] Pi: In apps/sim/executor/handlers/pi/README.md only, convert the folder-... --- apps/sim/executor/handlers/pi/README.md | 56 +++++++++++-------------- 1 file changed, 24 insertions(+), 32 deletions(-) diff --git a/apps/sim/executor/handlers/pi/README.md b/apps/sim/executor/handlers/pi/README.md index 7347c7001ac..b7a077c273a 100644 --- a/apps/sim/executor/handlers/pi/README.md +++ b/apps/sim/executor/handlers/pi/README.md @@ -4,38 +4,30 @@ Implements the PI block executor. Each sub-mode delegates to a dedicated backend ## Folder layout -``` -pi/ -├── pi-handler.ts # Single dispatcher — reads the block's mode and routes to the correct backend -├── core/ # Shared contracts and infrastructure -│ ├── backend.ts # Backend contracts — all run-params types, PiRunContext, PiRunResult, and PiBackendRun -│ ├── context.ts # Skills-resolution and memory helpers (resolvePiSkills, loadPiMemory, buildPiPrompt, appendPiMemory) -│ ├── events.ts # Streaming event helpers -│ ├── keys.ts # API-key resolution utilities -│ ├── pi-sdk.ts # Thin wrapper around the PI SDK client -│ └── redaction.ts # Secret redaction for logs and responses -├── cloud/ # Cloud mode — GitHub-hosted sandboxes -│ ├── shared.ts # Shared GitHub and sandbox utilities (repo helpers, polling, etc.) -│ ├── github-pr.ts # Low-level GitHub PR API wrappers -│ ├── authoring/ # Create PR and Update PR implementation -│ │ └── backend.ts -│ ├── review/ # Review Code implementation -│ │ ├── backend.ts -│ │ ├── tools.ts # Tool definitions injected into the review agent -│ │ └── tools-script.ts -│ └── babysit/ # PR review / check continuation (babysit mode) -│ ├── backend.ts -│ ├── github.ts # GitHub status/check polling helpers -│ └── round.ts # Single babysit iteration logic -├── local/ # Local Dev mode — SSH-connected local machine -│ ├── backend.ts -│ ├── sim-tools.ts # Sim-side tool implementations -│ └── ssh-tools.ts # SSH tool implementations -└── search/ # Shared search support used across modes - ├── tool.ts # Search tool definition - ├── normalize.ts # Result normalisation - └── extension-source.ts # Extension-based source adapter -``` +| 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 | +| `core/redaction.ts` | Secret redaction for logs and responses | +| `cloud/shared.ts` | Shared GitHub and sandbox utilities (repo helpers, polling, etc.) | +| `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 | +| `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 From d411532a5a8a1e0ddf61ca1b7a1b253390f62519 Mon Sep 17 00:00:00 2001 From: Sim Pi Agent Date: Fri, 7 Aug 2026 03:44:51 +0000 Subject: [PATCH 4/4] Pi: Without re-reading the file first, state from memory the exact two c... --- apps/sim/executor/handlers/pi/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/sim/executor/handlers/pi/README.md b/apps/sim/executor/handlers/pi/README.md index b7a077c273a..8afa8df710e 100644 --- a/apps/sim/executor/handlers/pi/README.md +++ b/apps/sim/executor/handlers/pi/README.md @@ -32,3 +32,5 @@ Implements the PI block executor. Each sub-mode delegates to a dedicated backend ## 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`. + +