Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wix/agent-platform-bm-sdk

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wix/agent-platform-bm-sdk

`agent-platform-bm-sdk` is a library designed to facilitate interaction with a platform's agent within a Domain Assistant Tool. It provides a way to report events and errors to the platform, and to invoke side effects.

  • 1.18.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
156
increased by64.21%
Maintainers
0
Weekly downloads
 
Created
Source

Introduction

agent-platform-bm-sdk is a library designed to facilitate interaction with a platform's agent within a Domain Assistant Tool. It provides a way to report events and errors to the platform, and to invoke side effects.

Prerequisites

Add to your Assistant App, the GENIE.PUBLISH_ASSISTANT_SIDE_EFFECT permission

Usage in Domain Assistant Tool

In the tools execute function use this:

execute: async (params, ctx) => {
 const APP_SECRET = ctx.getConfig('app-secret')!
 ctx.apiGatewayClient.signWith('<PASTE_APP_DEF_ID>', APP_SECRET)

 const signedAspects = await ctx.apiGatewayClient.addServiceIdentitySafe(ctx.aspects)

 const data = {
   url: 'http://www.wix.com'
 }

 await ctx.invokeSideEffect(
   'your-event-name', //Like 'navigate-to' - must match this regex `^[A-Za-z0-9_-]+$`
   data,
   signedAspects
 )

Usage in BM Client

Add this code to your BM app when you want to receive event on the client (like navigate)

import { useAssistantEffect } from '@wix/agent-platform-bm-sdk';

// ...

useAssistantEffect<{url: string}>(
  ({url}) => {
    console.log({url});
    window.open(url);
  },
  'your-app-def-id',
  'your-event-name', //like 'navigate-to'
);

Example Code

Domain Assistant Code (emit)

https://github.com/wix-private/assistant-domains/blob/0db203f34094fb862eed27f65b4e243da6971a93/packages/time-assistant/src/tools/getCurrentTime.ts#L22

Client Code (listen)

https://github.com/wix-private/genie/blob/2027541202f6330157ddb682c8037f7c50138985/packages/business-assistant-bm-app/src/pages/index.tsx#L28

Testing in AI Assistant Playground

  1. In Advanced Assistant Configuration (initial screen) register a side effect listener.
  2. In chat trigger side effect from the tool or widget.
  3. Expect browser alert with emitted side effect data.

FAQs

Package last updated on 23 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc