@scout9/app 1.0.0-alpha.0.1.91 → 1.0.0-alpha.0.1.93

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-3b603262.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-54a3ab5f.cjs"); });
41177
+ } = await Promise.resolve().then(function () { return require("./multipart-parser-af15f044.cjs"); });
41178
41178
  return toFormData(this.body, ct);
41179
41179
  }
41180
41180
 
@@ -61167,6 +61167,44 @@ common.createRequestFunction = createRequestFunction;
61167
61167
  options: localVarRequestOptions
61168
61168
  };
61169
61169
  },
61170
+ /**
61171
+ *
61172
+ * @summary Natural language prompt to resolve a context value derived from the conversation.
61173
+ * @param {CaptureContextRequest} captureContextRequest
61174
+ * @param {*} [options] Override http request option.
61175
+ * @throws {RequiredError}
61176
+ */
61177
+ captureContext: async (captureContextRequest, options = {}) => {
61178
+ // verify required parameter 'captureContextRequest' is not null or undefined
61179
+ (0, common_1.assertParamExists)('captureContext', 'captureContextRequest', captureContextRequest);
61180
+ const localVarPath = `/v1-utils-macros-context`;
61181
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
61182
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
61183
+ let baseOptions;
61184
+ if (configuration) {
61185
+ baseOptions = configuration.baseOptions;
61186
+ }
61187
+ const localVarRequestOptions = {
61188
+ method: 'POST',
61189
+ ...baseOptions,
61190
+ ...options
61191
+ };
61192
+ const localVarHeaderParameter = {};
61193
+ const localVarQueryParameter = {};
61194
+ localVarHeaderParameter['Content-Type'] = 'application/json';
61195
+ (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
61196
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
61197
+ localVarRequestOptions.headers = {
61198
+ ...localVarHeaderParameter,
61199
+ ...headersFromBaseOptions,
61200
+ ...options.headers
61201
+ };
61202
+ localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(captureContextRequest, localVarRequestOptions, configuration);
61203
+ return {
61204
+ url: (0, common_1.toPathString)(localVarUrlObj),
61205
+ options: localVarRequestOptions
61206
+ };
61207
+ },
61170
61208
  /**
61171
61209
  *
61172
61210
  * @summary Get the current project configuration
@@ -62558,6 +62596,44 @@ common.createRequestFunction = createRequestFunction;
62558
62596
  options: localVarRequestOptions
62559
62597
  };
62560
62598
  },
62599
+ /**
62600
+ *
62601
+ * @summary Natural language prompt to resolve to a boolean value.
62602
+ * @param {DidRequest} didRequest
62603
+ * @param {*} [options] Override http request option.
62604
+ * @throws {RequiredError}
62605
+ */
62606
+ did: async (didRequest, options = {}) => {
62607
+ // verify required parameter 'didRequest' is not null or undefined
62608
+ (0, common_1.assertParamExists)('did', 'didRequest', didRequest);
62609
+ const localVarPath = `/v1-utils-macros-did`;
62610
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
62611
+ const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
62612
+ let baseOptions;
62613
+ if (configuration) {
62614
+ baseOptions = configuration.baseOptions;
62615
+ }
62616
+ const localVarRequestOptions = {
62617
+ method: 'POST',
62618
+ ...baseOptions,
62619
+ ...options
62620
+ };
62621
+ const localVarHeaderParameter = {};
62622
+ const localVarQueryParameter = {};
62623
+ localVarHeaderParameter['Content-Type'] = 'application/json';
62624
+ (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
62625
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
62626
+ localVarRequestOptions.headers = {
62627
+ ...localVarHeaderParameter,
62628
+ ...headersFromBaseOptions,
62629
+ ...options.headers
62630
+ };
62631
+ localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(didRequest, localVarRequestOptions, configuration);
62632
+ return {
62633
+ url: (0, common_1.toPathString)(localVarUrlObj),
62634
+ options: localVarRequestOptions
62635
+ };
62636
+ },
62561
62637
  /**
62562
62638
  *
62563
62639
  * @summary Get an entity by type and ID
@@ -63457,6 +63533,17 @@ common.createRequestFunction = createRequestFunction;
63457
63533
  const localVarAxiosArgs = await localVarAxiosParamCreator.agentsUpdate(updateAgentsRequest, options);
63458
63534
  return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1$1.default, base_1.BASE_PATH, configuration);
63459
63535
  },
63536
+ /**
63537
+ *
63538
+ * @summary Natural language prompt to resolve a context value derived from the conversation.
63539
+ * @param {CaptureContextRequest} captureContextRequest
63540
+ * @param {*} [options] Override http request option.
63541
+ * @throws {RequiredError}
63542
+ */
63543
+ async captureContext(captureContextRequest, options) {
63544
+ const localVarAxiosArgs = await localVarAxiosParamCreator.captureContext(captureContextRequest, options);
63545
+ return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1$1.default, base_1.BASE_PATH, configuration);
63546
+ },
63460
63547
  /**
63461
63548
  *
63462
63549
  * @summary Get the current project configuration
@@ -63865,6 +63952,17 @@ common.createRequestFunction = createRequestFunction;
63865
63952
  const localVarAxiosArgs = await localVarAxiosParamCreator.deleteEntity(type, id, options);
63866
63953
  return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1$1.default, base_1.BASE_PATH, configuration);
63867
63954
  },
63955
+ /**
63956
+ *
63957
+ * @summary Natural language prompt to resolve to a boolean value.
63958
+ * @param {DidRequest} didRequest
63959
+ * @param {*} [options] Override http request option.
63960
+ * @throws {RequiredError}
63961
+ */
63962
+ async did(didRequest, options) {
63963
+ const localVarAxiosArgs = await localVarAxiosParamCreator.did(didRequest, options);
63964
+ return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1$1.default, base_1.BASE_PATH, configuration);
63965
+ },
63868
63966
  /**
63869
63967
  *
63870
63968
  * @summary Get an entity by type and ID
@@ -64193,6 +64291,16 @@ common.createRequestFunction = createRequestFunction;
64193
64291
  agentsUpdate(updateAgentsRequest, options) {
64194
64292
  return localVarFp.agentsUpdate(updateAgentsRequest, options).then(request => request(axios, basePath));
64195
64293
  },
64294
+ /**
64295
+ *
64296
+ * @summary Natural language prompt to resolve a context value derived from the conversation.
64297
+ * @param {CaptureContextRequest} captureContextRequest
64298
+ * @param {*} [options] Override http request option.
64299
+ * @throws {RequiredError}
64300
+ */
64301
+ captureContext(captureContextRequest, options) {
64302
+ return localVarFp.captureContext(captureContextRequest, options).then(request => request(axios, basePath));
64303
+ },
64196
64304
  /**
64197
64305
  *
64198
64306
  * @summary Get the current project configuration
@@ -64565,6 +64673,16 @@ common.createRequestFunction = createRequestFunction;
64565
64673
  deleteEntity(type, id, options) {
64566
64674
  return localVarFp.deleteEntity(type, id, options).then(request => request(axios, basePath));
64567
64675
  },
64676
+ /**
64677
+ *
64678
+ * @summary Natural language prompt to resolve to a boolean value.
64679
+ * @param {DidRequest} didRequest
64680
+ * @param {*} [options] Override http request option.
64681
+ * @throws {RequiredError}
64682
+ */
64683
+ did(didRequest, options) {
64684
+ return localVarFp.did(didRequest, options).then(request => request(axios, basePath));
64685
+ },
64568
64686
  /**
64569
64687
  *
64570
64688
  * @summary Get an entity by type and ID
@@ -64883,6 +65001,17 @@ common.createRequestFunction = createRequestFunction;
64883
65001
  agentsUpdate(updateAgentsRequest, options) {
64884
65002
  return (0, exports.Scout9ApiFp)(this.configuration).agentsUpdate(updateAgentsRequest, options).then(request => request(this.axios, this.basePath));
64885
65003
  }
65004
+ /**
65005
+ *
65006
+ * @summary Natural language prompt to resolve a context value derived from the conversation.
65007
+ * @param {CaptureContextRequest} captureContextRequest
65008
+ * @param {*} [options] Override http request option.
65009
+ * @throws {RequiredError}
65010
+ * @memberof Scout9Api
65011
+ */
65012
+ captureContext(captureContextRequest, options) {
65013
+ return (0, exports.Scout9ApiFp)(this.configuration).captureContext(captureContextRequest, options).then(request => request(this.axios, this.basePath));
65014
+ }
64886
65015
  /**
64887
65016
  *
64888
65017
  * @summary Get the current project configuration
@@ -65291,6 +65420,17 @@ common.createRequestFunction = createRequestFunction;
65291
65420
  deleteEntity(type, id, options) {
65292
65421
  return (0, exports.Scout9ApiFp)(this.configuration).deleteEntity(type, id, options).then(request => request(this.axios, this.basePath));
65293
65422
  }
65423
+ /**
65424
+ *
65425
+ * @summary Natural language prompt to resolve to a boolean value.
65426
+ * @param {DidRequest} didRequest
65427
+ * @param {*} [options] Override http request option.
65428
+ * @throws {RequiredError}
65429
+ * @memberof Scout9Api
65430
+ */
65431
+ did(didRequest, options) {
65432
+ return (0, exports.Scout9ApiFp)(this.configuration).did(didRequest, options).then(request => request(this.axios, this.basePath));
65433
+ }
65294
65434
  /**
65295
65435
  *
65296
65436
  * @summary Get an entity by type and ID
@@ -65669,13 +65809,14 @@ common.createRequestFunction = createRequestFunction;
65669
65809
  var configuration = {};
65670
65810
 
65671
65811
  var name$2 = "@scout9/admin";
65672
- var version$3 = "1.0.0-alpha.0.0.41";
65812
+ var version$3 = "1.0.0-alpha.0.0.46";
65673
65813
  var description$2 = "";
65674
65814
  var main$3 = "./build/index.js";
65675
- var types$1 = "./build/index.d.ts";
65676
65815
  var scripts$2 = {
65677
65816
  prepublishOnly: "npm run build",
65678
65817
  prebuild: "rm -rf ./build && rm -rf ./tsconfig.tsbuildinfo",
65818
+ "build:cjs": "tsc --project tsconfig.cjs.json",
65819
+ "build:esm": "tsc --project tsconfig.esm.json",
65679
65820
  build: "npx tsc --project ./tsconfig.json"
65680
65821
  };
65681
65822
  var repository$2 = {
@@ -65718,7 +65859,6 @@ var require$$0 = {
65718
65859
  version: version$3,
65719
65860
  description: description$2,
65720
65861
  main: main$3,
65721
- types: types$1,
65722
65862
  scripts: scripts$2,
65723
65863
  repository: repository$2,
65724
65864
  engines: engines$1,
@@ -79152,7 +79292,7 @@ function _writeFileToLocal() {
79152
79292
  return _writeFileToLocal.apply(this, arguments);
79153
79293
  }
79154
79294
 
79155
- var _excluded$1 = ["entity", "entities", "api", "id"];
79295
+ var _excluded$3 = ["entity", "entities", "api", "id"];
79156
79296
  /**
79157
79297
  * @param {Scout9ProjectBuildConfig['agents']} agents
79158
79298
  * @param {string} exe - file extension
@@ -79185,7 +79325,7 @@ function entityTemplate(entity) {
79185
79325
  entity.entities;
79186
79326
  entity.api;
79187
79327
  entity.id;
79188
- var rest = spirits._objectWithoutProperties(entity, _excluded$1);
79328
+ var rest = spirits._objectWithoutProperties(entity, _excluded$3);
79189
79329
  if (!_entity.endsWith('Entity')) {
79190
79330
  _entity = "".concat(_entity, "Entity");
79191
79331
  }
@@ -81250,7 +81390,7 @@ function _loadUserPackageJson$1() {
81250
81390
  targetPkgUrl = isTest ? packageTestJsonUrl : packageJsonUrl;
81251
81391
  _context2.t0 = JSON;
81252
81392
  _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-212ef6be.js', document.baseURI).href))), 'utf-8');
81393
+ 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-83755281.js', document.baseURI).href))), 'utf-8');
81254
81394
  case 10:
81255
81395
  _context2.t1 = _context2.sent;
81256
81396
  pkg = _context2.t0.parse.call(_context2.t0, _context2.t1);
@@ -82095,7 +82235,7 @@ function _loadUserPackageJson() {
82095
82235
  targetPkgUrl = isTest ? packageTestJsonUrl : packageJsonUrl;
82096
82236
  _context.t0 = JSON;
82097
82237
  _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-212ef6be.js', document.baseURI).href))), 'utf-8');
82238
+ 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-83755281.js', document.baseURI).href))), 'utf-8');
82099
82239
  case 10:
82100
82240
  _context.t1 = _context.sent;
82101
82241
  pkg = _context.t0.parse.call(_context.t0, _context.t1);
@@ -87107,10 +87247,11 @@ var ForwardSchema = z.union([z["boolean"](), z.string(), z.object({
87107
87247
 
87108
87248
  /**
87109
87249
  * Instruction object schema used to send context to guide conversations
87110
- * @typedef {import('zod').infer<typeof InstructionSchema>} IInstruction
87250
+ * @typedef {import('zod').infer<typeof InstructionObjectSchema>} IInstruction
87111
87251
  */
