mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-24 14:55:19 +00:00
Merge remote-tracking branch 'origin' into sqlite2
This commit is contained in:
@@ -4,6 +4,7 @@ import { createSimpleContext } from "@opencode-ai/ui/context"
|
||||
import { useGlobalSync } from "./global-sync"
|
||||
import { useGlobalSDK } from "./global-sdk"
|
||||
import { useServer } from "./server"
|
||||
import { usePlatform } from "./platform"
|
||||
import { Project } from "@opencode-ai/sdk/v2"
|
||||
import { Persist, persisted, removePersisted } from "@/utils/persist"
|
||||
import { same } from "@/utils/same"
|
||||
@@ -90,6 +91,7 @@ export const { use: useLayout, provider: LayoutProvider } = createSimpleContext(
|
||||
const globalSdk = useGlobalSDK()
|
||||
const globalSync = useGlobalSync()
|
||||
const server = useServer()
|
||||
const platform = usePlatform()
|
||||
|
||||
const isRecord = (value: unknown): value is Record<string, unknown> =>
|
||||
typeof value === "object" && value !== null && !Array.isArray(value)
|
||||
@@ -200,10 +202,10 @@ export const { use: useLayout, provider: LayoutProvider } = createSimpleContext(
|
||||
|
||||
for (const entry of SESSION_STATE_KEYS) {
|
||||
const target = session ? Persist.session(dir, session, entry.key) : Persist.workspace(dir, entry.key)
|
||||
void removePersisted(target)
|
||||
void removePersisted(target, platform)
|
||||
|
||||
const legacyKey = `${dir}/${entry.legacy}${session ? "/" + session : ""}.${entry.version}`
|
||||
void removePersisted({ key: legacyKey })
|
||||
void removePersisted({ key: legacyKey }, platform)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { createSimpleContext } from "@opencode-ai/ui/context"
|
||||
import { batch, createEffect, createMemo, createRoot, onCleanup } from "solid-js"
|
||||
import { useParams } from "@solidjs/router"
|
||||
import { useSDK } from "./sdk"
|
||||
import type { Platform } from "./platform"
|
||||
import { Persist, persisted, removePersisted } from "@/utils/persist"
|
||||
|
||||
export type LocalPTY = {
|
||||
@@ -37,14 +38,14 @@ type TerminalCacheEntry = {
|
||||
|
||||
const caches = new Set<Map<string, TerminalCacheEntry>>()
|
||||
|
||||
export function clearWorkspaceTerminals(dir: string, sessionIDs?: string[]) {
|
||||
export function clearWorkspaceTerminals(dir: string, sessionIDs?: string[], platform?: Platform) {
|
||||
const key = getWorkspaceTerminalCacheKey(dir)
|
||||
for (const cache of caches) {
|
||||
const entry = cache.get(key)
|
||||
entry?.value.clear()
|
||||
}
|
||||
|
||||
removePersisted(Persist.workspace(dir, "terminal"))
|
||||
removePersisted(Persist.workspace(dir, "terminal"), platform)
|
||||
|
||||
const legacy = new Set(getLegacyTerminalStorageKeys(dir))
|
||||
for (const id of sessionIDs ?? []) {
|
||||
@@ -53,7 +54,7 @@ export function clearWorkspaceTerminals(dir: string, sessionIDs?: string[]) {
|
||||
}
|
||||
}
|
||||
for (const key of legacy) {
|
||||
removePersisted({ key })
|
||||
removePersisted({ key }, platform)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1203,6 +1203,16 @@ export default function Layout(props: ParentProps) {
|
||||
|
||||
if (!result) return
|
||||
|
||||
globalSync.set(
|
||||
"project",
|
||||
produce((draft) => {
|
||||
const project = draft.find((item) => item.worktree === root)
|
||||
if (!project) return
|
||||
project.sandboxes = (project.sandboxes ?? []).filter((sandbox) => sandbox !== directory)
|
||||
}),
|
||||
)
|
||||
setStore("workspaceOrder", root, (order) => (order ?? []).filter((workspace) => workspace !== directory))
|
||||
|
||||
layout.projects.close(directory)
|
||||
layout.projects.open(root)
|
||||
|
||||
@@ -1230,6 +1240,7 @@ export default function Layout(props: ParentProps) {
|
||||
clearWorkspaceTerminals(
|
||||
directory,
|
||||
sessions.map((s) => s.id),
|
||||
platform,
|
||||
)
|
||||
await globalSDK.client.instance.dispose({ directory }).catch(() => undefined)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { usePlatform } from "@/context/platform"
|
||||
import { Platform, usePlatform } from "@/context/platform"
|
||||
import { makePersisted, type AsyncStorage, type SyncStorage } from "@solid-primitives/storage"
|
||||
import { checksum } from "@opencode-ai/util/encode"
|
||||
import { createResource, type Accessor } from "solid-js"
|
||||
@@ -318,9 +318,8 @@ export const Persist = {
|
||||
},
|
||||
}
|
||||
|
||||
export function removePersisted(target: { storage?: string; key: string }) {
|
||||
const platform = usePlatform()
|
||||
const isDesktop = platform.platform === "desktop" && !!platform.storage
|
||||
export function removePersisted(target: { storage?: string; key: string }, platform?: Platform) {
|
||||
const isDesktop = platform?.platform === "desktop" && !!platform.storage
|
||||
|
||||
if (isDesktop) {
|
||||
return platform.storage?.(target.storage)?.removeItem(target.key)
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
export const dict = {
|
||||
"ui.sessionReview.title": "تغييرات الجلسة",
|
||||
"ui.sessionReview.title.lastTurn": "تغييرات آخر دور",
|
||||
"ui.sessionReview.diffStyle.unified": "موجد",
|
||||
"ui.sessionReview.diffStyle.unified": "موحد",
|
||||
"ui.sessionReview.diffStyle.split": "منقسم",
|
||||
"ui.sessionReview.expandAll": "توسيع الكل",
|
||||
"ui.sessionReview.collapseAll": "طي الكل",
|
||||
|
||||
"ui.sessionReview.change.added": "مضاف",
|
||||
"ui.sessionReview.change.removed": "محذوف",
|
||||
"ui.sessionReview.change.modified": "معدل",
|
||||
|
||||
"ui.lineComment.label.prefix": "تعليق على ",
|
||||
"ui.lineComment.label.suffix": "",
|
||||
"ui.lineComment.editorLabel.prefix": "جارٍ التعليق على ",
|
||||
"ui.lineComment.editorLabel.suffix": "",
|
||||
"ui.lineComment.placeholder": "أضف تعليقًا",
|
||||
"ui.lineComment.submit": "تعليق",
|
||||
|
||||
"ui.sessionTurn.steps.show": "إظهار الخطوات",
|
||||
"ui.sessionTurn.steps.hide": "إخفاء الخطوات",
|
||||
"ui.sessionTurn.summary.response": "استجابة",
|
||||
|
||||
@@ -5,16 +5,17 @@ export const dict = {
|
||||
"ui.sessionReview.diffStyle.split": "Dividido",
|
||||
"ui.sessionReview.expandAll": "Expandir tudo",
|
||||
"ui.sessionReview.collapseAll": "Recolher tudo",
|
||||
|
||||
"ui.sessionReview.change.added": "Adicionado",
|
||||
"ui.sessionReview.change.removed": "Removido",
|
||||
"ui.sessionReview.change.modified": "Modificado",
|
||||
|
||||
"ui.lineComment.label.prefix": "Comentar em ",
|
||||
"ui.lineComment.label.suffix": "",
|
||||
"ui.lineComment.editorLabel.prefix": "Comentando em ",
|
||||
"ui.lineComment.editorLabel.suffix": "",
|
||||
"ui.lineComment.placeholder": "Adicionar comentário",
|
||||
"ui.lineComment.submit": "Comentar",
|
||||
|
||||
"ui.sessionTurn.steps.show": "Mostrar passos",
|
||||
"ui.sessionTurn.steps.hide": "Ocultar passos",
|
||||
"ui.sessionTurn.summary.response": "Resposta",
|
||||
@@ -94,7 +95,7 @@ export const dict = {
|
||||
"ui.patch.action.deleted": "Excluído",
|
||||
"ui.patch.action.created": "Criado",
|
||||
"ui.patch.action.moved": "Movido",
|
||||
"ui.patch.action.patched": "Aplicado patch",
|
||||
"ui.patch.action.patched": "Patch aplicado",
|
||||
|
||||
"ui.question.subtitle.answered": "{{count}} respondidas",
|
||||
"ui.question.answer.none": "(sem resposta)",
|
||||
|
||||
@@ -63,8 +63,8 @@ export const dict = {
|
||||
"ui.tool.webfetch": "Webhentning",
|
||||
"ui.tool.shell": "Shell",
|
||||
"ui.tool.patch": "Patch",
|
||||
"ui.tool.todos": "To-dos",
|
||||
"ui.tool.todos.read": "Læs to-dos",
|
||||
"ui.tool.todos": "Opgaver",
|
||||
"ui.tool.todos.read": "Læs opgaver",
|
||||
"ui.tool.questions": "Spørgsmål",
|
||||
"ui.tool.agent": "{{type}} Agent",
|
||||
|
||||
@@ -94,7 +94,7 @@ export const dict = {
|
||||
"ui.patch.action.deleted": "Slettet",
|
||||
"ui.patch.action.created": "Oprettet",
|
||||
"ui.patch.action.moved": "Flyttet",
|
||||
"ui.patch.action.patched": "Patched",
|
||||
"ui.patch.action.patched": "Patchet",
|
||||
|
||||
"ui.question.subtitle.answered": "{{count}} besvaret",
|
||||
"ui.question.answer.none": "(intet svar)",
|
||||
|
||||
@@ -5,16 +5,17 @@ export const dict = {
|
||||
"ui.sessionReview.diffStyle.split": "Dividido",
|
||||
"ui.sessionReview.expandAll": "Expandir todo",
|
||||
"ui.sessionReview.collapseAll": "Colapsar todo",
|
||||
|
||||
"ui.sessionReview.change.added": "Añadido",
|
||||
"ui.sessionReview.change.removed": "Eliminado",
|
||||
"ui.sessionReview.change.modified": "Modificado",
|
||||
|
||||
"ui.lineComment.label.prefix": "Comentar en ",
|
||||
"ui.lineComment.label.suffix": "",
|
||||
"ui.lineComment.editorLabel.prefix": "Comentando en ",
|
||||
"ui.lineComment.editorLabel.suffix": "",
|
||||
"ui.lineComment.placeholder": "Añadir comentario",
|
||||
"ui.lineComment.submit": "Comentar",
|
||||
|
||||
"ui.sessionTurn.steps.show": "Mostrar pasos",
|
||||
"ui.sessionTurn.steps.hide": "Ocultar pasos",
|
||||
"ui.sessionTurn.summary.response": "Respuesta",
|
||||
|
||||
@@ -5,16 +5,17 @@ export const dict = {
|
||||
"ui.sessionReview.diffStyle.split": "Divisé",
|
||||
"ui.sessionReview.expandAll": "Tout développer",
|
||||
"ui.sessionReview.collapseAll": "Tout réduire",
|
||||
|
||||
"ui.sessionReview.change.added": "Ajouté",
|
||||
"ui.sessionReview.change.removed": "Supprimé",
|
||||
"ui.sessionReview.change.modified": "Modifié",
|
||||
|
||||
"ui.lineComment.label.prefix": "Commenter sur ",
|
||||
"ui.lineComment.label.suffix": "",
|
||||
"ui.lineComment.editorLabel.prefix": "Commentaire sur ",
|
||||
"ui.lineComment.editorLabel.suffix": "",
|
||||
"ui.lineComment.placeholder": "Ajouter un commentaire",
|
||||
"ui.lineComment.submit": "Commenter",
|
||||
|
||||
"ui.sessionTurn.steps.show": "Afficher les étapes",
|
||||
"ui.sessionTurn.steps.hide": "Masquer les étapes",
|
||||
"ui.sessionTurn.summary.response": "Réponse",
|
||||
|
||||
@@ -5,16 +5,17 @@ export const dict = {
|
||||
"ui.sessionReview.diffStyle.split": "분할 보기",
|
||||
"ui.sessionReview.expandAll": "모두 펼치기",
|
||||
"ui.sessionReview.collapseAll": "모두 접기",
|
||||
|
||||
"ui.sessionReview.change.added": "추가됨",
|
||||
"ui.sessionReview.change.removed": "삭제됨",
|
||||
"ui.sessionReview.change.modified": "수정됨",
|
||||
|
||||
"ui.lineComment.label.prefix": "",
|
||||
"ui.lineComment.label.suffix": "에 댓글 달기",
|
||||
"ui.lineComment.editorLabel.prefix": "",
|
||||
"ui.lineComment.editorLabel.suffix": "에 댓글 작성 중",
|
||||
"ui.lineComment.placeholder": "댓글 추가",
|
||||
"ui.lineComment.submit": "댓글",
|
||||
|
||||
"ui.sessionTurn.steps.show": "단계 표시",
|
||||
"ui.sessionTurn.steps.hide": "단계 숨기기",
|
||||
"ui.sessionTurn.summary.response": "응답",
|
||||
|
||||
@@ -8,16 +8,17 @@ export const dict: Record<Keys, string> = {
|
||||
"ui.sessionReview.diffStyle.split": "Delt",
|
||||
"ui.sessionReview.expandAll": "Utvid alle",
|
||||
"ui.sessionReview.collapseAll": "Fold sammen alle",
|
||||
|
||||
"ui.sessionReview.change.added": "Lagt til",
|
||||
"ui.sessionReview.change.removed": "Fjernet",
|
||||
"ui.sessionReview.change.modified": "Endret",
|
||||
|
||||
"ui.lineComment.label.prefix": "Kommenter på ",
|
||||
"ui.lineComment.label.suffix": "",
|
||||
"ui.lineComment.editorLabel.prefix": "Kommenterer på ",
|
||||
"ui.lineComment.editorLabel.suffix": "",
|
||||
"ui.lineComment.placeholder": "Legg til kommentar",
|
||||
"ui.lineComment.submit": "Kommenter",
|
||||
|
||||
"ui.sessionTurn.steps.show": "Vis trinn",
|
||||
"ui.sessionTurn.steps.hide": "Skjul trinn",
|
||||
"ui.sessionTurn.summary.response": "Svar",
|
||||
|
||||
@@ -57,6 +57,7 @@ export const dict = {
|
||||
"ui.imagePreview.alt": "ตัวอย่างรูปภาพ",
|
||||
|
||||
"ui.tool.read": "อ่าน",
|
||||
"ui.tool.loaded": "โหลดแล้ว",
|
||||
"ui.tool.list": "รายการ",
|
||||
"ui.tool.glob": "Glob",
|
||||
"ui.tool.grep": "Grep",
|
||||
|
||||
@@ -9,16 +9,17 @@ export const dict = {
|
||||
"ui.sessionReview.diffStyle.split": "拆分",
|
||||
"ui.sessionReview.expandAll": "全部展开",
|
||||
"ui.sessionReview.collapseAll": "全部收起",
|
||||
|
||||
"ui.sessionReview.change.added": "已添加",
|
||||
"ui.sessionReview.change.removed": "已移除",
|
||||
"ui.sessionReview.change.modified": "已修改",
|
||||
|
||||
"ui.lineComment.label.prefix": "评论 ",
|
||||
"ui.lineComment.label.suffix": "",
|
||||
"ui.lineComment.editorLabel.prefix": "正在评论 ",
|
||||
"ui.lineComment.editorLabel.suffix": "",
|
||||
"ui.lineComment.placeholder": "添加评论",
|
||||
"ui.lineComment.submit": "评论",
|
||||
|
||||
"ui.sessionTurn.steps.show": "显示步骤",
|
||||
"ui.sessionTurn.steps.hide": "隐藏步骤",
|
||||
"ui.sessionTurn.summary.response": "回复",
|
||||
@@ -92,7 +93,7 @@ export const dict = {
|
||||
"ui.message.expand": "展开消息",
|
||||
"ui.message.collapse": "收起消息",
|
||||
"ui.message.copy": "复制",
|
||||
"ui.message.copied": "已复制",
|
||||
"ui.message.copied": "已复制!",
|
||||
"ui.message.attachment.alt": "附件",
|
||||
|
||||
"ui.patch.action.deleted": "已删除",
|
||||
|
||||
@@ -9,16 +9,17 @@ export const dict = {
|
||||
"ui.sessionReview.diffStyle.split": "拆分",
|
||||
"ui.sessionReview.expandAll": "全部展開",
|
||||
"ui.sessionReview.collapseAll": "全部收合",
|
||||
|
||||
"ui.sessionReview.change.added": "已新增",
|
||||
"ui.sessionReview.change.removed": "已移除",
|
||||
"ui.sessionReview.change.modified": "已修改",
|
||||
|
||||
"ui.lineComment.label.prefix": "評論 ",
|
||||
"ui.lineComment.label.suffix": "",
|
||||
"ui.lineComment.editorLabel.prefix": "正在評論 ",
|
||||
"ui.lineComment.editorLabel.suffix": "",
|
||||
"ui.lineComment.placeholder": "新增評論",
|
||||
"ui.lineComment.submit": "評論",
|
||||
|
||||
"ui.sessionTurn.steps.show": "顯示步驟",
|
||||
"ui.sessionTurn.steps.hide": "隱藏步驟",
|
||||
"ui.sessionTurn.summary.response": "回覆",
|
||||
@@ -92,7 +93,7 @@ export const dict = {
|
||||
"ui.message.expand": "展開訊息",
|
||||
"ui.message.collapse": "收合訊息",
|
||||
"ui.message.copy": "複製",
|
||||
"ui.message.copied": "已複製",
|
||||
"ui.message.copied": "已複製!",
|
||||
"ui.message.attachment.alt": "附件",
|
||||
|
||||
"ui.patch.action.deleted": "已刪除",
|
||||
|
||||
Reference in New Issue
Block a user