@scout9/app 1.0.0-alpha.0.9.0 → 1.0.0-alpha.0.9.2
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/dist/{dev-024a0325.cjs → dev-d2855389.cjs} +1 -1
- package/dist/{index-93d877d8.cjs → index-fddbc695.cjs} +5 -5
- package/dist/index.cjs +2 -2
- package/dist/{multipart-parser-593e5511.cjs → multipart-parser-d542a32d.cjs} +2 -2
- package/dist/spirits.cjs +37 -59
- package/dist/testing-tools.cjs +1 -1
- package/package.json +1 -1
- package/src/testing-tools/spirits.js +5 -3
|
@@ -35338,7 +35338,7 @@ function _loadUserPackageJson() {
|
|
|
35338
35338
|
targetPkgUrl = isTest ? packageTestJsonUrl : packageJsonUrl;
|
|
35339
35339
|
_context2.t0 = JSON;
|
|
35340
35340
|
_context2.next = 10;
|
|
35341
|
-
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-
|
|
35341
|
+
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-d2855389.js', document.baseURI).href))), 'utf-8');
|
|
35342
35342
|
case 10:
|
|
35343
35343
|
_context2.t1 = _context2.sent;
|
|
35344
35344
|
pkg = _context2.t0.parse.call(_context2.t0, _context2.t1);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var _rollupPluginBabelHelpers = require("./_rollupPluginBabelHelpers-9c73c95c.cjs");
|
|
4
|
-
var dev = require("./dev-
|
|
4
|
+
var dev = require("./dev-d2855389.cjs");
|
|
5
5
|
var macros = require("./macros-77983cef.cjs");
|
|
6
6
|
var require$$0 = require('fs');
|
|
7
7
|
var require$$2$1 = require('events');
|
|
@@ -29483,7 +29483,7 @@ class Body {
|
|
|
29483
29483
|
}
|
|
29484
29484
|
const {
|
|
29485
29485
|
toFormData
|
|
29486
|
-
} = await Promise.resolve().then(function () { return require("./multipart-parser-
|
|
29486
|
+
} = await Promise.resolve().then(function () { return require("./multipart-parser-d542a32d.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-
|
|
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-fddbc695.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);
|
|
@@ -43176,7 +43176,7 @@ var ProjectFiles = /*#__PURE__*/function () {
|
|
|
43176
43176
|
return ProjectFiles;
|
|
43177
43177
|
}();
|
|
43178
43178
|
|
|
43179
|
-
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-
|
|
43179
|
+
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-fddbc695.js', document.baseURI).href)));
|
|
43180
43180
|
var __dirname$1 = path__default["default"].dirname(__filename$1);
|
|
43181
43181
|
function zipDirectory(source, out) {
|
|
43182
43182
|
var archive = archiver$1('tar', {
|
|
@@ -43391,7 +43391,7 @@ function _buildApp() {
|
|
|
43391
43391
|
case 11:
|
|
43392
43392
|
_context4.t0 = JSON;
|
|
43393
43393
|
_context4.next = 14;
|
|
43394
|
-
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-
|
|
43394
|
+
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-fddbc695.js', document.baseURI).href))), 'utf-8');
|
|
43395
43395
|
case 14:
|
|
43396
43396
|
_context4.t1 = _context4.sent;
|
|
43397
43397
|
packageTemplate = _context4.t0.parse.call(_context4.t0, _context4.t1);
|
package/dist/index.cjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require("./index-
|
|
6
|
-
var dev = require("./dev-
|
|
5
|
+
var index = require("./index-fddbc695.cjs");
|
|
6
|
+
var dev = require("./dev-d2855389.cjs");
|
|
7
7
|
require("./_rollupPluginBabelHelpers-9c73c95c.cjs");
|
|
8
8
|
require("./macros-77983cef.cjs");
|
|
9
9
|
require('fs');
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
require('node:fs');
|
|
4
4
|
require('node:path');
|
|
5
|
-
var index = require("./index-
|
|
5
|
+
var index = require("./index-fddbc695.cjs");
|
|
6
6
|
require("./_rollupPluginBabelHelpers-9c73c95c.cjs");
|
|
7
|
-
require("./dev-
|
|
7
|
+
require("./dev-d2855389.cjs");
|
|
8
8
|
require('util');
|
|
9
9
|
require('stream');
|
|
10
10
|
require('path');
|
package/dist/spirits.cjs
CHANGED
|
@@ -237,11 +237,11 @@ var Spirits = {
|
|
|
237
237
|
_slot,
|
|
238
238
|
slotId,
|
|
239
239
|
_tasks2,
|
|
240
|
+
_iterator4,
|
|
241
|
+
_step4,
|
|
242
|
+
instruction,
|
|
240
243
|
_iterator5,
|
|
241
244
|
_step5,
|
|
242
|
-
instruction,
|
|
243
|
-
_iterator6,
|
|
244
|
-
_step6,
|
|
245
245
|
_loop2,
|
|
246
246
|
manualMessageObj,
|
|
247
247
|
now,
|
|
@@ -257,8 +257,6 @@ var Spirits = {
|
|
|
257
257
|
_iterator3,
|
|
258
258
|
_step3,
|
|
259
259
|
newMessage,
|
|
260
|
-
_iterator4,
|
|
261
|
-
_step4,
|
|
262
260
|
transformResponse,
|
|
263
261
|
_agentMessages,
|
|
264
262
|
_lastAgentMessage,
|
|
@@ -772,10 +770,10 @@ var Spirits = {
|
|
|
772
770
|
_context4.next = 108;
|
|
773
771
|
break;
|
|
774
772
|
}
|
|
775
|
-
|
|
773
|
+
_iterator4 = _rollupPluginBabelHelpers._createForOfIteratorHelper(instructions);
|
|
776
774
|
try {
|
|
777
|
-
for (
|
|
778
|
-
instruction =
|
|
775
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
776
|
+
instruction = _step4.value;
|
|
779
777
|
if (typeof instruction === 'string') {
|
|
780
778
|
addInstruction(instruction, previousLockAttempt);
|
|
781
779
|
} else {
|
|
@@ -783,9 +781,9 @@ var Spirits = {
|
|
|
783
781
|
}
|
|
784
782
|
}
|
|
785
783
|
} catch (err) {
|
|
786
|
-
|
|
784
|
+
_iterator4.e(err);
|
|
787
785
|
} finally {
|
|
788
|
-
|
|
786
|
+
_iterator4.f();
|
|
789
787
|
}
|
|
790
788
|
_context4.next = 113;
|
|
791
789
|
break;
|
|
@@ -804,14 +802,14 @@ var Spirits = {
|
|
|
804
802
|
_context4.next = 130;
|
|
805
803
|
break;
|
|
806
804
|
}
|
|
807
|
-
|
|
805
|
+
_iterator5 = _rollupPluginBabelHelpers._createForOfIteratorHelper(removeInstructions);
|
|
808
806
|
_context4.prev = 115;
|
|
809
807
|
_loop2 = /*#__PURE__*/_rollupPluginBabelHelpers._regeneratorRuntime().mark(function _loop2() {
|
|
810
808
|
var instructionId, index;
|
|
811
809
|
return _rollupPluginBabelHelpers._regeneratorRuntime().wrap(function _loop2$(_context3) {
|
|
812
810
|
while (1) switch (_context3.prev = _context3.next) {
|
|
813
811
|
case 0:
|
|
814
|
-
instructionId =
|
|
812
|
+
instructionId = _step5.value;
|
|
815
813
|
index = messages.findIndex(function (m) {
|
|
816
814
|
return m.id === instructionId;
|
|
817
815
|
});
|
|
@@ -829,9 +827,9 @@ var Spirits = {
|
|
|
829
827
|
}
|
|
830
828
|
}, _loop2);
|
|
831
829
|
});
|
|
832
|
-
|
|
830
|
+
_iterator5.s();
|
|
833
831
|
case 118:
|
|
834
|
-
if ((
|
|
832
|
+
if ((_step5 = _iterator5.n()).done) {
|
|
835
833
|
_context4.next = 122;
|
|
836
834
|
break;
|
|
837
835
|
}
|
|
@@ -845,10 +843,10 @@ var Spirits = {
|
|
|
845
843
|
case 124:
|
|
846
844
|
_context4.prev = 124;
|
|
847
845
|
_context4.t3 = _context4["catch"](115);
|
|
848
|
-
|
|
846
|
+
_iterator5.e(_context4.t3);
|
|
849
847
|
case 127:
|
|
850
848
|
_context4.prev = 127;
|
|
851
|
-
|
|
849
|
+
_iterator5.f();
|
|
852
850
|
return _context4.finish(127);
|
|
853
851
|
case 130:
|
|
854
852
|
if (!manualMessage) {
|
|
@@ -935,7 +933,7 @@ var Spirits = {
|
|
|
935
933
|
// 5. Generate response
|
|
936
934
|
// If conversation previously locked, don't generate
|
|
937
935
|
if (input.conversation.locked) {
|
|
938
|
-
_context4.next =
|
|
936
|
+
_context4.next = 200;
|
|
939
937
|
break;
|
|
940
938
|
}
|
|
941
939
|
if (!((!conversation.locked || !hasNoInstructions) && !!hasNoCustomMessage)) {
|
|
@@ -1010,10 +1008,12 @@ var Spirits = {
|
|
|
1010
1008
|
})
|
|
1011
1009
|
// De-dupe by content (change the key if you want stricter uniqueness)
|
|
1012
1010
|
.reduce(function (acc, msg) {
|
|
1013
|
-
var key = String(msg.content); // e.g. `${msg.role}::${msg.content}` for stronger uniqueness
|
|
1011
|
+
var key = String(msg.content || (msg.tool_calls ? JSON.stringify(msg.tool_calls) : '')); // e.g. `${msg.role}::${msg.content}` for stronger uniqueness
|
|
1014
1012
|
if (!acc.seen.has(key)) {
|
|
1015
1013
|
acc.seen.add(key);
|
|
1016
1014
|
acc.items.push(msg);
|
|
1015
|
+
} else {
|
|
1016
|
+
console.warn("Duplicate message removed: ".concat(JSON.stringify(msg)));
|
|
1017
1017
|
}
|
|
1018
1018
|
return acc;
|
|
1019
1019
|
}, {
|
|
@@ -1064,20 +1064,11 @@ var Spirits = {
|
|
|
1064
1064
|
onStatus('generate', 'ignored');
|
|
1065
1065
|
case 179:
|
|
1066
1066
|
if (!(messagesToTransform.length && transformer)) {
|
|
1067
|
-
_context4.next =
|
|
1067
|
+
_context4.next = 197;
|
|
1068
1068
|
break;
|
|
1069
1069
|
}
|
|
1070
1070
|
_context4.prev = 180;
|
|
1071
|
-
|
|
1072
|
-
_context4.prev = 182;
|
|
1073
|
-
_iterator4.s();
|
|
1074
|
-
case 184:
|
|
1075
|
-
if ((_step4 = _iterator4.n()).done) {
|
|
1076
|
-
_context4.next = 195;
|
|
1077
|
-
break;
|
|
1078
|
-
}
|
|
1079
|
-
_step4.value;
|
|
1080
|
-
_context4.next = 188;
|
|
1071
|
+
_context4.next = 183;
|
|
1081
1072
|
return wrapStep(transformer({
|
|
1082
1073
|
message: messagesToTransform,
|
|
1083
1074
|
persona: persona,
|
|
@@ -1085,7 +1076,7 @@ var Spirits = {
|
|
|
1085
1076
|
messages: messages,
|
|
1086
1077
|
context: context
|
|
1087
1078
|
}), 'transform');
|
|
1088
|
-
case
|
|
1079
|
+
case 183:
|
|
1089
1080
|
transformResponse = _context4.sent;
|
|
1090
1081
|
progress('Generated response', 'success', undefined, undefined);
|
|
1091
1082
|
// Check if already had message
|
|
@@ -1105,44 +1096,31 @@ var Spirits = {
|
|
|
1105
1096
|
});
|
|
1106
1097
|
progress('Added agent message', 'info', 'ADD_MESSAGE', messages[messages.length - 1]);
|
|
1107
1098
|
}
|
|
1108
|
-
|
|
1109
|
-
|
|
1099
|
+
|
|
1100
|
+
// }
|
|
1101
|
+
_context4.next = 195;
|
|
1110
1102
|
break;
|
|
1103
|
+
case 190:
|
|
1104
|
+
_context4.prev = 190;
|
|
1105
|
+
_context4.t6 = _context4["catch"](180);
|
|
1106
|
+
console.error("Locking conversation, error transforming response: ".concat(_context4.t6.message));
|
|
1107
|
+
conversation = lockConversation(conversation, 'API: ' + _context4.t6.message);
|
|
1108
|
+
onError(_context4.t6);
|
|
1111
1109
|
case 195:
|
|
1112
|
-
_context4.next =
|
|
1110
|
+
_context4.next = 198;
|
|
1113
1111
|
break;
|
|
1114
1112
|
case 197:
|
|
1115
|
-
_context4.prev = 197;
|
|
1116
|
-
_context4.t6 = _context4["catch"](182);
|
|
1117
|
-
_iterator4.e(_context4.t6);
|
|
1118
|
-
case 200:
|
|
1119
|
-
_context4.prev = 200;
|
|
1120
|
-
_iterator4.f();
|
|
1121
|
-
return _context4.finish(200);
|
|
1122
|
-
case 203:
|
|
1123
|
-
_context4.next = 210;
|
|
1124
|
-
break;
|
|
1125
|
-
case 205:
|
|
1126
|
-
_context4.prev = 205;
|
|
1127
|
-
_context4.t7 = _context4["catch"](180);
|
|
1128
|
-
console.error("Locking conversation, error transforming response: ".concat(_context4.t7.message));
|
|
1129
|
-
conversation = lockConversation(conversation, 'API: ' + _context4.t7.message);
|
|
1130
|
-
onError(_context4.t7);
|
|
1131
|
-
case 210:
|
|
1132
|
-
_context4.next = 213;
|
|
1133
|
-
break;
|
|
1134
|
-
case 212:
|
|
1135
1113
|
if (messagesToTransform.length) {
|
|
1136
1114
|
console.warn("No transformer provided");
|
|
1137
1115
|
onStatus('transform', 'ignored');
|
|
1138
1116
|
}
|
|
1139
|
-
case
|
|
1140
|
-
_context4.next =
|
|
1117
|
+
case 198:
|
|
1118
|
+
_context4.next = 202;
|
|
1141
1119
|
break;
|
|
1142
|
-
case
|
|
1120
|
+
case 200:
|
|
1143
1121
|
onStatus('generate', 'ignored');
|
|
1144
1122
|
onStatus('transform', 'ignored');
|
|
1145
|
-
case
|
|
1123
|
+
case 202:
|
|
1146
1124
|
progress('Parsing message', 'info', 'SET_PROCESSING', null);
|
|
1147
1125
|
return _context4.abrupt("return", {
|
|
1148
1126
|
conversation: {
|
|
@@ -1166,11 +1144,11 @@ var Spirits = {
|
|
|
1166
1144
|
followup: followup,
|
|
1167
1145
|
entityContextUpsert: entityContextUpsert
|
|
1168
1146
|
});
|
|
1169
|
-
case
|
|
1147
|
+
case 204:
|
|
1170
1148
|
case "end":
|
|
1171
1149
|
return _context4.stop();
|
|
1172
1150
|
}
|
|
1173
|
-
}, _callee2, null, [[51, 60, 63, 66], [77, 152, 155, 158], [115, 124, 127, 130], [161, 171], [180,
|
|
1151
|
+
}, _callee2, null, [[51, 60, 63, 66], [77, 152, 155, 158], [115, 124, 127, 130], [161, 171], [180, 190]]);
|
|
1174
1152
|
}));
|
|
1175
1153
|
function customer(_x) {
|
|
1176
1154
|
return _customer.apply(this, arguments);
|
package/dist/testing-tools.cjs
CHANGED
package/package.json
CHANGED
|
@@ -764,10 +764,12 @@ export const Spirits = {
|
|
|
764
764
|
// De-dupe by content (change the key if you want stricter uniqueness)
|
|
765
765
|
.reduce(
|
|
766
766
|
(acc, msg) => {
|
|
767
|
-
const key = String(msg.content); // e.g. `${msg.role}::${msg.content}` for stronger uniqueness
|
|
767
|
+
const key = String(msg.content || (msg.tool_calls ? JSON.stringify(msg.tool_calls) : '')); // e.g. `${msg.role}::${msg.content}` for stronger uniqueness
|
|
768
768
|
if (!acc.seen.has(key)) {
|
|
769
769
|
acc.seen.add(key);
|
|
770
770
|
acc.items.push(msg);
|
|
771
|
+
} else {
|
|
772
|
+
console.warn(`Duplicate message removed: ${JSON.stringify(msg)}`);
|
|
771
773
|
}
|
|
772
774
|
return acc;
|
|
773
775
|
},
|
|
@@ -809,7 +811,7 @@ export const Spirits = {
|
|
|
809
811
|
|
|
810
812
|
if (messagesToTransform.length && transformer) {
|
|
811
813
|
try {
|
|
812
|
-
for (const messageToTransform of messagesToTransform) {
|
|
814
|
+
// for (const messageToTransform of messagesToTransform) {
|
|
813
815
|
const transformResponse = await wrapStep(transformer({
|
|
814
816
|
message: messagesToTransform,
|
|
815
817
|
persona,
|
|
@@ -835,7 +837,7 @@ export const Spirits = {
|
|
|
835
837
|
progress('Added agent message', 'info', 'ADD_MESSAGE', messages[messages.length - 1]);
|
|
836
838
|
}
|
|
837
839
|
|
|
838
|
-
}
|
|
840
|
+
// }
|
|
839
841
|
} catch (e) {
|
|
840
842
|
console.error(`Locking conversation, error transforming response: ${e.message}`);
|
|
841
843
|
conversation = lockConversation(conversation, 'API: ' + e.message);
|