@genesislcap/ai-assistant 15.6.0 → 15.6.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/chat-driver.cjs +6 -1
- package/dist/chat-driver.cjs.map +2 -2
- package/dist/chat-driver.mjs +6 -1
- package/dist/chat-driver.mjs.map +2 -2
- package/dist/dts/utils/condense-history.d.ts +4 -0
- package/dist/dts/utils/condense-history.d.ts.map +1 -1
- package/dist/esm/utils/condense-history.js +18 -3
- package/dist/esm/utils/condense-history.test.js +30 -0
- package/package.json +17 -17
- package/src/utils/condense-history.test.ts +63 -0
- package/src/utils/condense-history.ts +26 -3
package/dist/chat-driver.mjs
CHANGED
|
@@ -2793,6 +2793,9 @@ function triggerLabel(trigger) {
|
|
|
2793
2793
|
function estimateTokensSaved(origLen, stubLen) {
|
|
2794
2794
|
return Math.max(0, Math.ceil((origLen - stubLen) / APPROX_CHARS_PER_TOKEN));
|
|
2795
2795
|
}
|
|
2796
|
+
function marksDiscontinuity(kind) {
|
|
2797
|
+
return kind === "agentEnd" || kind === "phaseEnd";
|
|
2798
|
+
}
|
|
2796
2799
|
function applyCondensation(history, policies, ctx, onCondensed) {
|
|
2797
2800
|
if (policies.size === 0) return history;
|
|
2798
2801
|
const triggersOf = (entry) => Array.isArray(entry.policy.on) ? entry.policy.on : [entry.policy.on];
|
|
@@ -2832,7 +2835,9 @@ function applyCondensation(history, policies, ctx, onCondensed) {
|
|
|
2832
2835
|
return latestByKey.get(trig.by) !== toolCallId;
|
|
2833
2836
|
}
|
|
2834
2837
|
};
|
|
2835
|
-
const firstFired = (toolCallId, entry) =>
|
|
2838
|
+
const firstFired = (toolCallId, entry) => triggersOf(entry).find(
|
|
2839
|
+
(t) => (marksDiscontinuity(t.kind) || withinBatch(entry)) && triggerFires(toolCallId, entry, t)
|
|
2840
|
+
);
|
|
2836
2841
|
return history.map((msg) => {
|
|
2837
2842
|
if (msg.toolCalls?.length) {
|
|
2838
2843
|
let changed = false;
|