Repository navigation
fix(composer): write a skill named like a slash command as /skill:<name> so choosing it invokes the skill - #630
Merged
Merged
Conversation
…me> so choosing it invokes the skill A skill called new was written into the draft as /new, so the message ran the /new command instead of invoking the skill. The token for a skill whose /<name> parses as a command is now /skill:<name>, the form pi itself reads; a typed /new keeps running the command. The picker row shows that token, /skill: lists skills only, and a turn whose skill the host already briefed does not hand pi the leading /skill: to expand a second time.
…ences A /skill:<name> chosen from the picker is briefed by the node, so pi must not expand it again. The guard now reads the message's own skill references instead of searching the brief, so a revision gone stale before the turn no longer lets pi insert the current file. The brief names the skill by its draft token, the client no longer reads the /skill of /skill:new as a skill called skill, and a real-SDK test pins that a leading space stops expansion.
Only /skill before :<name> is held back from ending a token, so /skill:new is still not a skill called skill, while @main.ts:42, @Proj:C:\x, @team:10:30 and /review:xem keep their chosen reference again.
Contributor
Author
|
Review attestation: ready to merge at A push to this PR makes this attestation stale; the new head needs its own review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
A skill can share its name with a built-in slash command, for example a skill called
new. Choosing that skill in the/picker wrote/new …into the draft. The node reads slash commands from the text before it looks at references, so the message ran/newand opened a fresh conversation instead of invoking the skill.Fix
referenceToken(contracts) writes a skill as/skill:<name>when/<name>would parse as a command. Skills that don't collide keep/<name>. The rule comes fromparseSlashCommand, so it followsSLASH_COMMANDSand stays compatible with feat(widgets): let the person choose a project folder for widget dev sessions #612 (/develop).skill:…after/lists only skills./newwith no chosen skill still runs the command./skill:<name>is also the form pi expands by itself, so typing it invokes the same skill./skill:a second time. A/skill:the person typed without choosing the skill is not briefed, so pi still expands it.DESIGN.mdcomposer rule anddocs/open-interfaces.mdpicker paragraph. Official API docs: docs(api): write a skill that shares a command's name as /skill:<name> clarkcant-web#136.Tests
packages/conversation-client/test/composer-trigger.spec.ts: choosingnewwrites/skill:new, which is not a command and carries the skill. A typed/newcarries no skill.apps/runtime/test/composer-references.spec.ts: the token and theskill:query. Sending/skill:new …with the reference returns a model turn, with noappIntentand no new conversation, and the skill is briefed. A typed/newstill answersnav.home.apps/web/e2e/composer-references.spec.ts): the fixture node gets a skill namednew. The test chooses that skill's row (not the command's) and sends. It checks:/skill:new …and carries the skill reference;<skill name="new">;nav.homeand no "new conversation" answer./new, and no assistant turn appeared.pnpm verifypassed: 570 files and 7698 tests, plus typecheck, lint and invariants. The fullcomposer-referencese2e passed (10/10).Changes after review
referencedSkillIds+wordsBesideReferences), wired through askillsForlookup besidebriefFor. It no longer searches the brief text. Before this, a skill whose chosen revision changed before the turn ran was left out of the brief, so the words had no space and pi inserted the current file.apps/runtime/test/composer-references.spec.tscovers the normal case (referencednew), a hand-typed/skill:newwith no reference, another skill referenced, a typed/new, a mid-text token, and the stale-revision case (the brief says the skill was not inserted, and the words still start with a space).packages/pi-adapter/test/skill-command-boundary.spec.tsadds a test on the real SDK, with and without the context guard:/skill:deploy …is expanded, while/skill:deploy …is sent as typed./skill:new). The client no longer reads the/skillof/skill:newas a skill calledskill. The DESIGN lines are rewrapped. Old stored messages that show a/skill:<name>chip are left as they are: they show what was sent, and changing them would need a stored-message migration for a display-only nit.pnpm typecheck, eslint on the changed files andpnpm invariantsclean; Playwrightcomposer-references+slash-commands14/14.Round 2
@main.ts:42,@proj:C:\x,@team:10:30and/review:xem. Now only the/skilltoken before:<name>is held back. Every other token ends at a colon as it did before this PR.packages/conversation-client/test/composer-trigger.spec.ts:@main.ts:42,@proj:C:\x,@team:10:30and/review:xemkeep their reference. The existing test still shows that/skill:newis not read as a skill calledskill. The new test fails on 72f0cb3 and passes now.main(including feat(widgets): let the person choose a project folder for widget dev sessions #612/develop) with no conflicts.pnpm typecheck, eslint on the changed files andpnpm invariants(15/15) clean; Playwrightcomposer-references+slash-commands15/15, including the/developtest from feat(widgets): let the person choose a project folder for widget dev sessions #612.Fixes #623