@scout9/app 1.0.0-alpha.0.1.92 → 1.0.0-alpha.0.1.94

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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var spirits = require("./spirits-6a709255.cjs");
3
+ var spirits = require("./spirits-32395ac4.cjs");
4
4
  var readline = require('node:readline');
5
5
  var require$$0$2 = require('fs');
6
6
  var require$$2$1 = require('events');
@@ -28665,8 +28665,8 @@ const unescape$1 = (s, { windowsPathsNoEscape = false, } = {}) => {
28665
28665
  };
28666
28666
 
28667
28667
  // parse a single path portion
28668
- const types$2 = new Set(['!', '?', '+', '*', '@']);
28669
- const isExtglobType = (c) => types$2.has(c);
28668
+ const types$1 = new Set(['!', '?', '+', '*', '@']);
28669
+ const isExtglobType = (c) => types$1.has(c);
28670
28670
  // Patterns that get prepended to bind to the start of either the
28671
28671
  // entire string, or just a single path portion, to prevent dots
28672
28672
  // and/or traversal patterns, when needed.
@@ -41174,7 +41174,7 @@ class Body {
41174
41174
  }
41175
41175
  const {
41176
41176
  toFormData
41177
- } = await Promise.resolve().then(function () { return require("./multipart-parser-52e1536f.cjs"); });
41177
+ } = await Promise.resolve().then(function () { return require("./multipart-parser-bbe3e14d.cjs"); });
41178
41178
  return toFormData(this.body, ct);
41179
41179
  }
41180
41180
 
@@ -60535,7 +60535,7 @@ common.createRequestFunction = createRequestFunction;
60535
60535
  Object.defineProperty(exports, "__esModule", {
60536
60536
  value: true
60537
60537
  });
60538
- exports.Scout9Api = exports.Scout9ApiGenerated = exports.Scout9ApiFactory = exports.Scout9ApiFp = exports.Scout9ApiAxiosParamCreator = exports.CustomContextApi = exports.CustomContextApiFactory = exports.CustomContextApiFp = exports.CustomContextApiAxiosParamCreator = exports.WorkflowResponseSlotForwardOneOfModeEnum = exports.PurposeEnum = exports.PmtConfigModelEnum = exports.PmtConfigEngineEnum = exports.MessageGetResponseInnerRoleEnum = exports.MessageCreateRequestRoleEnum = exports.MessageBaseRoleEnum = exports.MessageRoleEnum = exports.LlmConfigOneOf2EngineEnum = exports.LlmConfigOneOf1EngineEnum = exports.LlmConfigOneOfModelEnum = exports.LlmConfigOneOfEngineEnum = exports.ListApiOperationsResponseInnerMethodEnum = exports.GetApiOperationResponseMethodEnum = exports.ForwardRequestLatestMessageRoleEnum = exports.ForwardRequestForwardOneOfModeEnum = exports.ExistenceOperator = exports.EqualityOperator = exports.ConversationEnvironment = exports.ConversationContextFieldConditionOperatorEnum = exports.ApiOperationMethodEnum = void 0;
60538
+ exports.Scout9Api = exports.Scout9ApiGenerated = exports.Scout9ApiFactory = exports.Scout9ApiFp = exports.Scout9ApiAxiosParamCreator = exports.CustomContextApi = exports.CustomContextApiFactory = exports.CustomContextApiFp = exports.CustomContextApiAxiosParamCreator = exports.WorkflowResponseSlotForwardOneOfModeEnum = exports.PurposeEnum = exports.PmtConfigModelEnum = exports.PmtConfigEngineEnum = exports.MessageGetResponseInnerRoleEnum = exports.MessageCreateRequestRoleEnum = exports.MessageBaseRoleEnum = exports.MessageRoleEnum = exports.MacroResultTypeEnum = exports.MacroDidResultAllOfTypeEnum = exports.MacroDidResultTypeEnum = exports.MacroContextResultAllOfTypeEnum = exports.MacroContextResultTypeEnum = exports.LlmConfigOneOf2EngineEnum = exports.LlmConfigOneOf1EngineEnum = exports.LlmConfigOneOfModelEnum = exports.LlmConfigOneOfEngineEnum = exports.ListApiOperationsResponseInnerMethodEnum = exports.GetApiOperationResponseMethodEnum = exports.ForwardRequestLatestMessageRoleEnum = exports.ForwardRequestForwardOneOfModeEnum = exports.ExistenceOperator = exports.EqualityOperator = exports.ConversationEnvironment = exports.ConversationContextFieldConditionOperatorEnum = exports.ApiOperationMethodEnum = void 0;
60539
60539
  const axios_1$1 = __importDefault(axios_1);
60540
60540
  // Some imports not used depending on template conditions
60541
60541
  // @ts-ignore
@@ -60660,6 +60660,22 @@ common.createRequestFunction = createRequestFunction;
60660
60660
  exports.LlmConfigOneOf2EngineEnum = {
60661
60661
  Bard: 'bard'
60662
60662
  };
