@poncho-ai/harness 0.31.1 → 0.31.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/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +11 -0
- package/dist/index.d.ts +27 -1
- package/dist/index.js +357 -46
- package/package.json +2 -2
- package/src/compaction.ts +8 -4
- package/src/harness.ts +427 -49
- package/src/state.ts +12 -0
- package/src/telemetry.ts +4 -0
- package/.turbo/turbo-lint.log +0 -6
- package/.turbo/turbo-test.log +0 -34
package/src/compaction.ts
CHANGED
|
@@ -8,9 +8,11 @@ const MIN_COMPACTABLE_MESSAGES = 4;
|
|
|
8
8
|
|
|
9
9
|
const DEFAULT_COMPACTION_CONFIG: CompactionConfig = {
|
|
10
10
|
enabled: true,
|
|
11
|
-
trigger: 0.
|
|
12
|
-
keepRecentMessages:
|
|
11
|
+
trigger: 0.75,
|
|
12
|
+
keepRecentMessages: 4,
|
|
13
13
|
};
|
|
14
|
+
const SUMMARIZATION_MESSAGE_TRUNCATION_CHARS = 1200;
|
|
15
|
+
const SUMMARIZATION_MAX_OUTPUT_TOKENS = 768;
|
|
14
16
|
|
|
15
17
|
const SUMMARIZATION_PROMPT = `Summarize the following conversation into a structured working state that allows continuation without re-asking questions. Include:
|
|
16
18
|
|
|
@@ -110,7 +112,9 @@ const buildSummarizationMessages = (
|
|
|
110
112
|
const conversationLines: string[] = [];
|
|
111
113
|
for (const msg of messagesToCompact) {
|
|
112
114
|
const text = getTextContent(msg);
|
|
113
|
-
const truncated = text.length >
|
|
115
|
+
const truncated = text.length > SUMMARIZATION_MESSAGE_TRUNCATION_CHARS
|
|
116
|
+
? text.slice(0, SUMMARIZATION_MESSAGE_TRUNCATION_CHARS) + "\n...[truncated]"
|
|
117
|
+
: text;
|
|
114
118
|
conversationLines.push(`[${msg.role}]: ${truncated}`);
|
|
115
119
|
}
|
|
116
120
|
|
|
@@ -193,7 +197,7 @@ export const compactMessages = async (
|
|
|
193
197
|
const result = await generateText({
|
|
194
198
|
model,
|
|
195
199
|
messages: summarizationMessages,
|
|
196
|
-
maxOutputTokens:
|
|
200
|
+
maxOutputTokens: SUMMARIZATION_MAX_OUTPUT_TOKENS,
|
|
197
201
|
});
|
|
198
202
|
|
|
199
203
|
const summary = result.text.trim();
|