Add provider skill discovery #1905
Mergedjuliusmarmingemerged 12 commits into
main fromrefs/pull/1905/headmerged by juliusmarminge View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
- apps/web/src/components/chat/ChatComposer.tsx line 827OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -764,6 +820,8 @@764820 [composerHighlightedItemId, composerMenuItems],765821 );766822767- composerMenuOpenRef.current = composerMenuOpen;768- composerMenuItemsRef.current = composerMenuItems;769- activeComposerMenuItemRef.current = activeComposerMenuItem;823+ useEffect(() => {824+ composerMenuOpenRef.current = composerMenuOpen;825+ composerMenuItemsRef.current = composerMenuItems;826+ activeComposerMenuItemRef.current = activeComposerMenuItem;827+ }, [activeComposerMenuItem, composerMenuItems, composerMenuOpen]);apps/server/src/provider/codexAppServer.ts line 259OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -152,3 +244,16 @@152244 });153245 });154246 }247+248+export async function probeCodexAccount(input: {249+ readonly binaryPath: string;250+ readonly homePath?: string;251+ readonly signal?: AbortSignal;252+}): Promise<CodexAccountSnapshot> {253+ return (254+ await probeCodexDiscovery({255+ ...input,256+ cwd: process.cwd(),257+ })258+ ).account;259+}
- apps/web/src/components/ComposerPromptEditor.tsx lines 1404 to 1404OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1241,3 +1401,4 @@12411401 onChangeRef.current = onChange;12421402 }, [onChange]);124314031404+ useEffect(() => {apps/web/src/components/ComposerPromptEditor.tsx lines 288 to 294Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -191,0 +221,21 @@221+ container.append(icon, label);222+}223+224+class ComposerSkillNode extends TextNode {225+ __skillName: string;226+ __skillLabel: string;227+228+ static override getType(): string {229+ return "composer-skill";230+ }231+232+ static override clone(node: ComposerSkillNode): ComposerSkillNode {233+ return new ComposerSkillNode(node.__skillName, node.__skillLabel, node.__key);234+ }235+236+ static override importJSON(serializedNode: SerializedComposerSkillNode): ComposerSkillNode {237+ return $createComposerSkillNode(238+ serializedNode.skillName,239+ serializedNode.skillLabel ?? serializedNode.skillName,240+ );241+ }
- apps/server/src/provider/codexAppServer.ts line 210Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -120,8 +198,18 @@120198 }121199122200 writeMessage({ method: "initialized" });123- writeMessage({ id: 2, method: "account/read", params: {} });201+ writeMessage({ id: 2, method: "skills/list", params: { cwds: [input.cwd] } });202+ writeMessage({ id: 3, method: "account/read", params: {} });124203 return;125204 }126205127206 if (response.id === 2) {207+ const errorMessage = readErrorMessage(response);208+ if (errorMessage) {209+ fail(new Error(`skills/list failed: ${errorMessage}`));210+ return;211+ }212+213+ skills = parseCodexSkillsResult(response.result, input.cwd);214+ maybeResolve();215+ return;
juliusmarminge changed the title
- @@ -16,0 +56,21 @@56+ }57+58+ return [59+ {60+ name,61+ path,62+ enabled: skill?.enabled !== false,63+ ...(nonEmptyTrimmed(skill?.description)64+ ? { description: nonEmptyTrimmed(skill?.description) }65+ : {}),66+ ...(nonEmptyTrimmed(skill?.scope) ? { scope: nonEmptyTrimmed(skill?.scope) } : {}),67+ ...(nonEmptyTrimmed(display?.displayName)68+ ? { displayName: nonEmptyTrimmed(display?.displayName) }69+ : {}),70+ ...(nonEmptyTrimmed(skill?.shortDescription) || nonEmptyTrimmed(display?.shortDescription)71+ ? {72+ shortDescription:73+ nonEmptyTrimmed(skill?.shortDescription) ??74+ nonEmptyTrimmed(display?.shortDescription),75+ }76+ : {}),
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:XL
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XXL
- apps/web/src/components/chat/ChatComposer.tsx line 882OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -828,4 +879,4 @@828879 setComposerTrigger(detectComposerTrigger(nextPrompt, nextPrompt.length));829880 scheduleComposerFocus();830881 },831- [composerDraftTarget, promptRef, scheduleComposerFocus, setComposerDraftPrompt],882+ [composerDraftTarget, prompt, promptRef, scheduleComposerFocus, setComposerDraftPrompt],
- packages/shared/src/searchRanking.ts line 91OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -0,0 +71,21 @@71+ const matchIndex = index + marker.length;72+ if (bestIndex === null || matchIndex < bestIndex) {73+ bestIndex = matchIndex;74+ }75+ }76+77+ return bestIndex;78+}79+80+export function scoreQueryMatch(input: {81+ value: string;82+ query: string;83+ exactBase: number;84+ prefixBase?: number;85+ boundaryBase?: number;86+ includesBase?: number;87+ fuzzyBase?: number;88+ boundaryMarkers?: readonly string[];89+}): number | null {90+ const value = input.value.trim().toLowerCase();91+ const query = input.query.trim().toLowerCase();
juliusmarminge changed the title
juliusmarminge merged this58e5f71
juliusmarminge closed this
Sign in to join this conversation.



Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID:
1385ec2d-bc74-4b7b-b23e-c104f25cb89cYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment `@coderabbitai help` to get the list of available commands and usage tips.