60663
+ exports.MacroContextResultTypeEnum = {
60664
+ Context: 'context'
60665
+ };
60666
+ exports.MacroContextResultAllOfTypeEnum = {
60667
+ Context: 'context'
60668
+ };
60669
+ exports.MacroDidResultTypeEnum = {
60670
+ Did: 'did'
60671
+ };
60672
+ exports.MacroDidResultAllOfTypeEnum = {
60673
+ Did: 'did'
60674
+ };
60675
+ exports.MacroResultTypeEnum = {
60676
+ Did: 'did',
60677
+ Context: 'context'
60678
+ };
60663
60679
  exports.MessageRoleEnum = {
60664
60680
  Customer: 'customer',
60665
60681
  Agent: 'agent',
@@ -61167,6 +61183,44 @@ common.createRequestFunction = createRequestFunction;
61167
61183
  options: localVarRequestOptions
61168
61184
  };
61169
61185
  },
61186
+ /**
61187
+ *
61188
+ * @summary Natural language prompt to resolve a context value derived from the conversation.
61189
+ * @param {MacroContextInput} macroContextInput
61190
+ * @param {*} [options] Override http request option.
61191
+ * @throws {RequiredError}
61192
+ */
61193
+ captureContext: async (macroContextInput, options = {}) => {
61194
+ // verify required parameter 'macroContextInput' is not null or undefined
61195
+ (0, common_1.assertParamExists)('captureContext', 'macroContextInput', macroContextInput);
61196
+ const localVarPath = `/v1-utils-macros-context`;
61197
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
61198
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
61199
+ let baseOptions;
61200
+ if (configuration) {
61201
+ baseOptions = configuration.baseOptions;
61202
+ }
61203
+ const localVarRequestOptions = {
61204
+ method: 'POST',
61205
+ ...baseOptions,
61206
+ ...options
61207
+ };
61208
+ const localVarHeaderParameter = {};
61209
+ const localVarQueryParameter = {};
61210
+ localVarHeaderParameter['Content-Type'] = 'application/json';
61211
+ (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
61212
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
61213
+ localVarRequestOptions.headers = {
61214
+ ...localVarHeaderParameter,
61215
+ ...headersFromBaseOptions,
61216
+ ...options.headers
61217
+ };
61218
+ localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(macroContextInput, localVarRequestOptions, configuration);
61219
+ return {
61220
+ url: (0, common_1.toPathString)(localVarUrlObj),
61221
+ options: localVarRequestOptions
61222
+ };
61223
+ },
61170
61224
  /**
61171
61225
  *
61172
61226
  * @summary Get the current project configuration
@@ -62558,6 +62612,44 @@ common.createRequestFunction = createRequestFunction;
62558
62612
  options: localVarRequestOptions
62559
62613
  };
62560
62614
  },
62615
+ /**
62616
+ *
62617
+ * @summary Natural language prompt to resolve to a boolean value.
62618
+ * @param {MacroDidInput} macroDidInput
62619
+ * @param {*} [options] Override http request option.
62620
+ * @throws {RequiredError}
62621
+ */
62622
+ did: async (macroDidInput, options = {}) => {
62623
+ // verify required parameter 'macroDidInput' is not null or undefined
62624
+ (0, common_1.assertParamExists)('did', 'macroDidInput', macroDidInput);
62625
+ const localVarPath = `/v1-utils-macros-did`;
62626
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
62627
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
62628
+ let baseOptions;
62629
+ if (configuration) {
62630
+ baseOptions = configuration.baseOptions;
62631
+ }
62632
+ const localVarRequestOptions = {
62633
+ method: 'POST',
62634
+ ...baseOptions,
62635
+ ...options
62636
+ };
62637
+ const localVarHeaderParameter = {};
62638
+ const localVarQueryParameter = {};
62639
+ localVarHeaderParameter['Content-Type'] = 'application/json';
62640
+ (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
62641
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
62642
+ localVarRequestOptions.headers = {
62643
+ ...localVarHeaderParameter,
62644
+ ...headersFromBaseOptions,
62645
+ ...options.headers
62646
+ };
62647
+ localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(macroDidInput, localVarRequestOptions, configuration);
62648
+ return {
62649
+ url: (0, common_1.toPathString)(localVarUrlObj),
62650
+ options: localVarRequestOptions
62651
+ };
62652
+ },
62561
62653
  /**
62562
62654
  *
62563
62655
  * @summary Get an entity by type and ID
@@ -63457,6 +63549,17 @@ common.createRequestFunction = createRequestFunction;
63457
63549
  const localVarAxiosArgs = await localVarAxiosParamCreator.agentsUpdate(updateAgentsRequest, options);
63458
63550
  return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1$1.default, base_1.BASE_PATH, configuration);
63459
63551
  },
63552
+ /**
63553
+ *
63554
+ * @summary Natural language prompt to resolve a context value derived from the conversation.
63555
+ * @param {MacroContextInput} macroContextInput
63556
+ * @param {*} [options] Override http request option.
63557
+ * @throws {RequiredError}
63558
+ */
63559
+ async captureContext(macroContextInput, options) {
63560
+ const localVarAxiosArgs = await localVarAxiosParamCreator.captureContext(macroContextInput, options);
63561
+ return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1$1.default, base_1.BASE_PATH, configuration);
63562
+ },
63460
63563
  /**
63461
63564
  *
63462
63565
  * @summary Get the current project configuration
@@ -63865,6 +63968,17 @@ common.createRequestFunction = createRequestFunction;
63865
63968
  const localVarAxiosArgs = await localVarAxiosParamCreator.deleteEntity(type, id, options);
63866
63969
  return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1$1.default, base_1.BASE_PATH, configuration);
63867
63970
  },
63971
+ /**
63972
+ *
63973
+ * @summary Natural language prompt to resolve to a boolean value.
63974
+ * @param {MacroDidInput} macroDidInput
63975
+ * @param {*} [options] Override http request option.
63976
+ * @throws {RequiredError}
63977
+ */
63978
+ async did(macroDidInput, options) {
63979
+ const localVarAxiosArgs = await localVarAxiosParamCreator.did(macroDidInput, options);
63980
+ return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1$1.default, base_1.BASE_PATH, configuration);
63981
+ },
63868
63982
  /**
63869
63983
  *
63870
63984
  * @summary Get an entity by type and ID
@@ -64193,6 +64307,16 @@ common.createRequestFunction = createRequestFunction;
64193
64307
  agentsUpdate(updateAgentsRequest, options) {
64194
64308
  return localVarFp.agentsUpdate(updateAgentsRequest, options).then(request => request(axios, basePath));
64195
64309
  },
64310
+ /**
64311
+ *
64312
+ * @summary Natural language prompt to resolve a context value derived from the conversation.
64313
+ * @param {MacroContextInput} macroContextInput
64314
+ * @param {*} [options] Override http request option.
64315
+ * @throws {RequiredError}
64316
+ */
64317
+ captureContext(macroContextInput, options) {
64318
+ return localVarFp.captureContext(macroContextInput, options).then(request => request(axios, basePath));
64319
+ },
64196
64320
  /**
64197
64321
  *
64198
64322
  * @summary Get the current project configuration
@@ -64565,6 +64689,16 @@ common.createRequestFunction = createRequestFunction;
64565
64689
  deleteEntity(type, id, options) {
64566
64690
  return localVarFp.deleteEntity(type, id, options).then(request => request(axios, basePath));
64567
64691
  },
64692
+ /**
64693
+ *
64694
+ * @summary Natural language prompt to resolve to a boolean value.
64695
+ * @param {MacroDidInput} macroDidInput
64696
+ * @param {*} [options] Override http request option.
64697
+ * @throws {RequiredError}
64698
+ */
64699
+ did(macroDidInput, options) {
64700
+ return localVarFp.did(macroDidInput, options).then(request => request(axios, basePath));
64701
+ },
64568
64702
  /**
64569
64703
  *
64570
64704
  * @summary Get an entity by type and ID
@@ -64883,6 +65017,17 @@ common.createRequestFunction = createRequestFunction;
64883
65017
  agentsUpdate(updateAgentsRequest, options) {
64884
65018
  return (0, exports.Scout9ApiFp)(this.configuration).agentsUpdate(updateAgentsRequest, options).then(request => request(this.axios, this.basePath));
64885
65019
  }
65020
+ /**
65021
+ *
65022
+ * @summary Natural language prompt to resolve a context value derived from the conversation.
65023
+ * @param {MacroContextInput} macroContextInput
65024
+ * @param {*} [options] Override http request option.
65025
+ * @throws {RequiredError}
65026
+ * @memberof Scout9Api
65027
+ */
65028
+ captureContext(macroContextInput, options) {
65029
+ return (0, exports.Scout9ApiFp)(this.configuration).captureContext(macroContextInput, options).then(request => request(this.axios, this.basePath));
65030
+ }
64886
65031
  /**
64887
65032
  *
64888
65033
  * @summary Get the current project configuration
@@ -65291,6 +65436,17 @@ common.createRequestFunction = createRequestFunction;
65291
65436
  deleteEntity(type, id, options) {
65292
65437
  return (0, exports.Scout9ApiFp)(this.configuration).deleteEntity(type, id, options).then(request => request(this.axios, this.basePath));
65293
65438
  }
65439
+ /**
65440
+ *
65441
+ * @summary Natural language prompt to resolve to a boolean value.
65442
+ * @param {MacroDidInput} macroDidInput
65443
+ * @param {*} [options] Override http request option.
65444
+ * @throws {RequiredError}
65445
+ * @memberof Scout9Api
65446
+ */
65447
+ did(macroDidInput, options) {
65448
+ return (0, exports.Scout9ApiFp)(this.configuration).did(macroDidInput, options).then(request => request(this.axios, this.basePath));
65449
+ }
65294
65450
  /**
65295
65451
  *
65296
65452
  * @summary Get an entity by type and ID
@@ -65669,13 +65825,14 @@ common.createRequestFunction = createRequestFunction;
65669
65825
  var configuration = {};
65670
65826
 
65671
65827
  var name$2 = "@scout9/admin";
65672
- var version$3 = "1.0.0-alpha.0.0.41";
65828
+ var version$3 = "1.0.0-alpha.0.0.47";
65673
65829
  var description$2 = "";
65674
65830
  var main$3 = "./build/index.js";
65675
- var types$1 = "./build/index.d.ts";
65676
65831
  var scripts$2 = {
65677
65832
  prepublishOnly: "npm run build",
65678
65833
  prebuild: "rm -rf ./build && rm -rf ./tsconfig.tsbuildinfo",
65834
+ "build:cjs": "tsc --project tsconfig.cjs.json",
65835
+ "build:esm": "tsc --project tsconfig.esm.json",
65679
65836
  build: "npx tsc --project ./tsconfig.json"
65680
65837
  };
65681
65838
  var repository$2 = {
@@ -65718,7 +65875,6 @@ var require$$0 = {
65718
65875
  version: version$3,
65719
65876
  description: description$2,
65720
65877
  main: main$3,
65721
- types: types$1,
65722
65878
  scripts: scripts$2,
65723
65879
  repository: repository$2,
65724
65880
  engines: engines$1,
@@ -79152,7 +79308,7 @@ function _writeFileToLocal() {
79152
79308
  return _writeFileToLocal.apply(this, arguments);
79153
79309
  }
79154
79310
 
79155
- var _excluded$1 = ["entity", "entities", "api", "id"];
79311
+ var _excluded$3 = ["entity", "entities", "api", "id"];
79156
79312
  /**
79157
79313
  * @param {Scout9ProjectBuildConfig['agents']} agents
79158
79314
  * @param {string} exe - file extension
@@ -79185,7 +79341,7 @@ function entityTemplate(entity) {
79185
79341
  entity.entities;
79186
79342
  entity.api;
79187
79343
  entity.id;
79188
- var rest = spirits._objectWithoutProperties(entity, _excluded$1);
79344
+ var rest = spirits._objectWithoutProperties(entity, _excluded$3);
79189
79345
  if (!_entity.endsWith('Entity')) {
79190
79346
  _entity = "".concat(_entity, "Entity");
79191
79347
  }
@@ -81250,7 +81406,7 @@ function _loadUserPackageJson$1() {
81250
81406
  targetPkgUrl = isTest ? packageTestJsonUrl : packageJsonUrl;
81251
81407
  _context2.t0 = JSON;
81252
81408
  _context2.next = 10;
81253
- return fs__default["default"].readFile(new URL(targetPkgUrl, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('exports-dfabefaf.js', document.baseURI).href))), 'utf-8');
81409
+ return fs__default["default"].readFile(new URL(targetPkgUrl, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('exports-1f0580dd.js', document.baseURI).href))), 'utf-8');
81254
81410
  case 10:
81255
81411
  _context2.t1 = _context2.sent;
81256
81412
  pkg = _context2.t0.parse.call(_context2.t0, _context2.t1);
@@ -82095,7 +82251,7 @@ function _loadUserPackageJson() {
82095
82251
  targetPkgUrl = isTest ? packageTestJsonUrl : packageJsonUrl;
82096
82252
  _context.t0 = JSON;
82097
82253
  _context.next = 10;
82098
- return fs__default["default"].readFile(new URL(targetPkgUrl, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('exports-dfabefaf.js', document.baseURI).href))), 'utf-8');
82254
+ return fs__default["default"].readFile(new URL(targetPkgUrl, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('exports-1f0580dd.js', document.baseURI).href))), 'utf-8');
82099
82255
  case 10:
82100
82256
  _context.t1 = _context.sent;
82101
82257
  pkg = _context.t0.parse.call(_context.t0, _context.t1);
@@ -87107,10 +87263,11 @@ var ForwardSchema = z.union([z["boolean"](), z.string(), z.object({
87107
87263
 
87108
87264
  /**
87109
87265
  * Instruction object schema used to send context to guide conversations
87110
- * @typedef {import('zod').infer<typeof InstructionSchema>} IInstruction
87266
+ * @typedef {import('zod').infer<typeof InstructionObjectSchema>} IInstruction
87111
87267
  */
