New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@bavard/agent-config

Package Overview
Dependencies
Maintainers
1
Versions
316
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bavard/agent-config - npm Package Compare versions

Comparing version 0.0.38 to 0.0.39

test/lifeapps.json

10

dist/actions/user/index.d.ts

@@ -5,3 +5,4 @@ import { ITagValue } from '../../graph-policy';

EMAIL_ACTION = "EMAIL_ACTION",
OPTION_ACTION = "OPTION_ACTION"
OPTION_ACTION = "OPTION_ACTION",
REPLAY_AGENT_ACTION = "REPLAY_AGENT_ACTION"
}

@@ -35,2 +36,7 @@ export interface IUserActionBase {

}
export declare type IUserAction = IUtteranceUserAction | IEmailUserAction | IOptionUserAction;
export interface IReplayAgentAction extends IUserActionBase {
type: EUserActionType.REPLAY_AGENT_ACTION;
actionName?: string;
nodeId?: number;
}
export declare type IUserAction = IUtteranceUserAction | IEmailUserAction | IOptionUserAction | IReplayAgentAction;

1

dist/actions/user/index.js

@@ -9,2 +9,3 @@ "use strict";

EUserActionType["OPTION_ACTION"] = "OPTION_ACTION";
EUserActionType["REPLAY_AGENT_ACTION"] = "REPLAY_AGENT_ACTION";
})(EUserActionType = exports.EUserActionType || (exports.EUserActionType = {}));
{
"name": "@bavard/agent-config",
"version": "0.0.38",
"version": "0.0.39",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -7,2 +7,3 @@ import { ITagValue } from '../../graph-policy';

OPTION_ACTION = 'OPTION_ACTION',
REPLAY_AGENT_ACTION = 'REPLAY_AGENT_ACTION',
}

@@ -41,2 +42,8 @@

export type IUserAction = IUtteranceUserAction | IEmailUserAction | IOptionUserAction;
export interface IReplayAgentAction extends IUserActionBase {
type: EUserActionType.REPLAY_AGENT_ACTION;
actionName?: string;
nodeId?: number;
}
export type IUserAction = IUtteranceUserAction | IEmailUserAction | IOptionUserAction | IReplayAgentAction;

@@ -5,5 +5,9 @@ import { assert } from 'chai';

