77import { normalizeSortedUniqueTrimmedStringList } from "@openclaw/normalization-core/string-normalization" ;
88import type { NodePairingPendingRequest , PairedDeviceNode } from "../infra/device-pairing-node.js" ;
99import { hasEffectivePairedDeviceRole , type PairedDevice } from "../infra/device-pairing.js" ;
10+ import { filterPublicNodeCommands } from "../infra/node-commands.js" ;
1011import {
1112 sameNodeApprovalSurfaceSet ,
1213 sameNodePermissionSurface ,
@@ -128,7 +129,7 @@ function buildApprovedNodeSource(entry: PairedDeviceNode): KnownNodeApprovedSour
128129 deviceFamily : entry . deviceFamily ,
129130 modelIdentifier : entry . modelIdentifier ,
130131 caps : entry . caps ?? [ ] ,
131- commands : entry . commands ?? [ ] ,
132+ commands : filterPublicNodeCommands ( entry . commands ?? [ ] ) ,
132133 permissions : entry . permissions ,
133134 approvedAtMs : entry . approvedAtMs ,
134135 lastConnectedAtMs : entry . lastConnectedAtMs ,
@@ -152,7 +153,7 @@ function buildPendingNodeSource(entry: NodePairingPendingRequest): KnownNodePend
152153 deviceFamily : entry . deviceFamily ,
153154 modelIdentifier : entry . modelIdentifier ,
154155 caps : uniqueSortedStrings ( entry . caps ) ,
155- commands : uniqueSortedStrings ( entry . commands ) ,
156+ commands : filterPublicNodeCommands ( uniqueSortedStrings ( entry . commands ) ) ,
156157 permissions : entry . permissions ,
157158 } ;
158159}
@@ -278,9 +279,9 @@ function buildEffectiveKnownNode(entry: {
278279 pendingNodePairing ?. remoteIp ,
279280 ) ,
280281 caps : live ? uniqueSortedStrings ( live . caps ) : uniqueSortedStrings ( nodePairing ?. caps ) ,
281- commands : live
282- ? uniqueSortedStrings ( live . commands )
283- : uniqueSortedStrings ( nodePairing ?. commands ) ,
282+ commands : filterPublicNodeCommands (
283+ live ? uniqueSortedStrings ( live . commands ) : uniqueSortedStrings ( nodePairing ?. commands ) ,
284+ ) ,
284285 nodePluginTools : live ?. nodePluginTools ,
285286 pathEnv : live ?. pathEnv ,
286287 permissions : live ?. permissions ?? nodePairing ?. permissions ,
0 commit comments