87112
- var InstructionSchema = z.object({
87113
- id: zId('Instruction ID').describe('Unique ID for the instruction, this is used to remove the instruction later'),
87268
+ var InstructionObjectSchema = z.object({
87269
+ id: zId('Instruction ID').describe('Unique ID for the instruction, this is used to remove the instruction later').optional(),
87270
+ persist: z["boolean"]().describe('if true, the instruction persists the conversation, if false the instruction will only last for 1 auto reply')["default"](true).optional(),
87114
87271
  content: z.string()
87115
87272
  });
87116
87273
 
@@ -87121,7 +87278,7 @@ var WorkflowResponseMessageApiRequest = z.object({
87121
87278
  uri: z.string(),
87122
87279
  data: z.any().optional(),
87123
87280
  headers: z.object(spirits._defineProperty({}, z.string(), z.string())).optional(),
87124
- method: z["enum"](["GET", "POST", "PUT"]).optional()
87281
+ method: z["enum"](['GET', 'POST', 'PUT']).optional()
87125
87282
  });
87126
87283
 
87127
87284
  /**
@@ -87155,21 +87312,67 @@ var WorkflowResponseMessageApiResponse = z.union([z.string(), z.object({
87155
87312
 
87156
87313
  /**
87157
87314
  * The workflow response object slot
87158
- * @typedef {import('zod').infer<typeof WorkflowResponseSlotSchema>} IWorkflowResponseSlot
87315
+ * @typedef {import('zod').infer<typeof InstructionSchema>} IInstruction
87159
87316
  */
87160
- var WorkflowResponseSlotSchema = z.object({
87317
+ var InstructionSchema = z.union([z.string(), InstructionObjectSchema, z.array(z.string()), z.array(InstructionObjectSchema)]);
87318
+
87319
+ /**
87320
+ * Base follow up schema to follow up with the client
87321
+ * @typedef {import('zod').infer<typeof FollowupBaseSchema>} IFollowupBase
87322
+ */
87323
+ var FollowupBaseSchema = z.object({
87324
+ scheduled: z.number(),
87325
+ cancelIf: ConversationContext.optional(),
87326
+ overrideLock: z["boolean"]({
87327
+ description: 'This will still run even if the conversation is locked, defaults to false'
87328
+ }).optional()
87329
+ });
87330
+
87331
+ /**
87332
+ * Data used to automatically follow up with the client in the future
87333
+ * @typedef {import('zod').infer<typeof FollowupSchema>} IFollowup
87334
+ */
87335
+ var FollowupSchema = z.union([FollowupBaseSchema.extend({
87336
+ message: z.string({
87337
+ description: 'Manual message sent to client'
87338
+ })
87339
+ }), FollowupBaseSchema.extend({
87340
+ instructions: InstructionSchema
87341
+ })]);
87342
+
87343
+ /**
87344
+ * The workflow response object slot
87345
+ * @typedef {import('zod').infer<typeof WorkflowResponseSlotBaseSchema>} IWorkflowResponseSlotBase
87346
+ */
87347
+ var WorkflowResponseSlotBaseSchema = z.object({
87161
87348
  forward: ForwardSchema.optional(),
87162
87349
  forwardNote: z.string({
87163
87350
  description: 'Note to provide to the agent, recommend using forward object api instead'
87164
87351
  }).optional(),
87165
- instructions: z.union([z.string(), InstructionSchema, z.array(z.string()), z.array(InstructionSchema)]).optional(),
87352
+ instructions: InstructionSchema.optional(),
87166
87353
  removeInstructions: z.array(z.string()).optional(),
87167
87354
  message: z.string().optional(),
87168
- // message: WorkflowResponseMessage.optional(),
87169
87355
  secondsDelay: z.number().optional(),
87170
87356
  scheduled: z.number().optional(),
87171
87357
  contextUpsert: ConversationContext.optional(),
87172
- resetIntent: z["boolean"]().optional()
87358
+ resetIntent: z["boolean"]().optional(),
87359
+ followup: FollowupSchema.optional()
87360
+ });
87361
+
87362
+ /**
87363
+ * The workflow response object slot
87364
+ * @typedef {import('zod').infer<typeof WorkflowResponseSlotSchema>} IWorkflowResponseSlot
87365
+ */
87366
+ var WorkflowResponseSlotSchema = WorkflowResponseSlotBaseSchema.extend({
87367
+ anticipate: z.union([z.object({
87368
+ did: z.string({
87369
+ definition: 'The prompt to check if true or false'
87370
+ }),
87371
+ yes: WorkflowResponseSlotBaseSchema,
87372
+ no: WorkflowResponseSlotBaseSchema
87373
+ }), z.array(WorkflowResponseSlotBaseSchema.extend({
87374
+ keywords: z.array(z.string()).min(1).max(20)
87375
+ }))]).optional()
87173
87376
  });
87174
87377
 
87175
87378
  /**
@@ -87340,6 +87543,297 @@ var patchApiFunctionSchema = function patchApiFunctionSchema(requestBodySchema)
87340
87543
  */
87341
87544
  var deleteApiFunctionSchema = apiFunctionSchema;
87342
87545
 
87546
+ var _excluded$2 = ["success"];
87547
+ function MacroUtilsFactory() {
87548
+ return {
87549
+ dateToUnix: function dateToUnix(date) {
87550
+ return parseInt((date.getTime() / 1000).toFixed(0));
87551
+ },
87552
+ scheduledToUnixSafe: function scheduledToUnixSafe(scheduled) {
87553
+ if (scheduled instanceof Date) {
87554
+ return {
87555
+ data: this.dateToUnix(scheduled),
87556
+ success: true
87557
+ };
87558
+ } else if (typeof scheduled === 'string') {
87559
+ var timestamp = Date.parse(scheduled);
87560
+ if (isNaN(timestamp) === false) {
87561
+ return {
87562
+ data: this.dateToUnix(new Date(timestamp)),
87563
+ success: true
87564
+ };
87565
+ } else {
87566
+ return {
87567
+ error: '.scheduled is an invalid date string',
87568
+ success: false
87569
+ };
87570
+ }
87571
+ } else {
87572
+ return {
87573
+ error: ".scheduled was neither a Date or ISO string",
87574
+ success: false
87575
+ };
87576
+ }
87577
+ },
87578
+ scheduledToUnix: function scheduledToUnix(scheduled) {
87579
+ var _this$scheduledToUnix = this.scheduledToUnixSafe(scheduled),
87580
+ success = _this$scheduledToUnix.success,
87581
+ rest = spirits._objectWithoutProperties(_this$scheduledToUnix, _excluded$2);
87582
+ if (success) {
87583
+ return rest.data;
87584
+ } else {
87585
+ throw new Error(rest.error);
87586
+ }
87587
+ }
87588
+ };
87589
+ }
87590
+ var MacroUtils = MacroUtilsFactory();
87591
+
87592
+ var _excluded$1 = ["success"];
87593
+ function EventMacros() {
87594
+ var slots = [];
87595
+ return {
87596
+ /**
87597
+ * Sets context into the conversation context for later use
87598
+ * @param {Record<string, any>} updates
87599
+ * @return {this}
87600
+ */
87601
+ upsert: function upsert(updates) {
87602
+ var slot = {
87603
+ contextUpsert: updates
87604
+ };
87605
+ slots.push(WorkflowResponseSlotSchema.parse(slot));
87606
+ return this;
87607
+ },
87608
+ /**
87609
+ * Similar to `instruction` except that it requires a schedule time parameter that determines when to follow up (and is not an event output macro). This will fire another run job with a new insert system context message, if `options.literal` is set to true, it will be an appended agent message prior to running the workflow app.
87610
+ *
87611
+ * @param {string} instruction
87612
+ *
87613
+ * @overload
87614
+ * @param {Date | string} options
87615
+ *
87616
+ * @overload
87617
+ * @param {Object} options
87618
+ * @param {Date | string} options.scheduled
87619
+ * @param {Record<string, any>} [options.cancelIf]
87620
+ * @param {boolean} [options.literal]
87621
+ * @param {boolean} [options.overrideLock]
87622
+ *
87623
+ * @return {this}
87624
+ */
87625
+ followup: function followup(instruction, options) {
87626
+ var slot;
87627
+ if (!options) {
87628
+ throw new Error('Missing second argument in followup(instruction, options) \'options\' argument needs to be included');
87629
+ }
87630
+ // Check if it's date value
87631
+ var _MacroUtils$scheduled = MacroUtils.scheduledToUnixSafe(options),
87632
+ success = _MacroUtils$scheduled.success,
87633
+ rest = spirits._objectWithoutProperties(_MacroUtils$scheduled, _excluded$1);
87634
+ if (!success) {
87635
+ if (!('scheduled' in options)) {
87636
+ throw new Error('.scheduled was not included in options and needs to be required');
87637
+ }
87638
+ if (spirits._typeof(options) !== 'object') {
87639
+ throw new Error('second argument options in followup is not an object type');
87640
+ }
87641
+
87642
+ // Advance object
87643
+ slot = {
87644
+ followup: {
87645
+ scheduled: MacroUtils.scheduledToUnix(options.scheduled)
87646
+ }
87647
+ };
87648
+ if (options.literal) {
87649
+ slot.followup.message = instruction;
87650
+ } else {
87651
+ slot.followup.instructions = instruction;
87652
+ }
87653
+ if (typeof options.overrideLock === 'boolean') {
87654
+ slot.followup.overrideLock = options.overrideLock;
87655
+ }
87656
+ if (options.cancelIf) {
87657
+ slot.followup.cancelIf = options.cancelIf;
87658
+ }
87659
+ } else {
87660
+ // Simple follow up
87661
+ slot = {
87662
+ followup: {
87663
+ instructions: instruction,
87664
+ scheduled: rest.data
87665
+ }
87666
+ };
87667
+ }
87668
+ slots.push(WorkflowResponseSlotSchema.parse(slot));
87669
+ return this;
87670
+ },
87671
+ /**
87672
+ * Similar to `instruct` except that it requires a schedule time parameter that determines when to follow up (and is not an event output macro). This will fire another run job with a new insert system context message, if `options.literal` is set to true, it will be an appended agent message prior to running the workflow app.
87673
+ * @overload
87674
+ * @param {string} instruction - The instruction to be anticipated as a string. When this is a string, `yes` and `no` must be provided as objects.
87675
+ * @param {object} yes - The object to process if the instruction is a string and the condition is met.
87676
+ * @param {object} no - The object to process if the instruction is a string and the condition is not met.
87677
+ *
87678
+ * @overload
87679
+ * @param {(Array<import('zod').infer<typeof import('../runtime/client/workflow.js').WorkflowResponseSlotBaseSchema> & {keywords: string[]}>)} instruction
87680
+ *
87681
+ * @return {EventMacros}
87682
+ */
87683
+ anticipate: function anticipate(instruction, yes, no) {
87684
+ var slot = {
87685
+ anticipate: []
87686
+ };
87687
+ if (Array.isArray(instruction)) {
87688
+ var _iterator = spirits._createForOfIteratorHelper(instruction),
87689
+ _step;
87690
+ try {
87691
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
87692
+ var _slot = _step.value;
87693
+ if (!Array.isArray(_slot.keywords) || _slot.keywords.length < 1) {
87694
+ throw new Error("Anticipate field .keywords should be an array of string, with more than one value");
87695
+ }
87696
+ slot.anticipate.push(_slot);
87697
+ }
87698
+ } catch (err) {
87699
+ _iterator.e(err);
87700
+ } finally {
87701
+ _iterator.f();
87702
+ }
87703
+ } else if (typeof instruction === 'string') {
87704
+ if (!yes) {
87705
+ throw new Error('Missing "yes" option for anticipate');
87706
+ }
87707
+ if (!no) {
87708
+ throw new Error('Missing "no" option for anticipate');
87709
+ }
87710
+ slot.anticipate = {
87711
+ did: instruction,
87712
+ yes: WorkflowResponseSlotBaseSchema.parse(yes),
87713
+ no: WorkflowResponseSlotBaseSchema.parse(no)
87714
+ };
87715
+ } else {
87716
+ throw new Error("Instruction is not of type \"string\" or \"array\"");
87717
+ }
87718
+ slots.push(WorkflowResponseSlotSchema.parse(slot));
87719
+ return this;
87720
+ },
87721
+ /**
87722
+ *
87723
+ * @param {string} instruction
87724
+ * @param {Object} [options]
87725
+ * @param {string} [options.id] - Unique ID for the instruction, this is used to remove the instruction later
87726
+ * @param {string} [options.persist] - if true, the instruction persists the conversation, if false the instruction will only last for 1 auto reply
87727
+ * @return {EventMacros}
87728
+ */
87729
+ instruct: function instruct(instruction) {
87730
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
87731
+ var slot = {};
87732
+ if (Object.keys(options).length > 0) {
87733
+ var instructionObj = {
87734
+ content: instruction
87735
+ };
87736
+ if (options.id) {
87737
+ instructionObj.id = options.id;
87738
+ }
87739
+ if (typeof options.persist === 'boolean') {
87740
+ instructionObj.persist = options.persist;
87741
+ }
87742
+ slot.instructions = instructionObj;
87743
+ } else {
87744
+ slot.instructions = instruction;
87745
+ }
87746
+ slots.push(WorkflowResponseSlotSchema.parse(slot));
87747
+ return this;
87748
+ },
87749
+ /**
87750
+ * If a manual message must be sent, you can use the `reply` macro
87751
+ * @param {string} message - the message to manually send to the user
87752
+ * @param {Object} [options]
87753
+ * @param {Date | string} [options.scheduled] - this will schedule the date to a specific provided date
87754
+ * @param {string} [options.delay] - delays the message return in seconds
87755
+ * @return {this}
87756
+ */
87757
+ reply: function reply(message) {
87758
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
87759
+ var slot = {
87760
+ message: message
87761
+ };
87762
+ if (Object.keys(options).length) {
87763
+ if ('scheduled' in options) {
87764
+ slot.scheduled = MacroUtils.scheduledToUnix(options.scheduled);
87765
+ }
87766
+ if ('delay' in options) {
87767
+ var delay = options.delay;
87768
+ if (typeof delay !== 'number') {
87769
+ throw new Error('.delay is not of type "number"');
87770
+ }
87771
+ slot.secondsDelay = delay;
87772
+ }
87773
+ }
87774
+ slots.push(WorkflowResponseSlotSchema.parse(slot));
87775
+ return this;
87776
+ },
87777
+ /**
87778
+ * This macro ends the conversation and forwards it the owner of the persona to manually handle the flow. If your app returns undefined or no event, then a default forward is generated.
87779
+ * @param {string} message - the message to forward to owner of persona
87780
+ * @param {Object} [options]
87781
+ * @param {'after-reply' | 'immediately'} [options.mode] - sets forward mode, defaults to "immediately"
87782
+ * @param {string} [options.to] - another phone or email to forward to instead of owner
87783
+ * @return {this}
87784
+ */
87785
+ forward: function forward(message) {
87786
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
87787
+ var slot;
87788
+ if (options && Object.keys(options).length) {
87789
+ slot = {
87790
+ forward: {
87791
+ note: message
87792
+ },
87793
+ forwardNote: message
87794
+ };
87795
+ if (options.to) {
87796
+ slot.forward.to = options.to;
87797
+ }
87798
+ if (options.mode) {
87799
+ slot.forward.mode = options.mode;
87800
+ }
87801
+ } else {
87802
+ slot = {
87803
+ forward: true,
87804
+ forwardNote: message
87805
+ };
87806
+ }
87807
+ slots.push(WorkflowResponseSlotSchema.parse(slot));
87808
+ return this;
87809
+ },
87810
+ /**
87811
+ *
87812
+ * @return {Array<(import('zod').infer<typeof import('../runtime/client/workflow.js').WorkflowResponseSlotSchema>)>}
87813
+ */
87814
+ toJSON: function toJSON() {
87815
+ var flush = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
87816
+ if (flush) {
87817
+ var copy = spirits._toConsumableArray(slots);
87818
+ slots = [];
87819
+ return copy;
87820
+ } else {
87821
+ return slots;
87822
+ }
87823
+ }
87824
+ };
87825
+ }
87826
+ var eventMacros = EventMacros();
87827
+ var instruct = eventMacros.instruct.bind(eventMacros);
87828
+ var forward = eventMacros.forward.bind(eventMacros);
87829
+ var reply = eventMacros.reply.bind(eventMacros);
87830
+
87831
+ var ContextExampleWithTrainingDataSchema = z.object({
87832
+ input: z.string(),
87833
+ output: z.array(z.record(z.any()))
87834
+ });
87835
+ var ContextExampleSchema = z.union([z.array(ContextExampleWithTrainingDataSchema), z.array(z.record(z.any()))]);
87836
+
87343
87837
  function loadEntityApiConfig$1(_x, _x2) {
87344
87838
  return _loadEntityApiConfig$1.apply(this, arguments);
87345
87839
  }
@@ -88534,7 +89028,7 @@ function report(config, logger) {
88534
89028
  logger.primary("Run ".concat(cyan('scout9 dev'), " to test your project locally"));
88535
89029
  }
88536
89030
 
88537
- var __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('exports-dfabefaf.js', document.baseURI).href)));
89031
+ var __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('exports-1f0580dd.js', document.baseURI).href)));
88538
89032
  var __dirname$1 = path__default["default"].dirname(__filename$1);
