refactor(cli): share acp string narrowing

This commit is contained in:
Shoubhit Dash
2026-07-20 18:49:09 +05:30
parent 7761ea2e4a
commit 78592847e3
2 changed files with 2 additions and 6 deletions
+1 -5
View File
@@ -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"
+1 -1
View File
@@ -215,7 +215,7 @@ function locationFrom(...values: unknown[]): ToolCallLocation[] {
)
}
function stringValue(value: unknown) {
export function stringValue(value: unknown) {
return typeof value === "string" ? value : undefined
}