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.55 to 0.0.56

.vscode/launch.json

8

dist/graph-policy/graph-policy.js

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

const limits_1 = require("../limits");
const form_node_1 = require("./nodes/form-node");
class GraphPolicy {

@@ -163,2 +164,9 @@ constructor(policyName, root, currentNode) {

break;
case form_node_1.FormNode.typename:
{
const formJsonNode = jsonNode;
const node = new form_node_1.FormNode(jsonNode.nodeId, jsonNode.actionName, formJsonNode.url, formJsonNode.fields);
nodeMap.set(node.nodeId, node);
}
break;
default:

@@ -165,0 +173,0 @@ throw new Error('Invalid nodeType');

9

dist/graph-policy/interfaces.d.ts

@@ -41,3 +41,3 @@ import { IResponseOption } from '../response-options';

export declare type IGraphPolicyNode = IUtteranceNode | IEmailNode;
interface BaseNode {
export interface IBaseNode {
nodeId: number;

@@ -50,10 +50,10 @@ nodeType: string;

}
export interface IUtteranceNode extends BaseNode {
export interface IUtteranceNode extends IBaseNode {
utterance: string;
}
export interface IEmailNode extends BaseNode {
export interface IEmailNode extends IBaseNode {
to: string;
from: string;
}
export interface IFormNode extends BaseNode {
export interface IFormNode extends IBaseNode {
url: string;

@@ -82,2 +82,1 @@ fields: IFormField[];

export declare type OptionType = 'TEXT' | 'IMAGE' | 'OTHER_OPTIONS' | GraphNodeOptionType;
export {};

@@ -118,11 +118,14 @@ "use strict";

if (from) {
switch (from.type) {
switch (from.nodeType) {
case email_node_1.default.typename:
console.log('EmailNode');
return EmailNodeSchema;
case utterance_node_1.default.typename:
console.log('UtteranceNode');
return UtteranceNodeSchema;
case form_node_1.FormNode.typename:
console.log('FormNode');
return exports.FormNodeShema;
default:
return UtteranceNodeSchema;
return;
}

@@ -129,0 +132,0 @@ }

{
"name": "@bavard/agent-config",
"version": "0.0.55",
"version": "0.0.56",
"description": "",

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

@@ -6,3 +6,3 @@ import GraphPolicyNode from './nodes/base-node';

IUtteranceEdge,
IEmailNode,
IEmailNode, IFormNode
} from './interfaces';

@@ -26,2 +26,3 @@ import _ from 'lodash';

import { MAX_GRAPH_POLICY_NODE_COUNT } from '../limits';
import { FormNode } from './nodes/form-node';

@@ -216,2 +217,15 @@ export default class GraphPolicy {

break;
case FormNode.typename:
{
const formJsonNode = jsonNode as IFormNode;
const node = new FormNode(
jsonNode.nodeId,
jsonNode.actionName,
formJsonNode.url,
formJsonNode.fields,
);
nodeMap.set(node.nodeId, node);
}
break;
default:

@@ -218,0 +232,0 @@ throw new Error('Invalid nodeType');

@@ -50,3 +50,3 @@ import { IResponseOption } from '../response-options';

interface BaseNode {
export interface IBaseNode {
nodeId: number;

@@ -60,7 +60,7 @@ nodeType: string;

export interface IUtteranceNode extends BaseNode {
export interface IUtteranceNode extends IBaseNode {
utterance: string;
}
export interface IEmailNode extends BaseNode {
export interface IEmailNode extends IBaseNode {
to: string;

@@ -70,3 +70,3 @@ from: string;

export interface IFormNode extends BaseNode {
export interface IFormNode extends IBaseNode {
url: string;

@@ -73,0 +73,0 @@ fields: IFormField[];

@@ -8,2 +8,3 @@ import * as yup from './yup';

import { FormNode } from './nodes/form-node';
import { IBaseNode } from './interfaces';

@@ -129,13 +130,18 @@ yup.addMethod<ArraySchema<any>>(

const NodeSchema = yup.lazy<UtteranceNode | EmailNode>((from): any => {
const NodeSchema = yup.lazy<IBaseNode>((from: IBaseNode): any => {
if (from) {
switch (from.type) {
switch (from.nodeType) {
case EmailNode.typename:
console.log('EmailNode');
return EmailNodeSchema;
case UtteranceNode.typename:
console.log('UtteranceNode');
return UtteranceNodeSchema;
case FormNode.typename:
console.log('FormNode');
return FormNodeShema;
default:
return UtteranceNodeSchema;
return;
}

@@ -142,0 +148,0 @@ }

@@ -24,3 +24,3 @@ import { FormNode, UtteranceNode } from '../src/graph-policy';

assert.equal((policy.rootNode.edges[0] as any).option, undefined);
assert.equal(policy.nodeCount(), 4);
assert.equal(policy.nodeCount(), 5);
assert.equal(policy.currentNode, policy.rootNode);

@@ -90,3 +90,3 @@ });

actions = policy.act(new UtteranceInput('sell', []));
assert.equal(actions.length, 1);
assert.equal(actions.length, 2);
assert.equal(actions[0].actionName, 'what_model');

@@ -105,3 +105,3 @@

await GraphPolicySchema.validate(jsonObj);
assert.equal(jsonObj.nodes.length, 4);
assert.equal(jsonObj.nodes.length, 5);
//fs.writeFileSync('policy.json', JSON.stringify(jsonObj, null, 2));

@@ -128,3 +128,3 @@ });

const jsonObj = await policy.toJsonObj();
await GraphPolicySchema.validate(jsonObj);
await GraphPolicySchema.validate(jsonObj);'';
const reconstructedPolicy = GraphPolicy.fromJsonObj(jsonObj);

@@ -131,0 +131,0 @@ assert.deepEqual(jsonObj, reconstructedPolicy.toJsonObj());

import UtteranceNode from '../src/graph-policy/nodes/utterance-node';
import {
FormNode,
GraphPolicy,

@@ -10,3 +11,3 @@ } from '../src/graph-policy';

import { AgentConfig } from '../src/agent-config';
import { EAgentActionTypes } from '../src/types';
import { EAgentActionTypes, EFormFieldTypes } from '../src/types';
import { IConversation } from '../src/dialogue-manager/conversation';

@@ -29,2 +30,10 @@

const contactFormNode = new FormNode(
5,
'contact_form',
'<url>',
[{name: 'name', type: EFormFieldTypes.TEXT},
{name: 'email', type: EFormFieldTypes.EMAIL}]
);
// edges

@@ -40,2 +49,3 @@ root.addEmptyEdge(buyOrSell); // empty edge

);
sell.addEmptyEdge(contactFormNode);

@@ -42,0 +52,0 @@ const policy = new GraphPolicy('Car Bot', root);

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