88539
89033
  function zipDirectory(source, out) {
88540
89034
  var archive = archiver$1('tar', {
@@ -88749,7 +89243,7 @@ function _buildApp() {
88749
89243
  case 11:
88750
89244
  _context4.t0 = JSON;
88751
89245
  _context4.next = 14;
88752
- return fs__default["default"].readFile(new URL(templatePackagePath, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('exports-dfabefaf.js', document.baseURI).href))), 'utf-8');
89246
+ return fs__default["default"].readFile(new URL(templatePackagePath, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('exports-1f0580dd.js', document.baseURI).href))), 'utf-8');
88753
89247
  case 14:
88754
89248
  _context4.t1 = _context4.sent;
88755
89249
  packageTemplate = _context4.t0.parse.call(_context4.t0, _context4.t1);
@@ -89743,7 +90237,7 @@ function _loadAgentConfig() {
89743
90237
  }
89744
90238
  if (!agent.programmablePhoneNumber) {
89745
90239
  userName = agent.firstName ? "".concat(agent.firstName).concat(agent.lastName ? ' ' + agent.lastName : '') : agent.forwardPhone;
89746
- cb("\u26A0\uFE0F".concat($$1.yellow('Warning'), ": ").concat(userName, " does not have a masked phone number to do auto replies. You can register one at ").concat($$1.cyan('https://scout9.com/b'), " under ").concat($$1.green('users'), " > ").concat($$1.green(userName), ". Then run ").concat($$1.cyan('scout9 sync'), " to update."));
90240
+ cb("\u26A0\uFE0F".concat($$1.yellow('Warning'), ": ").concat(userName, " does not have a masked phone number to do auto replies.\nYou can register one at ").concat($$1.cyan('https://scout9.com/b'), " under ").concat($$1.green('users'), " > ").concat($$1.green(userName), ". Then run ").concat($$1.cyan('scout9 sync'), " to update."));
89747
90241
  }
