Repository navigation
feat(coding-agent): let extensions expand skills in sendUserMessage - #14608
andrebrait wants to merge 7 commits into
Conversation
roboomp
left a comment
There was a problem hiding this comment.
P2 — focused opt-in extension behavior; maintainer sign-off needed for the new sendUserMessage contract.
Should-fix: add external contributor/PR attribution to packages/coding-agent/CHANGELOG.md:11.
Verification blocked: focused bun test packages/coding-agent/test/agent-session-send-user-message-expand.test.ts fails at import because src/export/html/tool-views.generated.js is absent in this checkout; no assertions ran.
Thanks for the detailed repro and test coverage, @andrebrait.
|
|
||
| ### Added | ||
|
|
||
| - Extensions can pass `expandPromptTemplates: true` to `pi.sendUserMessage()` so a `/skill:<name>` command or prompt template they send expands like typed input, matching Pi; Pi extensions with skill-alias commands now load the skill instead of sending the literal command text ([#14608](https://github.com/can1357/oh-my-pi/pull/14608) by [@andrebrait](https://github.com/andrebrait)) |
There was a problem hiding this comment.
should-fix: This user-facing entry lacks the external-contribution attribution required by the changelog convention. Append ([#14608](https://github.com/can1357/oh-my-pi/pull/14608) by [@andrebrait](https://github.com/andrebrait)) so release notes credit the contributor and link the PR.
There was a problem hiding this comment.
This is already in the reviewed commit. In 469f77c98e, CHANGELOG.md:11 ends with ([#14608](https://github.com/can1357/oh-my-pi/pull/14608) by [@andrebrait](https://github.com/andrebrait)). About the blocked verification: tool-views.generated.js is a build-generated file. With it present, bun test packages/coding-agent/test/agent-session-send-user-message-expand.test.ts passes 9/9 locally.
… sendUserMessage Squashed from origin/fix/send-user-message-expand-templates (469f77c) onto upstream/main.
469f77c to
087a0b8
Compare
… sendUserMessage Squashed from origin/fix/send-user-message-expand-templates (087a0b8) onto upstream/main.
… sendUserMessage Squashed from origin/fix/send-user-message-expand-templates (087a0b8) onto upstream/main.
087a0b8 to
397dc39
Compare
… sendUserMessage Squashed from origin/fix/send-user-message-expand-templates (397dc39) onto upstream/main.
397dc39 to
74eb9b4
Compare
… sendUserMessage Squashed from origin/fix/send-user-message-expand-templates (74eb9b4) onto upstream/main.
74eb9b4 to
292f462
Compare
… sendUserMessage Squashed from origin/fix/send-user-message-expand-templates (292f462) onto upstream/main.
292f462 to
17ad75d
Compare
… sendUserMessage Squashed from origin/fix/send-user-message-expand-templates (17ad75d) onto upstream/main.
… sendUserMessage Squashed from origin/fix/send-user-message-expand-templates (17ad75d) onto upstream/main.
… sendUserMessage Squashed from origin/fix/send-user-message-expand-templates (17ad75d) onto upstream/main.
17ad75d to
2c77bcc
Compare
… sendUserMessage Squashed from origin/fix/send-user-message-expand-templates (2c77bcc) onto upstream/main.
2c77bcc to
135fda3
Compare
… sendUserMessage Squashed from origin/fix/send-user-message-expand-templates (135fda3) onto upstream/main.
135fda3 to
2e7f16e
Compare
… sendUserMessage Squashed from origin/fix/send-user-message-expand-templates (2e7f16e) onto upstream/main.
… sendUserMessage Squashed from origin/fix/send-user-message-expand-templates (2e7f16e) onto upstream/main.
2e7f16e to
5a7f7a6
Compare
… sendUserMessage Squashed from origin/fix/send-user-message-expand-templates (5a7f7a6) onto upstream/main.
Pi's sendUserMessage accepts expandPromptTemplates (default false) so an extension can dispatch a /skill:<name> command or a prompt template like typed input. omp kept the original hardcoded false and had no option, so Pi extensions with skill-alias commands (for example ponytail's /ponytail-review) sent the literal '/skill:...' text and the model never saw the skill. Add the opt-in option. When set, a registered /skill: command is built into a user-attributed skill message and delivered on every path (idle, steer, follow-up, aside); other text gets prompt-template expansion, and only the prompt() path runs extension/custom/file slash commands, matching steer()/followUp().
…n change lands during the SKILL.md read
…on change lands during image preparation
…attributed expanded skills user-role
…during image preparation
5a7f7a6 to
16aa9d4
Compare
… sendUserMessage Squashed from origin/fix/send-user-message-expand-templates (16aa9d4) onto upstream/main.
What
Honor
expandPromptTemplates: trueto allow Ponytail's pi extension to work on omp. For context: an omp-native extension was proposed to upstream Ponytail, but ultimately rejected because the pi extension works well enough. I did send a PR to fix how their pi extension interfaces with omp, but some things still require addressing on omp's side. This is one of them.Related: DietrichGebert/ponytail#858 (the rejected omp-native extension) and DietrichGebert/ponytail#1050 (the Pi extension fix).
pi.sendUserMessage()now acceptsexpandPromptTemplates(defaultfalse), as Pi does. When it is set, a registered/skill:<name>command becomes the user-invoked skill message on every delivery path (idle, steer, follow-up, aside), and any other text gets prompt-template expansion. Extension, custom, and file slash commands still run only throughprompt(), which handles an omitteddeliverAsandasidewhile idle. If the extension passesattribution: "agent", the expanded skill body is sent as plain user-role text, the same as every othersendUserMessagepath.The shared
#queueCustomMessagenow drops a steer or follow-up, andpromptCustomMessageresolvesfalse, when an abort, a session change, or disposal lands during image preparation. Before, the message was queued afterabort()had cleared the queues, which could restart the run the user had just stopped. The same race affected skill commands with images sent from RPC or the TUI while a turn was streaming.Why
omp kept Pi's original hardcoded
expandPromptTemplates: falseand never added Pi's later opt-in. Pi extensions that register skill aliases therefore broke in omp. ponytail's/ponytail-review, for example, sent the literal/skill:ponytail-reviewtext, and the model never received the skill.Testing
agent-session-send-user-message-expand.test.ts(9 tests) covers: default literal vs opt-in expansion, the disabled-skill-commands gate, an idle explicit follow-up staying queued, an expanded template that the submitted text can still remove, abort during theSKILL.mdread, abort or disposal during image normalization (promptCustomMessageresolvesfalse), agent attribution delivered as a user-role message, and a follow-up queued while streaming. The expansion, drop, and attribution tests failed before their fixes. Mutating the gate,queueOnly, queued template expansion, orrawTextmakes the matching branch test fail.bun run check:tspasses. I didn't runcheck:rsbecause the PR has no Rust changes./ponytail-review focus on the diff. omp 18.6.2 sends the literal/skill:text to the model. This branch sends the skill body, ending inUser: focus on the diff.omp -p "/ponytail-help"still produces no turn. Print mode never waits for turns that an extension command starts withsendUserMessage, and this is the same for plain text. That needs a separate fix.bun checkpasses (onlycheck:tswas run; see Testing)