create-scout9 1.0.0-alpha.0.0.2 → 1.0.0-alpha.0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # create-svelte
2
+
3
+ A CLI for creating new [Scout9](https://scout9.com) auto reply projects. Just run...
4
+
5
+ ```bash
6
+ npm create scout9@latest my-app
7
+ ```
8
+
9
+ ...and follow the prompts.
10
+
11
+ ## API
12
+
13
+ You can also use `create-scout9` programmatically:
14
+
15
+ ```js
16
+ import { create } from 'create-scout9';
17
+
18
+ await create('my-new-app', {
19
+ name: 'my-new-app',
20
+ template: 'default', // or 'skeleton'
21
+ // types: 'checkjs', // or 'typescript' or null; // @TODO TypeScript support
22
+ prettier: false,
23
+ eslint: false,
24
+ jest: false
25
+ });
26
+ ```
27
+
28
+ `checkjs` means your project will use TypeScript to typecheck JavaScript via [JSDoc comments](https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html).
29
+
30
+ **_Note_**: *Typescript support will be available soon.*
31
+
32
+ ## License
33
+
34
+ [MIT](../../LICENSE).
package/bin.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import fs from 'node:fs';
3
3
  import path from 'node:path';
4
4
  import * as p from '@clack/prompts';
5
- import { bold, cyan, grey, yellow } from 'kleur/colors';
5
+ import { bold, cyan, grey, yellow, green, magenta } from 'kleur/colors';
6
6
  import { create } from './index.js';
7
7
  import { dist, package_manager } from './utils.js';
8
8
 
@@ -58,22 +58,22 @@ const options = await p.group(
58
58
  })
59
59
  }),
60
60
 
61
- // types: () =>
62
- // p.select({
63
- // message: 'Add type checking with TypeScript?',
64
- // initialValue: /** @type {'checkjs' | 'typescript' | null} */ (null),
65
- // options: [
66
- // {
67
- // label: 'Yes, using JavaScript with JSDoc comments',
68
- // value: 'checkjs'
69
- // },
70
- // {
71
- // label: 'Yes, using TypeScript syntax',
72
- // value: 'typescript'
73
- // },
74
- // { label: 'No', value: null }
75
- // ]
76
- // }),
61
+ types: () =>
62
+ p.select({
63
+ message: 'Add type checking with TypeScript?',
64
+ initialValue: /** @type {'checkjs' | 'typescript' | null} */ (null),
65
+ options: [
66
+ {
67
+ label: 'Yes, using JavaScript with JSDoc comments',
68
+ value: 'checkjs'
69
+ },
70
+ {
71
+ label: 'Yes, using TypeScript syntax',
72
+ value: 'typescript'
73
+ },
74
+ { label: 'No', value: null }
75
+ ]
76
+ }),
77
77
 
78
78
  features: () =>
79
79
  p.multiselect({
@@ -100,9 +100,8 @@ const options = await p.group(
100
100
 
101
101
  await create(cwd, {
102
102
  name: path.basename(path.resolve(cwd)),
103
- template: /** @type {'default' | 'skeleton' | 'skeletonlib'} */ (options.template),
104
- // types: options.types,
105
- types: null,
103
+ template: /** @type {'default' | 'skeleton' | 'skeletonlib' | 'default-typscript} */ (options.template),
104
+ types: options.types,
106
105
  prettier: options.features.includes('prettier'),
107
106
  eslint: options.features.includes('eslint'),
108
107
  jest: options.features.includes('jest'),
@@ -151,7 +150,10 @@ if (relative !== '') {
151
150
  console.log(` ${i++}: ${bold(cyan(`${package_manager} install`))}`);
152
151
  // prettier-ignore
153
152
  console.log(` ${i++}: ${bold(cyan('git init && git add -A && git commit -m "Initial commit"'))} (optional)`);
154
- console.log(` ${i++}: ${bold(cyan(`${package_manager} run dev -- --open`))}`);
153
+ console.log(` ${i++}: ${bold(magenta('Add your SCOUT9_API_KEY to .env'))} (login for api key: https://scout9.com/b)`);
154
+ // console.log(` ${i++}: ${bold(cyan(`${package_manager} run dev`))}`);
155
+ console.log(` ${i++}: ${bold(cyan(`${package_manager} run dev`))}`);
155
156
 
156
157
  // console.log(`\nTo close the dev server, hit ${bold(cyan('Ctrl-C'))}`);
157
- console.log(`\nStuck? Visit us at ${cyan('https://scout9.dev/chat')}`);
158
+ console.log(`\nStuck? Connect with us on ${bold('Discord')} ${cyan('https://discord.gg/kG8hZwc5sQ')}`);
159
+ console.log(`\nYour api key is listed on your ${bold('Scout9')} account ${cyan('https://scout9.com/b')} page`);
package/dist/shared.json CHANGED
@@ -93,7 +93,7 @@
93
93
  "jest"
94
94
  ],
95
95
  "exclude": [],
96
- "contents": "import { createMockWorkflowEvent } from '../platform/src/index.js';\nimport Scout9App from './app.js';\n\ndescribe('Scout9App', () => {\n\n it('Should try to ask customer what type of pizza they want', async () => {\n const event = createMockWorkflowEvent('Hey I would like a pizza', 'pizzaOrder');\n\n // Alternatively you can run the app using sendEvent\n // const response = await sendEvent(event);\n\n const response = await Scout9App(event);\n expect(response.instructions).toEqual('Figure out what pizza sizes, toppings are needed for order');\n });\n\n});\n"
96
+ "contents": "import Scout9App from './app.js';\nimport { createMockWorkflowEvent } from '@scout9/app';\n\ndescribe('Scout9App', () => {\n\n it('Should try to ask customer what type of pizza they want', async () => {\n const event = createMockWorkflowEvent('Hey I would like a pizza', 'pizzaOrder');\n\n // Alternatively you can run the app using sendEvent\n // const response = await sendEvent(event);\n\n const response = await Scout9App(event);\n expect(response.instructions).toEqual('Figure out what pizza sizes, toppings are needed for order');\n });\n\n});\n"
97
97
  },
98
98
  {
99
99
  "name": "package.json",
@@ -1,35 +1,35 @@
1
1
  [
2
2
  {
3
3
  "name": "src/app.js",
4
- "contents": "import { EventResponse } from '@scout9/app';\n\nimport PizzaOrder from './workflows/pizzaOrder/workflow.js';\n\nexport default async function Scout9App(event) {\n\n console.log(EventResponse);\n if (event.intent === 'pizzaOrder') {\n // run pizza order workflow\n return PizzaOrder(event);\n } else {\n if (event.stagnationCount < 2) {\n return {\n instructions: 'Double check if the user is looking to order a pizza'\n }\n } else {\n // End auto replies, forward to agent for manual intervention\n return {\n forward: true,\n }\n }\n }\n\n}\n"
4
+ "contents": "\nimport PizzaOrder from './workflows/pizzaOrder/workflow.js';\n\n/**\n * @param {import('@scout9/app').WorkflowEvent} event - every workflow receives an event object\n * @returns {Promise<import('@scout9/app').WorkflowResponse>} - every workflow must return a WorkflowResponse\n */\nexport default async function Scout9App(event) {\n\n // If the user intent is pizzaOrder or the context has a pizza object, run the pizza order workflow\n if (event.intent === 'pizzaOrder' || event.context === 'pizza') {\n // run pizza order workflow\n return PizzaOrder(event);\n } else {\n if (event.stagnationCount < 2) {\n return {\n instructions: 'Double check if the user is looking to order a pizza'\n }\n } else {\n // End auto replies, forward to agent for manual intervention\n return {\n forward: true,\n }\n }\n }\n\n}\n"
5
5
  },
6
6
  {
7
7
  "name": "src/entities/agents/index.js",
8
- "contents": "/**\n * Required core entity type: Agents represents you and your team\n */\nexport default function Agents() {\n return [\n {\n id: 'agent-1',\n firstName: 'Agent',\n lastName: 'Smith',\n forwardPhone: '+15555555555',\n forwardEmail: '',\n programmablePhoneNumber: '+15555555555',\n }\n ];\n}\n"
8
+ "contents": "/**\n * Required core entity type: Agents represents you and your team\n * @returns {Array<import('@scout9/app').Agent>}\n */\nexport default function Agents() {\n return [\n {\n id: 'agent-1',\n firstName: 'Patrick',\n lastName: 'Opie',\n forwardPhone: '+15555555555',\n context: 'helps customers with placing their pizza orders',\n forwardEmail: '',\n programmablePhoneNumber: '+15555555555',\n }\n ];\n}\n"
9
9
  },
10
10
  {
11
11
  "name": "src/entities/customers/[customer]/api.js",
12
- "contents": "import { json } from '../../../../platform/src/exports.js';\n\n// @TODO replace with your CRM api\nimport { customerMockDb } from '../../../lib/customer-mock-db';\n\n\n/**\n * Get customer info from your CRM\n */\nexport const GET = async ({params}) => {\n return json(await customerMockDb.get(params.customer));\n};\n\n/**\n * When a customer is created on scout9's side\n *\n * Example:\n * A new or unrecognized customer has contacted an agent. Scout9 has captured some preliminary information\n * about them and sent this POST request. Take the information to either add a new customer record to your CRM\n * or return an existing customer id to map the correct customer document.\n */\nexport const POST = async ({params, body: newCustomer}) => {\n // Scout9 will generate random id for new customers, but whatever id you return back will be used for the new customer\n const {id: crmId} = await customerMockDb.add(params.customer, newCustomer);\n return json({success: true, id: crmId}, {status: 200});\n};\n\n/**\n * New customer info revealed, use this to save the customer info to your CRM\n *\n * Example:\n * In a conversation, if any new data is found, Scout9 will send a PUT or PATCH request to allow for you to update\n * your CRM accordingly.\n */\nexport const PUT = async ({params, body: updatedCustomer}) => {\n // const id = params.customer;\n\n console.log('updatedCustomer', updatedCustomer);\n // @TODO REST call to api to save customer info\n\n // @TODO REST call to api to save customer info\n return json({success: true}, {status: 200});\n};\n\n\n/**\n * Customer request to be removed from platform, use this to remove/update the customer info from your CRM\n *\n * Example:\n * A customer has opt-out of text messaging, Scout9 will send a DELETE message for you to remove any data, returning\n * back success: true will then have Scout9 delete any data on their end as well.\n */\nexport const DELETE = async ({params, request}) => {\n await customerMockDb.remove(params.customer);\n return json({success: true}, {status: 200});\n};\n"
12
+ "contents": "import { json } from '@scout9/app';\n\n// @TODO replace with your CRM api\nimport { customerDb } from '../../../lib/customer-db.js';\n\n/**\n * Get customer info from your CRM\n * @returns {Promise<import('@scout9/app').EventResponse<import('@scout9/app').Customer>>}\n */\nexport const GET = async ({params}) => {\n return json(await customerDb.get(params.customer));\n};\n\n/**\n * When a customer is created on scout9's side\n *\n * Example:\n * A new or unrecognized customer has contacted an agent. Scout9 has captured some preliminary information\n * about them and sent this POST request. Take the information to either add a new customer record to your CRM\n * or return an existing customer id to map the correct customer document.\n *\n * @returns {Promise<import('@scout9/app').EventResponse>}\n */\nexport const POST = async ({params, body: newCustomer}) => {\n // Scout9 will generate random id for new customers, but whatever id you return back will be used for the new customer\n const {id: crmId} = await customerDb.add({$id: params.customer, newCustomer});\n return json({success: true, id: crmId}, {status: 200});\n};\n\n/**\n * New customer info revealed, use this to save the customer info to your CRM\n *\n * Example:\n * In a conversation, if any new data is found, Scout9 will send a PUT or PATCH request to allow for you to update\n * your CRM accordingly.\n *\n * @returns {Promise<import('@scout9/app').EventResponse>}\n */\nexport const PUT = async ({params, body: updatedCustomer}) => {\n // const id = params.customer;\n\n console.log('updatedCustomer', updatedCustomer);\n // @TODO REST call to api to save customer info\n\n // @TODO REST call to api to save customer info\n return json({success: true}, {status: 200});\n};\n\n\n/**\n * Customer request to be removed from platform, use this to remove/update the customer info from your CRM\n *\n * Example:\n * A customer has opt-out of text messaging, Scout9 will send a DELETE message for you to remove any data, returning\n * back success: true will then have Scout9 delete any data on their end as well.\n *\n * @returns {Promise<import('@scout9/app').EventResponse>}\n */\nexport const DELETE = async ({params, request}) => {\n await customerDb.remove(params.customer);\n return json({success: true}, {status: 200});\n};\n"
13
13
  },
14
14
  {
15
15
  "name": "src/entities/customers/api.js",
16
- "contents": "import { EventResponse } from '../../../platform/src/index.js';\nimport { customerMockDb } from '../../lib/customer-mock-db.js';\n\n/**\n * Required entity - use this to sync with your CRM\n *\n * Query customer info from your CRM\n */\nexport const QUERY = async ({searchParams}) => {\n const {page, q, orderBy, endAt, startAt, limit} = searchParams;\n const customers = await customerMockDb.query(\n q,\n page ? parseInt(page) : undefined,\n limit ? parseInt(limit) : undefined,\n orderBy ? parseInt(orderBy) : undefined,\n endAt ? parseInt(endAt) : undefined,\n startAt ? parseInt(startAt) : undefined,\n );\n return EventResponse.json(customers, {status: 200});\n};\n"
16
+ "contents": "import { customerDb } from '../../lib/customer-db.js';\nimport { EventResponse } from '@scout9/app';\n\n/**\n * Required entity - use this to sync with your CRM\n *\n * Query customer info from your CRM\n * @returns {Promise<import('@scout9/app').EventResponse<Array<import('@scout9/app').Customer>>>}\n */\nexport const QUERY = async ({searchParams}) => {\n const {page, q, orderBy, endAt, startAt, limit} = searchParams;\n const customers = await customerDb.query(\n q,\n page ? parseInt(page) : undefined,\n limit ? parseInt(limit) : undefined,\n orderBy ? parseInt(orderBy) : undefined,\n endAt ? parseInt(endAt) : undefined,\n startAt ? parseInt(startAt) : undefined,\n );\n return EventResponse.json(customers, {status: 200});\n};\n"
17
17
  },
18
18
  {
19
- "name": "src/entities/deliveryMethod/index.js",
20
- "contents": "// import { EntityRootConfiguration } from '../../../platform/src/runtime/client/entity';\n\n// export type DeliveryMethod = {\n// deliveryMethod: 'pickup' | 'delivery';\n// }\n\n/**\n * Example entity to help us differentiate if a user wants a delivery or pickup order\n */\nexport default function () {\n return {\n definitions: [\n {\n value: 'delivery',\n text: [\n 'delivery',\n 'deliver',\n 'delivered',\n 'dropped off',\n 'drop off',\n ]\n },\n {\n value: 'pickup',\n text: [\n 'pickup',\n 'pick this one up',\n 'pick up',\n ]\n },\n ],\n training:\n [\n ...[\n 'I\\'ll have my order %delivery_method%',\n 'I\\'ll do a %delivery_method% order',\n '%delivery_method% please',\n ].map((text) => ({text, intent: 'delivery_method'})),\n ],\n tests: [\n {\n text: 'drop off order please',\n expected: {\n intent: 'deliveryMethod',\n context: {\n 'deliveryMethod': 'delivery'\n }\n },\n },\n {\n text: 'I\\'ll pick this one up',\n expected: {\n intent: 'deliveryMethod',\n context: {\n 'deliveryMethod': 'pickup'\n }\n },\n }\n ],\n }\n}\n"
19
+ "name": "src/entities/delivery_method/index.js",
20
+ "contents": "\n/**\n * Example entity to help us differentiate if a user wants a delivery or pickup order\n * @returns {IEntityBuildConfig}\n */\nexport default async function deliveryMethodEntity() {\n return {\n \"definitions\": [\n {\n \"value\": \"delivery\",\n \"text\": [\n \"delivery\",\n \"deliver\",\n \"delivered\",\n \"dropped off\",\n \"drop off\"\n ]\n },\n {\n \"value\": \"pickup\",\n \"text\": [\n \"pickup\",\n \"pick this one up\",\n \"pick up\"\n ]\n }\n ],\n \"training\": [\n {\n \"text\": \"I'll have my order %delivery_method%\",\n \"intent\": \"delivery_method\"\n },\n {\n \"text\": \"I'll do a %delivery_method% order\",\n \"intent\": \"delivery_method\"\n },\n {\n \"text\": \"%delivery_method% please\",\n \"intent\": \"delivery_method\"\n }\n ],\n \"tests\": [\n {\n \"text\": \"drop off order please\",\n \"expected\": {\n \"intent\": \"delivery_method\",\n \"context\": [\n {\n \"delivery_method\": \"delivery\"\n }\n ]\n }\n },\n {\n \"text\": \"I'll pick this one up\",\n \"expected\": {\n \"intent\": \"delivery_method\",\n \"context\": [\n {\n \"delivery_method\": \"pickup\"\n }\n ]\n }\n }\n ]\n };\n}\n"
21
21
  },
22
22
  {
23
23
  "name": "src/entities/pizza/index.js",
24
- "contents": "/**\n * Example entity that breaks down the pizza the user wants to order\n */\nexport default async function () {\n\n return {\n definitions: [\n {\n utterance: 'quantity',\n value: 'number',\n text: []\n },\n {\n utterance: 'size',\n value: 'small',\n text: ['small', 'sm', '6 inch', '6-inch', '6in', '6 in', '6\"']\n },\n {\n utterance: 'size',\n value: 'medium',\n text: ['medium', 'med', 'md', '8 inch', '8-inch', '8in', '8 in', '8\"']\n },\n {\n utterance: 'size',\n value: 'large',\n text: ['large', 'lg', '12 inch', '12-inch', '12in', '12 in', '12\"']\n },\n {\n utterance: 'size',\n value: 'x-large',\n text: ['extra large', 'x-large', 'xlarge', 'xl', '16 inch', '16-inch', '16in', '16 in', '16\"']\n },\n {\n utterance: 'topping',\n value: 'pepperoni',\n text: ['pepperoni']\n },\n {\n utterance: 'topping',\n value: 'sausage',\n text: ['sausage', 'italian sausage']\n },\n {\n utterance: 'topping',\n value: 'mushroom',\n text: ['mushroom', 'mushrooms', 'mush']\n },\n {\n utterance: 'topping',\n value: 'cheese',\n text: ['cheese', 'cheesy', 'cheez', 'mozarella', 'mozzarella', 'mozz']\n }\n ],\n training: [\n ...[\n '{{quantity:number}} %topping% %size%',\n '{{quantity:number}} %topping% %size%, {{quantity:number}} %topping% %size%, and {{quantity:number}} %topping% %size% and that should be all',\n 'Hey I would like {{quantity:number}} %topping% %size%',\n 'Hey I would like {{quantity:number}} %topping% and %topping%',\n 'Hey I would like {{quantity:number}} %topping%, %topping%, and extra %topping%', // @TODO extra would need to be a separate topping\n 'Hey I would like {{quantity:number}} %size% %topping%, %topping%, and %topping%',\n 'Could I get a %topping% pizza please?',\n 'Could I get {{quantity:number}} %size% %topping%, %topping%, and %topping%?',\n 'Can I order a {{quantity:number}} %size% %topping%, %topping%, and %topping%',\n ].map((text) => ({text, intent: 'pizza'})),\n ...[\n 'Can you remove that %size% %topping% pizza',\n 'Can you remove that %topping% %size% pizza',\n 'Can you cancel that %size% %topping%',\n 'Let\\'s remove that %size% %topping% pizza',\n 'Let\\'s get rid of that %size% %topping%',\n 'Let\\'s remove the %size% %topping% pizza',\n ].map((text) => ({text, intent: 'remove_pizza'})),\n ...[\n 'Can you remove those %topping%?',\n 'Can you remove that %topping%?',\n 'Actually, no %topping%?',\n 'Sorry, I don\\'t want %topping%?',\n ].map((text) => ({text, intent: 'remove_topping'})),\n ...[\n 'Do you have %topping%?',\n ].map((text) => ({text, intent: 'pizza_question'})),\n ],\n tests: [\n {\n text: 'I would like 3 pepperoni medium, 2 cheese medium, and 3 sausage mushroom',\n expected: {\n intent: 'pizza',\n context: {\n pizza: [\n {\n quantity: 3,\n topping: 'pepperoni',\n size: 'medium'\n },\n {\n quantity: 2,\n topping: 'cheese',\n size: 'medium'\n },\n {\n quantity: 3,\n topping: ['sausage', 'mushroom'],\n }\n ]\n },\n },\n },\n {\n text: 'Hey I would like 3 medium pepperoni, sausage, and extra cheese',\n expected: {\n intent: 'pizza',\n context: {\n pizza: [\n {\n quantity: 3,\n topping: ['pepperoni', 'sausage', 'cheese'],\n size: 'medium'\n }\n ]\n }\n }\n }\n ]\n };\n}\n\n"
24
+ "contents": "/**\n * Example entity that breaks down the pizza the user wants to order\n * @returns {IEntityBuildConfig}\n */\nexport default async function () {\n\n return {\n definitions: [\n {\n utterance: 'quantity',\n value: 'number',\n text: []\n },\n {\n utterance: 'size',\n value: 'small',\n text: ['small', 'sm', '6 inch', '6-inch', '6in', '6 in', '6\"']\n },\n {\n utterance: 'size',\n value: 'medium',\n text: ['medium', 'med', 'md', '8 inch', '8-inch', '8in', '8 in', '8\"']\n },\n {\n utterance: 'size',\n value: 'large',\n text: ['large', 'lg', '12 inch', '12-inch', '12in', '12 in', '12\"']\n },\n {\n utterance: 'size',\n value: 'x-large',\n text: ['extra large', 'x-large', 'xlarge', 'xl', '16 inch', '16-inch', '16in', '16 in', '16\"']\n },\n {\n utterance: 'topping',\n value: 'pepperoni',\n text: ['pepperoni']\n },\n {\n utterance: 'topping',\n value: 'sausage',\n text: ['sausage', 'italian sausage']\n },\n {\n utterance: 'topping',\n value: 'mushroom',\n text: ['mushroom', 'mushrooms', 'mush']\n },\n {\n utterance: 'topping',\n value: 'cheese',\n text: ['cheese', 'cheesy', 'cheez', 'mozarella', 'mozzarella', 'mozz']\n }\n ],\n training: [\n ...[\n '{{quantity:number}} %topping% %size%',\n '{{quantity:number}} %topping% %size%, {{quantity:number}} %topping% %size%, and {{quantity:number}} %topping% %size% and that should be all',\n 'Hey I would like {{quantity:number}} %topping% %size%',\n 'Hey I would like {{quantity:number}} %topping% and %topping%',\n 'Hey I would like {{quantity:number}} %topping%, %topping%, and extra %topping%', // @TODO extra would need to be a separate topping\n 'Hey I would like {{quantity:number}} %size% %topping%, %topping%, and %topping%',\n 'Could I get a %topping% pizza please?',\n 'Could I get {{quantity:number}} %size% %topping%, %topping%, and %topping%?',\n 'Can I order a {{quantity:number}} %size% %topping%, %topping%, and %topping%',\n ].map((text) => ({text, intent: 'pizza'})),\n ...[\n 'Can you remove that %size% %topping% pizza',\n 'Can you remove that %topping% %size% pizza',\n 'Can you cancel that %size% %topping%',\n 'Let\\'s remove that %size% %topping% pizza',\n 'Let\\'s get rid of that %size% %topping%',\n 'Let\\'s remove the %size% %topping% pizza',\n ].map((text) => ({text, intent: 'remove_pizza'})),\n ...[\n 'Can you remove those %topping%?',\n 'Can you remove that %topping%?',\n 'Actually, no %topping%?',\n 'Sorry, I don\\'t want %topping%?',\n ].map((text) => ({text, intent: 'remove_topping'})),\n ...[\n 'Do you have %topping%?',\n ].map((text) => ({text, intent: 'pizza_question'})),\n ],\n tests: [\n {\n text: 'I would like 3 pepperoni medium, 2 cheese medium, and 3 sausage mushroom',\n expected: {\n intent: 'pizza',\n context: {\n pizza: [\n {\n quantity: 3,\n topping: 'pepperoni',\n size: 'medium'\n },\n {\n quantity: 2,\n topping: 'cheese',\n size: 'medium'\n },\n {\n quantity: 3,\n topping: ['sausage', 'mushroom'],\n }\n ]\n },\n },\n },\n {\n text: 'Hey I would like 3 medium pepperoni, sausage, and extra cheese',\n expected: {\n intent: 'pizza',\n context: {\n pizza: [\n {\n quantity: 3,\n topping: ['pepperoni', 'sausage', 'cheese'],\n size: 'medium'\n }\n ]\n }\n }\n }\n ]\n };\n}\n\n"
25
25
  },
26
26
  {
27
27
  "name": "src/index.js",
28
- "contents": "export default {\n\n /**\n * Configure large language model (LLM) settings to generate auto replies\n */\n llm: {\n engine: 'openai',\n model: 'gpt-3.5-turbo',\n },\n /**\n * Configure personal model transformer (PMT) settings to align auto replies the agent's tone\n */\n pmt: {\n engine: 'scout9',\n model: 'orin-2.2'\n },\n}\n"
28
+ "contents": "/**\n * Configuration for the Scout9 project.\n * @type {import('@scout9/app').Scout9ProjectConfig}\n */\nexport default {\n\n /**\n * Configure large language model (LLM) settings to generate auto replies\n */\n llm: {\n engine: 'openai',\n model: 'gpt-3.5-turbo',\n },\n /**\n * Configure personal model transformer (PMT) settings to align auto replies the agent's tone\n */\n pmt: {\n engine: 'scout9',\n model: 'orin-1.0'\n },\n organization: {\n name: \"PizzaZoom\",\n description: \"PizzaZoom is a pizza delivery service that uses drones to deliver pizza to your door in 30 minutes or less.\",\n },\n initialContext: [\n \"Get the customers pizza order, be as brief and concise as possible.\",\n \"Customers generally want the pizza ASAP, so assume unless they ask for a specific time, they want it as soon as possible.\",\n ]\n}\n"
29
29
  },
30
30
  {
31
- "name": "src/lib/customer-mock-db.js",
32
- "contents": "/**\n * This an example adapter for a mock database to your CRM\n */\nexport const customerMockDb = {\n query: async (\n query,\n page,\n limit,\n orderBy,\n endAt,\n startAt,\n ) => Promise.resolve([{id: '1234', name: 'Test Customer', email: '', phone: ''}]),\n get: async (id) => Promise.resolve({id, name: 'Test Customer', email: '', phone: ''}),\n add: async (id, customer) => ({id}),\n update: async (id, updates) => true,\n remove: async (id) => true\n}\n"
31
+ "name": "src/lib/customer-db.js",
32
+ "contents": "import Scout9CRM from '@scout9/crm';\n\nconst crm = new Scout9CRM({apiKey: process.env.SCOUT9_API_KEY});\n\n/**\n * This an example adapter for a mock database to your CRM\n */\nexport const customerDb = {\n query: async (\n query,\n page,\n limit,\n orderBy,\n endAt,\n startAt,\n ) => crm.query(query, page, limit, orderBy, endAt, startAt),\n get: async (id) => crm.get(id),\n add: async (customer) => crm.add(customer),\n update: async (id, updates) => crm.update({...updates, $id: id}),\n remove: async (id) => crm.remove(id)\n}\n"
33
33
  },
34
34
  {
35
35
  "name": "src/lib/drivers.js",
@@ -37,10 +37,10 @@
37
37
  },
38
38
  {
39
39
  "name": "src/lib/invoice.js",
40
- "contents": "/**\n * An example service of creating and retrieving an invoice\n */\nexport async function createInvoice(pizza) {\n // @TODO create invoice\n return {\n id: 'invoice-123',\n subtotal: 6000,\n tax: 600,\n total: 6600,\n invoiceUrl: 'https://example.com/invoice-123'\n };\n}\n\nexport async function getInvoice(id) {\n // @TODO create invoice\n return {\n id: 'invoice-123',\n subtotal: 6000,\n tax: 600,\n total: 6600,\n invoiceUrl: 'https://example.com/invoice-123'\n };\n}\n"
40
+ "contents": "/**\n * An example service of creating and retrieving an invoice\n */\nexport async function createInvoice(pizza) {\n // @TODO create invoice backend\n return {\n id: 'invoice-123',\n subtotal: 6000,\n tax: 600,\n total: 6600,\n invoiceUrl: 'https://example.com/invoice-123'\n };\n}\n\nexport async function getInvoice(id) {\n // @TODO create invoice backend\n return {\n id: 'invoice-123',\n subtotal: 6000,\n tax: 600,\n total: 6600,\n invoiceUrl: 'https://example.com/invoice-123'\n };\n}\n"
41
41
  },
42
42
  {
43
43
  "name": "src/workflows/pizzaOrder/workflow.js",
44
- "contents": "import moment from 'moment';\nimport { getAvailableDriver } from '../../lib/drivers.js';\nimport { createInvoice, getInvoice } from '../../lib/invoice.js';\n\n/**\n * Example PizzaOrder workflow - this is a simple example of a workflow that can be used to order a pizza\n */\nexport default async function PizzaOrder(\n {\n context,\n customer\n }) {\n\n if (!context.pizza) {\n return {\n instructions: 'Figure out what pizza sizes, toppings are needed for order'\n };\n }\n\n if (!context.deliveryMethod) {\n return {\n instructions: `Determine if ${customer?.firstName || 'the customer'} is doing a delivery or pickup and determine time of pickup/delivery`\n };\n }\n\n if (!context.invoiceId) {\n const invoice = await createInvoice(context.pizza);\n return {\n instructions: `Send invoice to customer`,\n message: `Order created - $${(invoice.total/100).toFixed(2)} you can pay at ${invoice.invoiceUrl}`,\n contextUpsert: {\n invoiceId: invoice.id,\n invoicePaid: false\n }\n }\n }\n\n if (!context.invoicePaid) {\n if (!context.invoiceId) {\n return {forward: true};\n }\n const invoice = await getInvoice(context.invoiceId || '');\n return {\n instructions: `Let user know order is ready for payment at ${invoice.invoiceUrl}`\n }\n }\n\n if (context.deliveryMethod === 'pickup') {\n return [\n {\n instructions: `Let user know their order will be ready at ${moment().add(30, 'minutes').format('h:mm a')}`\n },\n {\n instructions: `Find out if everything was delivered, and let the user know to contact if there are any issues`,\n forward: {\n mode: 'after-reply'\n },\n scheduled: moment().add(30, 'minutes').unix()\n }\n ];\n // @TODO - delay and notify user for feedback and if they got their pizza\n }\n\n if (!context.address && context.deliveryMethod === 'delivery') {\n return {\n instructions: `Ask ${customer.firstName || 'the customer'} for their delivery address`\n };\n }\n\n if (context.address && !context.driver && !context.deliveryTime) {\n const {driver, deliveryEstimate} = await getAvailableDriver(context.address);\n return {\n instructions: `Let ${customer.firstName || 'the customer'} know the pizza order should arrive at ${deliveryEstimate.format(\n 'h:mm a')}`,\n contextUpsert: {\n driver: {\n ...driver\n },\n deliveryTime: deliveryEstimate.unix()\n }\n };\n }\n\n return {\n forward: true\n }\n}\n"
44
+ "contents": "import moment from 'moment';\nimport { getAvailableDriver } from '../../lib/drivers.js';\nimport { createInvoice, getInvoice } from '../../lib/invoice.js';\n\n/**\n * Example PizzaOrder workflow - this is a simple example of a workflow that can be used to order a pizza\n * @param {import('@scout9/app').WorkflowEvent} event - the workflow event that every workflow must have\n * @returns {Promise<import('@scout9/app').WorkflowResponse>} - the response that every workflow must return\n */\nexport default async function PizzaOrder(\n {\n context,\n customer\n }) {\n\n if (!context.pizza) {\n return {\n instructions: 'Figure out what pizza sizes, toppings are needed for order'\n };\n }\n\n if (!context.invoiceId && context.delivery_method) {\n const invoice = await createInvoice(context.pizza);\n const intro = `${context.delivery_method === 'delivery' ? 'Order will be sent over in 30 minutes' : 'Order will be ready for pickup in 30 minutes at 123 Nark Ave Seattle WA 98122'}.`;\n return {\n message: `${intro}.\\n\\nThe total is $${(invoice.total/100).toFixed(2)}, you can pay at this url: ${invoice.invoiceUrl}`,\n contextUpsert: {\n invoiceId: invoice.id,\n invoicePaid: false\n }\n }\n }\n\n if (!context.invoicePaid && context.invoiceId) {\n if (!context.invoiceId) {\n return {forward: true};\n }\n const invoice = await getInvoice(context.invoiceId || '');\n return {\n instructions: `Let user know order is ready for payment at ${invoice.invoiceUrl}`\n }\n }\n\n if (context.delivery_method === 'pickup') {\n return [\n {\n instructions: `Let user know their order will be ready at ${moment().add(30, 'minutes').format('h:mm a')}`\n },\n {\n instructions: `Find out if everything was delivered, and let the user know to contact if there are any issues`,\n forward: {\n mode: 'after-reply'\n },\n scheduled: moment().add(30, 'minutes').unix()\n }\n ];\n // @TODO - delay and notify user for feedback and if they got their pizza\n }\n\n if (!context.address && context.delivery_method === 'delivery') {\n return {\n instructions: `Ask ${customer.firstName || 'the customer'} for their delivery address`\n };\n }\n\n if (context.address && !context.driver && !context.deliveryTime) {\n const {driver, deliveryEstimate} = await getAvailableDriver(context.address);\n return {\n instructions: `Let ${customer.firstName || 'the customer'} know the pizza order should arrive at ${deliveryEstimate.format(\n 'h:mm a')}`,\n contextUpsert: {\n driver: {\n ...driver\n },\n deliveryTime: deliveryEstimate.unix()\n }\n };\n }\n\n if (!context.delivery_method) {\n return {\n instructions: `Ask ${customer.firstName || 'the customer'} if they want their pizza order for either pickup or delivery.`\n }\n }\n\n console.error('No where to go - view context:\\n', JSON.stringify(context, null, 2));\n return {\n forward: true,\n notes: 'No where to go, something happened'\n }\n}\n"
45
45
  }
46
46
  ]
@@ -1,23 +1,23 @@
1
1
  [
2
2
  {
3
3
  "name": "src/app.js",
4
- "contents": "import { EventResponse } from '@scout9/app';\n\nimport PizzaOrder from './workflows/pizzaOrder/workflow.js';\n\nexport default async function Scout9App(event) {\n\n console.log(EventResponse);\n if (event.intent === 'pizzaOrder') {\n // run pizza order workflow\n return PizzaOrder(event);\n } else {\n if (event.stagnationCount < 2) {\n return {\n instructions: 'Double check if the user is looking to order a pizza'\n }\n } else {\n // End auto replies, forward to agent for manual intervention\n return {\n forward: true,\n }\n }\n }\n\n}\n"
4
+ "contents": "\nimport PizzaOrder from './workflows/pizzaOrder/workflow.js';\n\nexport default async function Scout9App(event) {\n\n // If the user intent is pizzaOrder or the context has a pizza object, run the pizza order workflow\n if (event.intent === 'pizzaOrder' || event.context === 'pizza') {\n // run pizza order workflow\n return PizzaOrder(event);\n } else {\n if (event.stagnationCount < 2) {\n return {\n instructions: 'Double check if the user is looking to order a pizza'\n }\n } else {\n // End auto replies, forward to agent for manual intervention\n return {\n forward: true,\n }\n }\n }\n\n}\n"
5
5
  },
6
6
  {
7
7
  "name": "src/entities/agents/index.js",
8
- "contents": "/**\n * Required core entity type: Agents represents you and your team\n */\nexport default function Agents() {\n return [\n {\n id: 'agent-1',\n firstName: 'Agent',\n lastName: 'Smith',\n forwardPhone: '+15555555555',\n forwardEmail: '',\n programmablePhoneNumber: '+15555555555',\n }\n ];\n}\n"
8
+ "contents": "/**\n * Required core entity type: Agents represents you and your team\n */\nexport default function Agents() {\n return [\n {\n id: 'agent-1',\n firstName: 'Patrick',\n lastName: 'Opie',\n forwardPhone: '+15555555555',\n context: 'helps customers with placing their pizza orders',\n forwardEmail: '',\n programmablePhoneNumber: '+15555555555',\n }\n ];\n}\n"
9
9
  },
10
10
  {
11
11
  "name": "src/entities/customers/[customer]/api.js",
12
- "contents": "import { json } from '../../../../platform/src/exports.js';\n\n// @TODO replace with your CRM api\nimport { customerMockDb } from '../../../lib/customer-mock-db';\n\n\n/**\n * Get customer info from your CRM\n */\nexport const GET = async ({params}) => {\n return json(await customerMockDb.get(params.customer));\n};\n\n/**\n * When a customer is created on scout9's side\n *\n * Example:\n * A new or unrecognized customer has contacted an agent. Scout9 has captured some preliminary information\n * about them and sent this POST request. Take the information to either add a new customer record to your CRM\n * or return an existing customer id to map the correct customer document.\n */\nexport const POST = async ({params, body: newCustomer}) => {\n // Scout9 will generate random id for new customers, but whatever id you return back will be used for the new customer\n const {id: crmId} = await customerMockDb.add(params.customer, newCustomer);\n return json({success: true, id: crmId}, {status: 200});\n};\n\n/**\n * New customer info revealed, use this to save the customer info to your CRM\n *\n * Example:\n * In a conversation, if any new data is found, Scout9 will send a PUT or PATCH request to allow for you to update\n * your CRM accordingly.\n */\nexport const PUT = async ({params, body: updatedCustomer}) => {\n // const id = params.customer;\n\n console.log('updatedCustomer', updatedCustomer);\n // @TODO REST call to api to save customer info\n\n // @TODO REST call to api to save customer info\n return json({success: true}, {status: 200});\n};\n\n\n/**\n * Customer request to be removed from platform, use this to remove/update the customer info from your CRM\n *\n * Example:\n * A customer has opt-out of text messaging, Scout9 will send a DELETE message for you to remove any data, returning\n * back success: true will then have Scout9 delete any data on their end as well.\n */\nexport const DELETE = async ({params, request}) => {\n await customerMockDb.remove(params.customer);\n return json({success: true}, {status: 200});\n};\n"
12
+ "contents": "import { json } from '@scout9/app';\n\n// @TODO replace with your CRM api\nimport { customerDb } from '../../../lib/customer-db.js';\n\n/**\n * Get customer info from your CRM\n */\nexport const GET = async ({params}) => {\n return json(await customerDb.get(params.customer));\n};\n\n/**\n * When a customer is created on scout9's side\n *\n * Example:\n * A new or unrecognized customer has contacted an agent. Scout9 has captured some preliminary information\n * about them and sent this POST request. Take the information to either add a new customer record to your CRM\n * or return an existing customer id to map the correct customer document.\n *\n */\nexport const POST = async ({params, body: newCustomer}) => {\n // Scout9 will generate random id for new customers, but whatever id you return back will be used for the new customer\n const {id: crmId} = await customerDb.add({$id: params.customer, newCustomer});\n return json({success: true, id: crmId}, {status: 200});\n};\n\n/**\n * New customer info revealed, use this to save the customer info to your CRM\n *\n * Example:\n * In a conversation, if any new data is found, Scout9 will send a PUT or PATCH request to allow for you to update\n * your CRM accordingly.\n *\n */\nexport const PUT = async ({params, body: updatedCustomer}) => {\n // const id = params.customer;\n\n console.log('updatedCustomer', updatedCustomer);\n // @TODO REST call to api to save customer info\n\n // @TODO REST call to api to save customer info\n return json({success: true}, {status: 200});\n};\n\n\n/**\n * Customer request to be removed from platform, use this to remove/update the customer info from your CRM\n *\n * Example:\n * A customer has opt-out of text messaging, Scout9 will send a DELETE message for you to remove any data, returning\n * back success: true will then have Scout9 delete any data on their end as well.\n *\n */\nexport const DELETE = async ({params, request}) => {\n await customerDb.remove(params.customer);\n return json({success: true}, {status: 200});\n};\n"
13
13
  },
14
14
  {
15
15
  "name": "src/entities/customers/api.js",
16
- "contents": "import { EventResponse } from '../../../platform/src/index.js';\nimport { customerMockDb } from '../../lib/customer-mock-db.js';\n\n/**\n * Required entity - use this to sync with your CRM\n *\n * Query customer info from your CRM\n */\nexport const QUERY = async ({searchParams}) => {\n const {page, q, orderBy, endAt, startAt, limit} = searchParams;\n const customers = await customerMockDb.query(\n q,\n page ? parseInt(page) : undefined,\n limit ? parseInt(limit) : undefined,\n orderBy ? parseInt(orderBy) : undefined,\n endAt ? parseInt(endAt) : undefined,\n startAt ? parseInt(startAt) : undefined,\n );\n return EventResponse.json(customers, {status: 200});\n};\n"
16
+ "contents": "import { customerDb } from '../../lib/customer-db.js';\nimport { EventResponse } from '@scout9/app';\n\n/**\n * Required entity - use this to sync with your CRM\n *\n * Query customer info from your CRM\n */\nexport const QUERY = async ({searchParams}) => {\n const {page, q, orderBy, endAt, startAt, limit} = searchParams;\n const customers = await customerDb.query(\n q,\n page ? parseInt(page) : undefined,\n limit ? parseInt(limit) : undefined,\n orderBy ? parseInt(orderBy) : undefined,\n endAt ? parseInt(endAt) : undefined,\n startAt ? parseInt(startAt) : undefined,\n );\n return EventResponse.json(customers, {status: 200});\n};\n"
17
17
  },
18
18
  {
19
- "name": "src/entities/deliveryMethod/index.js",
20
- "contents": "// import { EntityRootConfiguration } from '../../../platform/src/runtime/client/entity';\n\n// export type DeliveryMethod = {\n// deliveryMethod: 'pickup' | 'delivery';\n// }\n\n/**\n * Example entity to help us differentiate if a user wants a delivery or pickup order\n */\nexport default function () {\n return {\n definitions: [\n {\n value: 'delivery',\n text: [\n 'delivery',\n 'deliver',\n 'delivered',\n 'dropped off',\n 'drop off',\n ]\n },\n {\n value: 'pickup',\n text: [\n 'pickup',\n 'pick this one up',\n 'pick up',\n ]\n },\n ],\n training:\n [\n ...[\n 'I\\'ll have my order %delivery_method%',\n 'I\\'ll do a %delivery_method% order',\n '%delivery_method% please',\n ].map((text) => ({text, intent: 'delivery_method'})),\n ],\n tests: [\n {\n text: 'drop off order please',\n expected: {\n intent: 'deliveryMethod',\n context: {\n 'deliveryMethod': 'delivery'\n }\n },\n },\n {\n text: 'I\\'ll pick this one up',\n expected: {\n intent: 'deliveryMethod',\n context: {\n 'deliveryMethod': 'pickup'\n }\n },\n }\n ],\n }\n}\n"
19
+ "name": "src/entities/delivery_method/index.js",
20
+ "contents": "\n/**\n * Example entity to help us differentiate if a user wants a delivery or pickup order\n */\nexport default async function deliveryMethodEntity() {\n return {\n \"definitions\": [\n {\n \"value\": \"delivery\",\n \"text\": [\n \"delivery\",\n \"deliver\",\n \"delivered\",\n \"dropped off\",\n \"drop off\"\n ]\n },\n {\n \"value\": \"pickup\",\n \"text\": [\n \"pickup\",\n \"pick this one up\",\n \"pick up\"\n ]\n }\n ],\n \"training\": [\n {\n \"text\": \"I'll have my order %delivery_method%\",\n \"intent\": \"delivery_method\"\n },\n {\n \"text\": \"I'll do a %delivery_method% order\",\n \"intent\": \"delivery_method\"\n },\n {\n \"text\": \"%delivery_method% please\",\n \"intent\": \"delivery_method\"\n }\n ],\n \"tests\": [\n {\n \"text\": \"drop off order please\",\n \"expected\": {\n \"intent\": \"delivery_method\",\n \"context\": [\n {\n \"delivery_method\": \"delivery\"\n }\n ]\n }\n },\n {\n \"text\": \"I'll pick this one up\",\n \"expected\": {\n \"intent\": \"delivery_method\",\n \"context\": [\n {\n \"delivery_method\": \"pickup\"\n }\n ]\n }\n }\n ]\n };\n}\n"
21
21
  },
22
22
  {
23
23
  "name": "src/entities/pizza/index.js",
@@ -25,11 +25,11 @@
25
25
  },
26
26
  {
27
27
  "name": "src/index.js",
28
- "contents": "export default {\n\n /**\n * Configure large language model (LLM) settings to generate auto replies\n */\n llm: {\n engine: 'openai',\n model: 'gpt-3.5-turbo',\n },\n /**\n * Configure personal model transformer (PMT) settings to align auto replies the agent's tone\n */\n pmt: {\n engine: 'scout9',\n model: 'orin-2.2'\n },\n}\n"
28
+ "contents": "/**\n * Configuration for the Scout9 project.\n */\nexport default {\n\n /**\n * Configure large language model (LLM) settings to generate auto replies\n */\n llm: {\n engine: 'openai',\n model: 'gpt-3.5-turbo',\n },\n /**\n * Configure personal model transformer (PMT) settings to align auto replies the agent's tone\n */\n pmt: {\n engine: 'scout9',\n model: 'orin-1.0'\n },\n organization: {\n name: \"PizzaZoom\",\n description: \"PizzaZoom is a pizza delivery service that uses drones to deliver pizza to your door in 30 minutes or less.\",\n },\n initialContext: [\n \"Get the customers pizza order, be as brief and concise as possible.\",\n \"Customers generally want the pizza ASAP, so assume unless they ask for a specific time, they want it as soon as possible.\",\n ]\n}\n"
29
29
  },
30
30
  {
31
- "name": "src/lib/customer-mock-db.js",
32
- "contents": "/**\n * This an example adapter for a mock database to your CRM\n */\nexport const customerMockDb = {\n query: async (\n query,\n page,\n limit,\n orderBy,\n endAt,\n startAt,\n ) => Promise.resolve([{id: '1234', name: 'Test Customer', email: '', phone: ''}]),\n get: async (id) => Promise.resolve({id, name: 'Test Customer', email: '', phone: ''}),\n add: async (id, customer) => ({id}),\n update: async (id, updates) => true,\n remove: async (id) => true\n}\n"
31
+ "name": "src/lib/customer-db.js",
32
+ "contents": "import Scout9CRM from '@scout9/crm';\n\nconst crm = new Scout9CRM({apiKey: process.env.SCOUT9_API_KEY});\n\n/**\n * This an example adapter for a mock database to your CRM\n */\nexport const customerDb = {\n query: async (\n query,\n page,\n limit,\n orderBy,\n endAt,\n startAt,\n ) => crm.query(query, page, limit, orderBy, endAt, startAt),\n get: async (id) => crm.get(id),\n add: async (customer) => crm.add(customer),\n update: async (id, updates) => crm.update({...updates, $id: id}),\n remove: async (id) => crm.remove(id)\n}\n"
33
33
  },
34
34
  {
35
35
  "name": "src/lib/drivers.js",
@@ -37,10 +37,10 @@
37
37
  },
38
38
  {
39
39
  "name": "src/lib/invoice.js",
40
- "contents": "/**\n * An example service of creating and retrieving an invoice\n */\nexport async function createInvoice(pizza) {\n // @TODO create invoice\n return {\n id: 'invoice-123',\n subtotal: 6000,\n tax: 600,\n total: 6600,\n invoiceUrl: 'https://example.com/invoice-123'\n };\n}\n\nexport async function getInvoice(id) {\n // @TODO create invoice\n return {\n id: 'invoice-123',\n subtotal: 6000,\n tax: 600,\n total: 6600,\n invoiceUrl: 'https://example.com/invoice-123'\n };\n}\n"
40
+ "contents": "/**\n * An example service of creating and retrieving an invoice\n */\nexport async function createInvoice(pizza) {\n // @TODO create invoice backend\n return {\n id: 'invoice-123',\n subtotal: 6000,\n tax: 600,\n total: 6600,\n invoiceUrl: 'https://example.com/invoice-123'\n };\n}\n\nexport async function getInvoice(id) {\n // @TODO create invoice backend\n return {\n id: 'invoice-123',\n subtotal: 6000,\n tax: 600,\n total: 6600,\n invoiceUrl: 'https://example.com/invoice-123'\n };\n}\n"
41
41
  },
42
42
  {
43
43
  "name": "src/workflows/pizzaOrder/workflow.js",
44
- "contents": "import moment from 'moment';\nimport { getAvailableDriver } from '../../lib/drivers.js';\nimport { createInvoice, getInvoice } from '../../lib/invoice.js';\n\n/**\n * Example PizzaOrder workflow - this is a simple example of a workflow that can be used to order a pizza\n */\nexport default async function PizzaOrder(\n {\n context,\n customer\n }) {\n\n if (!context.pizza) {\n return {\n instructions: 'Figure out what pizza sizes, toppings are needed for order'\n };\n }\n\n if (!context.deliveryMethod) {\n return {\n instructions: `Determine if ${customer?.firstName || 'the customer'} is doing a delivery or pickup and determine time of pickup/delivery`\n };\n }\n\n if (!context.invoiceId) {\n const invoice = await createInvoice(context.pizza);\n return {\n instructions: `Send invoice to customer`,\n message: `Order created - $${(invoice.total/100).toFixed(2)} you can pay at ${invoice.invoiceUrl}`,\n contextUpsert: {\n invoiceId: invoice.id,\n invoicePaid: false\n }\n }\n }\n\n if (!context.invoicePaid) {\n if (!context.invoiceId) {\n return {forward: true};\n }\n const invoice = await getInvoice(context.invoiceId || '');\n return {\n instructions: `Let user know order is ready for payment at ${invoice.invoiceUrl}`\n }\n }\n\n if (context.deliveryMethod === 'pickup') {\n return [\n {\n instructions: `Let user know their order will be ready at ${moment().add(30, 'minutes').format('h:mm a')}`\n },\n {\n instructions: `Find out if everything was delivered, and let the user know to contact if there are any issues`,\n forward: {\n mode: 'after-reply'\n },\n scheduled: moment().add(30, 'minutes').unix()\n }\n ];\n // @TODO - delay and notify user for feedback and if they got their pizza\n }\n\n if (!context.address && context.deliveryMethod === 'delivery') {\n return {\n instructions: `Ask ${customer.firstName || 'the customer'} for their delivery address`\n };\n }\n\n if (context.address && !context.driver && !context.deliveryTime) {\n const {driver, deliveryEstimate} = await getAvailableDriver(context.address);\n return {\n instructions: `Let ${customer.firstName || 'the customer'} know the pizza order should arrive at ${deliveryEstimate.format(\n 'h:mm a')}`,\n contextUpsert: {\n driver: {\n ...driver\n },\n deliveryTime: deliveryEstimate.unix()\n }\n };\n }\n\n return {\n forward: true\n }\n}\n"
44
+ "contents": "import moment from 'moment';\nimport { getAvailableDriver } from '../../lib/drivers.js';\nimport { createInvoice, getInvoice } from '../../lib/invoice.js';\n\n/**\n * Example PizzaOrder workflow - this is a simple example of a workflow that can be used to order a pizza\n */\nexport default async function PizzaOrder(\n {\n context,\n customer\n }) {\n\n if (!context.pizza) {\n return {\n instructions: 'Figure out what pizza sizes, toppings are needed for order'\n };\n }\n\n if (!context.invoiceId && context.delivery_method) {\n const invoice = await createInvoice(context.pizza);\n const intro = `${context.delivery_method === 'delivery' ? 'Order will be sent over in 30 minutes' : 'Order will be ready for pickup in 30 minutes at 123 Nark Ave Seattle WA 98122'}.`;\n return {\n message: `${intro}.\\n\\nThe total is $${(invoice.total/100).toFixed(2)}, you can pay at this url: ${invoice.invoiceUrl}`,\n contextUpsert: {\n invoiceId: invoice.id,\n invoicePaid: false\n }\n }\n }\n\n if (!context.invoicePaid && context.invoiceId) {\n if (!context.invoiceId) {\n return {forward: true};\n }\n const invoice = await getInvoice(context.invoiceId || '');\n return {\n instructions: `Let user know order is ready for payment at ${invoice.invoiceUrl}`\n }\n }\n\n if (context.delivery_method === 'pickup') {\n return [\n {\n instructions: `Let user know their order will be ready at ${moment().add(30, 'minutes').format('h:mm a')}`\n },\n {\n instructions: `Find out if everything was delivered, and let the user know to contact if there are any issues`,\n forward: {\n mode: 'after-reply'\n },\n scheduled: moment().add(30, 'minutes').unix()\n }\n ];\n // @TODO - delay and notify user for feedback and if they got their pizza\n }\n\n if (!context.address && context.delivery_method === 'delivery') {\n return {\n instructions: `Ask ${customer.firstName || 'the customer'} for their delivery address`\n };\n }\n\n if (context.address && !context.driver && !context.deliveryTime) {\n const {driver, deliveryEstimate} = await getAvailableDriver(context.address);\n return {\n instructions: `Let ${customer.firstName || 'the customer'} know the pizza order should arrive at ${deliveryEstimate.format(\n 'h:mm a')}`,\n contextUpsert: {\n driver: {\n ...driver\n },\n deliveryTime: deliveryEstimate.unix()\n }\n };\n }\n\n if (!context.delivery_method) {\n return {\n instructions: `Ask ${customer.firstName || 'the customer'} if they want their pizza order for either pickup or delivery.`\n }\n }\n\n console.error('No where to go - view context:\\n', JSON.stringify(context, null, 2));\n return {\n forward: true,\n notes: 'No where to go, something happened'\n }\n}\n"
45
45
  }
46
46
  ]
@@ -1,23 +1,23 @@
1
1
  [
2
2
  {
3
3
  "name": "src/app.js",
4
- "contents": "import { EventResponse } from '@scout9/app';\n\nimport PizzaOrder from './workflows/pizzaOrder/workflow.js';\n\nexport default async function Scout9App(event) {\n\n console.log(EventResponse);\n if (event.intent === 'pizzaOrder') {\n // run pizza order workflow\n return PizzaOrder(event);\n } else {\n if (event.stagnationCount < 2) {\n return {\n instructions: 'Double check if the user is looking to order a pizza'\n }\n } else {\n // End auto replies, forward to agent for manual intervention\n return {\n forward: true,\n }\n }\n }\n\n}\n"
4
+ "contents": "\nimport PizzaOrder from './workflows/pizzaOrder/workflow.js';\n\nexport default async function Scout9App(event) {\n\n // If the user intent is pizzaOrder or the context has a pizza object, run the pizza order workflow\n if (event.intent === 'pizzaOrder' || event.context === 'pizza') {\n // run pizza order workflow\n return PizzaOrder(event);\n } else {\n if (event.stagnationCount < 2) {\n return {\n instructions: 'Double check if the user is looking to order a pizza'\n }\n } else {\n // End auto replies, forward to agent for manual intervention\n return {\n forward: true,\n }\n }\n }\n\n}\n"
5
5
  },
6
6
  {
7
7
  "name": "src/entities/agents/index.js",
8
- "contents": "/**\n * Required core entity type: Agents represents you and your team\n */\nexport default function Agents() {\n return [\n {\n id: 'agent-1',\n firstName: 'Agent',\n lastName: 'Smith',\n forwardPhone: '+15555555555',\n forwardEmail: '',\n programmablePhoneNumber: '+15555555555',\n }\n ];\n}\n"
8
+ "contents": "/**\n * Required core entity type: Agents represents you and your team\n */\nexport default function Agents() {\n return [\n {\n id: 'agent-1',\n firstName: 'Patrick',\n lastName: 'Opie',\n forwardPhone: '+15555555555',\n context: 'helps customers with placing their pizza orders',\n forwardEmail: '',\n programmablePhoneNumber: '+15555555555',\n }\n ];\n}\n"
9
9
  },
10
10
  {
11
11
  "name": "src/entities/customers/[customer]/api.js",
12
- "contents": "import { json } from '../../../../platform/src/exports.js';\n\n// @TODO replace with your CRM api\nimport { customerMockDb } from '../../../lib/customer-mock-db';\n\n\n/**\n * Get customer info from your CRM\n */\nexport const GET = async ({params}) => {\n return json(await customerMockDb.get(params.customer));\n};\n\n/**\n * When a customer is created on scout9's side\n *\n * Example:\n * A new or unrecognized customer has contacted an agent. Scout9 has captured some preliminary information\n * about them and sent this POST request. Take the information to either add a new customer record to your CRM\n * or return an existing customer id to map the correct customer document.\n */\nexport const POST = async ({params, body: newCustomer}) => {\n // Scout9 will generate random id for new customers, but whatever id you return back will be used for the new customer\n const {id: crmId} = await customerMockDb.add(params.customer, newCustomer);\n return json({success: true, id: crmId}, {status: 200});\n};\n\n/**\n * New customer info revealed, use this to save the customer info to your CRM\n *\n * Example:\n * In a conversation, if any new data is found, Scout9 will send a PUT or PATCH request to allow for you to update\n * your CRM accordingly.\n */\nexport const PUT = async ({params, body: updatedCustomer}) => {\n // const id = params.customer;\n\n console.log('updatedCustomer', updatedCustomer);\n // @TODO REST call to api to save customer info\n\n // @TODO REST call to api to save customer info\n return json({success: true}, {status: 200});\n};\n\n\n/**\n * Customer request to be removed from platform, use this to remove/update the customer info from your CRM\n *\n * Example:\n * A customer has opt-out of text messaging, Scout9 will send a DELETE message for you to remove any data, returning\n * back success: true will then have Scout9 delete any data on their end as well.\n */\nexport const DELETE = async ({params, request}) => {\n await customerMockDb.remove(params.customer);\n return json({success: true}, {status: 200});\n};\n"
12
+ "contents": "import { json } from '@scout9/app';\n\n// @TODO replace with your CRM api\nimport { customerDb } from '../../../lib/customer-db.js';\n\n/**\n * Get customer info from your CRM\n */\nexport const GET = async ({params}) => {\n return json(await customerDb.get(params.customer));\n};\n\n/**\n * When a customer is created on scout9's side\n *\n * Example:\n * A new or unrecognized customer has contacted an agent. Scout9 has captured some preliminary information\n * about them and sent this POST request. Take the information to either add a new customer record to your CRM\n * or return an existing customer id to map the correct customer document.\n *\n */\nexport const POST = async ({params, body: newCustomer}) => {\n // Scout9 will generate random id for new customers, but whatever id you return back will be used for the new customer\n const {id: crmId} = await customerDb.add({$id: params.customer, newCustomer});\n return json({success: true, id: crmId}, {status: 200});\n};\n\n/**\n * New customer info revealed, use this to save the customer info to your CRM\n *\n * Example:\n * In a conversation, if any new data is found, Scout9 will send a PUT or PATCH request to allow for you to update\n * your CRM accordingly.\n *\n */\nexport const PUT = async ({params, body: updatedCustomer}) => {\n // const id = params.customer;\n\n console.log('updatedCustomer', updatedCustomer);\n // @TODO REST call to api to save customer info\n\n // @TODO REST call to api to save customer info\n return json({success: true}, {status: 200});\n};\n\n\n/**\n * Customer request to be removed from platform, use this to remove/update the customer info from your CRM\n *\n * Example:\n * A customer has opt-out of text messaging, Scout9 will send a DELETE message for you to remove any data, returning\n * back success: true will then have Scout9 delete any data on their end as well.\n *\n */\nexport const DELETE = async ({params, request}) => {\n await customerDb.remove(params.customer);\n return json({success: true}, {status: 200});\n};\n"
13
13
  },
14
14
  {
15
15
  "name": "src/entities/customers/api.js",
16
- "contents": "import { EventResponse } from '../../../platform/src/index.js';\nimport { customerMockDb } from '../../lib/customer-mock-db.js';\n\n/**\n * Required entity - use this to sync with your CRM\n *\n * Query customer info from your CRM\n */\nexport const QUERY = async ({searchParams}) => {\n const {page, q, orderBy, endAt, startAt, limit} = searchParams;\n const customers = await customerMockDb.query(\n q,\n page ? parseInt(page) : undefined,\n limit ? parseInt(limit) : undefined,\n orderBy ? parseInt(orderBy) : undefined,\n endAt ? parseInt(endAt) : undefined,\n startAt ? parseInt(startAt) : undefined,\n );\n return EventResponse.json(customers, {status: 200});\n};\n"
16
+ "contents": "import { customerDb } from '../../lib/customer-db.js';\nimport { EventResponse } from '@scout9/app';\n\n/**\n * Required entity - use this to sync with your CRM\n *\n * Query customer info from your CRM\n */\nexport const QUERY = async ({searchParams}) => {\n const {page, q, orderBy, endAt, startAt, limit} = searchParams;\n const customers = await customerDb.query(\n q,\n page ? parseInt(page) : undefined,\n limit ? parseInt(limit) : undefined,\n orderBy ? parseInt(orderBy) : undefined,\n endAt ? parseInt(endAt) : undefined,\n startAt ? parseInt(startAt) : undefined,\n );\n return EventResponse.json(customers, {status: 200});\n};\n"
17
17
  },
18
18
  {
19
- "name": "src/entities/deliveryMethod/index.js",
20
- "contents": "// import { EntityRootConfiguration } from '../../../platform/src/runtime/client/entity';\n\n// export type DeliveryMethod = {\n// deliveryMethod: 'pickup' | 'delivery';\n// }\n\n/**\n * Example entity to help us differentiate if a user wants a delivery or pickup order\n */\nexport default function () {\n return {\n definitions: [\n {\n value: 'delivery',\n text: [\n 'delivery',\n 'deliver',\n 'delivered',\n 'dropped off',\n 'drop off',\n ]\n },\n {\n value: 'pickup',\n text: [\n 'pickup',\n 'pick this one up',\n 'pick up',\n ]\n },\n ],\n training:\n [\n ...[\n 'I\\'ll have my order %delivery_method%',\n 'I\\'ll do a %delivery_method% order',\n '%delivery_method% please',\n ].map((text) => ({text, intent: 'delivery_method'})),\n ],\n tests: [\n {\n text: 'drop off order please',\n expected: {\n intent: 'deliveryMethod',\n context: {\n 'deliveryMethod': 'delivery'\n }\n },\n },\n {\n text: 'I\\'ll pick this one up',\n expected: {\n intent: 'deliveryMethod',\n context: {\n 'deliveryMethod': 'pickup'\n }\n },\n }\n ],\n }\n}\n"
19
+ "name": "src/entities/delivery_method/index.js",
20
+ "contents": "\n/**\n * Example entity to help us differentiate if a user wants a delivery or pickup order\n */\nexport default async function deliveryMethodEntity() {\n return {\n \"definitions\": [\n {\n \"value\": \"delivery\",\n \"text\": [\n \"delivery\",\n \"deliver\",\n \"delivered\",\n \"dropped off\",\n \"drop off\"\n ]\n },\n {\n \"value\": \"pickup\",\n \"text\": [\n \"pickup\",\n \"pick this one up\",\n \"pick up\"\n ]\n }\n ],\n \"training\": [\n {\n \"text\": \"I'll have my order %delivery_method%\",\n \"intent\": \"delivery_method\"\n },\n {\n \"text\": \"I'll do a %delivery_method% order\",\n \"intent\": \"delivery_method\"\n },\n {\n \"text\": \"%delivery_method% please\",\n \"intent\": \"delivery_method\"\n }\n ],\n \"tests\": [\n {\n \"text\": \"drop off order please\",\n \"expected\": {\n \"intent\": \"delivery_method\",\n \"context\": [\n {\n \"delivery_method\": \"delivery\"\n }\n ]\n }\n },\n {\n \"text\": \"I'll pick this one up\",\n \"expected\": {\n \"intent\": \"delivery_method\",\n \"context\": [\n {\n \"delivery_method\": \"pickup\"\n }\n ]\n }\n }\n ]\n };\n}\n"
21
21
  },
22
22
  {
23
23
  "name": "src/entities/pizza/index.js",
@@ -25,11 +25,11 @@
25
25
  },
26
26
  {
27
27
  "name": "src/index.js",
28
- "contents": "export default {\n\n /**\n * Configure large language model (LLM) settings to generate auto replies\n */\n llm: {\n engine: 'openai',\n model: 'gpt-3.5-turbo',\n },\n /**\n * Configure personal model transformer (PMT) settings to align auto replies the agent's tone\n */\n pmt: {\n engine: 'scout9',\n model: 'orin-2.2'\n },\n}\n"
28
+ "contents": "/**\n * Configuration for the Scout9 project.\n */\nexport default {\n\n /**\n * Configure large language model (LLM) settings to generate auto replies\n */\n llm: {\n engine: 'openai',\n model: 'gpt-3.5-turbo',\n },\n /**\n * Configure personal model transformer (PMT) settings to align auto replies the agent's tone\n */\n pmt: {\n engine: 'scout9',\n model: 'orin-1.0'\n },\n organization: {\n name: \"PizzaZoom\",\n description: \"PizzaZoom is a pizza delivery service that uses drones to deliver pizza to your door in 30 minutes or less.\",\n },\n initialContext: [\n \"Get the customers pizza order, be as brief and concise as possible.\",\n \"Customers generally want the pizza ASAP, so assume unless they ask for a specific time, they want it as soon as possible.\",\n ]\n}\n"
29
29
  },
30
30
  {
31
- "name": "src/lib/customer-mock-db.js",
32
- "contents": "/**\n * This an example adapter for a mock database to your CRM\n */\nexport const customerMockDb = {\n query: async (\n query,\n page,\n limit,\n orderBy,\n endAt,\n startAt,\n ) => Promise.resolve([{id: '1234', name: 'Test Customer', email: '', phone: ''}]),\n get: async (id) => Promise.resolve({id, name: 'Test Customer', email: '', phone: ''}),\n add: async (id, customer) => ({id}),\n update: async (id, updates) => true,\n remove: async (id) => true\n}\n"
31
+ "name": "src/lib/customer-db.js",
32
+ "contents": "import Scout9CRM from '@scout9/crm';\n\nconst crm = new Scout9CRM({apiKey: process.env.SCOUT9_API_KEY});\n\n/**\n * This an example adapter for a mock database to your CRM\n */\nexport const customerDb = {\n query: async (\n query,\n page,\n limit,\n orderBy,\n endAt,\n startAt,\n ) => crm.query(query, page, limit, orderBy, endAt, startAt),\n get: async (id) => crm.get(id),\n add: async (customer) => crm.add(customer),\n update: async (id, updates) => crm.update({...updates, $id: id}),\n remove: async (id) => crm.remove(id)\n}\n"
33
33
  },
34
34
  {
35
35
  "name": "src/lib/drivers.js",
@@ -37,10 +37,10 @@
37
37
  },
38
38
  {
39
39
  "name": "src/lib/invoice.js",
40
- "contents": "/**\n * An example service of creating and retrieving an invoice\n */\nexport async function createInvoice(pizza) {\n // @TODO create invoice\n return {\n id: 'invoice-123',\n subtotal: 6000,\n tax: 600,\n total: 6600,\n invoiceUrl: 'https://example.com/invoice-123'\n };\n}\n\nexport async function getInvoice(id) {\n // @TODO create invoice\n return {\n id: 'invoice-123',\n subtotal: 6000,\n tax: 600,\n total: 6600,\n invoiceUrl: 'https://example.com/invoice-123'\n };\n}\n"
40
+ "contents": "/**\n * An example service of creating and retrieving an invoice\n */\nexport async function createInvoice(pizza) {\n // @TODO create invoice backend\n return {\n id: 'invoice-123',\n subtotal: 6000,\n tax: 600,\n total: 6600,\n invoiceUrl: 'https://example.com/invoice-123'\n };\n}\n\nexport async function getInvoice(id) {\n // @TODO create invoice backend\n return {\n id: 'invoice-123',\n subtotal: 6000,\n tax: 600,\n total: 6600,\n invoiceUrl: 'https://example.com/invoice-123'\n };\n}\n"
41
41
  },
42
42
  {
43
43
  "name": "src/workflows/pizzaOrder/workflow.js",
44
- "contents": "import moment from 'moment';\nimport { getAvailableDriver } from '../../lib/drivers.js';\nimport { createInvoice, getInvoice } from '../../lib/invoice.js';\n\n/**\n * Example PizzaOrder workflow - this is a simple example of a workflow that can be used to order a pizza\n */\nexport default async function PizzaOrder(\n {\n context,\n customer\n }) {\n\n if (!context.pizza) {\n return {\n instructions: 'Figure out what pizza sizes, toppings are needed for order'\n };\n }\n\n if (!context.deliveryMethod) {\n return {\n instructions: `Determine if ${customer?.firstName || 'the customer'} is doing a delivery or pickup and determine time of pickup/delivery`\n };\n }\n\n if (!context.invoiceId) {\n const invoice = await createInvoice(context.pizza);\n return {\n instructions: `Send invoice to customer`,\n message: `Order created - $${(invoice.total/100).toFixed(2)} you can pay at ${invoice.invoiceUrl}`,\n contextUpsert: {\n invoiceId: invoice.id,\n invoicePaid: false\n }\n }\n }\n\n if (!context.invoicePaid) {\n if (!context.invoiceId) {\n return {forward: true};\n }\n const invoice = await getInvoice(context.invoiceId || '');\n return {\n instructions: `Let user know order is ready for payment at ${invoice.invoiceUrl}`\n }\n }\n\n if (context.deliveryMethod === 'pickup') {\n return [\n {\n instructions: `Let user know their order will be ready at ${moment().add(30, 'minutes').format('h:mm a')}`\n },\n {\n instructions: `Find out if everything was delivered, and let the user know to contact if there are any issues`,\n forward: {\n mode: 'after-reply'\n },\n scheduled: moment().add(30, 'minutes').unix()\n }\n ];\n // @TODO - delay and notify user for feedback and if they got their pizza\n }\n\n if (!context.address && context.deliveryMethod === 'delivery') {\n return {\n instructions: `Ask ${customer.firstName || 'the customer'} for their delivery address`\n };\n }\n\n if (context.address && !context.driver && !context.deliveryTime) {\n const {driver, deliveryEstimate} = await getAvailableDriver(context.address);\n return {\n instructions: `Let ${customer.firstName || 'the customer'} know the pizza order should arrive at ${deliveryEstimate.format(\n 'h:mm a')}`,\n contextUpsert: {\n driver: {\n ...driver\n },\n deliveryTime: deliveryEstimate.unix()\n }\n };\n }\n\n return {\n forward: true\n }\n}\n"
44
+ "contents": "import moment from 'moment';\nimport { getAvailableDriver } from '../../lib/drivers.js';\nimport { createInvoice, getInvoice } from '../../lib/invoice.js';\n\n/**\n * Example PizzaOrder workflow - this is a simple example of a workflow that can be used to order a pizza\n */\nexport default async function PizzaOrder(\n {\n context,\n customer\n }) {\n\n if (!context.pizza) {\n return {\n instructions: 'Figure out what pizza sizes, toppings are needed for order'\n };\n }\n\n if (!context.invoiceId && context.delivery_method) {\n const invoice = await createInvoice(context.pizza);\n const intro = `${context.delivery_method === 'delivery' ? 'Order will be sent over in 30 minutes' : 'Order will be ready for pickup in 30 minutes at 123 Nark Ave Seattle WA 98122'}.`;\n return {\n message: `${intro}.\\n\\nThe total is $${(invoice.total/100).toFixed(2)}, you can pay at this url: ${invoice.invoiceUrl}`,\n contextUpsert: {\n invoiceId: invoice.id,\n invoicePaid: false\n }\n }\n }\n\n if (!context.invoicePaid && context.invoiceId) {\n if (!context.invoiceId) {\n return {forward: true};\n }\n const invoice = await getInvoice(context.invoiceId || '');\n return {\n instructions: `Let user know order is ready for payment at ${invoice.invoiceUrl}`\n }\n }\n\n if (context.delivery_method === 'pickup') {\n return [\n {\n instructions: `Let user know their order will be ready at ${moment().add(30, 'minutes').format('h:mm a')}`\n },\n {\n instructions: `Find out if everything was delivered, and let the user know to contact if there are any issues`,\n forward: {\n mode: 'after-reply'\n },\n scheduled: moment().add(30, 'minutes').unix()\n }\n ];\n // @TODO - delay and notify user for feedback and if they got their pizza\n }\n\n if (!context.address && context.delivery_method === 'delivery') {\n return {\n instructions: `Ask ${customer.firstName || 'the customer'} for their delivery address`\n };\n }\n\n if (context.address && !context.driver && !context.deliveryTime) {\n const {driver, deliveryEstimate} = await getAvailableDriver(context.address);\n return {\n instructions: `Let ${customer.firstName || 'the customer'} know the pizza order should arrive at ${deliveryEstimate.format(\n 'h:mm a')}`,\n contextUpsert: {\n driver: {\n ...driver\n },\n deliveryTime: deliveryEstimate.unix()\n }\n };\n }\n\n if (!context.delivery_method) {\n return {\n instructions: `Ask ${customer.firstName || 'the customer'} if they want their pizza order for either pickup or delivery.`\n }\n }\n\n console.error('No where to go - view context:\\n', JSON.stringify(context, null, 2));\n return {\n forward: true,\n notes: 'No where to go, something happened'\n }\n}\n"
45
45
  }
46
46
  ]
@@ -1,4 +1,4 @@
1
1
  {
2
- "title": "Scout9 demo app",
3
- "description": "A demo app showcasing some of the features of Scout9 - a SMS pizza order service"
2
+ "title": "PizzaZoom Demo",
3
+ "description": "Scout9 demo app of a SMS aerial drone pizza service"
4
4
  }
@@ -4,10 +4,14 @@
4
4
  "scripts": {
5
5
  "deploy": "scout9 deploy",
6
6
  "build": "scout9 build",
7
- "test": "scout9 test"
7
+ "sync": "scout9 sync",
8
+ "dev": "scout9 dev",
9
+ "start": "npm run dev"
8
10
  },
9
11
  "dependencies": {
10
- "@scout9/app": "latest"
12
+ "@scout9/app": "latest",
13
+ "@scout9/crm": "latest",
14
+ "moment": "^2.30.1"
11
15
  },
12
16
  "type": "module"
13
17
  }
@@ -1,26 +1,30 @@
1
1
  [
2
2
  {
3
3
  "name": "src/app.js",
4
- "contents": "import DefaultWorkflow from './workflows/default/workflow.js';\n\nexport default async function Scout9App(event) {\n return DefaultWorkflow(event);\n}\n"
4
+ "contents": "import DefaultWorkflow from './workflows/default/workflow.js';\n\n/**\n * @param {import('@scout9/app').WorkflowEvent} event - every workflow receives an event object\n * @returns {Promise<import('@scout9/app').WorkflowResponse>} - every workflow must return a WorkflowResponse\n */\nexport default async function Scout9App(event) {\n return DefaultWorkflow(event);\n}\n"
5
5
  },
6
6
  {
7
7
  "name": "src/entities/agents/index.js",
8
- "contents": "/**\n * Required core entity type: Agents represents you and your team\n */\nexport default function Agents() {\n return [\n {\n id: 'agent-1',\n firstName: 'Agent',\n lastName: 'Smith',\n forwardPhone: '+15555555555',\n forwardEmail: '',\n programmablePhoneNumber: '+15555555555',\n }\n ];\n}\n"
8
+ "contents": "/**\n * Required core entity type: Agents represents you and your team\n * @returns {Array<import('@scout9/app').Agent>}\n */\nexport default function Agents() {\n return [\n {\n id: 'agent-1',\n firstName: 'Agent',\n lastName: 'Smith',\n forwardPhone: '+15555555555',\n forwardEmail: '',\n programmablePhoneNumber: '+15555555555',\n }\n ];\n}\n"
9
9
  },
10
10
  {
11
11
  "name": "src/entities/customers/[customer]/api.js",
12
- "contents": "import { json } from '../../../../platform/src/exports.js';\n\n// @TODO replace with your CRM api\nimport { customerMockDb } from '../../../lib/customer-mock-db';\n\n\n/**\n * Get customer info from your CRM\n */\nexport const GET = async ({params}) => {\n return json(await customerMockDb.get(params.customer));\n};\n\n/**\n * When a customer is created on scout9's side\n *\n * Example:\n * A new or unrecognized customer has contacted an agent. Scout9 has captured some preliminary information\n * about them and sent this POST request. Take the information to either add a new customer record to your CRM\n * or return an existing customer id to map the correct customer document.\n */\nexport const POST = async ({params, body: newCustomer}) => {\n // Scout9 will generate random id for new customers, but whatever id you return back will be used for the new customer\n const {id: crmId} = await customerMockDb.add(params.customer, newCustomer);\n return json({success: true, id: crmId}, {status: 200});\n};\n\n/**\n * New customer info revealed, use this to save the customer info to your CRM\n *\n * Example:\n * In a conversation, if any new data is found, Scout9 will send a PUT or PATCH request to allow for you to update\n * your CRM accordingly.\n */\nexport const PUT = async ({params, body: updatedCustomer}) => {\n // const id = params.customer;\n\n console.log('updatedCustomer', updatedCustomer);\n // @TODO REST call to api to save customer info\n\n // @TODO REST call to api to save customer info\n return json({success: true}, {status: 200});\n};\n\n\n/**\n * Customer request to be removed from platform, use this to remove/update the customer info from your CRM\n *\n * Example:\n * A customer has opt-out of text messaging, Scout9 will send a DELETE message for you to remove any data, returning\n * back success: true will then have Scout9 delete any data on their end as well.\n */\nexport const DELETE = async ({params, request}) => {\n await customerMockDb.remove(params.customer);\n return json({success: true}, {status: 200});\n};\n"
12
+ "contents": "import { json } from '@scout9/app';\n\n// @TODO replace with your CRM api\nimport { customerDb } from '../../../lib/customer-db.js';\n\n/**\n * Get customer info from your CRM\n * @returns {Promise<import('@scout9/app').EventResponse<import('@scout9/app').Customer>>}\n */\nexport const GET = async ({params}) => {\n return json(await customerDb.get(params.customer));\n};\n\n/**\n * When a customer is created on scout9's side\n *\n * Example:\n * A new or unrecognized customer has contacted an agent. Scout9 has captured some preliminary information\n * about them and sent this POST request. Take the information to either add a new customer record to your CRM\n * or return an existing customer id to map the correct customer document.\n *\n * @returns {Promise<import('@scout9/app').EventResponse>}\n */\nexport const POST = async ({params, body: newCustomer}) => {\n // Scout9 will generate random id for new customers, but whatever id you return back will be used for the new customer\n const {id: crmId} = await customerDb.add({$id: params.customer, newCustomer});\n return json({success: true, id: crmId}, {status: 200});\n};\n\n/**\n * New customer info revealed, use this to save the customer info to your CRM\n *\n * Example:\n * In a conversation, if any new data is found, Scout9 will send a PUT or PATCH request to allow for you to update\n * your CRM accordingly.\n *\n * @returns {Promise<import('@scout9/app').EventResponse>}\n */\nexport const PUT = async ({params, body: updatedCustomer}) => {\n // const id = params.customer;\n\n console.log('updatedCustomer', updatedCustomer);\n // @TODO REST call to api to save customer info\n\n // @TODO REST call to api to save customer info\n return json({success: true}, {status: 200});\n};\n\n\n/**\n * Customer request to be removed from platform, use this to remove/update the customer info from your CRM\n *\n * Example:\n * A customer has opt-out of text messaging, Scout9 will send a DELETE message for you to remove any data, returning\n * back success: true will then have Scout9 delete any data on their end as well.\n *\n * @returns {Promise<import('@scout9/app').EventResponse>}\n */\nexport const DELETE = async ({params, request}) => {\n await customerDb.remove(params.customer);\n return json({success: true}, {status: 200});\n};\n"
13
13
  },
14
14
  {
15
15
  "name": "src/entities/customers/api.js",
16
- "contents": "import { EventResponse } from '../../../platform/src/index.js';\nimport { customerMockDb } from '../../lib/customer-mock-db.js';\n\n/**\n * Required entity - use this to sync with your CRM\n *\n * Query customer info from your CRM\n */\nexport const QUERY = async ({searchParams}) => {\n const {page, q, orderBy, endAt, startAt, limit} = searchParams;\n const customers = await customerMockDb.query(\n q,\n page ? parseInt(page) : undefined,\n limit ? parseInt(limit) : undefined,\n orderBy ? parseInt(orderBy) : undefined,\n endAt ? parseInt(endAt) : undefined,\n startAt ? parseInt(startAt) : undefined,\n );\n return EventResponse.json(customers, {status: 200});\n};\n"
16
+ "contents": "import { customerDb } from '../../lib/customer-db.js';\nimport { EventResponse } from '@scout9/app';\n\n/**\n * Required entity - use this to sync with your CRM\n *\n * Query customer info from your CRM\n * @returns {Promise<import('@scout9/app').EventResponse<Array<import('@scout9/app').Customer>>>}\n */\nexport const QUERY = async ({searchParams}) => {\n const {page, q, orderBy, endAt, startAt, limit} = searchParams;\n const customers = await customerDb.query(\n q,\n page ? parseInt(page) : undefined,\n limit ? parseInt(limit) : undefined,\n orderBy ? parseInt(orderBy) : undefined,\n endAt ? parseInt(endAt) : undefined,\n startAt ? parseInt(startAt) : undefined,\n );\n return EventResponse.json(customers, {status: 200});\n};\n"
17
17
  },
18
18
  {
19
- "name": "src/lib/customer-mock-db.js",
20
- "contents": "/**\n * This an example adapter for a mock database to your CRM\n */\nexport const customerMockDb = {\n query: async (\n query,\n page,\n limit,\n orderBy,\n endAt,\n startAt,\n ) => Promise.resolve([{id: '1234', name: 'Test Customer', email: '', phone: ''}]),\n get: async (id) => Promise.resolve({id, name: 'Test Customer', email: '', phone: ''}),\n add: async (id, customer) => ({id}),\n update: async (id, updates) => true,\n remove: async (id) => true\n}\n"
19
+ "name": "src/index.js",
20
+ "contents": "/**\n * Configuration for the Scout9 project.\n * @type {import('@scout9/app').Scout9ProjectConfig}\n */\nexport default {\n\n /**\n * Configure large language model (LLM) settings to generate auto replies\n */\n llm: {\n engine: 'openai',\n model: 'gpt-3.5-turbo',\n },\n /**\n * Configure personal model transformer (PMT) settings to align auto replies the agent's tone\n */\n pmt: {\n engine: 'scout9',\n model: 'orin-2.2'\n },\n initialContext: [\n ]\n}\n"
21
+ },
22
+ {
23
+ "name": "src/lib/customer-db.js",
24
+ "contents": "import {Scout9CRM} from '@scout9/crm';\n\nconst crm = new Scout9CRM({apiKey: process.env.SCOUT9_API_KEY});\n\n/**\n * This an example adapter for a mock database to your CRM\n */\nexport const customerDb = {\n query: async (\n query,\n page,\n limit,\n orderBy,\n endAt,\n startAt,\n ) => crm.query(query, page, limit, orderBy, endAt, startAt),\n get: async (id) => crm.get(id),\n add: async (customer) => crm.add(customer),\n update: async (id, updates) => crm.update({...updates, $id: id}),\n remove: async (id) => crm.remove(id)\n}\n"
21
25
  },
22
26
  {
23
27
  "name": "src/workflows/default/workflow.js",
24
- "contents": "export default async function DefaultWorkflow(\n {\n context,\n customer\n }) {\n return {\n forward: true,\n };\n}\n"
28
+ "contents": "/**\n * @param {import('@scout9/app').WorkflowEvent} event - every workflow receives an event object\n * @returns {Promise<import('@scout9/app').WorkflowResponse>} - every workflow must return a WorkflowResponse\n */\nexport default async function DefaultWorkflow(\n {\n context,\n customer\n }) {\n return {\n forward: true,\n };\n}\n"
25
29
  }
26
30
  ]
@@ -9,15 +9,19 @@
9
9
  },
10
10
  {
11
11
  "name": "src/entities/customers/[customer]/api.js",
12
- "contents": "import { json } from '../../../../platform/src/exports.js';\n\n// @TODO replace with your CRM api\nimport { customerMockDb } from '../../../lib/customer-mock-db';\n\n\n/**\n * Get customer info from your CRM\n */\nexport const GET = async ({params}) => {\n return json(await customerMockDb.get(params.customer));\n};\n\n/**\n * When a customer is created on scout9's side\n *\n * Example:\n * A new or unrecognized customer has contacted an agent. Scout9 has captured some preliminary information\n * about them and sent this POST request. Take the information to either add a new customer record to your CRM\n * or return an existing customer id to map the correct customer document.\n */\nexport const POST = async ({params, body: newCustomer}) => {\n // Scout9 will generate random id for new customers, but whatever id you return back will be used for the new customer\n const {id: crmId} = await customerMockDb.add(params.customer, newCustomer);\n return json({success: true, id: crmId}, {status: 200});\n};\n\n/**\n * New customer info revealed, use this to save the customer info to your CRM\n *\n * Example:\n * In a conversation, if any new data is found, Scout9 will send a PUT or PATCH request to allow for you to update\n * your CRM accordingly.\n */\nexport const PUT = async ({params, body: updatedCustomer}) => {\n // const id = params.customer;\n\n console.log('updatedCustomer', updatedCustomer);\n // @TODO REST call to api to save customer info\n\n // @TODO REST call to api to save customer info\n return json({success: true}, {status: 200});\n};\n\n\n/**\n * Customer request to be removed from platform, use this to remove/update the customer info from your CRM\n *\n * Example:\n * A customer has opt-out of text messaging, Scout9 will send a DELETE message for you to remove any data, returning\n * back success: true will then have Scout9 delete any data on their end as well.\n */\nexport const DELETE = async ({params, request}) => {\n await customerMockDb.remove(params.customer);\n return json({success: true}, {status: 200});\n};\n"
12
+ "contents": "import { json } from '@scout9/app';\n\n// @TODO replace with your CRM api\nimport { customerDb } from '../../../lib/customer-db.js';\n\n/**\n * Get customer info from your CRM\n */\nexport const GET = async ({params}) => {\n return json(await customerDb.get(params.customer));\n};\n\n/**\n * When a customer is created on scout9's side\n *\n * Example:\n * A new or unrecognized customer has contacted an agent. Scout9 has captured some preliminary information\n * about them and sent this POST request. Take the information to either add a new customer record to your CRM\n * or return an existing customer id to map the correct customer document.\n *\n */\nexport const POST = async ({params, body: newCustomer}) => {\n // Scout9 will generate random id for new customers, but whatever id you return back will be used for the new customer\n const {id: crmId} = await customerDb.add({$id: params.customer, newCustomer});\n return json({success: true, id: crmId}, {status: 200});\n};\n\n/**\n * New customer info revealed, use this to save the customer info to your CRM\n *\n * Example:\n * In a conversation, if any new data is found, Scout9 will send a PUT or PATCH request to allow for you to update\n * your CRM accordingly.\n *\n */\nexport const PUT = async ({params, body: updatedCustomer}) => {\n // const id = params.customer;\n\n console.log('updatedCustomer', updatedCustomer);\n // @TODO REST call to api to save customer info\n\n // @TODO REST call to api to save customer info\n return json({success: true}, {status: 200});\n};\n\n\n/**\n * Customer request to be removed from platform, use this to remove/update the customer info from your CRM\n *\n * Example:\n * A customer has opt-out of text messaging, Scout9 will send a DELETE message for you to remove any data, returning\n * back success: true will then have Scout9 delete any data on their end as well.\n *\n */\nexport const DELETE = async ({params, request}) => {\n await customerDb.remove(params.customer);\n return json({success: true}, {status: 200});\n};\n"
13
13
  },
14
14
  {
15
15
  "name": "src/entities/customers/api.js",
16
- "contents": "import { EventResponse } from '../../../platform/src/index.js';\nimport { customerMockDb } from '../../lib/customer-mock-db.js';\n\n/**\n * Required entity - use this to sync with your CRM\n *\n * Query customer info from your CRM\n */\nexport const QUERY = async ({searchParams}) => {\n const {page, q, orderBy, endAt, startAt, limit} = searchParams;\n const customers = await customerMockDb.query(\n q,\n page ? parseInt(page) : undefined,\n limit ? parseInt(limit) : undefined,\n orderBy ? parseInt(orderBy) : undefined,\n endAt ? parseInt(endAt) : undefined,\n startAt ? parseInt(startAt) : undefined,\n );\n return EventResponse.json(customers, {status: 200});\n};\n"
16
+ "contents": "import { customerDb } from '../../lib/customer-db.js';\nimport { EventResponse } from '@scout9/app';\n\n/**\n * Required entity - use this to sync with your CRM\n *\n * Query customer info from your CRM\n */\nexport const QUERY = async ({searchParams}) => {\n const {page, q, orderBy, endAt, startAt, limit} = searchParams;\n const customers = await customerDb.query(\n q,\n page ? parseInt(page) : undefined,\n limit ? parseInt(limit) : undefined,\n orderBy ? parseInt(orderBy) : undefined,\n endAt ? parseInt(endAt) : undefined,\n startAt ? parseInt(startAt) : undefined,\n );\n return EventResponse.json(customers, {status: 200});\n};\n"
17
17
  },
18
18
  {
19
- "name": "src/lib/customer-mock-db.js",
20
- "contents": "/**\n * This an example adapter for a mock database to your CRM\n */\nexport const customerMockDb = {\n query: async (\n query,\n page,\n limit,\n orderBy,\n endAt,\n startAt,\n ) => Promise.resolve([{id: '1234', name: 'Test Customer', email: '', phone: ''}]),\n get: async (id) => Promise.resolve({id, name: 'Test Customer', email: '', phone: ''}),\n add: async (id, customer) => ({id}),\n update: async (id, updates) => true,\n remove: async (id) => true\n}\n"
19
+ "name": "src/index.js",
20
+ "contents": "/**\n * Configuration for the Scout9 project.\n */\nexport default {\n\n /**\n * Configure large language model (LLM) settings to generate auto replies\n */\n llm: {\n engine: 'openai',\n model: 'gpt-3.5-turbo',\n },\n /**\n * Configure personal model transformer (PMT) settings to align auto replies the agent's tone\n */\n pmt: {\n engine: 'scout9',\n model: 'orin-2.2'\n },\n initialContext: [\n ]\n}\n"
21
+ },
22
+ {
23
+ "name": "src/lib/customer-db.js",
24
+ "contents": "import {Scout9CRM} from '@scout9/crm';\n\nconst crm = new Scout9CRM({apiKey: process.env.SCOUT9_API_KEY});\n\n/**\n * This an example adapter for a mock database to your CRM\n */\nexport const customerDb = {\n query: async (\n query,\n page,\n limit,\n orderBy,\n endAt,\n startAt,\n ) => crm.query(query, page, limit, orderBy, endAt, startAt),\n get: async (id) => crm.get(id),\n add: async (customer) => crm.add(customer),\n update: async (id, updates) => crm.update({...updates, $id: id}),\n remove: async (id) => crm.remove(id)\n}\n"
21
25
  },
22
26
  {
23
27
  "name": "src/workflows/default/workflow.js",
@@ -9,15 +9,19 @@
9
9
  },
10
10
  {
11
11
  "name": "src/entities/customers/[customer]/api.js",
12
- "contents": "import { json } from '../../../../platform/src/exports.js';\n\n// @TODO replace with your CRM api\nimport { customerMockDb } from '../../../lib/customer-mock-db';\n\n\n/**\n * Get customer info from your CRM\n */\nexport const GET = async ({params}) => {\n return json(await customerMockDb.get(params.customer));\n};\n\n/**\n * When a customer is created on scout9's side\n *\n * Example:\n * A new or unrecognized customer has contacted an agent. Scout9 has captured some preliminary information\n * about them and sent this POST request. Take the information to either add a new customer record to your CRM\n * or return an existing customer id to map the correct customer document.\n */\nexport const POST = async ({params, body: newCustomer}) => {\n // Scout9 will generate random id for new customers, but whatever id you return back will be used for the new customer\n const {id: crmId} = await customerMockDb.add(params.customer, newCustomer);\n return json({success: true, id: crmId}, {status: 200});\n};\n\n/**\n * New customer info revealed, use this to save the customer info to your CRM\n *\n * Example:\n * In a conversation, if any new data is found, Scout9 will send a PUT or PATCH request to allow for you to update\n * your CRM accordingly.\n */\nexport const PUT = async ({params, body: updatedCustomer}) => {\n // const id = params.customer;\n\n console.log('updatedCustomer', updatedCustomer);\n // @TODO REST call to api to save customer info\n\n // @TODO REST call to api to save customer info\n return json({success: true}, {status: 200});\n};\n\n\n/**\n * Customer request to be removed from platform, use this to remove/update the customer info from your CRM\n *\n * Example:\n * A customer has opt-out of text messaging, Scout9 will send a DELETE message for you to remove any data, returning\n * back success: true will then have Scout9 delete any data on their end as well.\n */\nexport const DELETE = async ({params, request}) => {\n await customerMockDb.remove(params.customer);\n return json({success: true}, {status: 200});\n};\n"
12
+ "contents": "import { json } from '@scout9/app';\n\n// @TODO replace with your CRM api\nimport { customerDb } from '../../../lib/customer-db.js';\n\n/**\n * Get customer info from your CRM\n */\nexport const GET = async ({params}) => {\n return json(await customerDb.get(params.customer));\n};\n\n/**\n * When a customer is created on scout9's side\n *\n * Example:\n * A new or unrecognized customer has contacted an agent. Scout9 has captured some preliminary information\n * about them and sent this POST request. Take the information to either add a new customer record to your CRM\n * or return an existing customer id to map the correct customer document.\n *\n */\nexport const POST = async ({params, body: newCustomer}) => {\n // Scout9 will generate random id for new customers, but whatever id you return back will be used for the new customer\n const {id: crmId} = await customerDb.add({$id: params.customer, newCustomer});\n return json({success: true, id: crmId}, {status: 200});\n};\n\n/**\n * New customer info revealed, use this to save the customer info to your CRM\n *\n * Example:\n * In a conversation, if any new data is found, Scout9 will send a PUT or PATCH request to allow for you to update\n * your CRM accordingly.\n *\n */\nexport const PUT = async ({params, body: updatedCustomer}) => {\n // const id = params.customer;\n\n console.log('updatedCustomer', updatedCustomer);\n // @TODO REST call to api to save customer info\n\n // @TODO REST call to api to save customer info\n return json({success: true}, {status: 200});\n};\n\n\n/**\n * Customer request to be removed from platform, use this to remove/update the customer info from your CRM\n *\n * Example:\n * A customer has opt-out of text messaging, Scout9 will send a DELETE message for you to remove any data, returning\n * back success: true will then have Scout9 delete any data on their end as well.\n *\n */\nexport const DELETE = async ({params, request}) => {\n await customerDb.remove(params.customer);\n return json({success: true}, {status: 200});\n};\n"
13
13
  },
14
14
  {
15
15
  "name": "src/entities/customers/api.js",
16
- "contents": "import { EventResponse } from '../../../platform/src/index.js';\nimport { customerMockDb } from '../../lib/customer-mock-db.js';\n\n/**\n * Required entity - use this to sync with your CRM\n *\n * Query customer info from your CRM\n */\nexport const QUERY = async ({searchParams}) => {\n const {page, q, orderBy, endAt, startAt, limit} = searchParams;\n const customers = await customerMockDb.query(\n q,\n page ? parseInt(page) : undefined,\n limit ? parseInt(limit) : undefined,\n orderBy ? parseInt(orderBy) : undefined,\n endAt ? parseInt(endAt) : undefined,\n startAt ? parseInt(startAt) : undefined,\n );\n return EventResponse.json(customers, {status: 200});\n};\n"
16
+ "contents": "import { customerDb } from '../../lib/customer-db.js';\nimport { EventResponse } from '@scout9/app';\n\n/**\n * Required entity - use this to sync with your CRM\n *\n * Query customer info from your CRM\n */\nexport const QUERY = async ({searchParams}) => {\n const {page, q, orderBy, endAt, startAt, limit} = searchParams;\n const customers = await customerDb.query(\n q,\n page ? parseInt(page) : undefined,\n limit ? parseInt(limit) : undefined,\n orderBy ? parseInt(orderBy) : undefined,\n endAt ? parseInt(endAt) : undefined,\n startAt ? parseInt(startAt) : undefined,\n );\n return EventResponse.json(customers, {status: 200});\n};\n"
17
17
  },
18
18
  {
19
- "name": "src/lib/customer-mock-db.js",
20
- "contents": "/**\n * This an example adapter for a mock database to your CRM\n */\nexport const customerMockDb = {\n query: async (\n query,\n page,\n limit,\n orderBy,\n endAt,\n startAt,\n ) => Promise.resolve([{id: '1234', name: 'Test Customer', email: '', phone: ''}]),\n get: async (id) => Promise.resolve({id, name: 'Test Customer', email: '', phone: ''}),\n add: async (id, customer) => ({id}),\n update: async (id, updates) => true,\n remove: async (id) => true\n}\n"
19
+ "name": "src/index.js",
20
+ "contents": "/**\n * Configuration for the Scout9 project.\n */\nexport default {\n\n /**\n * Configure large language model (LLM) settings to generate auto replies\n */\n llm: {\n engine: 'openai',\n model: 'gpt-3.5-turbo',\n },\n /**\n * Configure personal model transformer (PMT) settings to align auto replies the agent's tone\n */\n pmt: {\n engine: 'scout9',\n model: 'orin-2.2'\n },\n initialContext: [\n ]\n}\n"
21
+ },
22
+ {
23
+ "name": "src/lib/customer-db.js",
24
+ "contents": "import {Scout9CRM} from '@scout9/crm';\n\nconst crm = new Scout9CRM({apiKey: process.env.SCOUT9_API_KEY});\n\n/**\n * This an example adapter for a mock database to your CRM\n */\nexport const customerDb = {\n query: async (\n query,\n page,\n limit,\n orderBy,\n endAt,\n startAt,\n ) => crm.query(query, page, limit, orderBy, endAt, startAt),\n get: async (id) => crm.get(id),\n add: async (customer) => crm.add(customer),\n update: async (id, updates) => crm.update({...updates, $id: id}),\n remove: async (id) => crm.remove(id)\n}\n"
21
25
  },
22
26
  {
23
27
  "name": "src/workflows/default/workflow.js",
@@ -5,10 +5,13 @@
5
5
  "scripts": {
6
6
  "deploy": "scout9 deploy",
7
7
  "build": "scout9 build",
8
- "test": "scout9 test"
8
+ "sync": "scout9 sync",
9
+ "dev": "scout9 dev",
10
+ "start": "npm run dev"
9
11
  },
10
12
  "dependencies": {
11
- "@scout9/app": "latest"
13
+ "@scout9/app": "latest",
14
+ "@scout9/crm": "latest"
12
15
  },
13
16
  "type": "module"
14
17
  }
package/index.js CHANGED
@@ -70,6 +70,9 @@ function write_common_files(cwd, options, name) {
70
70
  pkg.name = to_valid_package_name(name);
71
71
 
72
72
  fs.writeFileSync(pkg_file, JSON.stringify(pkg, null, '\t') + '\n');
73
+
74
+ const env_file = path.join(cwd, '.env');
75
+ fs.writeFileSync(env_file, 'SCOUT9_API_KEY=<insert-scout9-api-key>\n' );
73
76
  }
74
77
 
75
78
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-scout9",
3
- "version": "1.0.0-alpha.0.0.2",
3
+ "version": "1.0.0-alpha.0.0.20",
4
4
  "bin": "./bin.js",
5
5
  "main": "./index.js",
6
6
  "publishConfig": {
@@ -12,7 +12,8 @@
12
12
  },
13
13
  "scripts": {
14
14
  "build": "node scripts/build-templates",
15
- "prepublishOnly": "npm run build"
15
+ "prepublishOnly": "npm run build",
16
+ "test": "jest"
16
17
  },
17
18
  "types": "types/index.d.ts",
18
19
  "type": "module",