fix(web): match skill chip icons to file chips and add sent-message tooltips #9090
main fromrefs/pull/9090/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/providerSkills.ts lines 132 to 136OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +116,21 @@116+ const cache = yield* Cache.make({117+ capacity: CACHE_CAPACITY,118+ timeToLive: CACHE_TTL,119+ lookup: (120+ key: string,121+ ): Effect.Effect<ReadonlyArray<ServerProviderSkill>, ProviderWorkspaceSkillsError> =>122+ Effect.gen(function* () {123+ const { instanceId, cwd } = parseCacheKey(key);124+ const instance = yield* instanceRegistry.getInstance(instanceId);125+ if (instance?.listSkillsForCwd === undefined) {126+ // The instance disappeared or lost the capability between the127+ // caller's check and the cache miss (registry rebuild).128+ return yield* new ProviderWorkspaceSkillsError({129+ detail: `Provider instance '${instanceId}' is not available for workspace skill discovery.`,130+ });131+ }132+ return yield* instance.listSkillsForCwd(cwd).pipe(133+ Effect.mapError(134+ (cause) =>135+ new ProviderWorkspaceSkillsError({136+ detail: cause.detail,
- apps/web/src/components/chat/ChatComposer.tsx line 1122OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1107,3 +1113,10 @@11071113 () => selectedProviderEntry?.snapshot ?? null,11081114 [selectedProviderEntry],11091115 );1116+ // Skills scoped to the active workspace (thread worktree or project root)1117+ // instead of the provider snapshot's startup-directory catalog.1118+ const providerSkills = useWorkspaceSkills({1119+ environmentId,1120+ instanceId: selectedProviderEntry?.instanceId ?? null,1121+ projectId: activeProjectId,1122+ threadId: activeThreadId,apps/web/src/components/ChatView.tsx line 2958OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -2952,3 +2953,6 @@29522953 const defaultInstanceId = defaultInstanceIdForDriver(selectedProvider);29532954 return providerStatuses.find((status) => status.instanceId === defaultInstanceId) ?? null;29542955 }, [activeProviderInstanceId, providerStatuses, selectedProvider]);2956+ // Timeline chips re-parse `$name` tokens against this catalog, so sent2957+ // messages must see the same workspace-scoped skills the composer offered.2958+ const workspaceSkills = useWorkspaceSkills({
- apps/web/src/components/ChatView.tsx line 2964OutdatedResolvedby Mnigos(GitHub profile, opens in a new tab)@@ -2952,3 +2953,12 @@29522953 const defaultInstanceId = defaultInstanceIdForDriver(selectedProvider);29532954 return providerStatuses.find((status) => status.instanceId === defaultInstanceId) ?? null;29542955 }, [activeProviderInstanceId, providerStatuses, selectedProvider]);2956+ // Timeline chips re-parse `$name` tokens against this catalog, so sent2957+ // messages must see the same workspace-scoped skills the composer offered.2958+ const workspaceSkills = useWorkspaceSkills({2959+ environmentId,2960+ instanceId: activeProviderStatus?.instanceId ?? null,2961+ projectId: activeThread?.projectId ?? null,2962+ threadId: isServerThread ? activeThreadId : null,2963+ snapshotSkills: activeProviderStatus?.skills ?? EMPTY_PROVIDER_SKILLS,2964+ });apps/server/src/provider/providerSkills.ts line 142OutdatedResolvedby Mnigos(GitHub profile, opens in a new tab)@@ -0,0 +122,21 @@122+ Effect.gen(function* () {123+ const { instanceId, cwd } = parseCacheKey(key);124+ const instance = yield* instanceRegistry.getInstance(instanceId);125+ if (instance?.listSkillsForCwd === undefined) {126+ // The instance disappeared or lost the capability between the127+ // caller's check and the cache miss (registry rebuild).128+ return yield* new ProviderWorkspaceSkillsError({129+ detail: `Provider instance '${instanceId}' is not available for workspace skill discovery.`,130+ });131+ }132+ return yield* instance.listSkillsForCwd(cwd).pipe(133+ Effect.mapError(134+ (cause) =>135+ new ProviderWorkspaceSkillsError({136+ detail: cause.detail,137+ cause,138+ }),139+ ),140+ );141+ }),142+ });
- apps/web/src/components/composerInlineChip.ts lines 13 to 20OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -10,5 +10,11 @@10101111 export const COMPOSER_INLINE_CHIP_CLASS_NAME = `${INLINE_CHIP_CLASS_NAME} text-[0.86em] select-none`;121213-export const COMPOSER_INLINE_CHIP_DECORATOR_CLASS_NAME =14- "relative inline-flex align-[-0.125em] leading-none data-[composer-chip-selected]:after:pointer-events-none data-[composer-chip-selected]:after:absolute data-[composer-chip-selected]:after:inset-0 data-[composer-chip-selected]:after:rounded-[6px] data-[composer-chip-selected]:after:bg-[Highlight] data-[composer-chip-selected]:after:opacity-30 data-[composer-chip-selected]:after:content-['']";13+// One anchoring model for every inline-chip wrapper, composer and sent14+// messages alike: the pill hangs 0.125em below the text baseline, which15+// optically centers it on the surrounding line regardless of that line's16+// leading. Keeping composer and chat wrappers on the same constant is what17+// stops the two surfaces from drifting apart vertically.18+export const INLINE_CHIP_WRAPPER_CLASS_NAME = "inline-flex align-[-0.125em] leading-none";19+20+export const COMPOSER_INLINE_CHIP_DECORATOR_CLASS_NAME = `relative ${INLINE_CHIP_WRAPPER_CLASS_NAME} data-[composer-chip-selected]:after:pointer-events-none data-[composer-chip-selected]:after:absolute data-[composer-chip-selected]:after:inset-0 data-[composer-chip-selected]:after:rounded-[6px] data-[composer-chip-selected]:after:bg-[Highlight] data-[composer-chip-selected]:after:opacity-30 data-[composer-chip-selected]:after:content-['']`;
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
- packages/contracts/src/server.ts lines 128 to 131OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -100,0 +111,21 @@111+ * Where the returned catalog came from:112+ * - `workspace` — the provider discovered skills against the resolved113+ * workspace cwd. An empty `skills` array is a real "no skills here",114+ * not a failure; clients must not fall back to the instance snapshot.115+ * - `snapshot` — the provider has no per-workspace discovery. `skills`116+ * is empty and clients should keep using the instance snapshot's117+ * skills.118+ */119+export const ProviderWorkspaceSkillsSource = Schema.Literals(["workspace", "snapshot"]);120+export type ProviderWorkspaceSkillsSource = typeof ProviderWorkspaceSkillsSource.Type;121+122+export const ProviderWorkspaceSkillsResult = Schema.Struct({123+ skills: Schema.Array(ServerProviderSkill),124+ source: ProviderWorkspaceSkillsSource,125+});126+export type ProviderWorkspaceSkillsResult = typeof ProviderWorkspaceSkillsResult.Type;127+128+export class ProviderWorkspaceSkillsError extends Schema.TaggedErrorClass<ProviderWorkspaceSkillsError>()(129+ "ProviderWorkspaceSkillsError",130+ {131+ detail: TrimmedNonEmptyString,
- apps/web/src/components/chat/ChatComposer.tsx line 1118OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1107,3 +1113,6 @@11071113 () => selectedProviderEntry?.snapshot ?? null,11081114 [selectedProviderEntry],11091115 );1116+ // Skills scoped to the active workspace (thread worktree or project root)1117+ // instead of the provider snapshot's startup-directory catalog.1118+ const providerSkills = useWorkspaceSkills({
- apps/server/src/provider/Drivers/CodexDriver.ts line 197OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -184,3 +189,9 @@184189 ),185190 Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),186191 );192+ // Workspace-scoped skill discovery for the composer's `$` picker. The193+ // managed snapshot above keeps machine-level state; this closure asks a194+ // short-lived app-server — spawned in the workspace itself — for the195+ // catalog that workspace would actually load.196+ const listSkillsForCwd: ProviderInstance["listSkillsForCwd"] = (workspaceCwd) =>197+ listCodexSkillsForCwd(effectiveConfig, workspaceCwd, processEnv).pipe(
- apps/server/src/provider/Drivers/CodexDriver.ts line 206OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -184,3 +189,18 @@184189 ),185190 Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),186191 );192+ // Workspace-scoped skill discovery for the composer's `$` picker. The193+ // managed snapshot above keeps machine-level state; this closure asks a194+ // short-lived app-server — spawned in the workspace itself — for the195+ // catalog that workspace would actually load.196+ const listSkillsForCwd: ProviderInstance["listSkillsForCwd"] = (workspaceCwd) =>197+ listCodexSkillsForCwd(effectiveConfig, workspaceCwd, processEnv).pipe(198+ Effect.scoped,199+ Effect.timeout(Duration.millis(AUTH_PROBE_TIMEOUT_MS)),200+ Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),201+ Effect.mapError(202+ (cause) =>203+ new ProviderDriverError({204+ driver: DRIVER_KIND,205+ instanceId,206+ detail: `Codex workspace skill discovery failed: ${cause.message ?? String(cause)}`,
- apps/server/src/provider/Drivers/CodexDriver.ts line 206OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -184,3 +189,18 @@184189 ),185190 Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),186191 );192+ // Workspace-scoped skill discovery for the composer's `$` picker. The193+ // managed snapshot above keeps machine-level state; this closure asks a194+ // short-lived app-server — spawned in the workspace itself — for the195+ // catalog that workspace would actually load.196+ const listSkillsForCwd: ProviderInstance["listSkillsForCwd"] = (workspaceCwd) =>197+ listCodexSkillsForCwd(effectiveConfig, workspaceCwd, processEnv).pipe(198+ Effect.scoped,199+ Effect.timeout(Duration.millis(AUTH_PROBE_TIMEOUT_MS)),200+ Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),201+ Effect.mapError(202+ (cause) =>203+ new ProviderDriverError({204+ driver: DRIVER_KIND,205+ instanceId,206+ detail: `Codex workspace skill discovery failed in '${workspaceCwd}'.`,
- apps/web/src/components/chat/ChatComposer.tsx line 1118OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1107,3 +1113,6 @@11071113 () => selectedProviderEntry?.snapshot ?? null,11081114 [selectedProviderEntry],11091115 );1116+ // Skills scoped to the active workspace (thread worktree or project root)1117+ // instead of the provider snapshot's startup-directory catalog.1118+ const providerSkills = useWorkspaceSkills({
- apps/web/src/components/ChatView.tsx lines 2963 to 2972OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -2952,3 +2954,19 @@29522954 const defaultInstanceId = defaultInstanceIdForDriver(selectedProvider);29532955 return providerStatuses.find((status) => status.instanceId === defaultInstanceId) ?? null;29542956 }, [activeProviderInstanceId, providerStatuses, selectedProvider]);2957+ // Timeline chips re-parse `$name` tokens against this catalog, so sent2958+ // messages must see the same workspace-scoped skills the composer offered.2959+ // The composer only selects enabled, available instances (falling back to2960+ // the first selectable one); apply the same filter here so the two2961+ // surfaces agree on which catalog resolves the tokens after the stored2962+ // selection is disabled or removed.2963+ const timelineProviderEntry = useMemo(() => {2964+ const entries = applyProviderInstanceSettings(2965+ deriveProviderInstanceEntries(providerStatuses),2966+ settings,2967+ );2968+ const stored = activeProviderInstanceId ?? undefined;2969+ const match = stored2970+ ? entries.find((entry) => entry.instanceId === stored && entry.enabled && entry.isAvailable)2971+ : undefined;2972+ return match ?? resolveSelectableProviderInstanceEntry(entries, stored);
- apps/server/src/provider/providerSkills.ts lines 65 to 69OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +49,21 @@49+50+function parseCacheKey(key: string): {51+ readonly instanceId: ProviderInstanceId;52+ readonly cwd: string;53+} {54+ const separatorIndex = key.indexOf(CACHE_KEY_SEPARATOR);55+ return {56+ instanceId: key.slice(0, separatorIndex) as ProviderInstanceId,57+ cwd: key.slice(separatorIndex + 1),58+ };59+}60+61+export type WorkspaceSkillsQuery = (62+ input: ProviderWorkspaceSkillsInput,63+) => Effect.Effect<ProviderWorkspaceSkillsResult, ProviderWorkspaceSkillsError>;64+65+export const makeWorkspaceSkillsQuery: Effect.Effect<66+ WorkspaceSkillsQuery,67+ never,68+ ProviderInstanceRegistry | ProjectionSnapshotQuery.ProjectionSnapshotQuery69+> = Effect.gen(function* () {
- apps/web/src/components/ChatView.tsx line 2974OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -2952,3 +2954,21 @@29522954 const defaultInstanceId = defaultInstanceIdForDriver(selectedProvider);29532955 return providerStatuses.find((status) => status.instanceId === defaultInstanceId) ?? null;29542956 }, [activeProviderInstanceId, providerStatuses, selectedProvider]);2957+ // Timeline chips re-parse `$name` tokens against this catalog, so sent2958+ // messages must see the same workspace-scoped skills the composer offered.2959+ // The composer only selects enabled, available instances (falling back to2960+ // the first selectable one); apply the same filter here so the two2961+ // surfaces agree on which catalog resolves the tokens after the stored2962+ // selection is disabled or removed.2963+ const timelineProviderEntry = useMemo(() => {2964+ const entries = applyProviderInstanceSettings(2965+ deriveProviderInstanceEntries(providerStatuses),2966+ settings,2967+ );2968+ const stored = activeProviderInstanceId ?? undefined;2969+ const match = stored2970+ ? entries.find((entry) => entry.instanceId === stored && entry.enabled && entry.isAvailable)2971+ : undefined;2972+ return match ?? resolveSelectableProviderInstanceEntry(entries, stored);2973+ }, [activeProviderInstanceId, providerStatuses, settings]);2974+ const workspaceSkills = useWorkspaceSkills({
- apps/web/src/components/ChatView.tsx lines 2963 to 2973OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -2952,3 +2954,20 @@29522954 const defaultInstanceId = defaultInstanceIdForDriver(selectedProvider);29532955 return providerStatuses.find((status) => status.instanceId === defaultInstanceId) ?? null;29542956 }, [activeProviderInstanceId, providerStatuses, selectedProvider]);2957+ // Timeline chips re-parse `$name` tokens against this catalog, so sent2958+ // messages must see the same workspace-scoped skills the composer offered.2959+ // The composer only selects enabled, available instances (falling back to2960+ // the first selectable one); apply the same filter here so the two2961+ // surfaces agree on which catalog resolves the tokens after the stored2962+ // selection is disabled or removed.2963+ const timelineProviderEntry = useMemo(() => {2964+ const entries = applyProviderInstanceSettings(2965+ deriveProviderInstanceEntries(providerStatuses),2966+ settings,2967+ );2968+ const stored = activeProviderInstanceId ?? undefined;2969+ const match = stored2970+ ? entries.find((entry) => entry.instanceId === stored && entry.enabled && entry.isAvailable)2971+ : undefined;2972+ return match ?? resolveSelectableProviderInstanceEntry(entries, stored);2973+ }, [activeProviderInstanceId, providerStatuses, settings]);
- apps/server/src/provider/providerSkills.ts lines 196 to 207OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +187,21 @@187+ if (instance.listSkillsForCwd === undefined || !instance.enabled) {188+ return { skills: [], source: "snapshot" as const };189+ }190+ const cwd = yield* resolveWorkspaceCwd(input);191+ const key = makeCacheKey(input.instanceId, cwd);192+ // Only successes stay cached: a failed lookup (spawn error, timeout)193+ // would otherwise keep every retry failing for the whole TTL.194+ const skills = yield* Cache.get(cache, key).pipe(195+ Effect.tapError(() => Cache.invalidate(cache, key)),196+ Effect.mapError((cause) =>197+ isProviderWorkspaceSkillsError(cause)198+ ? cause199+ : new ProviderWorkspaceSkillsError({200+ reason: "discovery-failed",201+ instanceId: input.instanceId,202+ projectId: input.projectId,203+ ...(input.threadId === undefined ? {} : { threadId: input.threadId }),204+ cwd,205+ cause,206+ }),207+ ),
Mnigos(GitHub profile, opens in a new tab) changed the title
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:L
- docs/user/composer.md lines 197 to 198OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -192,3 +192,7 @@192192 Type `/` to open the command menu. Type `$` to find and add a skill. Skill rows show their source,193193 such as System, Personal, Project, or App.194194195+On web and desktop, Codex, Claude, and OpenCode list skills for the workspace you are working in:196+the active thread's worktree when it has one, otherwise the project folder. Personal and system197+skills are always included. Providers that are disabled list the skills found when the provider198+was last checked.
Mnigos(GitHub profile, opens in a new tab) changed the title
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
- apps/web/src/components/chat/MessagesTimeline.tsx line 436OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -391,4 +391,4 @@391391 resolvedTheme: "light" | "dark";392392 timestampFormat: TimestampFormat;393393 workspaceRoot: string | undefined;394- skills?: ReadonlyArray<Pick<ServerProviderSkill, "name" | "displayName">>;394+ skills?: ReadonlyArray<InlineSkill>;
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
juliusmarminge closed this
Sign in to join this conversation.


macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed