@@ -15,10 +15,10 @@ import os from "os"
1515import path from "path"
1616import stripAnsi from "strip-ansi"
1717import type { SessionMessageAssistantTool } from "@opencode/client/promise"
18+ import { Tool } from "@opencode/schema/tool"
1819import { LANGUAGE_EXTENSIONS } from "../util/filetype"
1920import { Locale } from "../util/locale"
2021import {
21- canonicalToolName ,
2222 finiteNumber ,
2323 primitiveInputSummary ,
2424 toolDisplayContent ,
@@ -29,8 +29,6 @@ import { formatPath } from "../util/path-format"
2929import { isRecord } from "../util/record"
3030import type { RunEntryBody , StreamCommit , ToolSnapshot } from "./types"
3131
32- export { canonicalToolName } from "../util/tool-display"
33-
3432type ToolView = {
3533 output : boolean
3634 final : boolean
@@ -157,9 +155,9 @@ function text(v: unknown): string {
157155export function toolOutputText ( name : string , content : ReadonlyArray < { type : string ; text ?: string } > | undefined ) {
158156 if ( ! content ) return ""
159157 // V2 shell content appends model-only status after the user-visible command output.
160- if ( canonicalToolName ( name ) === "shell" ) return content . find ( ( item ) => item . type === "text" ) ?. text ?? ""
158+ if ( Tool . canonicalName ( name ) === "shell" ) return content . find ( ( item ) => item . type === "text" ) ?. text ?? ""
161159 const joined = content . flatMap ( ( item ) => ( item . type === "text" && item . text ? [ item . text ] : [ ] ) ) . join ( "\n" )
162- if ( canonicalToolName ( name ) === "read" ) return readDisplayText ( joined ) ?? joined
160+ if ( Tool . canonicalName ( name ) === "read" ) return readDisplayText ( joined ) ?? joined
163161 return joined
164162}
165163
@@ -240,7 +238,7 @@ function normalizeMetadata(name: string, value: unknown) {
240238}
241239
242240export function normalizeTool ( tool : SessionMessageAssistantTool ) : SessionMessageAssistantTool {
243- const name = canonicalToolName ( tool . name )
241+ const name = Tool . canonicalName ( tool . name )
244242 if ( tool . state . status === "streaming" ) return { ...tool , name }
245243 return {
246244 ...tool ,
@@ -1116,7 +1114,7 @@ function toolFrame(commit: StreamCommit, raw: string): ToolFrame {
11161114 return {
11171115 directory : commit . directory ,
11181116 raw,
1119- name : canonicalToolName ( commit . tool || current ?. name || "tool" ) ,
1117+ name : Tool . canonicalName ( commit . tool || current ?. name || "tool" ) ,
11201118 input : current ?. input ?? { } ,
11211119 meta : current ?. meta ?? { } ,
11221120 state : current ?. state ?? { } ,
@@ -1138,7 +1136,7 @@ function runShell(p: ToolProps): ToolInline {
11381136
11391137export function toolView ( name ?: string ) : ToolView {
11401138 return (
1141- rule ( name ? canonicalToolName ( name ) : undefined ) ?. view ?? {
1139+ rule ( name ? Tool . canonicalName ( name ) : undefined ) ?. view ?? {
11421140 output : true ,
11431141 final : true ,
11441142 }
0 commit comments