@@ -84,6 +84,7 @@ import ai.openclaw.app.node.LocationCaptureManager
8484import ai.openclaw.app.node.LocationHandler
8585import ai.openclaw.app.node.MobileUiHandler
8686import ai.openclaw.app.node.MotionHandler
87+ import ai.openclaw.app.node.NodeInvokeSessionKeyEnvelope
8788import ai.openclaw.app.node.NodePresenceAliveBeacon
8889import ai.openclaw.app.node.NotificationsHandler
8990import ai.openclaw.app.node.PhotosHandler
@@ -94,6 +95,7 @@ import ai.openclaw.app.node.SystemHandler
9495import ai.openclaw.app.node.TalkHandler
9596import ai.openclaw.app.node.asObjectOrNull
9697import ai.openclaw.app.node.asStringOrNull
98+ import ai.openclaw.app.node.currentNodeInvokeSessionKeyEnvelope
9799import ai.openclaw.app.node.invokeErrorFromThrowable
98100import ai.openclaw.app.node.parseHexColorArgb
99101import ai.openclaw.app.node.readAndroidPermissionSnapshot
@@ -109,6 +111,7 @@ import ai.openclaw.app.voice.TalkAudioPlayer
109111import ai.openclaw.app.voice.TalkModeManager
110112import ai.openclaw.app.voice.TalkPttOnceStart
111113import ai.openclaw.app.voice.TalkPttStopPayload
114+ import ai.openclaw.app.voice.TalkSessionKeyEnvelope
112115import ai.openclaw.app.voice.VoiceConversationEntry
113116import ai.openclaw.app.voice.VoiceConversationRole
114117import ai.openclaw.app.voice.VoiceWakeManager
@@ -183,6 +186,12 @@ private const val CRON_JOBS_SNAPSHOT_MAX_ATTEMPTS = 3
183186private const val OperatorAdminScope = " operator.admin"
184187private const val OperatorPairingScope = " operator.pairing"
185188
189+ private fun NodeInvokeSessionKeyEnvelope.toTalkSessionKeyEnvelope (): TalkSessionKeyEnvelope =
190+ when (this ) {
191+ NodeInvokeSessionKeyEnvelope .Legacy -> TalkSessionKeyEnvelope .Legacy
192+ is NodeInvokeSessionKeyEnvelope .Authoritative -> TalkSessionKeyEnvelope .Authoritative (sessionKey)
193+ }
194+
186195private fun execApprovalOutcomeUnknownMessage (): String = nativeText(" Resolution outcome unknown. Actions stay disabled until the Gateway record is verified." ).source
187196
188197private fun execApprovalStillPendingMessage (): String = nativeText(" The Gateway still shows this approval as pending. Review it before trying again." ).source
@@ -1049,13 +1058,13 @@ class NodeRuntime private constructor(
10491058 systemHandler = systemHandler,
10501059 talkHandler =
10511060 object : TalkHandler {
1052- override suspend fun handlePttStart (paramsJson : String? ): GatewaySession .InvokeResult = handleTalkPttStart()
1061+ override suspend fun handlePttStart (paramsJson : String? ): GatewaySession .InvokeResult = handleTalkPttStart(currentNodeInvokeSessionKeyEnvelope().toTalkSessionKeyEnvelope() )
10531062
10541063 override suspend fun handlePttStop (paramsJson : String? ): GatewaySession .InvokeResult = handleTalkPttStop()
10551064
10561065 override suspend fun handlePttCancel (paramsJson : String? ): GatewaySession .InvokeResult = handleTalkPttCancel()
10571066
1058- override suspend fun handlePttOnce (paramsJson : String? ): GatewaySession .InvokeResult = handleTalkPttOnce()
1067+ override suspend fun handlePttOnce (paramsJson : String? ): GatewaySession .InvokeResult = handleTalkPttOnce(currentNodeInvokeSessionKeyEnvelope().toTalkSessionKeyEnvelope() )
10591068 },
10601069 photosHandler = photosHandler,
10611070 contactsHandler = contactsHandler,
@@ -1752,7 +1761,7 @@ class NodeRuntime private constructor(
17521761 },
17531762 onEvent = ::handleNodeGatewayEvent,
17541763 onInvoke = { req ->
1755- invokeDispatcher.handleInvoke(req.command, req.paramsJson )
1764+ invokeDispatcher.handleInvoke(req)
17561765 },
17571766 onTlsFingerprint = { stableId, fingerprint ->
17581767 prefs.saveGatewayTlsFingerprint(stableId, fingerprint)
@@ -3548,7 +3557,7 @@ class NodeRuntime private constructor(
35483557 setVoiceCaptureMode(if (value) VoiceCaptureMode .TalkMode else VoiceCaptureMode .Off )
35493558 }
35503559
3551- private suspend fun handleTalkPttStart (): GatewaySession .InvokeResult =
3560+ private suspend fun handleTalkPttStart (sessionKeyEnvelope : TalkSessionKeyEnvelope ): GatewaySession .InvokeResult =
35523561 runTalkPttCommand {
35533562 talkMode.finishingPushToTalkCaptureId?.let {
35543563 return @runTalkPttCommand GatewaySession .InvokeResult .error(
@@ -3567,6 +3576,7 @@ class NodeRuntime private constructor(
35673576 val started =
35683577 talkMode.beginPushToTalk(
35693578 allowNewCapture = true ,
3579+ sessionKeyEnvelope = sessionKeyEnvelope,
35703580 canStartCapture = {
35713581 _isForeground .value &&
35723582 voiceLifecycleEpoch.get() == lifecycleEpoch &&
@@ -3592,7 +3602,7 @@ class NodeRuntime private constructor(
35923602 GatewaySession .InvokeResult .ok(payload.toJson())
35933603 }
35943604
3595- private suspend fun handleTalkPttOnce (): GatewaySession .InvokeResult =
3605+ private suspend fun handleTalkPttOnce (sessionKeyEnvelope : TalkSessionKeyEnvelope ): GatewaySession .InvokeResult =
35963606 runTalkPttCommand {
35973607 currentTalkPttOnceBusy()?.let { busy ->
35983608 return @runTalkPttCommand GatewaySession .InvokeResult .ok(busy.payload.toJson())
@@ -3607,6 +3617,7 @@ class NodeRuntime private constructor(
36073617 ) { ownershipEpoch ->
36083618 val started =
36093619 talkMode.beginPushToTalkOnce(
3620+ sessionKeyEnvelope = sessionKeyEnvelope,
36103621 canStartCapture = {
36113622 _isForeground .value &&
36123623 voiceLifecycleEpoch.get() == lifecycleEpoch &&
0 commit comments