feat: remove legacy OpenCode runtime
Cut product flows over to Coding/Pi and retain only the migration-owned v1 boundary. Promote supported native optional packages because electron-builder omitted pnpm transitive optional closure from the packaged ASAR.
This commit is contained in:
@@ -41,11 +41,11 @@ import {
|
||||
toModelOptionTestId,
|
||||
type ConfiguredModelOption,
|
||||
} from '@/lib/model-options';
|
||||
import { hostApiFetch } from '@/lib/host-api';
|
||||
import { getCodingSkills } from '@/lib/coding-product-tools';
|
||||
import { createLocalPartnerSubagent } from '@/lib/runtime-subagents';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { useOpencodeStore } from '@/stores/opencode';
|
||||
import { useCodingWorkspaceStore } from '@/stores/coding-workspace';
|
||||
import {
|
||||
partnerAvatarToneOptions,
|
||||
usePartnerProfilesStore,
|
||||
@@ -105,7 +105,8 @@ type Skill = {
|
||||
entries?: SkillStructureEntry[];
|
||||
};
|
||||
|
||||
type OpencodeSkillInfo = {
|
||||
type CodingSkillInfo = {
|
||||
id: string;
|
||||
name: string;
|
||||
description?: string;
|
||||
location: string;
|
||||
@@ -312,18 +313,18 @@ function getSubagentSkillIds(subagent: CreatedPartnerSubagent | null | undefined
|
||||
return subagent?.skillIds ?? [];
|
||||
}
|
||||
|
||||
function mapOpencodeSkillToDisplaySkill(skill: OpencodeSkillInfo): Skill {
|
||||
function mapCodingSkillToDisplaySkill(skill: CodingSkillInfo): Skill {
|
||||
const display = getSkillDisplayInfo(skill.name);
|
||||
return {
|
||||
id: skill.name,
|
||||
id: skill.id,
|
||||
name: display.name,
|
||||
description: display.description,
|
||||
prompt: skill.content.trim().split(/\r?\n/).find((line) => line.trim() && !line.startsWith('---'))?.trim() || '从 opencode 安装目录加载。',
|
||||
prompt: skill.content.trim().split(/\r?\n/).find((line) => line.trim() && !line.startsWith('---'))?.trim() || '从本地技能目录加载。',
|
||||
inputs: [],
|
||||
outputs: [],
|
||||
guardrails: [],
|
||||
appliesTo: [],
|
||||
statusLabel: 'opencode 已安装',
|
||||
statusLabel: '本地已安装',
|
||||
location: skill.location,
|
||||
content: skill.content,
|
||||
entries: skill.entries,
|
||||
@@ -763,7 +764,7 @@ export function CharacterScene() {
|
||||
const updatePartnerProfile = usePartnerProfilesStore((state) => state.updatePartnerProfile);
|
||||
const updateSubagentRuntimeConfig = usePartnerProfilesStore((state) => state.updateSubagentRuntimeConfig);
|
||||
const resetPartnerProfile = usePartnerProfilesStore((state) => state.resetPartnerProfile);
|
||||
const activeProject = useOpencodeStore((state) => state.activeProject);
|
||||
const activeProject = useCodingWorkspaceStore((state) => state.activeProject);
|
||||
const accessToken = useAuthStore((state) => state.accessToken);
|
||||
const getValidAccessToken = useAuthStore((state) => state.getValidAccessToken);
|
||||
const refreshSession = useAuthStore((state) => state.refreshSession);
|
||||
@@ -849,7 +850,7 @@ export function CharacterScene() {
|
||||
setInstalledSkillsLoading(true);
|
||||
setInstalledSkillsError(null);
|
||||
|
||||
void Promise.resolve(hostApiFetch<{ skills?: OpencodeSkillInfo[] }>('/api/opencode/skills'))
|
||||
void getCodingSkills()
|
||||
.then((payload) => {
|
||||
if (cancelled) return;
|
||||
const runtimeSkills = Array.isArray(payload?.skills) ? payload.skills : [];
|
||||
@@ -858,11 +859,11 @@ export function CharacterScene() {
|
||||
setInstalledSkillsError('当前没有返回已安装技能,正在显示课程内置技能。');
|
||||
return;
|
||||
}
|
||||
setInstalledSkills(mergeInstalledSkills(runtimeSkills.map(mapOpencodeSkillToDisplaySkill)));
|
||||
setInstalledSkills(mergeInstalledSkills(runtimeSkills.map(mapCodingSkillToDisplaySkill)));
|
||||
})
|
||||
.catch((error) => {
|
||||
if (cancelled) return;
|
||||
console.warn('[makelore] Failed to load opencode skills', error);
|
||||
console.warn('[makelore] Failed to load coding skills', error);
|
||||
setInstalledSkills(courseSkills);
|
||||
setInstalledSkillsError('暂时无法读取已安装技能,正在显示课程内置技能。');
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user