jsfe 1.86.0 → 1.86.1
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.
|
@@ -20,8 +20,11 @@ export function conversationCopy(turns: any, language?: string): string;
|
|
|
20
20
|
/**
|
|
21
21
|
* The conversation as "role: text" lines, one per turn, in order: the same text the host's flat chat history has
|
|
22
22
|
* always carried (ChatContextManager.messagesWithRole), so a note built from it reads as before.
|
|
23
|
+
* `maxLength` (optional, for a field with a length limit: a CRM description takes 2,000 characters, prod 2026-11-20): the
|
|
24
|
+
* latest whole turns that fit, after a line saying earlier turns were left out; a last turn longer than the room keeps its
|
|
25
|
+
* end. Without it the whole conversation, as before.
|
|
23
26
|
*/
|
|
24
|
-
export function chatTranscript(turns: any): string;
|
|
27
|
+
export function chatTranscript(turns: any, maxLength: any): string;
|
|
25
28
|
/**
|
|
26
29
|
* A flow's declared sendable: `sendable: {key, label, label_es?, media?}` on its definition means the caller may ask for it at
|
|
27
30
|
* any time (a statement nobody has produced yet), and that flow is its sender. → the problem with it, or '' when valid.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendables.d.ts","sourceRoot":"","sources":["../../src/helpers/sendables.js"],"names":[],"mappings":"AA2BA;;;;GAIG;AACH,kEAqCC;AAED;;;;;;GAMG;AACH,6CAYC;AAED;;;GAGG;AACH,wEAOC;
|
|
1
|
+
{"version":3,"file":"sendables.d.ts","sourceRoot":"","sources":["../../src/helpers/sendables.js"],"names":[],"mappings":"AA2BA;;;;GAIG;AACH,kEAqCC;AAED;;;;;;GAMG;AACH,6CAYC;AAED;;;GAGG;AACH,wEAOC;AAGD;;;;;;GAMG;AACH,mEAwBC;AAED;;;GAGG;AACH,gEAeC;AAED;;;;GAIG;AACH,oEAsBC;AA5KD,8GAA8G;AAC9G,+BAAgC,cAAc,CAAC"}
|
|
@@ -109,13 +109,38 @@ export function conversationCopy(turns, language = 'en') {
|
|
|
109
109
|
return '';
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
+
const OMITTED = '[earlier turns omitted]';
|
|
112
113
|
/**
|
|
113
114
|
* The conversation as "role: text" lines, one per turn, in order: the same text the host's flat chat history has
|
|
114
115
|
* always carried (ChatContextManager.messagesWithRole), so a note built from it reads as before.
|
|
116
|
+
* `maxLength` (optional, for a field with a length limit: a CRM description takes 2,000 characters, prod 2026-11-20): the
|
|
117
|
+
* latest whole turns that fit, after a line saying earlier turns were left out; a last turn longer than the room keeps its
|
|
118
|
+
* end. Without it the whole conversation, as before.
|
|
115
119
|
*/
|
|
116
|
-
export function chatTranscript(turns) {
|
|
120
|
+
export function chatTranscript(turns, maxLength) {
|
|
117
121
|
if (Array.isArray(turns)) {
|
|
118
|
-
|
|
122
|
+
const lines = turns.filter((turn) => turn && typeof turn.role === 'string').map((turn) => `${turn.role}: ${turn.text ?? ''}`);
|
|
123
|
+
const whole = lines.join('\n');
|
|
124
|
+
const max = Number(maxLength);
|
|
125
|
+
if (maxLength === undefined || maxLength === null || !Number.isFinite(max) || whole.length <= max) {
|
|
126
|
+
return whole;
|
|
127
|
+
}
|
|
128
|
+
else if (max <= OMITTED.length + 1) {
|
|
129
|
+
return whole.slice(whole.length - Math.max(0, Math.floor(max)));
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
const room = Math.floor(max) - OMITTED.length - 1;
|
|
133
|
+
const kept = [];
|
|
134
|
+
let used = 0;
|
|
135
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
136
|
+
const cost = lines[i].length + (kept.length ? 1 : 0);
|
|
137
|
+
if (used + cost > room)
|
|
138
|
+
break;
|
|
139
|
+
kept.unshift(lines[i]);
|
|
140
|
+
used += cost;
|
|
141
|
+
}
|
|
142
|
+
return `${OMITTED}\n${kept.length ? kept.join('\n') : lines[lines.length - 1].slice(lines[lines.length - 1].length - room)}`;
|
|
143
|
+
}
|
|
119
144
|
}
|
|
120
145
|
else {
|
|
121
146
|
return '';
|
package/dist/runtime-identity.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const JSFE_RUNTIME_FINGERPRINT = "sha256:
|
|
1
|
+
export const JSFE_RUNTIME_FINGERPRINT = "sha256:6b12bdc47c99a1718052fbc4918dc8b7762c433141e00d68ff187a55087a4eff";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsfe",
|
|
3
|
-
"version": "1.86.
|
|
3
|
+
"version": "1.86.1",
|
|
4
4
|
"description": "TypeScript workflow engine for conversational/automation apps: multi-flow orchestration, interrupt/resume, stack-based control, robust errors, and flexible tool/REST integration.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Ron Pinkas",
|