89748
90242
  if (agent.forwardPhone && agents.filter(function (a) {
89749
90243
  return a.forwardPhone && a.forwardPhone === agent.forwardPhone;
@@ -91833,12 +92327,17 @@ function json(data, init) {
91833
92327
  }
91834
92328
  var encoder = new TextEncoder();
91835
92329
 
92330
+ exports.ContextExampleSchema = ContextExampleSchema;
92331
+ exports.ContextExampleWithTrainingDataSchema = ContextExampleWithTrainingDataSchema;
91836
92332
  exports.ConversationContext = ConversationContext;
91837
92333
  exports.ConversationSchema = ConversationSchema;
91838
92334
  exports.EventResponse = EventResponse;
91839
92335
  exports.File = File;
92336
+ exports.FollowupBaseSchema = FollowupBaseSchema;
92337
+ exports.FollowupSchema = FollowupSchema;
91840
92338
  exports.FormData = FormData$2;
91841
92339
  exports.ForwardSchema = ForwardSchema;
92340
+ exports.InstructionObjectSchema = InstructionObjectSchema;
91842
92341
  exports.InstructionSchema = InstructionSchema;
91843
92342
  exports.IntentWorkflowEventSchema = IntentWorkflowEventSchema;
91844
92343
  exports.MessageSchema = MessageSchema;
@@ -91852,6 +92351,7 @@ exports.WorkflowResponseMessage = WorkflowResponseMessage;
91852
92351
  exports.WorkflowResponseMessageApiRequest = WorkflowResponseMessageApiRequest;
91853
92352
  exports.WorkflowResponseMessageApiResponse = WorkflowResponseMessageApiResponse;
91854
92353
  exports.WorkflowResponseSchema = WorkflowResponseSchema;
92354
+ exports.WorkflowResponseSlotBaseSchema = WorkflowResponseSlotBaseSchema;
91855
92355
  exports.WorkflowResponseSlotSchema = WorkflowResponseSlotSchema;
91856
92356
  exports.WorkflowsConfigurationSchema = WorkflowsConfigurationSchema;
91857
92357
  exports.agentBaseConfigurationSchema = agentBaseConfigurationSchema;
@@ -91859,6 +92359,7 @@ exports.agentConfigurationSchema = agentConfigurationSchema;
91859
92359
  exports.agentsBaseConfigurationSchema = agentsBaseConfigurationSchema;
91860
92360
  exports.agentsConfigurationSchema = agentsConfigurationSchema;
91861
92361
  exports.apiFunctionSchema = apiFunctionSchema;
92362
+ exports.build = build$1;
91862
92363
  exports.createMockAgent = createMockAgent;
91863
92364
  exports.createMockConversation = createMockConversation;
91864
92365
  exports.createMockCustomer = createMockCustomer;
@@ -91873,11 +92374,14 @@ exports.entityApiConfigurationSchema = entityApiConfigurationSchema;
91873
92374
  exports.entityConfigurationSchema = entityConfigurationSchema;
91874
92375
  exports.entityRootProjectConfigurationSchema = entityRootProjectConfigurationSchema;
91875
92376
  exports.eventResponseSchema = eventResponseSchema;
92377
+ exports.forward = forward;
91876
92378
  exports.getApiFunctionSchema = getApiFunctionSchema;
92379
+ exports.instruct = instruct;
91877
92380
  exports.json = json;
91878
92381
  exports.patchApiFunctionSchema = patchApiFunctionSchema;
91879
92382
  exports.postApiFunctionSchema = postApiFunctionSchema;
91880
92383
  exports.putApiFunctionSchema = putApiFunctionSchema;
91881
92384
  exports.queryApiFunctionSchema = queryApiFunctionSchema;
92385
+ exports.reply = reply;
91882
92386
  exports.run = run;
91883
92387
  exports.sendEvent = sendEvent;