@@ -50,97 +50,115 @@ describe("renderPluginConsentDialog", () => {
5050 vi . restoreAllMocks ( ) ;
5151 } ) ;
5252
53- it ( "presents manifest capabilities, effective grants, provenance, and the trust verdict before install" , ( ) => {
54- const inspection = createInspectResult ( {
55- plugin : {
56- id : "calendar-runtime" ,
57- name : "Calendar Plus" ,
58- version : "2.0.0" ,
59- origin : "global" ,
60- installed : false ,
61- enabled : false ,
62- } ,
53+ it . each ( [
54+ {
6355 source : {
6456 kind : "clawhub" ,
6557 packageName : "@openclaw/calendar-plus" ,
6658 integrity : "sha256-0123456789abcdefghijklmnop" ,
6759 integrityKind : "ssri" ,
6860 } ,
69- declared : {
70- channels : [ "calendar-channel" ] ,
71- providers : [ "calendar-provider" ] ,
72- tools : [ "calendar_create" ] ,
73- contracts : [ "gatewayMethodDispatch: calendar.dispatch" ] ,
74- hooks : [ "before_prompt_build" ] ,
75- mcpServers : [ "calendar-mcp" ] ,
76- cliCommands : [ "calendar" ] ,
77- cliBackends : [ "calendar-cli" ] ,
78- skills : [ "schedule" ] ,
79- dangerousConfigFlags : [ "calendar.allowShell" ] ,
61+ provenance : "ClawHub · @openclaw/calendar-plus" ,
62+ integrityLabel : "Integrity: sha256-0123456789abc…" ,
63+ } ,
64+ {
65+ source : {
66+ kind : "git" ,
67+ spec : "https://***:***@example.com/calendar.git?token=***#main" ,
68+ integrity : "0123456789abcdef0123456789abcdef01234567" ,
69+ integrityKind : "git-commit" ,
8070 } ,
81- grants : {
82- hooks : {
83- allowPromptInjection : { effective : false , configured : false } ,
84- allowConversationAccess : { effective : false } ,
71+ provenance : "Git · https://***:***@example.com/calendar.git?token=***#main" ,
72+ integrityLabel : "Commit: 0123456789abcdef0123…" ,
73+ } ,
74+ ] as const ) (
75+ "presents capabilities, grants, safe $source.kind provenance, and trust before install" ,
76+ ( { source, provenance, integrityLabel } ) => {
77+ const inspection = createInspectResult ( {
78+ plugin : {
79+ id : "calendar-runtime" ,
80+ name : "Calendar Plus" ,
81+ version : "2.0.0" ,
82+ origin : "global" ,
83+ installed : false ,
84+ enabled : false ,
8585 } ,
86- llm : { allowedModels : [ "model-a" , "model-b" ] } ,
87- subagent : { allowModelOverride : true } ,
88- } ,
89- trust : {
90- disposition : "review-required" ,
91- reasons : [ "Requests an elevated permission" ] ,
92- checkedAt : "2026-08-25" ,
93- } ,
94- } ) ;
95- const onConfirm = vi . fn ( ) ;
96- const container = mount ( {
97- consent : {
98- intent : {
99- kind : "install" ,
100- request : { source : "clawhub" , packageName : "@openclaw/calendar-plus" } ,
101- installIdentity : "plugin:calendar-runtime" ,
86+ source,
87+ declared : {
88+ channels : [ "calendar-channel" ] ,
89+ providers : [ "calendar-provider" ] ,
90+ tools : [ "calendar_create" ] ,
91+ contracts : [ "gatewayMethodDispatch: calendar.dispatch" ] ,
92+ hooks : [ "before_prompt_build" ] ,
93+ mcpServers : [ "calendar-mcp" ] ,
94+ cliCommands : [ "calendar" ] ,
95+ cliBackends : [ "calendar-cli" ] ,
96+ skills : [ "schedule" ] ,
97+ dangerousConfigFlags : [ "calendar.allowShell" ] ,
10298 } ,
103- pluginId : "calendar-runtime" ,
104- fallback : { name : "Calendar Plus" , version : "2.0.0" } ,
105- } ,
106- inspection,
107- onConfirm,
108- } ) ;
109-
110- const dialog = container . querySelector ( '[data-plugin-consent="install"]' ) ;
111- const text = normalizedText ( dialog ) ;
112- for ( const value of [
113- "Calendar Plus" ,
114- "v2.0.0" ,
115- "@openclaw/calendar-plus" ,
116- "Integrity: sha256-0123456789abc…" ,
117- "Review required" ,
118- "Requests an elevated permission" ,
119- "Scanned 2026-08-25" ,
120- "calendar-channel" ,
121- "calendar-provider" ,
122- "calendar_create" ,
123- "Contracts gatewayMethodDispatch: calendar.dispatch" ,
124- "before_prompt_build" ,
125- "calendar-mcp" ,
126- "calendar-cli" ,
127- "schedule" ,
128- "Dangerous config flags calendar.allowShell" ,
129- "Prompt injection Blocked (set in config)" ,
130- "Conversation access Off (default)" ,
131- "Off by default for external plugins." ,
132- "Allowed models: model-a, model-b" ,
133- "Subagent model overrides Model override: Allowed" ,
134- "Install Calendar Plus" ,
135- ] ) {
136- expect ( text ) . toContain ( value ) ;
137- }
138- expect ( dialog ?. querySelector ( "[title]" ) ?. getAttribute ( "title" ) ) . toBe (
139- "sha256-0123456789abcdefghijklmnop" ,
140- ) ;
141- dialog ?. querySelector < HTMLButtonElement > ( ".btn.primary" ) ?. click ( ) ;
142- expect ( onConfirm ) . toHaveBeenCalledOnce ( ) ;
143- } ) ;
99+ grants : {
100+ hooks : {
101+ allowPromptInjection : { effective : false , configured : false } ,
102+ allowConversationAccess : { effective : false } ,
103+ } ,
104+ llm : { allowedModels : [ "model-a" , "model-b" ] } ,
105+ subagent : { allowModelOverride : true } ,
106+ } ,
107+ trust : {
108+ disposition : "review-required" ,
109+ reasons : [ "Requests an elevated permission" ] ,
110+ checkedAt : "2026-08-25" ,
111+ } ,
112+ } ) ;
113+ const onConfirm = vi . fn ( ) ;
114+ const container = mount ( {
115+ consent : {
116+ intent : {
117+ kind : "install" ,
118+ request : { source : "clawhub" , packageName : "@openclaw/calendar-plus" } ,
119+ installIdentity : "plugin:calendar-runtime" ,
120+ } ,
121+ pluginId : "calendar-runtime" ,
122+ fallback : { name : "Calendar Plus" , version : "2.0.0" } ,
123+ } ,
124+ inspection,
125+ onConfirm,
126+ } ) ;
127+
128+ const dialog = container . querySelector ( '[data-plugin-consent="install"]' ) ;
129+ const text = normalizedText ( dialog ) ;
130+ for ( const value of [
131+ "Calendar Plus" ,
132+ "v2.0.0" ,
133+ "@openclaw/calendar-plus" ,
134+ provenance ,
135+ integrityLabel ,
136+ "Review required" ,
137+ "Requests an elevated permission" ,
138+ "Scanned 2026-08-25" ,
139+ "calendar-channel" ,
140+ "calendar-provider" ,
141+ "calendar_create" ,
142+ "Contracts gatewayMethodDispatch: calendar.dispatch" ,
143+ "before_prompt_build" ,
144+ "calendar-mcp" ,
145+ "calendar-cli" ,
146+ "schedule" ,
147+ "Dangerous config flags calendar.allowShell" ,
148+ "Prompt injection Blocked (set in config)" ,
149+ "Conversation access Off (default)" ,
150+ "Off by default for external plugins." ,
151+ "Allowed models: model-a, model-b" ,
152+ "Subagent model overrides Model override: Allowed" ,
153+ "Install Calendar Plus" ,
154+ ] ) {
155+ expect ( text ) . toContain ( value ) ;
156+ }
157+ expect ( dialog ?. querySelector ( "[title]" ) ?. getAttribute ( "title" ) ) . toBe ( source . integrity ) ;
158+ dialog ?. querySelector < HTMLButtonElement > ( ".btn.primary" ) ?. click ( ) ;
159+ expect ( onConfirm ) . toHaveBeenCalledOnce ( ) ;
160+ } ,
161+ ) ;
144162
145163 it ( "explains an empty manifest and preserves external-plugin grants" , ( ) => {
146164 const container = mount ( ) ;
0 commit comments