@@ -30,18 +30,16 @@ const INTENT_ORDER: BuiltInSessionPolicyPresetId[] = [
3030 'payments' ,
3131 'trading' ,
3232 'contract_write' ,
33- 'deploy' ,
3433 'signing' ,
35- 'full_app_control' ,
3634] ;
3735
3836const INTENT_DESCRIPTIONS : Record < BuiltInSessionPolicyPresetId , string > = {
3937 payments : 'Send funds for payouts and transfers.' ,
4038 trading : 'Buy, sell, and claim in selected apps.' ,
4139 gaming : 'Repeat gameplay actions in supported apps.' ,
4240 contract_write : 'Run advanced app actions in selected apps.' ,
43- deploy : 'Create and launch contracts.' ,
4441 signing : 'Sign messages and transactions when needed.' ,
42+ deploy : 'Create and launch contracts.' ,
4543 full_app_control : 'Give broad control in selected apps.' ,
4644} ;
4745
@@ -106,6 +104,9 @@ function buildCombinedPolicyPreview(
106104 }
107105
108106 const selectedIntents = INTENT_ORDER . filter ( intent => intentIds . includes ( intent ) ) ;
107+ if ( selectedIntents . length === 0 ) {
108+ throw new Error ( 'Select at least one supported intent.' ) ;
109+ }
109110 const defaultLimits = selectedIntents . map ( intent => BUILT_IN_POLICY_PRESETS [ intent ] . defaultLimits ) ;
110111
111112 const expiresInSeconds = Math . max ( ...defaultLimits . map ( limits => limits . expiresInSeconds ) ) ;
@@ -176,16 +177,18 @@ export default function SelectPolicy() {
176177 } = useSessionWizardState ( ) ;
177178
178179 const [ stage , setStage ] = useState < PolicyStage > ( 'intent' ) ;
180+ const isSelectableIntent = ( intent : BuiltInSessionPolicyPresetId ) : boolean => INTENT_ORDER . includes ( intent ) ;
181+
179182 const [ selectedIntentIds , setSelectedIntentIds ] = useState < BuiltInSessionPolicyPresetId [ ] > ( ( ) => {
180- if ( selectedPreset !== 'custom' && selectedPreset !== 'gaming' ) {
183+ if ( selectedPreset !== 'custom' && selectedPreset !== 'gaming' && isSelectableIntent ( selectedPreset ) ) {
181184 return [ selectedPreset ] ;
182185 }
183186 return [ 'payments' ] ;
184187 } ) ;
185188
186189 useEffect ( ( ) => {
187190 setPolicyMode ( 'guided' ) ;
188- if ( selectedPreset === 'custom' || selectedPreset === 'gaming' ) {
191+ if ( selectedPreset === 'custom' || selectedPreset === 'gaming' || ! isSelectableIntent ( selectedPreset ) ) {
189192 selectPreset ( 'payments' ) ;
190193 }
191194 } , [ selectedPreset , selectPreset , setPolicyMode ] ) ;
@@ -213,7 +216,6 @@ export default function SelectPolicy() {
213216
214217 const selectedIntentPresets = selectedIntentIds . map ( intentId => BUILT_IN_POLICY_PRESETS [ intentId ] ) ;
215218 const policyWarnings = composite . preview ?. policyPayload . policyMeta ?. warnings ?? [ ] ;
216- const riskReasons = composite . risk ?. reasons ?? [ ] ;
217219 const requiresDangerAcknowledgement =
218220 selectedIntentPresets . some ( preset => preset . requiresDangerAcknowledgement ) ||
219221 ( composite . risk ?. requiresConfirmation ?? false ) ||
@@ -376,38 +378,14 @@ export default function SelectPolicy() {
376378 } ) }
377379 </ div >
378380 < p className = { styles . appScopeSubhint } > More options coming soon.</ p >
379- { composite . risk ? (
380- < div className = { styles . riskSummary } >
381- < p className = { styles . riskHeading } > Risk: { composite . risk . level . toUpperCase ( ) } </ p >
382- { riskReasons . length === 0 ? (
383- < p className = { styles . riskMuted } > No elevated-risk signals were detected for this selection.</ p >
384- ) : (
385- < ul className = { styles . riskList } >
386- { riskReasons . map ( reason => (
387- < li key = { reason } > { reason } </ li >
388- ) ) }
389- </ ul >
390- ) }
391- { policyWarnings . length > 0 ? (
392- < >
393- < p className = { styles . warningHeading } > Policy warnings</ p >
394- < ul className = { styles . warningList } >
395- { policyWarnings . map ( warning => (
396- < li key = { warning } > { warning } </ li >
397- ) ) }
398- </ ul >
399- </ >
400- ) : null }
401- </ div >
402- ) : null }
403381 { requiresDangerAcknowledgement ? (
404382 < label className = { styles . dangerAck } >
405383 < input
406384 type = "checkbox"
407385 checked = { dangerAcknowledged }
408386 onChange = { event => setDangerAcknowledged ( event . target . checked ) }
409387 />
410- < span > I understand these permissions are high-risk and can move real funds.</ span >
388+ < span > I understand these permissions can move real funds.</ span >
411389 </ label >
412390 ) : null }
413391 </ div >
0 commit comments