@scout9/app 1.0.0-alpha.0.6.5 → 1.0.0-alpha.0.6.7
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-6e60a643.cjs → dev-197a7adb.cjs} +3 -3
- package/dist/{index-bf3ce1b6.cjs → index-1010a60c.cjs} +7 -7
- package/dist/index.cjs +4 -4
- package/dist/{macros-1a4fd407.cjs → macros-85a033b9.cjs} +26 -6
- package/dist/{multipart-parser-13478cb7.cjs → multipart-parser-0d83aaf8.cjs} +4 -4
- package/dist/schemas.cjs +3 -1
- package/dist/{spirits-985e6711.cjs → spirits-9719ae4f.cjs} +73 -57
- package/dist/spirits.cjs +1 -1
- package/dist/testing-tools.cjs +3 -3
- package/package.json +1 -1
- package/src/public.d.ts +4 -16
- package/src/runtime/schemas/workflow.js +35 -6
- package/src/testing-tools/spirits.js +16 -6
- package/types/index.d.ts +3052 -504
- package/types/index.d.ts.map +4 -2
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* @property {string} id
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
6
|
/**
|
|
8
7
|
* Represents a change with before and after states of a given type.
|
|
9
8
|
* @template Type The type of the before and after properties.
|
|
@@ -138,6 +137,8 @@ export const Spirits = {
|
|
|
138
137
|
conversation: conversationBefore
|
|
139
138
|
} = input;
|
|
140
139
|
let {conversation, messages, context, message} = input;
|
|
140
|
+
|
|
141
|
+
// Storing post process events here
|
|
141
142
|
const followup = [];
|
|
142
143
|
const entityContextUpsert = [];
|
|
143
144
|
|
|
@@ -521,15 +522,24 @@ export const Spirits = {
|
|
|
521
522
|
}
|
|
522
523
|
|
|
523
524
|
if (manualMessage) {
|
|
525
|
+
|
|
526
|
+
/** @type {import('@scout9/app').Message} */
|
|
524
527
|
let manualMessageObj = {
|
|
525
|
-
id: idGenerator('
|
|
526
|
-
role: 'agent',
|
|
527
|
-
content:
|
|
528
|
+
id: idGenerator('persona'),
|
|
529
|
+
role: 'agent', // @TODO switch role to persona
|
|
530
|
+
content: '',
|
|
528
531
|
time: new Date().toISOString()
|
|
529
532
|
};
|
|
530
|
-
if (typeof manualMessage
|
|
531
|
-
|
|
533
|
+
if (typeof manualMessage === 'object') {
|
|
534
|
+
Object.assign(manualMessageObj, manualMessage);
|
|
535
|
+
manualMessageObj.role = 'agent';
|
|
536
|
+
manualMessageObj.time = new Date().toISOString();
|
|
537
|
+
} else if (typeof manualMessage === 'string') {
|
|
538
|
+
manualMessageObj.content = manualMessage;
|
|
539
|
+
} else {
|
|
540
|
+
throw new Error('Manual message must be of type "string" or "DirectMessage"');
|
|
532
541
|
}
|
|
542
|
+
|
|
533
543
|
if (scheduled) {
|
|
534
544
|
manualMessageObj.time = new Date(scheduled * 1000).toISOString();
|
|
535
545
|
manualMessageObj.scheduled = manualMessageObj.time;
|