2.1 KiB
2.1 KiB
04. Thread ExtensionCommandContext through executeBatch
meta: id: ralph-loop-fixes-04 feature: ralph-loop-fixes priority: P1 depends_on: [] tags: [implementation, plumbing]
objective:
- Pass
ctx: ExtensionCommandContextfrom command handlers through to all executor functions that need it, replacing the missingpiApi: ExtensionAPIparameter
deliverables:
- Modified
index.ts— allexecuteBatch()calls passctxas 6th parameter - Modified
src/executor.ts—executeBatch(),executeTask(),runTask(),executeBatchParallel()acceptctx: ExtensionCommandContext
steps:
- Open
src/executor.ts - Add
import type { ExtensionCommandContext } from "@earendil-works/pi-coding-agent" - Update
executeBatch()signature: addctx: ExtensionCommandContextas 6th parameter (afterprogress) - Update
executeTask()signature: addctx: ExtensionCommandContextparameter - Update
runTask()signature: addctx: ExtensionCommandContextparameter - Update
executeBatchParallel()signature: addctx: ExtensionCommandContextparameter - Thread
ctxthrough all internal calls (batch → task → run) - Open
index.ts - In
handleRun(): passctxtoexecuteBatch() - In
handleResume(): passctxtoexecuteBatch() - In
handleNext(): passctxtoexecuteBatch()
tests:
- Manual:
/ralph runshould execute without "undefined is not a function" errors - Manual:
/ralph resumeshould execute without context-related errors
acceptance_criteria:
executeBatch()receives a validExtensionCommandContextin all call paths- No
undefinedaccess errors when executor callsctx.ui.* - TypeScript compiles without errors
validation:
- Run
npx tsc --noEmitin extension directory - Verify
ctxparameter exists in all executor function signatures - Verify all call sites in index.ts pass
ctx
notes:
ExtensionCommandContextextendsExtensionContextand adds session control methods- Command handlers receive
ExtensionCommandContext, not bareExtensionContext - The
piApiparameter wasExtensionAPIwhich hassendMessage()— we're replacing it withctxwhich hasctx.uifor UI access