import { AgentConfig, UtteranceAction, TextOption } from '../src';
import {
GraphPolicy,
} from '../src/graph-policy';
import UtteranceNode from '../src/graph-policy/nodes/utterance-node';
describe('Agent Config', () => {
it('Add intent', async () => {
it('Add intent', () => {
const config = new AgentConfig('test', 'test');

@@ -17,3 +21,3 @@ let intents = config.getIntents();

it('Delete intent', async () => {
it('Delete intent', () => {
const config = new AgentConfig('test', 'test');

@@ -41,3 +45,3 @@ let intents = config.getIntents();

it('To JSON', async () => {
it('To JSON', () => {
const config = new AgentConfig('test', 'test');

@@ -53,3 +57,3 @@ config.addIntent('A', 'X');

it('Copy', async () => {
it('Copy', () => {
const config = new AgentConfig('test', 'test');

@@ -62,9 +66,88 @@ config.addIntent('A', 'X');

it('test', async () => {
const ea = new EmailAction('test', 'test', 'test', 'test');
assert.equal(ea.name, 'test');
// test cases for tagType
it('Empty tagType', () => {
const config = new AgentConfig('test', 'test');
assert.isEmpty(config.getTagTypes());
});
it('Test Action Options', async () => {
it('Add tagType', () => {
const config = new AgentConfig('test', 'test');
const tagType = 't1';
config.addTagType(tagType);
const tagTypes = config.getTagTypes();
assert.equal(tagTypes.size, 1);
assert.equal(tagTypes.has(tagType), true);
});
it('Delete tagType', () => {
const config = new AgentConfig('test', 'test');
const addedTagTypes = ['t1', 't2', 't3'];
for (const tagType of addedTagTypes) {
config.addTagType(tagType);
}
let tagTypes;
config.deleteTagType(addedTagTypes[0]);
tagTypes = config.getTagTypes();
assert.equal(tagTypes.size, 2);
assert.equal(tagTypes.has(addedTagTypes[0]), false);
assert.equal(tagTypes.has(addedTagTypes[1]), true);
assert.equal(tagTypes.has(addedTagTypes[2]), true);
config.deleteTagType(addedTagTypes[1]);
tagTypes = config.getTagTypes();
assert.equal(tagTypes.size, 1);
assert.equal(tagTypes.has(addedTagTypes[0]), false);
assert.equal(tagTypes.has(addedTagTypes[1]), false);
assert.equal(tagTypes.has(addedTagTypes[2]), true);
config.deleteTagType(addedTagTypes[2]);
tagTypes = config.getTagTypes();
assert.isEmpty(tagTypes);
});
// test cases for actions
it('Empty actions', () => {
const config = new AgentConfig('test', 'test');
assert.isEmpty(config.getActions());
});
it('Add actions', () => {
const config = new AgentConfig('test', 'test');
const utteranceAction = new UtteranceAction('greeting', 'greeting');
const emailAction = new EmailAction('test', 'test', 'test', 'test');
config.addAction(utteranceAction);
config.addAction(emailAction);
const actions = config.getActions();
assert.equal(actions.length, 2);
assert.deepEqual(utteranceAction, <UtteranceAction>actions[0]);
assert.deepEqual(emailAction, <EmailAction>actions[1]);
});
it('Delete actions', () => {
const config = new AgentConfig('test', 'test');
const utteranceAction = new UtteranceAction('greeting', 'greeting');
const emailAction = new EmailAction('test', 'test', 'test', 'test');
config.addAction(utteranceAction);
config.addAction(emailAction);
let actions;
config.deleteAction(utteranceAction.name);
actions = config.getActions();
assert.equal(actions.length, 1);
assert.deepEqual(emailAction, <EmailAction>actions[0]);
config.deleteAction(emailAction.name);
actions = config.getActions();
assert.equal(actions.length, 0);
});
it('Action Options', () => {
const config = new AgentConfig('test', 'test');
config.addIntent('greeting', 'greeting');

@@ -78,2 +161,72 @@ config.addAction(new UtteranceAction('greeting', 'greeting'));

});
// test cases for graph policies
it('Empty graph policies', () => {
const config = new AgentConfig('test', 'test');
assert.isEmpty(config.getGraphPolicies());
});
it('Add graph policies', () => {
const config = new AgentConfig('test', 'test');
const root = new UtteranceNode(1, 'greeting', 'Hello, I\'m Car Bot!');
const policy1 = new GraphPolicy('Car Bot 1', root);
const policy2 = new GraphPolicy('Car Bot 2', root);
config.addGraphPolicy(policy1);
config.addGraphPolicy(policy2);
const policies = config.getGraphPolicies();
assert.equal(policies.length, 2);
assert.deepEqual(policy1, policies[0]);
assert.deepEqual(policy2, policies[1]);
});
it('Delete graph policies', () => {
const config = new AgentConfig('test', 'test');
const root = new UtteranceNode(1, 'greeting', 'Hello, I\'m Car Bot!');
const policy1 = new GraphPolicy('Car Bot 1', root);
const policy2 = new GraphPolicy('Car Bot 2', root);
config.addGraphPolicy(policy1);
config.addGraphPolicy(policy2);
config.deleteGraphPolicy(policy1.policyName);
const policies = config.getGraphPolicies();
assert.equal(policies.length, 1);
assert.deepEqual(policy2, policies[0]);
});
it('get graph policy', () => {
const config = new AgentConfig('test', 'test');
const root = new UtteranceNode(1, 'greeting', 'Hello, I\'m Car Bot!');
const policy1 = new GraphPolicy('Car Bot 1', root);
const policy2 = new GraphPolicy('Car Bot 2', root);
config.addGraphPolicy(policy1);
config.addGraphPolicy(policy2);
assert.deepEqual(policy1, config.getGraphPolicy(policy1.policyName));
assert.deepEqual(policy2, config.getGraphPolicy(policy2.policyName));
});
it('set active graph policy', () => {
const config = new AgentConfig('test', 'test');
const root = new UtteranceNode(1, 'greeting', 'Hello, I\'m Car Bot!');
const policy1 = new GraphPolicy('Car Bot 1', root);
const policy2 = new GraphPolicy('Car Bot 2', root);
config.addGraphPolicy(policy1);
config.addGraphPolicy(policy2);
config.setActivePolicyName(policy1.policyName);
assert.deepEqual(policy1, config.getActiveGraphPolicy());
config.setActivePolicyName(policy2.policyName);
assert.deepEqual(policy2, config.getActiveGraphPolicy());
});
});
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