1+ import { truncateUtf16Safe } from "@openclaw/normalization-core/utf16-slice" ;
12import { GatewayRequestError , type GatewayBrowserClient } from "../../api/gateway.ts" ;
23import type { GatewaySessionRow } from "../../api/types.ts" ;
34import { requestSessionCreate } from "../sessions/index.ts" ;
@@ -2192,7 +2193,9 @@ async function loadWorkboardInternal(
21922193 taskRefreshError = confirmationResult . error ;
21932194 }
21942195 nextUnfilteredCursor = pollResult ?. nextUnfilteredCursor ;
2195- applyTaskSummariesToState ( taskLinkState , taskSummaries , { missingTaskIds } ) ;
2196+ applyTaskSummariesToState ( taskLinkState , taskSummaries , {
2197+ missingTaskIds,
2198+ } ) ;
21962199 preserveLifecycleTaskRefreshFailure =
21972200 params . taskRefresh === "linked" &&
21982201 state . lifecycleTaskRefreshFailed &&
@@ -3167,7 +3170,9 @@ async function refreshWorkboardLifecycleTasks(
31673170 }
31683171 resetWorkboardLifecycleTaskConfirmations ( state , { host : params . host } ) ;
31693172 const recoveredTaskRefreshError = state . lifecycleTaskRefreshError ;
3170- setWorkboardLifecycleTaskRefreshFailed ( state , false , { host : params . host } ) ;
3173+ setWorkboardLifecycleTaskRefreshFailed ( state , false , {
3174+ host : params . host ,
3175+ } ) ;
31713176 state . lifecycleTaskRefreshError = null ;
31723177 if (
31733178 recoveredTaskRefreshError !== null &&
@@ -3584,7 +3589,9 @@ export async function deleteWorkboardCard(params: {
35843589 state . error = null ;
35853590 params . requestUpdate ?.( ) ;
35863591 try {
3587- await params . client . request ( "workboard.cards.delete" , { id : params . cardId } ) ;
3592+ await params . client . request ( "workboard.cards.delete" , {
3593+ id : params . cardId ,
3594+ } ) ;
35883595 state . cards = removeCardAndReferences ( state . cards , params . cardId ) ;
35893596 } catch ( error ) {
35903597 state . error = formatError ( error ) ;
@@ -3658,7 +3665,9 @@ export async function dispatchWorkboard(params: {
36583665 resetWorkboardLifecycleTaskConfirmations ( state , { host : params . host } ) ;
36593666 try {
36603667 applyTaskSummariesToState ( state , await listWorkboardTasks ( params . client ) ) ;
3661- setWorkboardLifecycleTaskRefreshFailed ( state , false , { host : params . host } ) ;
3668+ setWorkboardLifecycleTaskRefreshFailed ( state , false , {
3669+ host : params . host ,
3670+ } ) ;
36623671 state . lifecycleTaskRefreshError = null ;
36633672 state . lastRefreshError = null ;
36643673 } catch ( error ) {
@@ -3712,7 +3721,7 @@ function buildCardSessionLabel(card: WorkboardCard): string {
37123721 return `${ title } ${ suffixText } ` ;
37133722 }
37143723 const titleMax = WORKBOARD_SESSION_LABEL_MAX_CHARS - suffixText . length ;
3715- return `${ title . slice ( 0 , titleMax - 3 ) . trimEnd ( ) } ...${ suffixText } ` ;
3724+ return `${ truncateUtf16Safe ( title , titleMax - 3 ) . trimEnd ( ) } ...${ suffixText } ` ;
37163725}
37173726
37183727function sanitizeSessionSegment ( value : string | undefined , fallback : string ) : string {
@@ -3721,7 +3730,7 @@ function sanitizeSessionSegment(value: string | undefined, fallback: string): st
37213730 . replace ( / [ ^ a - z A - Z 0 - 9 _ - ] / g, "-" )
37223731 . replace ( / - + / g, "-" )
37233732 . replace ( / ^ - | - $ / g, "" ) ;
3724- return ( sanitized || fallback ) . slice ( 0 , 96 ) ;
3733+ return truncateUtf16Safe ( sanitized || fallback , 96 ) ;
37253734}
37263735
37273736function buildCardTaskSessionKey ( card : WorkboardCard ) : string {
@@ -3839,7 +3848,11 @@ function taskIsActive(task: WorkboardTaskSummary | undefined): task is Workboard
38393848async function cancelWorkboardTaskRun ( params : {
38403849 client : GatewayBrowserClient ;
38413850 taskId : string ;
3842- } ) : Promise < { cancelled : boolean ; missing : boolean ; task : WorkboardTaskSummary | null } > {
3851+ } ) : Promise < {
3852+ cancelled : boolean ;
3853+ missing : boolean ;
3854+ task : WorkboardTaskSummary | null ;
3855+ } > {
38433856 const result = await params . client . request ( "tasks.cancel" , {
38443857 taskId : params . taskId ,
38453858 reason : "Stopped from Workboard." ,
0 commit comments