mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-21 10:16:03 +00:00
refactor(cli): share acp string narrowing
This commit is contained in:
@@ -2,7 +2,7 @@ import type { AgentSideConnection, PermissionOption, ToolCallContent, ToolCallLo
|
||||
import type { EventSubscribeOutput, OpenCodeClient } from "@opencode-ai/client/promise"
|
||||
import { Patch } from "@opencode-ai/core/patch"
|
||||
import { isAbsolute, resolve } from "node:path"
|
||||
import { pendingToolCall, toLocations, toToolKind, type ToolInput } from "./tool"
|
||||
import { pendingToolCall, stringValue, toLocations, toToolKind, type ToolInput } from "./tool"
|
||||
|
||||
type PermissionEvent = Extract<EventSubscribeOutput, { type: "permission.v2.asked" }>
|
||||
type Connection = Pick<AgentSideConnection, "requestPermission"> & Partial<Pick<AgentSideConnection, "writeTextFile">>
|
||||
@@ -173,8 +173,4 @@ function resolvePath(path: string, cwd: string) {
|
||||
return isAbsolute(path) ? path : resolve(cwd, path)
|
||||
}
|
||||
|
||||
function stringValue(value: unknown) {
|
||||
return typeof value === "string" ? value : undefined
|
||||
}
|
||||
|
||||
export * as ACPPermission from "./permission"
|
||||
|
||||
@@ -215,7 +215,7 @@ function locationFrom(...values: unknown[]): ToolCallLocation[] {
|
||||
)
|
||||
}
|
||||
|
||||
function stringValue(value: unknown) {
|
||||
export function stringValue(value: unknown) {
|
||||
return typeof value === "string" ? value : undefined
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user