@@ -19,6 +19,7 @@ import {
1919 hasVisibleStreamParts ,
2020 historyReplacedVisibleStream ,
2121 materializeVisibleStreamState ,
22+ messageTimestampMs ,
2223 maybeResetToolStream ,
2324 persistedCurrentToolStreamIds ,
2425 prunePersistedToolStreamMessages ,
@@ -31,6 +32,7 @@ import {
3132 recordControlUiPerformanceEvent ,
3233 roundedControlUiDurationMs ,
3334} from "../control-ui-performance.ts" ;
35+ import { isGatewayMethodAdvertised } from "../gateway-methods.ts" ;
3436import { GatewayRequestError , type GatewayBrowserClient , type GatewayHelloOk } from "../gateway.ts" ;
3537import {
3638 areUiSessionKeysEquivalent ,
@@ -52,6 +54,8 @@ import {
5254 isMissingOperatorReadScopeError ,
5355} from "./scope-errors.ts" ;
5456
57+ export { isGatewayMethodAdvertised } from "../gateway-methods.ts" ;
58+
5559const SILENT_REPLY_PATTERN = / ^ \s * N O _ R E P L Y \s * $ / ;
5660const SYNTHETIC_TRANSCRIPT_REPAIR_RESULT =
5761 "[openclaw] missing tool result in session history; inserted synthetic error result for transcript repair." ;
@@ -241,18 +245,6 @@ function messageDisplaySignature(message: unknown): string | null {
241245 }
242246}
243247
244- function messageTimestampMs ( message : unknown ) : number | null {
245- if ( ! message || typeof message !== "object" ) {
246- return null ;
247- }
248- const timestamp = ( message as { timestamp ?: unknown ; ts ?: unknown } ) . timestamp ;
249- if ( typeof timestamp === "number" && Number . isFinite ( timestamp ) ) {
250- return timestamp ;
251- }
252- const ts = ( message as { timestamp ?: unknown ; ts ?: unknown } ) . ts ;
253- return typeof ts === "number" && Number . isFinite ( ts ) ? ts : null ;
254- }
255-
256248function historyHasSameOrNewerDisplayMessage (
257249 historyMessages : unknown [ ] ,
258250 signature : string ,
@@ -375,14 +367,6 @@ function isUnknownGatewayMethodError(err: unknown, method: string): err is Gatew
375367 ) ;
376368}
377369
378- export function isGatewayMethodAdvertised ( state : ChatState , method : string ) : boolean | null {
379- const methods = state . hello ?. features ?. methods ;
380- if ( ! Array . isArray ( methods ) ) {
381- return null ;
382- }
383- return methods . includes ( method ) ;
384- }
385-
386370function resolveStartupRetryDelayMs ( err : GatewayRequestError ) : number {
387371 const retryAfterMs =
388372 typeof err . retryAfterMs === "number" ? err . retryAfterMs : STARTUP_CHAT_HISTORY_DEFAULT_RETRY_MS ;
0 commit comments