@scout9/app 1.0.0-alpha.0.4.8 → 1.0.0-alpha.0.4.9

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-5c9243a1.cjs");
3
+ var spirits = require("./spirits-8225c9fd.cjs");
4
4
  var require$$0$4 = require('util');
5
5
  var require$$0$3 = require('stream');
6
6
  var require$$1 = require('path');
@@ -23,7 +23,7 @@ var Stream = require('node:stream');
23
23
  var node_string_decoder = require('node:string_decoder');
24
24
  var readline = require('node:readline');
25
25
  var process$2 = require('node:process');
26
- var macros = require("./macros-e4105c56.cjs");
26
+ var macros = require("./macros-c9b4654d.cjs");
27
27
  var node_os = require('node:os');
28
28
  var promises = require('fs/promises');
29
29
 
@@ -29939,7 +29939,7 @@ common.createRequestFunction = createRequestFunction;
29939
29939
  var configuration = {};
29940
29940
 
29941
29941
  var name$1 = "@scout9/admin";
29942
- var version$2 = "1.0.0-alpha.0.0.51";
29942
+ var version$2 = "1.0.0-alpha.0.0.52";
29943
29943
  var description$1 = "";
29944
29944
  var main$2 = "./build/index.js";
29945
29945
  var types$1 = "./build/index.d.ts";
@@ -35164,7 +35164,7 @@ function _loadUserPackageJson() {
35164
35164
  targetPkgUrl = isTest ? packageTestJsonUrl : packageJsonUrl;
35165
35165
  _context2.t0 = JSON;
35166
35166
  _context2.next = 10;
35167
- 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('dev-332ccb5a.js', document.baseURI).href))), 'utf-8');
35167
+ 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('dev-51604173.js', document.baseURI).href))), 'utf-8');
35168
35168
  case 10:
35169
35169
  _context2.t1 = _context2.sent;
35170
35170
  pkg = _context2.t0.parse.call(_context2.t0, _context2.t1);
@@ -42651,7 +42651,9 @@ var Scout9Test = /*#__PURE__*/function () {
42651
42651
  this._cwd = cwd;
42652
42652
  this._src = src;
42653
42653
  this._mode = mode;
42654
- this.context = context || {};
42654
+ this.context = spirits._objectSpread2(spirits._objectSpread2({}, context || {}), {}, {
42655
+ __no_cache: true
42656
+ });
42655
42657
  this.conversation = conversation;
42656
42658
  if (api) {
42657
42659
  this._api = api;
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var spirits = require("./spirits-5c9243a1.cjs");
4
- var dev = require("./dev-332ccb5a.cjs");
5
- var macros = require("./macros-e4105c56.cjs");
3
+ var spirits = require("./spirits-8225c9fd.cjs");
4
+ var dev = require("./dev-51604173.cjs");
5
+ var macros = require("./macros-c9b4654d.cjs");
6
6
  var require$$0 = require('fs');
7
7
  var require$$2$1 = require('events');
8
8
  var require$$1 = require('path');
@@ -29483,7 +29483,7 @@ class Body {
29483
29483
  }
29484
29484
  const {
29485
29485
  toFormData
29486
- } = await Promise.resolve().then(function () { return require("./multipart-parser-948d98ce.cjs"); });
29486
+ } = await Promise.resolve().then(function () { return require("./multipart-parser-24b2e9b9.cjs"); });
29487
29487
  return toFormData(this.body, ct);
29488
29488
  }
29489
29489
 
@@ -41884,7 +41884,7 @@ function _loadUserPackageJson() {
41884
41884
  targetPkgUrl = isTest ? packageTestJsonUrl : packageJsonUrl;
41885
41885
  _context.t0 = JSON;
41886
41886
  _context.next = 10;
41887
- 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('index-2d62ac36.js', document.baseURI).href))), 'utf-8');
41887
+ 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('index-2aa6f869.js', document.baseURI).href))), 'utf-8');
41888
41888
  case 10:
41889
41889
  _context.t1 = _context.sent;
41890
41890
  pkg = _context.t0.parse.call(_context.t0, _context.t1);
