Expose project Codex skills in chat #3901
Closedjakeleventhal(GitHub profile, opens in a new tab)wants to merge 12 commits into
main fromrefs/pull/3901/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/server/src/provider/Drivers/CodexDriver.ts line 203Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -163,0 +170,21 @@170+ binaryPath: effectiveConfig.binaryPath,171+ homePath: effectiveConfig.homePath,172+ cwd,173+ customModels: [],174+ environment: processEnv,175+ includeModels: false,176+ }).pipe(177+ Effect.scoped,178+ Effect.map((result) => result.skills),179+ Effect.mapError(180+ (cause) =>181+ new ProviderDriverError({182+ driver: DRIVER_KIND,183+ instanceId,184+ detail: `Failed to list Codex skills: ${cause.message}`,185+ cause,186+ }),187+ ),188+ Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),189+ );190+ });apps/web/src/components/chat/ChatComposer.tsx line 1088OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1070,4 +1084,5 @@10701084 ]);1071108510721086 const isComposerMenuLoading =1073- composerTriggerKind === "path" && pathTriggerQuery.length > 0 && workspaceEntries.isPending;1087+ (composerTriggerKind === "path" && pathTriggerQuery.length > 0 && workspaceEntries.isPending) ||1088+ (composerTriggerKind === "skill" && providerSkills.isPending);apps/web/src/components/chat/ChatComposer.tsx line 1088OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1070,4 +1084,5 @@10701084 ]);1071108510721086 const isComposerMenuLoading =1073- composerTriggerKind === "path" && pathTriggerQuery.length > 0 && workspaceEntries.isPending;1087+ (composerTriggerKind === "path" && pathTriggerQuery.length > 0 && workspaceEntries.isPending) ||1088+ (composerTriggerKind === "skill" && providerSkills.isPending);
- apps/server/src/provider/Drivers/CodexDriver.ts line 173Resolvedby jakeleventhal(GitHub profile, opens in a new tab)@@ -161,3 +165,5 @@161165 ...(eventLoggers.native ? { nativeEventLogger: eventLoggers.native } : {}),162166 });163167 const textGeneration = yield* makeCodexTextGeneration(effectiveConfig, processEnv);168+ const listSkills = Effect.fn("CodexDriver.listSkills")(function* (cwd: string) {169+ return yield* probeCodexAppServerProvider({apps/server/src/provider/Drivers/CodexDriver.ts lines 180 to 181Resolvedby jakeleventhal(GitHub profile, opens in a new tab)@@ -161,3 +165,13 @@161165 ...(eventLoggers.native ? { nativeEventLogger: eventLoggers.native } : {}),162166 });163167 const textGeneration = yield* makeCodexTextGeneration(effectiveConfig, processEnv);168+ const listSkills = Effect.fn("CodexDriver.listSkills")(function* (cwd: string) {169+ return yield* probeCodexAppServerProvider({170+ binaryPath: effectiveConfig.binaryPath,171+ homePath: effectiveConfig.homePath,172+ cwd,173+ customModels: [],174+ environment: processEnv,175+ includeModels: false,176+ }).pipe(177+ Effect.scoped,
- apps/server/src/ws.ts lines 1273 to 1277Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1253,0 +1257,21 @@1257+ observeRpcEffect(1258+ WS_METHODS.serverListProviderSkills,1259+ Effect.gen(function* () {1260+ const skills = yield* providerRegistry.listSkills(input);1261+ if (!skills) {1262+ return yield* new ServerProviderSkillsError({1263+ instanceId: input.instanceId,1264+ cwd: input.cwd,1265+ message: "This provider does not support project skill discovery.",1266+ });1267+ }1268+ return { skills };1269+ }).pipe(1270+ Effect.mapError((cause) =>1271+ cause._tag === "ServerProviderSkillsError"1272+ ? cause1273+ : new ServerProviderSkillsError({1274+ instanceId: input.instanceId,1275+ cwd: input.cwd,1276+ message: cause.message,1277+ }),
- apps/web/src/components/chat/ChatComposer.tsx line 965Resolvedby jakeleventhal(GitHub profile, opens in a new tab)@@ -937,0 +945,21 @@945+ enabled: composerTriggerKind === "skill",946+ });947+ const providerSkillsTargetKey = `${environmentId ?? ""}\0${selectedProviderStatus?.instanceId ?? ""}\0${gitCwd ?? ""}`;948+ const [cachedProviderSkills, setCachedProviderSkills] = useState<{949+ readonly targetKey: string;950+ readonly skills: ReadonlyArray<ServerProviderSkill>;951+ } | null>(null);952+ useEffect(() => {953+ if (providerSkills.data) {954+ setCachedProviderSkills({955+ targetKey: providerSkillsTargetKey,956+ skills: providerSkills.data.skills,957+ });958+ }959+ }, [providerSkills.data, providerSkillsTargetKey]);960+ const composerProviderSkills =961+ providerSkills.data?.skills ??962+ (cachedProviderSkills?.targetKey === providerSkillsTargetKey963+ ? cachedProviderSkills.skills964+ : selectedProviderStatus?.skills) ??965+ EMPTY_PROVIDER_SKILLS;
- packages/contracts/src/server.ts lines 105 to 113OutdatedResolvedby jakeleventhal(GitHub profile, opens in a new tab)@@ -93 +93,21 @@939394+export const ServerProviderSkillsInput = Schema.Struct({95+ instanceId: ProviderInstanceId,96+ cwd: TrimmedNonEmptyString,97+});98+export type ServerProviderSkillsInput = typeof ServerProviderSkillsInput.Type;99+100+export const ServerProviderSkillsResult = Schema.Struct({101+ skills: Schema.Array(ServerProviderSkill),102+});103+export type ServerProviderSkillsResult = typeof ServerProviderSkillsResult.Type;104+105+export class ServerProviderSkillsError extends Schema.TaggedErrorClass<ServerProviderSkillsError>()(106+ "ServerProviderSkillsError",107+ {108+ instanceId: ProviderInstanceId,109+ cwd: TrimmedNonEmptyString,110+ message: TrimmedNonEmptyString,111+ cause: Schema.optional(Schema.Defect()),112+ },113+) {}
- apps/web/src/components/ComposerPromptEditor.tsx lines 369 to 379OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -354,3 +360,20 @@354360 return $applyNodeReplacement(new ComposerSkillNode(skillName, skillLabel, skillDescription));355361 }356362363+function $updateComposerSkillMetadata(364+ skillMetadata: ReadonlyMap<string, ComposerSkillMetadata>,365+): void {366+ const visit = (node: LexicalNode): void => {367+ if (node instanceof ComposerSkillNode) {368+ const metadata = skillMetadata.get(node.__skillName);369+ if (!metadata) {370+ return;371+ }372+ if (373+ node.__skillLabel === metadata.label &&374+ node.__skillDescription === metadata.description375+ ) {376+ return;377+ }378+ node.setSkillPresentation(metadata.label, metadata.description);379+ return;
- apps/web/src/components/ComposerPromptEditor.tsx line 376Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -354,3 +360,15 @@354360 return $applyNodeReplacement(new ComposerSkillNode(skillName, skillLabel, skillDescription));355361 }356362363+function $updateComposerSkillMetadata(364+ skillMetadata: ReadonlyMap<string, ComposerSkillMetadata>,365+): void {366+ const visit = (node: LexicalNode): void => {367+ if (node instanceof ComposerSkillNode) {368+ const metadata = skillMetadata.get(node.__skillName);369+ const label = metadata?.label ?? node.__skillName;370+ const description = metadata?.description ?? null;371+ if (node.__skillLabel === label && node.__skillDescription === description) {372+ return;373+ }374+ node.setSkillPresentation(label, description);
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:
a2cf74ac-facd-4501-8c3c-39c8ffebfbc5You 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)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share