Upgrade @oh-my-pi SDK packages to 18.16.0 #219

Closed
opened 2026-11-03 16:08:59 +01:00 by omp-deck · 0 comments
Collaborator

Problem

omp-deck embeds the omp SDK (@oh-my-pi/pi-coding-agent, @oh-my-pi/pi-ai, @oh-my-pi/pi-tui), currently pinned exactly to 18.10.1. The newest release on npm is 18.16.0 for all three. Upgrade all three, keep exact pins, and carry the local SDK patch (patches/@oh-my-pi%2Fpi-coding-agent@18.10.1.patch) forward unchanged in intent. Upstream 18.16.0 still lacks systemPromptTemplate forwarding in src/task/executor.ts, so the patch is still required.

Plan

Context

Bump the three SDK packages from 18.10.1 to 18.16.0 with exact pins. Regenerate the pi-coding-agent patch against 18.16.0 with the same changes. Keep typecheck, tests and the server boot green.

Approach

  1. Bump pins. In root package.json (dependencies: @oh-my-pi/pi-ai, @oh-my-pi/pi-coding-agent, @oh-my-pi/pi-tui) and in apps/server/package.json (the same three keys), change "18.10.1" to "18.16.0". Keep exact versions, with no ^.

  2. Rebase the patch. Temporarily remove the patchedDependencies entry so the install succeeds, then run bun install. Next run bun patch @oh-my-pi/pi-coding-agent@18.16.0 and re-apply every hunk of the old patch file to the same paths in the new package:

    • src/prompts/system/orchestrate-notice.md: rule 1 and the "Yielding between in-scope phases" anti-pattern line.
    • src/prompts/system/plan-mode-active.md: the "Ground every claim" paragraph, the "in-scope exploration" wording (2 places), and the <critical> turn-end list adding option 3 plus the "boundary stop is not a failure" sentence.
    • src/prompts/system/plan-mode-tool-decision-reminder.md: the full replacement body shown in the old patch.
    • src/prompts/system/project-prompt.md: the two <critical> bullets.
    • src/sdk.ts: add systemPromptTemplate: options.systemPromptTemplate, next to contextFiles, in the createAgentSessionScoped tool-session object.
    • src/session/agent-session.ts: remove this.#toolChoiceQueue.pushOnce("required", { label: "plan-mode-decision" }); and add writeToolName: "write", to the planModeToolDecisionReminderPrompt render args.
    • src/task/executor.ts: add systemPromptTemplate?: string; (with its doc comment) to ExecutorOptions after contextFiles?, and pass systemPromptTemplate: options.systemPromptTemplate, after contextFiles: options.contextFiles, in the runSubprocess createAgentSession call.
    • src/task/structured-subagent.ts: add systemPromptTemplate: session.systemPromptTemplate, after contextFiles: in buildExecutorOptions.
    • src/tools/index.ts: add systemPromptTemplate?: string; (with its doc comment) to ToolSession after customToolPaths?.

    If upstream has moved or reworded the anchor text, apply the same semantic change at the new location. If upstream already contains a change, skip that hunk. Commit with bun patch --commit. The result is patches/@oh-my-pi%2Fpi-coding-agent@18.16.0.patch and a patchedDependencies key "@oh-my-pi/pi-coding-agent@18.16.0". Delete the old 18.10.1 patch file.

  3. Fix compile breaks. Run bun run typecheck. Fix any SDK API drift in apps/server/src/** (the route layer imports the SDK only through apps/server/src/bridge and the tool files), following the 18.16.0 types. Do not add compatibility shims.

  4. Lockfile. Commit the updated bun.lock so the frozen install in the Dockerfile and CI succeeds.

Verification

  • bun install --frozen-lockfile in the repo root succeeds with no "lockfile had changes" message and applies the patch without errors.
  • node_modules/@oh-my-pi/pi-coding-agent/package.json shows version 18.16.0, and grep -n systemPromptTemplate node_modules/@oh-my-pi/pi-coding-agent/src/task/executor.ts finds the patched lines.
  • bun run typecheck passes, and bun test in apps/server passes.
  • bun run build && bun run start boots. Open a session in the web UI, enter plan mode and end a turn with plain text: there is no forced tool call, and the reminder text matches the patched version.
## Problem omp-deck embeds the omp SDK (`@oh-my-pi/pi-coding-agent`, `@oh-my-pi/pi-ai`, `@oh-my-pi/pi-tui`), currently pinned exactly to `18.10.1`. The newest release on npm is `18.16.0` for all three. Upgrade all three, keep exact pins, and carry the local SDK patch (`patches/@oh-my-pi%2Fpi-coding-agent@18.10.1.patch`) forward unchanged in intent. Upstream 18.16.0 still lacks `systemPromptTemplate` forwarding in `src/task/executor.ts`, so the patch is still required. ## Plan ### Context Bump the three SDK packages from 18.10.1 to 18.16.0 with exact pins. Regenerate the pi-coding-agent patch against 18.16.0 with the same changes. Keep typecheck, tests and the server boot green. ### Approach 1. **Bump pins.** In root `package.json` (`dependencies`: `@oh-my-pi/pi-ai`, `@oh-my-pi/pi-coding-agent`, `@oh-my-pi/pi-tui`) and in `apps/server/package.json` (the same three keys), change `"18.10.1"` to `"18.16.0"`. Keep exact versions, with no `^`. 2. **Rebase the patch.** Temporarily remove the `patchedDependencies` entry so the install succeeds, then run `bun install`. Next run `bun patch @oh-my-pi/pi-coding-agent@18.16.0` and re-apply every hunk of the old patch file to the same paths in the new package: - `src/prompts/system/orchestrate-notice.md`: rule 1 and the "Yielding between in-scope phases" anti-pattern line. - `src/prompts/system/plan-mode-active.md`: the "Ground every claim" paragraph, the "in-scope exploration" wording (2 places), and the `<critical>` turn-end list adding option 3 plus the "boundary stop is not a failure" sentence. - `src/prompts/system/plan-mode-tool-decision-reminder.md`: the full replacement body shown in the old patch. - `src/prompts/system/project-prompt.md`: the two `<critical>` bullets. - `src/sdk.ts`: add `systemPromptTemplate: options.systemPromptTemplate,` next to `contextFiles,` in the `createAgentSessionScoped` tool-session object. - `src/session/agent-session.ts`: remove `this.#toolChoiceQueue.pushOnce("required", { label: "plan-mode-decision" });` and add `writeToolName: "write",` to the `planModeToolDecisionReminderPrompt` render args. - `src/task/executor.ts`: add `systemPromptTemplate?: string;` (with its doc comment) to `ExecutorOptions` after `contextFiles?`, and pass `systemPromptTemplate: options.systemPromptTemplate,` after `contextFiles: options.contextFiles,` in the `runSubprocess` createAgentSession call. - `src/task/structured-subagent.ts`: add `systemPromptTemplate: session.systemPromptTemplate,` after `contextFiles:` in `buildExecutorOptions`. - `src/tools/index.ts`: add `systemPromptTemplate?: string;` (with its doc comment) to `ToolSession` after `customToolPaths?`. If upstream has moved or reworded the anchor text, apply the same semantic change at the new location. If upstream already contains a change, skip that hunk. Commit with `bun patch --commit`. The result is `patches/@oh-my-pi%2Fpi-coding-agent@18.16.0.patch` and a `patchedDependencies` key `"@oh-my-pi/pi-coding-agent@18.16.0"`. Delete the old 18.10.1 patch file. 3. **Fix compile breaks.** Run `bun run typecheck`. Fix any SDK API drift in `apps/server/src/**` (the route layer imports the SDK only through `apps/server/src/bridge` and the tool files), following the 18.16.0 types. Do not add compatibility shims. 4. **Lockfile.** Commit the updated `bun.lock` so the frozen install in the `Dockerfile` and CI succeeds. ### Verification - `bun install --frozen-lockfile` in the repo root succeeds with no "lockfile had changes" message and applies the patch without errors. - `node_modules/@oh-my-pi/pi-coding-agent/package.json` shows version `18.16.0`, and `grep -n systemPromptTemplate node_modules/@oh-my-pi/pi-coding-agent/src/task/executor.ts` finds the patched lines. - `bun run typecheck` passes, and `bun test` in `apps/server` passes. - `bun run build && bun run start` boots. Open a session in the web UI, enter plan mode and end a turn with plain text: there is no forced tool call, and the reminder text matches the patched version.
lucas closed this issue 2026-11-03 16:24:07 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lucas/omp-deck#219
No description provided.