@@ -180,7 +180,7 @@ export class RemotePluginBridge {
180180 ) ;
181181 }
182182
183- const events = descriptor . events as
183+ const events = descriptor . events as unknown as
184184 | Record < string , RemoteFunctionRef [ ] >
185185 | undefined ;
186186 if ( events ) {
@@ -192,7 +192,7 @@ export class RemotePluginBridge {
192192 plugin . events = eventMap ;
193193 }
194194
195- const models = descriptor . models as
195+ const models = descriptor . models as unknown as
196196 | Record < string , RemoteFunctionRef >
197197 | undefined ;
198198 if ( models ) {
@@ -209,7 +209,7 @@ export class RemotePluginBridge {
209209 // Services: opt-in via `static rpcMethods`. The descriptor carries
210210 // one entry per service with the methods list and per-method rpc
211211 // ids; we synthesise a ServiceClass with dynamic methods.
212- const services = descriptor . services as
212+ const services = descriptor . services as unknown as
213213 | Array <
214214 JsonObject & {
215215 serviceType : string ;
@@ -219,13 +219,15 @@ export class RemotePluginBridge {
219219 >
220220 | undefined ;
221221 if ( services ?. length ) {
222- plugin . services = services . map ( ( svc ) => this . makeServiceClassStub ( svc ) ) ;
222+ plugin . services = services . map ( ( svc ) =>
223+ this . makeServiceClassStub ( svc ) ,
224+ ) as Plugin [ "services" ] ;
223225 }
224226
225227 // Routes: the agent's existing plugin-route lifecycle will pick
226228 // these up. Each routeHandler is wrapped to forward
227229 // RouteHandlerContext via worker-rpc and return RouteHandlerResult.
228- const routes = descriptor . routes as
230+ const routes = descriptor . routes as unknown as
229231 | Array < JsonObject & { path : string ; routeHandler ?: RemoteFunctionRef } >
230232 | undefined ;
231233 if ( routes ?. length ) {
@@ -237,12 +239,13 @@ export class RemotePluginBridge {
237239 // Views/widgets/componentTypes are pure JSON metadata; pass them
238240 // through unchanged so the existing view registry serves the
239241 // remote plugin's bundle the same way it does direct plugins'.
240- if ( descriptor . views ) plugin . views = descriptor . views as Plugin [ "views" ] ;
242+ if ( descriptor . views )
243+ plugin . views = descriptor . views as unknown as Plugin [ "views" ] ;
241244 if ( descriptor . widgets )
242- plugin . widgets = descriptor . widgets as Plugin [ "widgets" ] ;
245+ plugin . widgets = descriptor . widgets as unknown as Plugin [ "widgets" ] ;
243246 if ( descriptor . componentTypes ) {
244247 plugin . componentTypes =
245- descriptor . componentTypes as Plugin [ "componentTypes" ] ;
248+ descriptor . componentTypes as unknown as Plugin [ "componentTypes" ] ;
246249 }
247250
248251 return plugin ;
@@ -254,8 +257,11 @@ export class RemotePluginBridge {
254257 const name = descriptor . name ;
255258 const similes = ( descriptor . similes as string [ ] | undefined ) ?? [ ] ;
256259 const description = String ( descriptor . description ?? "" ) ;
257- const examples = ( descriptor . examples as Action [ "examples" ] ) ?? [ ] ;
258- const validateRef = descriptor . validate as RemoteFunctionRef | undefined ;
260+ const examples =
261+ ( descriptor . examples as unknown as Action [ "examples" ] ) ?? [ ] ;
262+ const validateRef = descriptor . validate as unknown as
263+ | RemoteFunctionRef
264+ | undefined ;
259265
260266 const handler : Action [ "handler" ] = async (
261267 _runtime ,
@@ -294,16 +300,16 @@ export class RemotePluginBridge {
294300 ) ;
295301 return Boolean ( result ) ;
296302 }
297- : undefined ;
303+ : async ( ) => true ;
298304
299305 const action : Action = {
300306 name,
301307 similes,
302308 description,
303309 examples,
304310 handler,
311+ validate,
305312 } ;
306- if ( validate ) action . validate = validate ;
307313 return action ;
308314 }
309315
@@ -580,7 +586,7 @@ export class RemotePluginBridge {
580586 const payload = args . payload as JsonValue ;
581587 await this . runtime . emitEvent (
582588 eventName as Parameters < IAgentRuntime [ "emitEvent" ] > [ 0 ] ,
583- payload as Parameters < IAgentRuntime [ "emitEvent" ] > [ 1 ] ,
589+ payload as unknown as Parameters < IAgentRuntime [ "emitEvent" ] > [ 1 ] ,
584590 ) ;
585591 return null ;
586592 }
0 commit comments