refactor(core): simplify location filesystem (#31545)
This commit is contained in:
@@ -29,8 +29,7 @@ import { ModelV2 } from "@opencode-ai/core/model"
|
||||
import { ProviderV2 } from "@opencode-ai/core/provider"
|
||||
import * as DateTime from "effect/DateTime"
|
||||
import { RuntimeFlags } from "@/effect/runtime-flags"
|
||||
import { toolFileSourceFromUri, Usage, type LLMEvent } from "@opencode-ai/llm"
|
||||
import { ToolOutput } from "@opencode-ai/core/tool-output"
|
||||
import { ToolOutput, Usage, type LLMEvent } from "@opencode-ai/llm"
|
||||
|
||||
const DOOM_LOOP_THRESHOLD = 3
|
||||
export type Result = "compact" | "stop" | "continue"
|
||||
@@ -595,20 +594,20 @@ export const layer = Layer.effect(
|
||||
if (mirrorAssistant) {
|
||||
const assistantMessageID = yield* requireV2AssistantMessage(toolCall?.call)
|
||||
const content = [
|
||||
ToolOutput.text({ type: "text", text: output.output }),
|
||||
{ type: "text" as const, text: output.output },
|
||||
...(output.attachments?.map((item: SessionV1.FilePart) =>
|
||||
ToolOutput.file({
|
||||
({
|
||||
type: "file",
|
||||
source: toolFileSourceFromUri(item.url),
|
||||
uri: item.url,
|
||||
mime: item.mime,
|
||||
name: item.filename,
|
||||
}),
|
||||
}) as const,
|
||||
) ?? []),
|
||||
]
|
||||
const unsupported = content.find((item) => item.type === "file" && item.source.type !== "data")
|
||||
const unsupported = content.find((item) => item.type === "file" && !item.uri.startsWith("data:"))
|
||||
if (unsupported?.type === "file") {
|
||||
const error = new Error(
|
||||
`Tool attachment source "${unsupported.source.type}" must be materialized before durable V2 settlement`,
|
||||
`Tool attachment URI "${unsupported.uri}" must be materialized before durable V2 settlement`,
|
||||
)
|
||||
yield* events.publish(SessionEvent.Tool.Failed, {
|
||||
sessionID: ctx.sessionID,
|
||||
|
||||
Reference in New Issue
Block a user