@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.cjs
CHANGED
|
@@ -2840,6 +2840,9 @@ function triggerLabel(trigger) {
|
|
|
2840
2840
|
function estimateTokensSaved(origLen, stubLen) {
|
|
2841
2841
|
return Math.max(0, Math.ceil((origLen - stubLen) / APPROX_CHARS_PER_TOKEN));
|
|
2842
2842
|
}
|
|
2843
|
+
function marksDiscontinuity(kind) {
|
|
2844
|
+
return kind === "agentEnd" || kind === "phaseEnd";
|
|
2845
|
+
}
|
|
2843
2846
|
function applyCondensation(history, policies, ctx, onCondensed) {
|
|
2844
2847
|
if (policies.size === 0) return history;
|
|
2845
2848
|
const triggersOf = (entry) => Array.isArray(entry.policy.on) ? entry.policy.on : [entry.policy.on];
|
|
@@ -2879,7 +2882,9 @@ function applyCondensation(history, policies, ctx, onCondensed) {
|
|
|
2879
2882
|
return latestByKey.get(trig.by) !== toolCallId;
|
|
2880
2883
|
}
|
|
2881
2884
|
};
|
|
2882
|
-
const firstFired = (toolCallId, entry) =>
|
|
2885
|
+
const firstFired = (toolCallId, entry) => triggersOf(entry).find(
|
|
2886
|
+
(t) => (marksDiscontinuity(t.kind) || withinBatch(entry)) && triggerFires(toolCallId, entry, t)
|
|
2887
|
+
);
|
|
2883
2888
|
return history.map((msg) => {
|
|
2884
2889
|
if (msg.toolCalls?.length) {
|
|
2885
2890
|
let changed = false;
|