Compare commits

..

1 Commits

Author SHA1 Message Date
Brendan Allan 73896b78fc fix(app): route review diffs through workspace 2026-08-10 16:46:13 +08:00
4 changed files with 35 additions and 10 deletions
+7 -7
View File
@@ -583,7 +583,7 @@ export const dict = {
"dialog.usageExceeded.dontShowAgain": "不再显示",
"context.breakdown.title": "上下文细分",
"context.breakdown.note": "输入 token 的大致细分。“其他”包含工具定义和开销。",
"context.breakdown.note": "输入词元的大致细分。“其他”包含工具定义和开销。",
"context.breakdown.system": "系统",
"context.breakdown.user": "用户",
"context.breakdown.assistant": "助手",
@@ -598,18 +598,18 @@ export const dict = {
"context.stats.provider": "提供商",
"context.stats.model": "模型",
"context.stats.limit": "上下文限制",
"context.stats.totalTokens": "总 token",
"context.stats.totalTokens": "词元总数",
"context.stats.usage": "使用率",
"context.stats.inputTokens": "输入 token",
"context.stats.outputTokens": "输出 token",
"context.stats.reasoningTokens": "推理 token",
"context.stats.cacheTokens": "缓存 token(读/写)",
"context.stats.inputTokens": "输入词元",
"context.stats.outputTokens": "输出词元",
"context.stats.reasoningTokens": "推理词元",
"context.stats.cacheTokens": "缓存词元(读/写)",
"context.stats.userMessages": "用户消息",
"context.stats.assistantMessages": "助手消息",
"context.stats.totalCost": "总成本",
"context.stats.sessionCreated": "创建时间",
"context.stats.lastActivity": "最后活动",
"context.usage.tokens": "Token",
"context.usage.tokens": "词元数",
"context.usage.usage": "使用率",
"context.usage.cost": "成本",
"context.usage.clickToView": "点击查看上下文",
+13 -3
View File
@@ -676,9 +676,16 @@ export default function Page() {
const mode = reviewMode()
if (mode === "git" || mode === "branch") return mode
})
const vcsWorkspace = createMemo(() => info()?.workspaceID)
const vcsKey = createMemo(
() =>
["session-vcs", sdk().directory, sync().data.vcs?.branch ?? "", sync().data.vcs?.default_branch ?? ""] as const,
[
"session-vcs",
sdk().directory,
vcsWorkspace() ?? "",
sync().data.vcs?.branch ?? "",
sync().data.vcs?.default_branch ?? "",
] as const,
)
const vcsQuery = createQuery(() => {
const mode = vcsMode()
@@ -690,7 +697,10 @@ export default function Page() {
queryFn: mode
? () =>
sdk()
.api.vcs.diff({ location: { directory: sdk().directory }, mode: mode === "git" ? "working" : mode })
.api.vcs.diff({
location: { directory: sdk().directory, workspace: vcsWorkspace() },
mode: mode === "git" ? "working" : mode,
})
.then((result) => result.data)
.catch((error) => {
console.debug("[session-review] failed to load vcs diff", { mode, error })
@@ -739,7 +749,7 @@ export default function Page() {
queryFn: () =>
sdk()
.api.vcs.diff({
location: { directory: scope },
location: { directory: scope, workspace: vcsWorkspace() },
mode: mode === "git" ? "working" : mode,
context,
})
@@ -184,6 +184,20 @@ describe("createCompatibleApi", () => {
expect(url.searchParams.get("limit")).toBe("20")
})
test("routes V1 diffs through the requested workspace", async () => {
const { api, requests } = setup("v1")
await api.vcs.diff({
location: { directory: "/repo", workspace: "workspace-1" },
mode: "working",
})
const url = new URL(requests[0]!.url)
expect(url.pathname).toBe("/vcs/diff")
expect(url.searchParams.get("directory")).toBe("/repo")
expect(url.searchParams.get("workspace")).toBe("workspace-1")
expect(url.searchParams.get("mode")).toBe("git")
})
test("routes V1 permission replies through the requested directory", async () => {
const { api, requests } = setup("v1")
await api.permission.reply({
+1
View File
@@ -344,6 +344,7 @@ function createV1Api(input: CompatibleInput): CompatibleApi {
const result = await legacy(value.location).vcs.diff({
mode: value.mode === "working" ? "git" : value.mode,
context: value.context,
workspace: value.location?.workspace,
})
return located(
(result.data ?? []).map((file) => ({