@seanhogg/builderforce-memory 2026.10.25 → 2026.10.26
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/working/consolidationMarker.d.ts +8 -2
- package/dist/working/consolidationMarker.d.ts.map +1 -1
- package/dist/working/consolidationMarker.js +13 -5
- package/dist/working/consolidationMarker.js.map +1 -1
- package/dist/working/index.d.ts +2 -2
- package/dist/working/index.d.ts.map +1 -1
- package/dist/working/index.js +2 -2
- package/dist/working/index.js.map +1 -1
- package/dist/working/summary.d.ts +18 -4
- package/dist/working/summary.d.ts.map +1 -1
- package/dist/working/summary.js +58 -14
- package/dist/working/summary.js.map +1 -1
- package/dist/working/transcript.js +1 -1
- package/dist/working/transcript.js.map +1 -1
- package/package.json +3 -3
- package/src/working/consolidationMarker.test.ts +12 -2
- package/src/working/consolidationMarker.ts +12 -5
- package/src/working/index.ts +1 -7
- package/src/working/summary.test.ts +35 -1
- package/src/working/summary.ts +58 -13
- package/src/working/transcript.ts +1 -1
|
@@ -25,7 +25,7 @@ export interface ConsolidationMarkerMeta {
|
|
|
25
25
|
folded?: number;
|
|
26
26
|
}
|
|
27
27
|
/** The metadata of a manual marker. */
|
|
28
|
-
export declare const CONSOLIDATION_META: ConsolidationMarkerMeta
|
|
28
|
+
export declare const CONSOLIDATION_META: Readonly<ConsolidationMarkerMeta>;
|
|
29
29
|
/** Serialized metadata for a marker message (ready to persist). Manual when no `auto`. */
|
|
30
30
|
export declare function consolidationMetadata(auto?: {
|
|
31
31
|
keepFromId?: number;
|
|
@@ -48,7 +48,13 @@ export declare function lastConsolidationIndex(messages: ReadonlyArray<{
|
|
|
48
48
|
* cover. A manual marker covers everything before it (the list from the marker on). An
|
|
49
49
|
* auto marker covers up to its `keepFromId`: the marker, then every message from that id
|
|
50
50
|
* on (other markers dropped — an older note is superseded by the newer one). Unchanged
|
|
51
|
-
* when there is no marker
|
|
51
|
+
* when there is no marker.
|
|
52
|
+
*
|
|
53
|
+
* An auto marker whose `keepFromId` cannot be placed (the row was deleted, or a merge or
|
|
54
|
+
* sync re-inserted the history under new ids) is IGNORED — the scope falls back to the
|
|
55
|
+
* marker before it, or the whole list. Reading it as manual would drop every message
|
|
56
|
+
* between `keepFromId` and the marker that the note never held; ignoring it only costs a
|
|
57
|
+
* re-summarize.
|
|
52
58
|
*/
|
|
53
59
|
export declare function scopeToConsolidation<T extends {
|
|
54
60
|
id?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consolidationMarker.d.ts","sourceRoot":"","sources":["../../src/working/consolidationMarker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,4FAA4F;AAC5F,MAAM,WAAW,uBAAuB;IACtC,aAAa,EAAE,IAAI,CAAC;IACpB,mDAAmD;IACnD,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,4FAA4F;IAC5F,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,uCAAuC;AACvC,eAAO,MAAM,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"consolidationMarker.d.ts","sourceRoot":"","sources":["../../src/working/consolidationMarker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,4FAA4F;AAC5F,MAAM,WAAW,uBAAuB;IACtC,aAAa,EAAE,IAAI,CAAC;IACpB,mDAAmD;IACnD,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,4FAA4F;IAC5F,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,uCAAuC;AACvC,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,uBAAuB,CAA0C,CAAC;AAE5G,0FAA0F;AAC1F,wBAAgB,qBAAqB,CAAC,IAAI,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAS7F;AAED,wFAAwF;AACxF,wBAAgB,qBAAqB,CAAC,GAAG,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG,uBAAuB,GAAG,IAAI,CAcvG;AAED,sFAAsF;AACtF,wBAAgB,qBAAqB,CAAC,GAAG,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG,OAAO,CAEhF;AAED,mFAAmF;AACnF,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,aAAa,CAAC;IAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,GAAG,MAAM,CAKpG;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS;IAAE,EAAE,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAS5G;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,aAAa,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAM5H;AAED,0FAA0F;AAC1F,eAAO,MAAM,2BAA2B,kFAAmE,CAAC;AAE5G,6EAA6E;AAC7E,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAElE"}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* from there on stays verbatim in the seed. Nothing is in neither.
|
|
16
16
|
*/
|
|
17
17
|
/** The metadata of a manual marker. */
|
|
18
|
-
export const CONSOLIDATION_META = { consolidation: true };
|
|
18
|
+
export const CONSOLIDATION_META = Object.freeze({ consolidation: true });
|
|
19
19
|
/** Serialized metadata for a marker message (ready to persist). Manual when no `auto`. */
|
|
20
20
|
export function consolidationMetadata(auto) {
|
|
21
21
|
if (!auto)
|
|
@@ -64,17 +64,25 @@ export function lastConsolidationIndex(messages) {
|
|
|
64
64
|
* cover. A manual marker covers everything before it (the list from the marker on). An
|
|
65
65
|
* auto marker covers up to its `keepFromId`: the marker, then every message from that id
|
|
66
66
|
* on (other markers dropped — an older note is superseded by the newer one). Unchanged
|
|
67
|
-
* when there is no marker
|
|
67
|
+
* when there is no marker.
|
|
68
|
+
*
|
|
69
|
+
* An auto marker whose `keepFromId` cannot be placed (the row was deleted, or a merge or
|
|
70
|
+
* sync re-inserted the history under new ids) is IGNORED — the scope falls back to the
|
|
71
|
+
* marker before it, or the whole list. Reading it as manual would drop every message
|
|
72
|
+
* between `keepFromId` and the marker that the note never held; ignoring it only costs a
|
|
73
|
+
* re-summarize.
|
|
68
74
|
*/
|
|
69
75
|
export function scopeToConsolidation(messages) {
|
|
70
76
|
const idx = lastConsolidationIndex(messages);
|
|
71
77
|
if (idx < 0)
|
|
72
78
|
return messages;
|
|
73
79
|
const marker = messages[idx];
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
if (from < 0 || from > idx)
|
|
80
|
+
const meta = consolidationMarkerOf(marker);
|
|
81
|
+
if (!meta.auto)
|
|
77
82
|
return messages.slice(idx);
|
|
83
|
+
const from = meta.keepFromId === undefined ? -1 : messages.findIndex((m) => m.id === meta.keepFromId);
|
|
84
|
+
if (from < 0 || from > idx)
|
|
85
|
+
return scopeToConsolidation(messages.filter((m) => m !== marker));
|
|
78
86
|
return [marker, ...messages.slice(from).filter((m) => m !== marker && !isConsolidationMarker(m))];
|
|
79
87
|
}
|
|
80
88
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consolidationMarker.js","sourceRoot":"","sources":["../../src/working/consolidationMarker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAaH,uCAAu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AO,GAAG,2BAA2B,GAAG,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;AAC3D,CAAC"}
|
package/dist/working/index.d.ts
CHANGED
|
@@ -26,9 +26,9 @@ export { WorkingMemory } from './workingMemory.js';
|
|
|
26
26
|
export { consolidate, mergeConsolidated, consolidatedKey, CONSOLIDATED_KEY_PREFIX, MIN_CONSOLIDATED_FILES } from './consolidate.js';
|
|
27
27
|
export { rankByCount } from './rank.js';
|
|
28
28
|
export type { Observation, WorkingMemorySnapshot, ConsolidatedMemory, ConsolidateOptions } from './types.js';
|
|
29
|
-
export { HISTORY_WINDOW, HISTORY_TOKEN_BUDGET, COMPACT_TAIL_TOKEN_BUDGET,
|
|
29
|
+
export { HISTORY_WINDOW, HISTORY_TOKEN_BUDGET, COMPACT_TAIL_TOKEN_BUDGET, windowed, stillInWorkingContext, transcriptTokens, buildWorkingTranscript, } from './transcript.js';
|
|
30
30
|
export type { TranscriptMessage, CompactMemo, WorkingTranscriptState, TranscriptFold } from './transcript.js';
|
|
31
|
-
export { TRANSCRIPT_SUMMARY_PROMPT, TRANSCRIPT_SUMMARY_MAX_TOKENS, renderForSummary, summarizeTranscript } from './summary.js';
|
|
31
|
+
export { TRANSCRIPT_SUMMARY_PROMPT, TRANSCRIPT_SUMMARY_MAX_TOKENS, TRANSCRIPT_SUMMARY_INPUT_TOKENS, renderForSummary, summaryChunks, summarizeTranscript } from './summary.js';
|
|
32
32
|
export type { SummaryCompletion } from './summary.js';
|
|
33
33
|
export { CONSOLIDATION_META, CONSOLIDATION_MARKER_PREFIX, consolidationMetadata, consolidationMarkerOf, consolidationMarkerContent, isConsolidationMarker, lastConsolidationIndex, scopeToConsolidation, foldKeepFromId, } from './consolidationMarker.js';
|
|
34
34
|
export type { ConsolidationMarkerMeta } from './consolidationMarker.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/working/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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3B,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,EAC1B,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,cAAc,GACf,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/working/index.js
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
export { WorkingMemory } from './workingMemory.js';
|
|
26
26
|
export { consolidate, mergeConsolidated, consolidatedKey, CONSOLIDATED_KEY_PREFIX, MIN_CONSOLIDATED_FILES } from './consolidate.js';
|
|
27
27
|
export { rankByCount } from './rank.js';
|
|
28
|
-
export { HISTORY_WINDOW, HISTORY_TOKEN_BUDGET, COMPACT_TAIL_TOKEN_BUDGET,
|
|
29
|
-
export { TRANSCRIPT_SUMMARY_PROMPT, TRANSCRIPT_SUMMARY_MAX_TOKENS, renderForSummary, summarizeTranscript } from './summary.js';
|
|
28
|
+
export { HISTORY_WINDOW, HISTORY_TOKEN_BUDGET, COMPACT_TAIL_TOKEN_BUDGET, windowed, stillInWorkingContext, transcriptTokens, buildWorkingTranscript, } from './transcript.js';
|
|
29
|
+
export { TRANSCRIPT_SUMMARY_PROMPT, TRANSCRIPT_SUMMARY_MAX_TOKENS, TRANSCRIPT_SUMMARY_INPUT_TOKENS, renderForSummary, summaryChunks, summarizeTranscript } from './summary.js';
|
|
30
30
|
export { CONSOLIDATION_META, CONSOLIDATION_MARKER_PREFIX, consolidationMetadata, consolidationMarkerOf, consolidationMarkerContent, isConsolidationMarker, lastConsolidationIndex, scopeToConsolidation, foldKeepFromId, } from './consolidationMarker.js';
|
|
31
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/working/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,eAAe,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AACpI,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,yBAAyB,EACzB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/working/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,eAAe,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AACpI,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,yBAAyB,EACzB,QAAQ,EACR,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,yBAAyB,EAAE,6BAA6B,EAAE,+BAA+B,EAAE,gBAAgB,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAE/K,OAAO,EACL,kBAAkB,EAClB,2BAA2B,EAC3B,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,EAC1B,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,cAAc,GACf,MAAM,0BAA0B,CAAC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* rendered for it, so a compaction note, a hand-off note and a "Consolidate" summary read
|
|
6
6
|
* the same everywhere.
|
|
7
7
|
*/
|
|
8
|
-
import type
|
|
8
|
+
import { type TranscriptMessage } from './transcript.js';
|
|
9
9
|
/** The summarizer's instructions. */
|
|
10
10
|
export declare const TRANSCRIPT_SUMMARY_PROMPT = "You compress an in-progress AI agent transcript into a concise MEMORY the agent keeps working from. Capture: the CURRENT outstanding instruction from the user (the most recent user message is authoritative \u2014 earlier requests it supersedes are history, not the active task), concrete facts/answers discovered, tool results that matter (ids, paths, values), decisions made, and what still remains to do. Keep every file path, symbol name and line number the remaining work depends on, with the specific facts learned from each file \u2014 the agent no longer sees those results, so what you leave out it must read again. Be information-dense; drop pleasantries. No preamble.";
|
|
11
11
|
/**
|
|
@@ -14,6 +14,13 @@ export declare const TRANSCRIPT_SUMMARY_PROMPT = "You compress an in-progress AI
|
|
|
14
14
|
* folds (paths, symbols, line numbers), and 1.2k was too little to carry them.
|
|
15
15
|
*/
|
|
16
16
|
export declare const TRANSCRIPT_SUMMARY_MAX_TOKENS = 2500;
|
|
17
|
+
/**
|
|
18
|
+
* The most transcript one summarizer call reads (~tokens). A longer input — a whole long
|
|
19
|
+
* chat on "Consolidate", a first fold over a big seeded history — is summarized in
|
|
20
|
+
* CHUNKS of this size, each folded onto the note so far, so no single call can overrun
|
|
21
|
+
* a model's window.
|
|
22
|
+
*/
|
|
23
|
+
export declare const TRANSCRIPT_SUMMARY_INPUT_TOKENS = 48000;
|
|
17
24
|
/** One no-tools, no-reasoning completion — the host's model call. Resolves the text. */
|
|
18
25
|
export type SummaryCompletion = (request: {
|
|
19
26
|
system: string;
|
|
@@ -24,8 +31,15 @@ export type SummaryCompletion = (request: {
|
|
|
24
31
|
/** Render a slice of the transcript to the compact text the summarizer compresses. */
|
|
25
32
|
export declare function renderForSummary(msgs: readonly TranscriptMessage[]): string;
|
|
26
33
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
34
|
+
* Split a transcript into consecutive chunks of at most `budget` tokens. A single message
|
|
35
|
+
* larger than the budget is a chunk of its own (its text is clipped when rendered).
|
|
36
|
+
*/
|
|
37
|
+
export declare function summaryChunks(msgs: readonly TranscriptMessage[], budget?: number): TranscriptMessage[][];
|
|
38
|
+
/**
|
|
39
|
+
* Compress `msgs` into a memory note — in one call, or chunk by chunk with each chunk
|
|
40
|
+
* folded onto the note so far when the transcript is longer than one call may read. Null
|
|
41
|
+
* on any failure or an empty answer, so the caller falls back (drop-oldest, elision,
|
|
42
|
+
* "nothing to consolidate").
|
|
29
43
|
*/
|
|
30
|
-
export declare function summarizeTranscript(complete: SummaryCompletion, msgs: readonly TranscriptMessage[], signal?: AbortSignal): Promise<string | null>;
|
|
44
|
+
export declare function summarizeTranscript(complete: SummaryCompletion, msgs: readonly TranscriptMessage[], signal?: AbortSignal, budget?: number): Promise<string | null>;
|
|
31
45
|
//# sourceMappingURL=summary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summary.d.ts","sourceRoot":"","sources":["../../src/working/summary.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"summary.d.ts","sourceRoot":"","sources":["../../src/working/summary.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAoB,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAE3E,qCAAqC;AACrC,eAAO,MAAM,yBAAyB,0qBACynB,CAAC;AAEhqB;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,OAAQ,CAAC;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,QAAS,CAAC;AAEtD,wFAAwF;AACxF,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;AAMzC,sFAAsF;AACtF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,iBAAiB,EAAE,GAAG,MAAM,CAU3E;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,iBAAiB,EAAE,EAAE,MAAM,SAAkC,GAAG,iBAAiB,EAAE,EAAE,CAgBjI;AAQD;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,SAAS,iBAAiB,EAAE,EAClC,MAAM,CAAC,EAAE,WAAW,EACpB,MAAM,SAAkC,GACvC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAmBxB"}
|
package/dist/working/summary.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* rendered for it, so a compaction note, a hand-off note and a "Consolidate" summary read
|
|
6
6
|
* the same everywhere.
|
|
7
7
|
*/
|
|
8
|
+
import { transcriptTokens } from './transcript.js';
|
|
8
9
|
/** The summarizer's instructions. */
|
|
9
10
|
export const TRANSCRIPT_SUMMARY_PROMPT = 'You compress an in-progress AI agent transcript into a concise MEMORY the agent keeps working from. Capture: the CURRENT outstanding instruction from the user (the most recent user message is authoritative — earlier requests it supersedes are history, not the active task), concrete facts/answers discovered, tool results that matter (ids, paths, values), decisions made, and what still remains to do. Keep every file path, symbol name and line number the remaining work depends on, with the specific facts learned from each file — the agent no longer sees those results, so what you leave out it must read again. Be information-dense; drop pleasantries. No preamble.';
|
|
10
11
|
/**
|
|
@@ -13,6 +14,13 @@ export const TRANSCRIPT_SUMMARY_PROMPT = 'You compress an in-progress AI agent t
|
|
|
13
14
|
* folds (paths, symbols, line numbers), and 1.2k was too little to carry them.
|
|
14
15
|
*/
|
|
15
16
|
export const TRANSCRIPT_SUMMARY_MAX_TOKENS = 2_500;
|
|
17
|
+
/**
|
|
18
|
+
* The most transcript one summarizer call reads (~tokens). A longer input — a whole long
|
|
19
|
+
* chat on "Consolidate", a first fold over a big seeded history — is summarized in
|
|
20
|
+
* CHUNKS of this size, each folded onto the note so far, so no single call can overrun
|
|
21
|
+
* a model's window.
|
|
22
|
+
*/
|
|
23
|
+
export const TRANSCRIPT_SUMMARY_INPUT_TOKENS = 48_000;
|
|
16
24
|
/** Render a slice of the transcript to the compact text the summarizer compresses. */
|
|
17
25
|
export function renderForSummary(msgs) {
|
|
18
26
|
return msgs
|
|
@@ -26,23 +34,59 @@ export function renderForSummary(msgs) {
|
|
|
26
34
|
.join('\n\n');
|
|
27
35
|
}
|
|
28
36
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
37
|
+
* Split a transcript into consecutive chunks of at most `budget` tokens. A single message
|
|
38
|
+
* larger than the budget is a chunk of its own (its text is clipped when rendered).
|
|
31
39
|
*/
|
|
32
|
-
export
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
export function summaryChunks(msgs, budget = TRANSCRIPT_SUMMARY_INPUT_TOKENS) {
|
|
41
|
+
const chunks = [];
|
|
42
|
+
let chunk = [];
|
|
43
|
+
let used = 0;
|
|
44
|
+
for (const m of msgs) {
|
|
45
|
+
const cost = transcriptTokens([m]);
|
|
46
|
+
if (chunk.length > 0 && used + cost > budget) {
|
|
47
|
+
chunks.push(chunk);
|
|
48
|
+
chunk = [];
|
|
49
|
+
used = 0;
|
|
50
|
+
}
|
|
51
|
+
chunk.push(m);
|
|
52
|
+
used += cost;
|
|
43
53
|
}
|
|
44
|
-
|
|
54
|
+
if (chunk.length > 0)
|
|
55
|
+
chunks.push(chunk);
|
|
56
|
+
return chunks;
|
|
57
|
+
}
|
|
58
|
+
/** ~4 characters a token: the rendered text one call may carry. */
|
|
59
|
+
const clip = (text, budget) => {
|
|
60
|
+
const max = budget * 4;
|
|
61
|
+
return text.length > max ? `${text.slice(0, max)}\n[…clipped]` : text;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Compress `msgs` into a memory note — in one call, or chunk by chunk with each chunk
|
|
65
|
+
* folded onto the note so far when the transcript is longer than one call may read. Null
|
|
66
|
+
* on any failure or an empty answer, so the caller falls back (drop-oldest, elision,
|
|
67
|
+
* "nothing to consolidate").
|
|
68
|
+
*/
|
|
69
|
+
export async function summarizeTranscript(complete, msgs, signal, budget = TRANSCRIPT_SUMMARY_INPUT_TOKENS) {
|
|
70
|
+
if (msgs.length === 0)
|
|
45
71
|
return null;
|
|
72
|
+
let note = null;
|
|
73
|
+
for (const chunk of summaryChunks(msgs, budget)) {
|
|
74
|
+
const input = note ? [{ role: 'assistant', content: note }, ...chunk] : chunk;
|
|
75
|
+
try {
|
|
76
|
+
const out = ((await complete({
|
|
77
|
+
system: TRANSCRIPT_SUMMARY_PROMPT,
|
|
78
|
+
user: clip(renderForSummary(input), budget),
|
|
79
|
+
maxTokens: TRANSCRIPT_SUMMARY_MAX_TOKENS,
|
|
80
|
+
...(signal ? { signal } : {}),
|
|
81
|
+
})) ?? '').trim();
|
|
82
|
+
if (!out)
|
|
83
|
+
return null;
|
|
84
|
+
note = out;
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
46
89
|
}
|
|
90
|
+
return note;
|
|
47
91
|
}
|
|
48
92
|
//# sourceMappingURL=summary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summary.js","sourceRoot":"","sources":["../../src/working/summary.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"summary.js","sourceRoot":"","sources":["../../src/working/summary.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,gBAAgB,EAA0B,MAAM,iBAAiB,CAAC;AAE3E,qCAAqC;AACrC,MAAM,CAAC,MAAM,yBAAyB,GACpC,6pBAA6pB,CAAC;AAEhqB;;;;GAIG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,KAAK,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,MAAM,CAAC;AActD,sFAAsF;AACtF,MAAM,UAAU,gBAAgB,CAAC,IAAkC;IACjE,OAAO,IAAI;SACR,GAAG,CAAC,CAAC,CA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G,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC9B,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;YAClB,IAAI,CAAC,GAAG;gBAAE,OAAO,IAAI,CAAC;YACtB,IAAI,GAAG,GAAG,CAAC;QACb,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -235,7 +235,7 @@ export async function buildWorkingTranscript(state, systemPrompt, summarize, onF
|
|
|
235
235
|
? assembleCompacted(systemPrompt, convo, memo.note, memo.coveredEnd)
|
|
236
236
|
: [{ role: 'system', content: systemPrompt }, ...windowed(convo)];
|
|
237
237
|
}
|
|
238
|
-
const note = `Compressed memory of the
|
|
238
|
+
const note = `Compressed memory of the earlier part of this conversation:\n${summary}`;
|
|
239
239
|
state.compactMemo = { note, coveredEnd: to };
|
|
240
240
|
onFolded({ droppedMessages: to - from, note, coveredEnd: to });
|
|
241
241
|
return assembleCompacted(systemPrompt, convo, note, to);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transcript.js","sourceRoot":"","sources":["../../src/working/transcript.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,qBAAqB,EAAE,aAAa,IAAI,oBAAoB,EAAE,QAAQ,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAMjI,qEAAqE;AACrE,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AAEjC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAC3C;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAEhD;;0CAE0C;AAC1C,SAAS,aAAa,CAAC,CAAoB;IACzC,OAAO,oBAAoB,CAAC,C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AAgE,OAAO,EAAE,CAAC;IACvF,KAAK,CAAC,WAAW,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;IAC7C,QAAQ,CAAC,EAAE,eAAe,EAAE,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;IAC/D,OAAO,iBAAiB,CAAC,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;AAC1D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seanhogg/builderforce-memory",
|
|
3
|
-
"version": "2026.10.
|
|
3
|
+
"version": "2026.10.26",
|
|
4
4
|
"description": "BuilderForce Agent Memory — runtime layer. SSM execution, Transformer orchestration, online distillation, enterprise RAG (ingestion pipelines, vector-store adapters, tenant/ACL-scoped hybrid retrieval), multi-agent graph orchestration, LLM telemetry and cost accounting, and persistent agent memory for BuilderForce.ai agents.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
},
|
|
104
104
|
"homepage": "https://github.com/SeanHogg/builderforce-memory/tree/main/packages/memory#readme",
|
|
105
105
|
"peerDependencies": {
|
|
106
|
-
"@seanhogg/builderforce-memory-engine": "^2026.10.
|
|
106
|
+
"@seanhogg/builderforce-memory-engine": "^2026.10.26"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
109
|
"@jest/globals": "^29.7.0",
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
"ts-jest": "^29.2.0",
|
|
118
118
|
"typescript": "^6.0.3",
|
|
119
119
|
"@typescript/native-preview": "7.0.0-dev.20260627.2",
|
|
120
|
-
"@seanhogg/builderforce-memory-engine": "2026.10.
|
|
120
|
+
"@seanhogg/builderforce-memory-engine": "2026.10.26"
|
|
121
121
|
},
|
|
122
122
|
"jest": {
|
|
123
123
|
"preset": "ts-jest/presets/default-esm",
|
|
@@ -65,9 +65,19 @@ describe('auto consolidation markers (a persisted fold)', () => {
|
|
|
65
65
|
expect(scopeToConsolidation(list).map((m) => m.content)).toEqual(['note', 'user turn', 'narration', 'final reply']);
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
-
it('
|
|
68
|
+
it('ignores an auto marker whose keepFromId cannot be placed (falls back, never drops)', () => {
|
|
69
69
|
const gone = [row(1, 'a'), row(2, 'note', consolidationMetadata({ keepFromId: 99 })), row(3, 'b')];
|
|
70
|
-
expect(scopeToConsolidation(gone).map((m) => m.content)).toEqual(['
|
|
70
|
+
expect(scopeToConsolidation(gone).map((m) => m.content)).toEqual(['a', 'b']);
|
|
71
|
+
const after = [row(1, 'a'), row(2, 'note', consolidationMetadata({ keepFromId: 3 })), row(3, 'b')];
|
|
72
|
+
expect(scopeToConsolidation(after).map((m) => m.content)).toEqual(['a', 'b']);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('falls back to the previous marker when the newest auto marker is unplaceable', () => {
|
|
76
|
+
const list = [
|
|
77
|
+
row(1, 'old'), row(2, 'manual', consolidationMetadata()), row(3, 'kept'),
|
|
78
|
+
row(4, 'auto', consolidationMetadata({ keepFromId: 99 })), row(5, 'new'),
|
|
79
|
+
];
|
|
80
|
+
expect(scopeToConsolidation(list).map((m) => m.content)).toEqual(['manual', 'kept', 'new']);
|
|
71
81
|
});
|
|
72
82
|
|
|
73
83
|
it('round-trips the auto metadata', () => {
|
|
@@ -27,7 +27,7 @@ export interface ConsolidationMarkerMeta {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/** The metadata of a manual marker. */
|
|
30
|
-
export const CONSOLIDATION_META: ConsolidationMarkerMeta = { consolidation: true };
|
|
30
|
+
export const CONSOLIDATION_META: Readonly<ConsolidationMarkerMeta> = Object.freeze({ consolidation: true });
|
|
31
31
|
|
|
32
32
|
/** Serialized metadata for a marker message (ready to persist). Manual when no `auto`. */
|
|
33
33
|
export function consolidationMetadata(auto?: { keepFromId?: number; folded?: number }): string {
|
|
@@ -76,15 +76,22 @@ export function lastConsolidationIndex(messages: ReadonlyArray<{ metadata?: stri
|
|
|
76
76
|
* cover. A manual marker covers everything before it (the list from the marker on). An
|
|
77
77
|
* auto marker covers up to its `keepFromId`: the marker, then every message from that id
|
|
78
78
|
* on (other markers dropped — an older note is superseded by the newer one). Unchanged
|
|
79
|
-
* when there is no marker
|
|
79
|
+
* when there is no marker.
|
|
80
|
+
*
|
|
81
|
+
* An auto marker whose `keepFromId` cannot be placed (the row was deleted, or a merge or
|
|
82
|
+
* sync re-inserted the history under new ids) is IGNORED — the scope falls back to the
|
|
83
|
+
* marker before it, or the whole list. Reading it as manual would drop every message
|
|
84
|
+
* between `keepFromId` and the marker that the note never held; ignoring it only costs a
|
|
85
|
+
* re-summarize.
|
|
80
86
|
*/
|
|
81
87
|
export function scopeToConsolidation<T extends { id?: number; metadata?: string | null }>(messages: T[]): T[] {
|
|
82
88
|
const idx = lastConsolidationIndex(messages);
|
|
83
89
|
if (idx < 0) return messages;
|
|
84
90
|
const marker = messages[idx]!;
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
91
|
+
const meta = consolidationMarkerOf(marker)!;
|
|
92
|
+
if (!meta.auto) return messages.slice(idx);
|
|
93
|
+
const from = meta.keepFromId === undefined ? -1 : messages.findIndex((m) => m.id === meta.keepFromId);
|
|
94
|
+
if (from < 0 || from > idx) return scopeToConsolidation(messages.filter((m) => m !== marker));
|
|
88
95
|
return [marker, ...messages.slice(from).filter((m) => m !== marker && !isConsolidationMarker(m))];
|
|
89
96
|
}
|
|
90
97
|
|
package/src/working/index.ts
CHANGED
|
@@ -31,19 +31,13 @@ export {
|
|
|
31
31
|
HISTORY_WINDOW,
|
|
32
32
|
HISTORY_TOKEN_BUDGET,
|
|
33
33
|
COMPACT_TAIL_TOKEN_BUDGET,
|
|
34
|
-
COMPACT_TAIL_TURNS,
|
|
35
34
|
windowed,
|
|
36
35
|
stillInWorkingContext,
|
|
37
|
-
verbatimStart,
|
|
38
|
-
compactTailStart,
|
|
39
|
-
compactTailStartForBudget,
|
|
40
|
-
pinnedDirectiveIndex,
|
|
41
|
-
assembleCompacted,
|
|
42
36
|
transcriptTokens,
|
|
43
37
|
buildWorkingTranscript,
|
|
44
38
|
} from './transcript.js';
|
|
45
39
|
export type { TranscriptMessage, CompactMemo, WorkingTranscriptState, TranscriptFold } from './transcript.js';
|
|
46
|
-
export { TRANSCRIPT_SUMMARY_PROMPT, TRANSCRIPT_SUMMARY_MAX_TOKENS, renderForSummary, summarizeTranscript } from './summary.js';
|
|
40
|
+
export { TRANSCRIPT_SUMMARY_PROMPT, TRANSCRIPT_SUMMARY_MAX_TOKENS, TRANSCRIPT_SUMMARY_INPUT_TOKENS, renderForSummary, summaryChunks, summarizeTranscript } from './summary.js';
|
|
47
41
|
export type { SummaryCompletion } from './summary.js';
|
|
48
42
|
export {
|
|
49
43
|
CONSOLIDATION_META,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* failing or empty completion reads as "no summary" (the caller falls back).
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { renderForSummary, summarizeTranscript, TRANSCRIPT_SUMMARY_MAX_TOKENS, TRANSCRIPT_SUMMARY_PROMPT } from './summary.js';
|
|
7
|
+
import { renderForSummary, summaryChunks, summarizeTranscript, TRANSCRIPT_SUMMARY_MAX_TOKENS, TRANSCRIPT_SUMMARY_PROMPT } from './summary.js';
|
|
8
8
|
import { buildWorkingTranscript, HISTORY_TOKEN_BUDGET, type TranscriptFold, type TranscriptMessage, type WorkingTranscriptState } from './transcript.js';
|
|
9
9
|
|
|
10
10
|
describe('renderForSummary', () => {
|
|
@@ -49,3 +49,37 @@ describe('buildWorkingTranscript fold report', () => {
|
|
|
49
49
|
expect(out[1]).toEqual({ role: 'assistant', content: folds[0]!.note });
|
|
50
50
|
});
|
|
51
51
|
});
|
|
52
|
+
|
|
53
|
+
describe('summarizeTranscript over a transcript longer than one call reads', () => {
|
|
54
|
+
const long = (n: number): TranscriptMessage[] =>
|
|
55
|
+
Array.from({ length: n }, (_, i) => ({ role: i % 2 ? 'assistant' : 'user', content: `turn ${i} ${'x'.repeat(400)}` }));
|
|
56
|
+
|
|
57
|
+
it('splits into consecutive chunks within the budget, losing nothing', () => {
|
|
58
|
+
const msgs = long(40);
|
|
59
|
+
const chunks = summaryChunks(msgs, 1_000);
|
|
60
|
+
expect(chunks.length).toBeGreaterThan(1);
|
|
61
|
+
expect(chunks.flat()).toEqual(msgs);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('folds each chunk onto the note so far and returns the last note', async () => {
|
|
65
|
+
const inputs: string[] = [];
|
|
66
|
+
let call = 0;
|
|
67
|
+
const out = await summarizeTranscript(async (req) => { inputs.push(req.user); return `note ${++call}`; }, long(40), undefined, 1_000);
|
|
68
|
+
expect(call).toBeGreaterThan(1);
|
|
69
|
+
expect(out).toBe(`note ${call}`);
|
|
70
|
+
expect(inputs[0]).not.toContain('note ');
|
|
71
|
+
expect(inputs[1]!.startsWith('assistant: note 1')).toBe(true);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('is null when any chunk fails — never a note that skipped part of the history', async () => {
|
|
75
|
+
let call = 0;
|
|
76
|
+
expect(await summarizeTranscript(async () => (++call === 2 ? '' : 'n'), long(40), undefined, 1_000)).toBeNull();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('clips one message larger than the whole budget', async () => {
|
|
80
|
+
let seen = '';
|
|
81
|
+
await summarizeTranscript(async (req) => { seen = req.user; return 'n'; }, [{ role: 'user', content: 'y'.repeat(50_000) }], undefined, 1_000);
|
|
82
|
+
expect(seen.length).toBeLessThan(5_000);
|
|
83
|
+
expect(seen.endsWith('[…clipped]')).toBe(true);
|
|
84
|
+
});
|
|
85
|
+
});
|
package/src/working/summary.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* the same everywhere.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type
|
|
9
|
+
import { transcriptTokens, type TranscriptMessage } from './transcript.js';
|
|
10
10
|
|
|
11
11
|
/** The summarizer's instructions. */
|
|
12
12
|
export const TRANSCRIPT_SUMMARY_PROMPT =
|
|
@@ -19,6 +19,14 @@ export const TRANSCRIPT_SUMMARY_PROMPT =
|
|
|
19
19
|
*/
|
|
20
20
|
export const TRANSCRIPT_SUMMARY_MAX_TOKENS = 2_500;
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* The most transcript one summarizer call reads (~tokens). A longer input — a whole long
|
|
24
|
+
* chat on "Consolidate", a first fold over a big seeded history — is summarized in
|
|
25
|
+
* CHUNKS of this size, each folded onto the note so far, so no single call can overrun
|
|
26
|
+
* a model's window.
|
|
27
|
+
*/
|
|
28
|
+
export const TRANSCRIPT_SUMMARY_INPUT_TOKENS = 48_000;
|
|
29
|
+
|
|
22
30
|
/** One no-tools, no-reasoning completion — the host's model call. Resolves the text. */
|
|
23
31
|
export type SummaryCompletion = (request: {
|
|
24
32
|
system: string;
|
|
@@ -45,24 +53,61 @@ export function renderForSummary(msgs: readonly TranscriptMessage[]): string {
|
|
|
45
53
|
}
|
|
46
54
|
|
|
47
55
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
56
|
+
* Split a transcript into consecutive chunks of at most `budget` tokens. A single message
|
|
57
|
+
* larger than the budget is a chunk of its own (its text is clipped when rendered).
|
|
58
|
+
*/
|
|
59
|
+
export function summaryChunks(msgs: readonly TranscriptMessage[], budget = TRANSCRIPT_SUMMARY_INPUT_TOKENS): TranscriptMessage[][] {
|
|
60
|
+
const chunks: TranscriptMessage[][] = [];
|
|
61
|
+
let chunk: TranscriptMessage[] = [];
|
|
62
|
+
let used = 0;
|
|
63
|
+
for (const m of msgs) {
|
|
64
|
+
const cost = transcriptTokens([m]);
|
|
65
|
+
if (chunk.length > 0 && used + cost > budget) {
|
|
66
|
+
chunks.push(chunk);
|
|
67
|
+
chunk = [];
|
|
68
|
+
used = 0;
|
|
69
|
+
}
|
|
70
|
+
chunk.push(m);
|
|
71
|
+
used += cost;
|
|
72
|
+
}
|
|
73
|
+
if (chunk.length > 0) chunks.push(chunk);
|
|
74
|
+
return chunks;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** ~4 characters a token: the rendered text one call may carry. */
|
|
78
|
+
const clip = (text: string, budget: number) => {
|
|
79
|
+
const max = budget * 4;
|
|
80
|
+
return text.length > max ? `${text.slice(0, max)}\n[…clipped]` : text;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Compress `msgs` into a memory note — in one call, or chunk by chunk with each chunk
|
|
85
|
+
* folded onto the note so far when the transcript is longer than one call may read. Null
|
|
86
|
+
* on any failure or an empty answer, so the caller falls back (drop-oldest, elision,
|
|
87
|
+
* "nothing to consolidate").
|
|
50
88
|
*/
|
|
51
89
|
export async function summarizeTranscript(
|
|
52
90
|
complete: SummaryCompletion,
|
|
53
91
|
msgs: readonly TranscriptMessage[],
|
|
54
92
|
signal?: AbortSignal,
|
|
93
|
+
budget = TRANSCRIPT_SUMMARY_INPUT_TOKENS,
|
|
55
94
|
): Promise<string | null> {
|
|
56
95
|
if (msgs.length === 0) return null;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
96
|
+
let note: string | null = null;
|
|
97
|
+
for (const chunk of summaryChunks(msgs, budget)) {
|
|
98
|
+
const input: TranscriptMessage[] = note ? [{ role: 'assistant', content: note } as TranscriptMessage, ...chunk] : chunk;
|
|
99
|
+
try {
|
|
100
|
+
const out: string = ((await complete({
|
|
101
|
+
system: TRANSCRIPT_SUMMARY_PROMPT,
|
|
102
|
+
user: clip(renderForSummary(input), budget),
|
|
103
|
+
maxTokens: TRANSCRIPT_SUMMARY_MAX_TOKENS,
|
|
104
|
+
...(signal ? { signal } : {}),
|
|
105
|
+
})) ?? '').trim();
|
|
106
|
+
if (!out) return null;
|
|
107
|
+
note = out;
|
|
108
|
+
} catch {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
67
111
|
}
|
|
112
|
+
return note;
|
|
68
113
|
}
|
|
@@ -284,7 +284,7 @@ export async function buildWorkingTranscript<M extends TranscriptMessage>(
|
|
|
284
284
|
? assembleCompacted(systemPrompt, convo, memo.note, memo.coveredEnd)
|
|
285
285
|
: [{ role: 'system', content: systemPrompt } as M, ...windowed(convo)];
|
|
286
286
|
}
|
|
287
|
-
const note = `Compressed memory of the
|
|
287
|
+
const note = `Compressed memory of the earlier part of this conversation:\n${summary}`;
|
|
288
288
|
state.compactMemo = { note, coveredEnd: to };
|
|
289
289
|
onFolded({ droppedMessages: to - from, note, coveredEnd: to });
|
|
290
290
|
return assembleCompacted(systemPrompt, convo, note, to);
|