87112
- var InstructionSchema = z.object({
87113
- id: zId('Instruction ID').describe('Unique ID for the instruction, this is used to remove the instruction later'),
87252
+ var InstructionObjectSchema = z.object({
87253
+ id: zId('Instruction ID').describe('Unique ID for the instruction, this is used to remove the instruction later').optional(),
87254
+ 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
87255
  content: z.string()
87115
87256
  });
87116
87257
 
@@ -87121,7 +87262,7 @@ var WorkflowResponseMessageApiRequest = z.object({
87121
87262
  uri: z.string(),
87122
87263
  data: z.any().optional(),
87123
87264
  headers: z.object(spirits._defineProperty({}, z.string(), z.string())).optional(),
87124
- method: z["enum"](["GET", "POST", "PUT"]).optional()
87265
+ method: z["enum"](['GET', 'POST', 'PUT']).optional()
87125
87266
  });
87126
87267
 
87127
87268
  /**
@@ -87155,21 +87296,67 @@ var WorkflowResponseMessageApiResponse = z.union([z.string(), z.object({
87155
87296
 
87156
87297
  /**
87157
87298
  * The workflow response object slot
87158
- * @typedef {import('zod').infer<typeof WorkflowResponseSlotSchema>} IWorkflowResponseSlot
87299
+ * @typedef {import('zod').infer<typeof InstructionSchema>} IInstruction
87300
+ */
87301
+ var InstructionSchema = z.union([z.string(), InstructionObjectSchema, z.array(z.string()), z.array(InstructionObjectSchema)]);
87302
+
87303
+ /**
87304
+ * Base follow up schema to follow up with the client
87305
+ * @typedef {import('zod').infer<typeof FollowupBaseSchema>} IFollowupBase
87306
+ */
87307
+ var FollowupBaseSchema = z.object({
87308
+ scheduled: z.number(),
87309
+ cancelIf: ConversationContext.optional(),
87310
+ overrideLock: z["boolean"]({
87311
+ description: 'This will still run even if the conversation is locked, defaults to false'
87312
+ }).optional()
87313
+ });
87314
+
87315
+ /**
87316
+ * Data used to automatically follow up with the client in the future
87317
+ * @typedef {import('zod').infer<typeof FollowupSchema>} IFollowup
87159
87318
  */
87160
- var WorkflowResponseSlotSchema = z.object({
87319
+ var FollowupSchema = z.union([FollowupBaseSchema.extend({
87320
+ message: z.string({
87321
+ description: 'Manual message sent to client'
87322
+ })
87323
+ }), FollowupBaseSchema.extend({
87324
+ instructions: InstructionSchema
87325
+ })]);
87326
+
87327
+ /**
87328
+ * The workflow response object slot
87329
+ * @typedef {import('zod').infer<typeof WorkflowResponseSlotBaseSchema>} IWorkflowResponseSlotBase
87330
+ */
87331
+ var WorkflowResponseSlotBaseSchema = z.object({
87161
87332
  forward: ForwardSchema.optional(),
87162
87333
  forwardNote: z.string({
87163
87334
  description: 'Note to provide to the agent, recommend using forward object api instead'
87164
87335
  }).optional(),
87165
- instructions: z.union([z.string(), InstructionSchema, z.array(z.string()), z.array(InstructionSchema)]).optional(),
87336
+ instructions: InstructionSchema.optional(),
87166
87337
  removeInstructions: z.array(z.string()).optional(),
87167
87338
  message: z.string().optional(),
87168
- // message: WorkflowResponseMessage.optional(),
87169
87339
  secondsDelay: z.number().optional(),
87170
87340
  scheduled: z.number().optional(),
87171
87341
  contextUpsert: ConversationContext.optional(),
87172
- resetIntent: z["boolean"]().optional()
87342
+ resetIntent: z["boolean"]().optional(),
87343
+ followup: FollowupSchema.optional()
87344
+ });
87345
+
87346
+ /**
87347
+ * The workflow response object slot
87348
+ * @typedef {import('zod').infer<typeof WorkflowResponseSlotSchema>} IWorkflowResponseSlot
87349
+ */
87350
+ var WorkflowResponseSlotSchema = WorkflowResponseSlotBaseSchema.extend({
87351
+ anticipate: z.union([z.object({
87352
+ did: z.string({
87353
+ definition: 'The prompt to check if true or false'
87354
+ }),
87355
+ yes: WorkflowResponseSlotBaseSchema,
87356
+ no: WorkflowResponseSlotBaseSchema
87357
+ }), z.array(WorkflowResponseSlotBaseSchema.extend({
87358
+ keywords: z.array(z.string()).min(1).max(20)
87359
+ }))]).optional()
87173
87360
  });
87174
87361
 
87175
87362
  /**
@@ -87340,6 +87527,297 @@ var patchApiFunctionSchema = function patchApiFunctionSchema(requestBodySchema)
87340
87527
  */
87341
87528
  var deleteApiFunctionSchema = apiFunctionSchema;
87342
87529
 
87530
+ var _excluded$2 = ["success"];
87531
+ function MacroUtilsFactory() {
87532
+ return {
87533
+ dateToUnix: function dateToUnix(date) {
87534
+ return parseInt((date.getTime() / 1000).toFixed(0));
87535
+ },
87536
+ scheduledToUnixSafe: function scheduledToUnixSafe(scheduled) {
87537
+ if (scheduled instanceof Date) {
87538
+ return {
87539
+ data: this.dateToUnix(scheduled),
87540
+ success: true
87541
+ };
87542
+ } else if (typeof scheduled === 'string') {
87543
+ var timestamp = Date.parse(scheduled);
87544
+ if (isNaN(timestamp) === false) {
87545
+ return {
87546
+ data: this.dateToUnix(new Date(timestamp)),
87547
+ success: true
87548
+ };
87549
+ } else {
87550
+ return {
87551
+ error: '.scheduled is an invalid date string',
87552
+ success: false
87553
+ };
87554
+ }
87555
+ } else {
87556
+ return {
87557
+ error: ".scheduled was neither a Date or ISO string",
87558
+ success: false
87559
+ };
87560
+ }
87561
+ },
87562
+ scheduledToUnix: function scheduledToUnix(scheduled) {
87563
+ var _this$scheduledToUnix = this.scheduledToUnixSafe(scheduled),
87564
+ success = _this$scheduledToUnix.success,
87565
+ rest = spirits._objectWithoutProperties(_this$scheduledToUnix, _excluded$2);
87566
+ if (success) {
87567
+ return rest.data;
87568
+ } else {
87569
+ throw new Error(rest.error);
87570
+ }
87571
+ }
87572
+ };
87573
+ }
87574
+ var MacroUtils = MacroUtilsFactory();
87575
+
87576
+ var _excluded$1 = ["success"];
87577
+ function EventMacros() {
87578
+ var slots = [];
87579
+ return {
87580
+ /**
87581
+ * Sets context into the conversation context for later use
87582
+ * @param {Record<string, any>} updates
87583
+ * @return {this}
87584
+ */
87585
+ upsert: function upsert(updates) {
87586
+ var slot = {
87587
+ contextUpsert: updates
87588
+ };
87589
+ slots.push(WorkflowResponseSlotSchema.parse(slot));
87590
+ return this;
87591
+ },
87592
+ /**
87593
+ * 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.
87594
+ *
87595
+ * @param {string} instruction
87596
+ *
87597
+ * @overload
87598
+ * @param {Date | string} options
87599
+ *
87600
+ * @overload
87601
+ * @param {Object} options
87602
+ * @param {Date | string} options.scheduled
87603
+ * @param {Record<string, any>} [options.cancelIf]
87604
+ * @param {boolean} [options.literal]
87605
+ * @param {boolean} [options.overrideLock]
87606
+ *
87607
+ * @return {this}
87608
+ */
87609
+ followup: function followup(instruction, options) {
87610
+ var slot;
87611
+ if (!options) {
87612
+ throw new Error('Missing second argument in followup(instruction, options) \'options\' argument needs to be included');
87613
+ }
87614
+ // Check if it's date value
87615
+ var _MacroUtils$scheduled = MacroUtils.scheduledToUnixSafe(options),
87616
+ success = _MacroUtils$scheduled.success,
87617
+ rest = spirits._objectWithoutProperties(_MacroUtils$scheduled, _excluded$1);
87618
+ if (!success) {
87619
+ if (!('scheduled' in options)) {
87620
+ throw new Error('.scheduled was not included in options and needs to be required');
87621
+ }
87622
+ if (spirits._typeof(options) !== 'object') {
87623
+ throw new Error('second argument options in followup is not an object type');
87624
+ }
87625
+
87626
+ // Advance object
87627
+ slot = {
87628
+ followup: {
87629
+ scheduled: MacroUtils.scheduledToUnix(options.scheduled)
87630
+ }
87631
+ };
87632
+ if (options.literal) {
87633
+ slot.followup.message = instruction;
87634
+ } else {
87635
+ slot.followup.instructions = instruction;
87636
+ }
87637
+ if (typeof options.overrideLock === 'boolean') {
87638
+ slot.followup.overrideLock = options.overrideLock;
87639
+ }
87640
+ if (options.cancelIf) {
87641
+ slot.followup.cancelIf = options.cancelIf;
87642
+ }
87643
+ } else {
87644
+ // Simple follow up
87645
+ slot = {
87646
+ followup: {
87647
+ instructions: instruction,
87648
+ scheduled: rest.data
87649
+ }
87650
+ };
87651
+ }
87652
+ slots.push(WorkflowResponseSlotSchema.parse(slot));
87653
+ return this;
87654
+ },
87655
+ /**
87656
+ * 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.
87657
+ * @overload
87658
+ * @param {string} instruction - The instruction to be anticipated as a string. When this is a string, `yes` and `no` must be provided as objects.
87659
+ * @param {object} yes - The object to process if the instruction is a string and the condition is met.
87660
+ * @param {object} no - The object to process if the instruction is a string and the condition is not met.
87661
+ *
87662
+ * @overload
87663
+ * @param {(Array<import('zod').infer<typeof import('../runtime/client/workflow.js').WorkflowResponseSlotBaseSchema> & {keywords: string[]}>)} instruction
87664
+ *
87665
+ * @return {EventMacros}
87666
+ */
87667
+ anticipate: function anticipate(instruction, yes, no) {
87668
+ var slot = {
87669
+ anticipate: []
87670
+ };
87671
+ if (Array.isArray(instruction)) {
87672
+ var _iterator = spirits._createForOfIteratorHelper(instruction),
87673
+ _step;
87674
+ try {
87675
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
87676
+ var _slot = _step.value;
87677
+ if (!Array.isArray(_slot.keywords) || _slot.keywords.length < 1) {
87678
+ throw new Error("Anticipate field .keywords should be an array of string, with more than one value");
87679
+ }
87680
+ slot.anticipate.push(_slot);
87681
+ }
87682
+ } catch (err) {
87683
+ _iterator.e(err);
87684
+ } finally {
87685
+ _iterator.f();
87686
+ }
87687
+ } else if (typeof instruction === 'string') {
87688
+ if (!yes) {
87689
+ throw new Error('Missing "yes" option for anticipate');
87690
+ }
87691
+ if (!no) {
87692
+ throw new Error('Missing "no" option for anticipate');
87693
+ }
87694
+ slot.anticipate = {
87695
+ did: instruction,
87696
+ yes: WorkflowResponseSlotBaseSchema.parse(yes),
87697
+ no: WorkflowResponseSlotBaseSchema.parse(no)
87698
+ };
87699
+ } else {
87700
+ throw new Error("Instruction is not of type \"string\" or \"array\"");
87701
+ }
87702
+ slots.push(WorkflowResponseSlotSchema.parse(slot));
87703
+ return this;
87704
+ },
87705
+ /**
87706
+ *
87707
+ * @param {string} instruction
87708
+ * @param {Object} [options]
87709
+ * @param {string} [options.id] - Unique ID for the instruction, this is used to remove the instruction later
87710
+ * @param {string} [options.persist] - if true, the instruction persists the conversation, if false the instruction will only last for 1 auto reply
87711
+ * @return {EventMacros}
87712
+ */
87713
+ instruct: function instruct(instruction) {
87714
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
87715
+ var slot = {};
87716
+ if (Object.keys(options).length > 0) {
87717
+ var instructionObj = {
87718
+ content: instruction
87719
+ };
87720
+ if (options.id) {
87721
+ instructionObj.id = options.id;
87722
+ }
87723
+ if (typeof options.persist === 'boolean') {
87724
+ instructionObj.persist = options.persist;
87725
+ }
87726
+ slot.instructions = instructionObj;
87727
+ } else {
87728
+ slot.instructions = instruction;
87729
+ }
87730
+ slots.push(WorkflowResponseSlotSchema.parse(slot));
87731
+ return this;
87732
+ },
87733
+ /**
87734
+ * If a manual message must be sent, you can use the `reply` macro
87735
+ * @param {string} message - the message to manually send to the user
87736
+ * @param {Object} [options]
87737
+ * @param {Date | string} [options.scheduled] - this will schedule the date to a specific provided date
87738
+ * @param {string} [options.delay] - delays the message return in seconds
87739
+ * @return {this}
87740
+ */
87741
+ reply: function reply(message) {
87742
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
87743
+ var slot = {
87744
+ message: message
87745
+ };
87746
+ if (Object.keys(options).length) {
87747
+ if ('scheduled' in options) {
87748
+ slot.scheduled = MacroUtils.scheduledToUnix(options.scheduled);
87749
+ }
87750
+ if ('delay' in options) {
87751
+ var delay = options.delay;
87752
+ if (typeof delay !== 'number') {
87753
+ throw new Error('.delay is not of type "number"');
87754
+ }
87755
+ slot.secondsDelay = delay;
87756
+ }
87757
+ }
87758
+ slots.push(WorkflowResponseSlotSchema.parse(slot));
87759
+ return this;
87760
+ },
87761
+ /**
87762
+ * 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.
87763
+ * @param {string} message - the message to forward to owner of persona
87764
+ * @param {Object} [options]
87765
+ * @param {'after-reply' | 'immediately'} [options.mode] - sets forward mode, defaults to "immediately"
87766
+ * @param {string} [options.to] - another phone or email to forward to instead of owner
87767
+ * @return {this}
87768
+ */
87769
+ forward: function forward(message) {
87770
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
87771
+ var slot;
87772
+ if (options && Object.keys(options).length) {
87773
+ slot = {
87774
+ forward: {
87775
+ note: message
87776
+ },
87777
+ forwardNote: message
87778
+ };
87779
+ if (options.to) {
87780
+ slot.forward.to = options.to;
87781
+ }
87782
+ if (options.mode) {
87783
+ slot.forward.mode = options.mode;
87784
+ }
87785
+ } else {
87786
+ slot = {
87787
+ forward: true,
87788
+ forwardNote: message
87789
+ };
87790
+ }
87791
+ slots.push(WorkflowResponseSlotSchema.parse(slot));
87792
+ return this;
87793
+ },
87794
+ /**
87795
+ *
87796
+ * @return {Array<(import('zod').infer<typeof import('../runtime/client/workflow.js').WorkflowResponseSlotSchema>)>}
87797
+ */
87798
+ toJSON: function toJSON() {
87799
+ var flush = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
87800
+ if (flush) {
87801
+ var copy = spirits._toConsumableArray(slots);
87802
+ slots = [];
87803
+ return copy;
87804
+ } else {
87805
+ return slots;
87806
+ }
87807
+ }
87808
+ };
87809
+ }
87810
+ var eventMacros = EventMacros();
87811
+ var instruct = eventMacros.instruct.bind(eventMacros);
87812
+ var forward = eventMacros.forward.bind(eventMacros);
87813
+ var reply = eventMacros.reply.bind(eventMacros);
87814
+
87815
+ var ContextExampleWithTrainingDataSchema = z.object({
87816
+ input: z.string(),
87817
+ output: z.array(z.record(z.any()))
87818
+ });
87819
+ var ContextExampleSchema = z.union([z.array(ContextExampleWithTrainingDataSchema), z.array(z.record(z.any()))]);
87820
+
87343
87821
  function loadEntityApiConfig$1(_x, _x2) {
87344
87822
  return _loadEntityApiConfig$1.apply(this, arguments);
87345
87823
  }
@@ -88534,7 +89012,7 @@ function report(config, logger) {
88534
89012
  logger.primary("Run ".concat(cyan('scout9 dev'), " to test your project locally"));
88535
89013
  }
88536
89014
 
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-212ef6be.js', document.baseURI).href)));
89015
+ 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-83755281.js', document.baseURI).href)));
88538
89016
  var __dirname$1 = path__default["default"].dirname(__filename$1);
88539
89017
  function zipDirectory(source, out) {
88540
89018
  var archive = archiver$1('tar', {
@@ -88749,7 +89227,7 @@ function _buildApp() {
88749
89227
  case 11:
88750
89228
  _context4.t0 = JSON;
88751
89229
  _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-212ef6be.js', document.baseURI).href))), 'utf-8');
89230
+ 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-83755281.js', document.baseURI).href))), 'utf-8');
88753
89231
  case 14:
88754
89232
  _context4.t1 = _context4.sent;
88755
89233
  packageTemplate = _context4.t0.parse.call(_context4.t0, _context4.t1);
@@ -89743,7 +90221,7 @@ function _loadAgentConfig() {
89743
90221
  }
89744
90222
  if (!agent.programmablePhoneNumber) {
89745
90223
  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."));
90224
+ 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
90225
  }
89748
90226
  if (agent.forwardPhone && agents.filter(function (a) {
89749
90227
  return a.forwardPhone && a.forwardPhone === agent.forwardPhone;
@@ -91833,12 +92311,17 @@ function json(data, init) {
91833
92311
  }
91834
92312
  var encoder = new TextEncoder();
91835
92313
 
92314
+ exports.ContextExampleSchema = ContextExampleSchema;
92315
+ exports.ContextExampleWithTrainingDataSchema = ContextExampleWithTrainingDataSchema;
91836
92316
  exports.ConversationContext = ConversationContext;
91837
92317
  exports.ConversationSchema = ConversationSchema;
91838
92318
  exports.EventResponse = EventResponse;
91839
92319
  exports.File = File;
92320
+ exports.FollowupBaseSchema = FollowupBaseSchema;
92321
+ exports.FollowupSchema = FollowupSchema;
91840
92322
  exports.FormData = FormData$2;
91841
92323
  exports.ForwardSchema = ForwardSchema;
92324
+ exports.InstructionObjectSchema = InstructionObjectSchema;
91842
92325
  exports.InstructionSchema = InstructionSchema;
91843
92326
  exports.IntentWorkflowEventSchema = IntentWorkflowEventSchema;
91844
92327
  exports.MessageSchema = MessageSchema;
@@ -91852,6 +92335,7 @@ exports.WorkflowResponseMessage = WorkflowResponseMessage;
91852
92335
  exports.WorkflowResponseMessageApiRequest = WorkflowResponseMessageApiRequest;
91853
92336
  exports.WorkflowResponseMessageApiResponse = WorkflowResponseMessageApiResponse;
91854
92337
  exports.WorkflowResponseSchema = WorkflowResponseSchema;
92338
+ exports.WorkflowResponseSlotBaseSchema = WorkflowResponseSlotBaseSchema;
91855
92339
  exports.WorkflowResponseSlotSchema = WorkflowResponseSlotSchema;
91856
92340
  exports.WorkflowsConfigurationSchema = WorkflowsConfigurationSchema;
91857
92341
  exports.agentBaseConfigurationSchema = agentBaseConfigurationSchema;
@@ -91859,6 +92343,7 @@ exports.agentConfigurationSchema = agentConfigurationSchema;
91859
92343
  exports.agentsBaseConfigurationSchema = agentsBaseConfigurationSchema;
91860
92344
  exports.agentsConfigurationSchema = agentsConfigurationSchema;
91861
92345
  exports.apiFunctionSchema = apiFunctionSchema;
92346
+ exports.build = build$1;
91862
92347
  exports.createMockAgent = createMockAgent;
91863
92348
  exports.createMockConversation = createMockConversation;
91864
92349
  exports.createMockCustomer = createMockCustomer;
@@ -91873,11 +92358,14 @@ exports.entityApiConfigurationSchema = entityApiConfigurationSchema;
91873
92358
  exports.entityConfigurationSchema = entityConfigurationSchema;
91874
92359
  exports.entityRootProjectConfigurationSchema = entityRootProjectConfigurationSchema;
91875
92360
  exports.eventResponseSchema = eventResponseSchema;
92361
+ exports.forward = forward;
91876
92362
  exports.getApiFunctionSchema = getApiFunctionSchema;
92363
+ exports.instruct = instruct;
91877
92364
  exports.json = json;
91878
92365
  exports.patchApiFunctionSchema = patchApiFunctionSchema;
91879
92366
  exports.postApiFunctionSchema = postApiFunctionSchema;
91880
92367
  exports.putApiFunctionSchema = putApiFunctionSchema;
91881
92368
  exports.queryApiFunctionSchema = queryApiFunctionSchema;
92369
+ exports.reply = reply;
91882
92370
  exports.run = run;
91883
92371
  exports.sendEvent = sendEvent;