@@ -42011,6 +42011,7 @@ function did(_x) {
42011
42011
  */
42012
42012
  function _did() {
42013
42013
  _did = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee(prompt) {
42014
+ var _event$context;
42014
42015
  var convoId, event, _yield$Scout9Api$did$, value;
42015
42016
  return spirits._regeneratorRuntime().wrap(function _callee$(_context2) {
42016
42017
  while (1) switch (_context2.prev = _context2.next) {
@@ -42031,7 +42032,8 @@ function _did() {
42031
42032
  })).did(processPayload({
42032
42033
  prompt: prompt,
42033
42034
  convoId: convoId,
42034
- event: event
42035
+ event: event,
42036
+ cache: !((_event$context = event.context) !== null && _event$context !== void 0 && _event$context.__no_cache)
42035
42037
  })).then(handleAxiosResponse)["catch"](function (err) {
42036
42038
  console.error('Error in did macro', err);
42037
42039
  throw err;
@@ -42076,6 +42078,7 @@ function does(_x2) {
42076
42078
  */
42077
42079
  function _does() {
42078
42080
  _does = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee2(prompt) {
42081
+ var _event$context2;
42079
42082
  var relation,
42080
42083
  convoId,
42081
42084
  event,
@@ -42103,7 +42106,8 @@ function _does() {
42103
42106
  prompt: prompt,
42104
42107
  convoId: convoId,
42105
42108
  role: relation,
42106
- event: event
42109
+ event: event,
42110
+ cache: !((_event$context2 = event.context) !== null && _event$context2 !== void 0 && _event$context2.__no_cache)
42107
42111
  })).then(handleAxiosResponse)["catch"](function (err) {
42108
42112
  console.error('Error in did macro', err);
42109
42113
  throw err;
@@ -42125,6 +42129,7 @@ function context(_x3, _x4) {
42125
42129
  }
42126
42130
  function _context() {
42127
42131
  _context = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee3(prompt, examples) {
42132
+ var _event$context3;
42128
42133
  var convoId, event, _yield$Scout9Api$capt, value;
42129
42134
  return spirits._regeneratorRuntime().wrap(function _callee3$(_context4) {
42130
42135
  while (1) switch (_context4.prev = _context4.next) {
@@ -42146,7 +42151,8 @@ function _context() {
42146
42151
  prompt: prompt,
42147
42152
  examples: examples,
42148
42153
  convoId: convoId,
42149
- event: event
42154
+ event: event,
42155
+ cache: !((_event$context3 = event.context) !== null && _event$context3 !== void 0 && _event$context3.__no_cache)
42150
42156
  })).then(handleAxiosResponse)["catch"](function (err) {
42151
42157
  console.error('Error in context macro', err);
42152
42158
  throw err;
@@ -43158,7 +43164,7 @@ var ProjectFiles = /*#__PURE__*/function () {
43158
43164
  return ProjectFiles;
43159
43165
  }();
43160
43166
 
43161
- var __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index-2d62ac36.js', document.baseURI).href)));
43167
+ var __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index-2aa6f869.js', document.baseURI).href)));
43162
43168
  var __dirname$1 = path__default["default"].dirname(__filename$1);
43163
43169
  function zipDirectory(source, out) {
43164
43170
  var archive = archiver$1('tar', {
@@ -43373,7 +43379,7 @@ function _buildApp() {
43373
43379
  case 11:
43374
43380
  _context4.t0 = JSON;
43375
43381
  _context4.next = 14;
43376
- 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('index-2d62ac36.js', document.baseURI).href))), 'utf-8');
43382
+ 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('index-2aa6f869.js', document.baseURI).href))), 'utf-8');
43377
43383
  case 14:
43378
43384
  _context4.t1 = _context4.sent;
43379
43385
  packageTemplate = _context4.t0.parse.call(_context4.t0, _context4.t1);
package/dist/index.cjs CHANGED
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require("./index-2d62ac36.cjs");
6
- var dev = require("./dev-332ccb5a.cjs");
7
- require("./spirits-5c9243a1.cjs");
8
- require("./macros-e4105c56.cjs");
5
+ var index = require("./index-2aa6f869.cjs");
6
+ var dev = require("./dev-51604173.cjs");
7
+ require("./spirits-8225c9fd.cjs");
8
+ require("./macros-c9b4654d.cjs");
9
9
  require('fs');
10
10
  require('events');
11
11
  require('path');
@@ -4131,7 +4131,7 @@ var PersonasConfigurationSchema = z.array(PersonaConfigurationSchema);
4131
4131
  var AgentsSchema = z.array(AgentSchema);
4132
4132
  var PersonasSchema = z.array(PersonaSchema);
4133
4133
 
4134
- var ConversationContext = z.record(z.union([z.string(), z.number(), z["boolean"](), z["null"](), z.array(z.union([z.string(), z.number(), z["boolean"](), z["null"]()]))]));
4134
+ var ConversationContext = z.record(z.union([z.any(), z.string(), z.number(), z["boolean"](), z["null"](), z.array(z.union([z.string(), z.number(), z["boolean"](), z["null"]()]))]));
4135
4135
  var ConversationAnticipateSchema = z.object({
4136
4136
  type: z["enum"](['did', 'literal', 'context'], {
4137
4137
  description: "Determines the runtime to address the next response"
@@ -2,9 +2,9 @@
2
2
 
3
3
  require('node:fs');
4
4
  require('node:path');
5
- var index = require("./index-2d62ac36.cjs");
6
- require("./spirits-5c9243a1.cjs");
7
- require("./dev-332ccb5a.cjs");
5
+ var index = require("./index-2aa6f869.cjs");
6
+ require("./spirits-8225c9fd.cjs");
7
+ require("./dev-51604173.cjs");
8
8
  require('util');
9
9
  require('stream');
10
10
  require('path');
@@ -25,7 +25,7 @@ require('node:stream');
25
25
  require('node:string_decoder');
26
26
  require('node:readline');
27
27
  require('node:process');
28
- require("./macros-e4105c56.cjs");
28
+ require("./macros-c9b4654d.cjs");
29
29
  require('node:os');
30
30
  require('fs/promises');
31
31
  require('constants');
package/dist/schemas.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var macros = require("./macros-e4105c56.cjs");
5
+ var macros = require("./macros-c9b4654d.cjs");
6
6
 
7
7
 
8
8
 
@@ -1116,7 +1116,7 @@ var Spirits = {
1116
1116
  _context2.next = 84;
1117
1117
  break;
1118
1118
  case 79:
1119
- if (!(_typeof(instructions) === 'object' && 'content' in instructions && 'id' in instructions)) {
1119
+ if (!(_typeof(instructions) === 'object' && 'content' in instructions)) {
1120
1120
  _context2.next = 83;
1121
1121
  break;
1122
1122
  }
@@ -1124,7 +1124,7 @@ var Spirits = {
1124
1124
  _context2.next = 84;
1125
1125
  break;
1126
1126
  case 83:
1127
- throw new Error('SpiritsError: instructions must be a string or array or {content: "", id: ""}');
1127
+ throw new Error("SpiritsError: instructions must be a string or array or {content: \"<instruction>\"}, got: ".concat(JSON.stringify(instructions)));
1128
1128
  case 84:
1129
1129
  if (!removeInstructions) {
1130
1130
  _context2.next = 101;
package/dist/spirits.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var spirits = require("./spirits-5c9243a1.cjs");
5
+ var spirits = require("./spirits-8225c9fd.cjs");
6
6
 
7
7
 
8
8
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var dev = require("./dev-332ccb5a.cjs");
6
- require("./spirits-5c9243a1.cjs");
5
+ var dev = require("./dev-51604173.cjs");
6
+ require("./spirits-8225c9fd.cjs");
7
7
  require('util');
8
8
  require('stream');
9
9
  require('path');
@@ -26,7 +26,7 @@ require('node:stream');
26
26
  require('node:string_decoder');
27
27
  require('node:readline');
28
28
  require('node:process');
29
- require("./macros-e4105c56.cjs");
29
+ require("./macros-c9b4654d.cjs");
30
30
  require('node:os');
31
31
  require('fs/promises');
32
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scout9/app",
3
- "version": "1.0.0-alpha.0.4.8",
3
+ "version": "1.0.0-alpha.0.4.9",
4
4
  "description": "Build and deploy your Scout9 app for SMS auto replies",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -44,7 +44,8 @@ export async function did(prompt) {
44
44
  const {value} = (await (new Scout9Api(new Configuration({apiKey: process.env.SCOUT9_API_KEY}))).did(processPayload({
45
45
  prompt,
46
46
  convoId,
47
- event
47
+ event,
48
+ cache: !event.context?.__no_cache
48
49
  }))
49
50
  .then(handleAxiosResponse)
50
51
  .catch((err) => {
@@ -76,7 +77,8 @@ export async function does(prompt, relation = 'customer') {
76
77
  prompt,
77
78
  convoId,
78
79
  role: relation,
79
- event
80
+ event,
81
+ cache: !event.context?.__no_cache
80
82
  })
81
83
  )
82
84
  .then(handleAxiosResponse)
@@ -122,7 +124,8 @@ export async function context(prompt, examples) {
122
124
  prompt,
123
125
  examples,
124
126
  convoId,
125
- event
127
+ event,
128
+ cache: !event.context?.__no_cache
126
129
  }))
127
130
  .then(handleAxiosResponse)
128
131
  .catch((err) => {
@@ -3,6 +3,7 @@ import { zId } from './utils.js';
3
3
 
4
4
  export const ConversationContext = z.record(
5
5
  z.union([
6
+ z.any(),
6
7
  z.string(),
7
8
  z.number(),
8
9
  z.boolean(),
@@ -123,7 +123,7 @@ export class Scout9Test {
123
123
  this._cwd = cwd;
124
124
  this._src = src;
125
125
  this._mode = mode;
126
- this.context = context || {};
126
+ this.context = {...(context || {}), __no_cache: true};
127
127
  this.conversation = conversation;
128
128
  if (api) {
129
129
  this._api = api;
@@ -470,10 +470,10 @@ export const Spirits = {
470
470
  addInstruction(instruction.content, previousLockAttempt, instruction.id);
471
471
  }
472
472
  }
473
- } else if (typeof instructions === 'object' && 'content' in instructions && 'id' in instructions) {
473
+ } else if (typeof instructions === 'object' && 'content' in instructions) {
474
474
  addInstruction(instructions.content, previousLockAttempt, instructions.id);
475
475
  } else {
476
- throw new Error('SpiritsError: instructions must be a string or array or {content: "", id: ""}');
476
+ throw new Error(`SpiritsError: instructions must be a string or array or {content: "<instruction>"}, got: ${JSON.stringify(instructions)}`);
477
477
  }
478
478
  }
479
479