Skip to content

🀯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

πŸ› fix(desktop): open device-scope skill previews (local IPC + bound-device RPC) (#16773)

Arvin Xuc467f528c4c9
diff --git a/src/features/SkillsList/useProjectSkillResolver.ts b/src/features/SkillsList/useProjectSkillResolver.ts
index a8dd5b7e1d1..e26c678ed50 100644
--- a/src/features/SkillsList/useProjectSkillResolver.ts
+++ b/src/features/SkillsList/useProjectSkillResolver.ts
@@ -12,10 +12,9 @@ export interface ResolvedProjectSkill {
description?: string;
name: string;
/**
- * Opens the skill's `SKILL.md` in the right-hand portal. Only present when the
- * skill is reachable by the local viewer β€” a remote device's filesystem can't
- * be previewed (matches the Files tab / working-sidebar behavior), so those
- * tags stay non-clickable.
+ * Opens the skill's `SKILL.md` in the right-hand portal. Present whenever the
+ * skill resolves β€” local reads go over IPC, a bound device over RPC (matches
+ * the Files tab / working-sidebar behavior).
*/
open?: () => void;
}
@@ -71,10 +70,11 @@ export const useProjectSkillResolver = (
return {
description: item.description,
name: item.name,
- // A remote device's SKILL.md isn't reachable by the local viewer.
- open: remoteDeviceId ? undefined : () => onOpenSkill(item),
+ // Preview opens in every mode now β€” onOpenSkill reads over IPC locally
+ // and over RPC for a bound device (like the Files tab).
+ open: () => onOpenSkill(item),
};
},
- [items, onOpenSkill, remoteDeviceId],
+ [items, onOpenSkill],
);
};
diff --git a/src/features/SkillsList/useProjectSkills.ts b/src/features/SkillsList/useProjectSkills.ts
index 594f6e88640..fed4dd5c64d 100644
--- a/src/features/SkillsList/useProjectSkills.ts
+++ b/src/features/SkillsList/useProjectSkills.ts
@@ -14,10 +14,9 @@ export interface UseProjectSkillsResult {
/** The thrown error from the SWR scan, if it failed. */
error: unknown;
/**
- * Per-row actions for filesystem skills: "view" opens the SKILL.md (local
- * only β€” a remote device's filesystem isn't reachable by the local viewer),
- * while rename / delete are stubbed (disabled) until filesystem-mutation IPC
- * lands.
+ * Per-row actions for filesystem skills: "view" opens the SKILL.md (locally
+ * via IPC, or on a bound device over RPC β€” same as the Files tab), while
+ * rename / delete are stubbed (disabled) until filesystem-mutation IPC lands.
*/
getRowActions: (item: SkillListItem) => SkillRowAction[];
isLoading: boolean;
@@ -35,10 +34,11 @@ export interface UseProjectSkillsResult {
* under `.agents/skills` / `.claude/skills` in `workingDirectory`; device
* skills live under those directories in the execution device's home.
*
- * `deviceId` picks the transport: when set, the scan runs on that remote device
- * via the `device.listProjectSkills` RPC; otherwise it goes through local
- * Electron IPC. Like the Files tab, remote mode lists skills but does not open
- * previews (the device's filesystem isn't reachable by the local viewer).
+ * `deviceId` picks the transport for both listing and preview: when set, the
+ * scan and file reads run on that bound device via RPC (`device.listProjectSkills`
+ * / `device.getLocalFilePreview`); otherwise they go through local Electron IPC.
+ * Mirrors the Files tab β€” a bound device (remote or this machine) previews over
+ * RPC rather than being non-openable.
*
* Pass `undefined` workingDirectory to keep the hook inert (no fetch fires) β€”
* useful when the caller hasn't decided whether to render the section yet.
@@ -49,7 +49,6 @@ export const useProjectSkills = (
): UseProjectSkillsResult => {
const { t } = useTranslation('chat');
const openLocalFile = useChatStore((s) => s.openLocalFile);
- const isRemote = !!deviceId;
const { data, error, isLoading, mutate } = useFetchProjectSkills(workingDirectory, deviceId);
@@ -81,31 +80,42 @@ export const useProjectSkills = (
return map;
}, [data?.skills]);
- const onOpenFile = (item: SkillListItem, relativePath: string) => {
- // A remote device has no filesystem the local viewer can open (matches the
- // Files tab); device mode lists skills but does not preview them.
- if (isRemote) return;
- const skill = skillByDir.get(item.id);
- if (!skill) return;
+ // Device-scope skills live under the execution device's home
+ // (`~/.agents/skills` / `~/.claude/skills`), outside the topic's project
+ // scope. Marking them external both keeps the portal scope filter
+ // (isLocalFileInCurrentScope) from dropping the tab and clears the desktop
+ // preview protocol's approved-root / symlink-containment check
+ // (resolveApprovedPreviewPath), so previews open instead of showing blank.
+ const openSkillFile = (skill: ProjectSkillItem, filePath: string) => {
openLocalFile({
- filePath: path.join(skill.skillDir, relativePath),
+ allowExternalFilePreview: skill.scope === 'device',
+ // A bound device (remote, or this machine as a device) reads the preview
+ // over RPC, exactly like the Files tab; an undefined deviceId falls back to
+ // local Electron IPC. The old `isRemote` no-op predated remote preview.
+ deviceId,
+ filePath,
workingDirectory: skill.previewRoot || previewRoot,
});
};
+ const onOpenFile = (item: SkillListItem, relativePath: string) => {
+ const skill = skillByDir.get(item.id);
+ if (!skill) return;
+ openSkillFile(skill, path.join(skill.skillDir, relativePath));
+ };
+
const onOpenSkill = (item: SkillListItem) => {
- if (isRemote) return;
const skill = skillByDir.get(item.id);
if (!skill) return;
- openLocalFile({ filePath: skill.path, workingDirectory: skill.previewRoot || previewRoot });
+ openSkillFile(skill, skill.path);
};
const getRowActions = (_item: SkillListItem): SkillRowAction[] => {
const comingSoon = t('workingPanel.skills.actions.comingSoon');
return [
{
- // Remote devices list skills but can't preview them (matches Files tab).
- disabled: isRemote,
+ // Preview works in every mode: local via IPC, bound device via RPC
+ // (matches the Files tab, which reads remote files over RPC).
icon: EyeIcon,
key: 'view',
label: t('workingPanel.skills.actions.view'),