Action Menu module for Credo. Implements Aries RFC 0509.
In order for this module to work, we have to inject it into the agent to access agent functionality. See the example for more information.
import { ActionMenuModule } from '@credo-ts/action-menu'
const agent = new Agent({
config: {
/* config */
},
dependencies: agentDependencies,
modules: {
actionMenu: new ActionMenuModule(),
/* other custom modules */
},
})
await agent.initialize()
// To request root menu to a given connection (menu will be received
// asynchronously in a ActionMenuStateChangedEvent)
await agent.modules.actionMenu.requestMenu({ connectionId })
// To select an option from the action menu
await agent.modules.actionMenu.performAction({
connectionId,
performedAction: { name: 'option-1' },
})