@tarquinen/opencode-dcp 2.1.2 → 2.1.4
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/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +24 -0
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/hooks.d.ts.map +1 -1
- package/dist/lib/hooks.js +4 -1
- package/dist/lib/hooks.js.map +1 -1
- package/dist/lib/message-ids.d.ts +19 -0
- package/dist/lib/message-ids.d.ts.map +1 -0
- package/dist/lib/message-ids.js +97 -0
- package/dist/lib/message-ids.js.map +1 -0
- package/dist/lib/messages/index.d.ts +1 -0
- package/dist/lib/messages/index.d.ts.map +1 -1
- package/dist/lib/messages/index.js +1 -0
- package/dist/lib/messages/index.js.map +1 -1
- package/dist/lib/messages/inject.d.ts +1 -0
- package/dist/lib/messages/inject.d.ts.map +1 -1
- package/dist/lib/messages/inject.js +35 -7
- package/dist/lib/messages/inject.js.map +1 -1
- package/dist/lib/messages/prune.js +8 -6
- package/dist/lib/messages/prune.js.map +1 -1
- package/dist/lib/messages/utils.d.ts +10 -4
- package/dist/lib/messages/utils.d.ts.map +1 -1
- package/dist/lib/messages/utils.js +37 -11
- package/dist/lib/messages/utils.js.map +1 -1
- package/dist/lib/prompts/_codegen/compress.generated.d.ts +1 -1
- package/dist/lib/prompts/_codegen/compress.generated.d.ts.map +1 -1
- package/dist/lib/prompts/_codegen/compress.generated.js +26 -16
- package/dist/lib/prompts/_codegen/compress.generated.js.map +1 -1
- package/dist/lib/prompts/_codegen/system.generated.d.ts +1 -1
- package/dist/lib/prompts/_codegen/system.generated.d.ts.map +1 -1
- package/dist/lib/prompts/_codegen/system.generated.js +2 -2
- package/dist/lib/state/persistence.d.ts.map +1 -1
- package/dist/lib/state/persistence.js +37 -7
- package/dist/lib/state/persistence.js.map +1 -1
- package/dist/lib/state/state.d.ts.map +1 -1
- package/dist/lib/state/state.js +16 -1
- package/dist/lib/state/state.js.map +1 -1
- package/dist/lib/state/types.d.ts +7 -0
- package/dist/lib/state/types.d.ts.map +1 -1
- package/dist/lib/state/utils.d.ts.map +1 -1
- package/dist/lib/state/utils.js +5 -0
- package/dist/lib/state/utils.js.map +1 -1
- package/dist/lib/strategies/purge-errors.js +1 -1
- package/dist/lib/strategies/purge-errors.js.map +1 -1
- package/dist/lib/tools/compress-utils.d.ts +59 -0
- package/dist/lib/tools/compress-utils.d.ts.map +1 -0
- package/dist/lib/tools/compress-utils.js +405 -0
- package/dist/lib/tools/compress-utils.js.map +1 -0
- package/dist/lib/tools/compress.d.ts.map +1 -1
- package/dist/lib/tools/compress.js +52 -96
- package/dist/lib/tools/compress.js.map +1 -1
- package/package.json +1 -3
- package/dist/lib/tools/utils.d.ts +0 -14
- package/dist/lib/tools/utils.d.ts.map +0 -1
- package/dist/lib/tools/utils.js +0 -171
- package/dist/lib/tools/utils.js.map +0 -1
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { Logger } from "../logger";
|
|
2
2
|
import type { SessionState, WithParts } from "../state";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
type MessagePart = WithParts["parts"][number];
|
|
4
|
+
type ToolPart = Extract<MessagePart, {
|
|
5
|
+
type: "tool";
|
|
6
|
+
}>;
|
|
7
|
+
export declare const createSyntheticUserMessage: (baseMessage: WithParts, content: string, variant?: string, stableSeed?: string) => WithParts;
|
|
8
|
+
export declare const createSyntheticTextPart: (baseMessage: WithParts, content: string, stableSeed?: string) => {
|
|
6
9
|
id: string;
|
|
7
10
|
sessionID: string;
|
|
8
11
|
messageID: string;
|
|
9
12
|
type: "text";
|
|
10
13
|
text: string;
|
|
11
14
|
};
|
|
12
|
-
export declare const createSyntheticToolPart: (baseMessage: WithParts, content: string, modelID: string) => {
|
|
15
|
+
export declare const createSyntheticToolPart: (baseMessage: WithParts, content: string, modelID: string, stableSeed?: string) => {
|
|
13
16
|
id: string;
|
|
14
17
|
sessionID: string;
|
|
15
18
|
messageID: string;
|
|
@@ -34,6 +37,8 @@ export declare const createSyntheticToolPart: (baseMessage: WithParts, content:
|
|
|
34
37
|
};
|
|
35
38
|
};
|
|
36
39
|
};
|
|
40
|
+
export declare const appendMessageIdTagToToolOutput: (part: ToolPart, tag: string) => boolean;
|
|
41
|
+
export declare const findLastToolPart: (message: WithParts) => ToolPart | null;
|
|
37
42
|
/**
|
|
38
43
|
* Extracts a human-readable key from tool metadata for display purposes.
|
|
39
44
|
*/
|
|
@@ -41,4 +46,5 @@ export declare const extractParameterKey: (tool: string, parameters: any) => str
|
|
|
41
46
|
export declare function buildToolIdList(state: SessionState, messages: WithParts[], logger: Logger): string[];
|
|
42
47
|
export declare const isIgnoredUserMessage: (message: WithParts) => boolean;
|
|
43
48
|
export declare const findMessageIndex: (messages: WithParts[], messageId: string) => number;
|
|
49
|
+
export {};
|
|
44
50
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../lib/messages/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../lib/messages/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAUvD,KAAK,WAAW,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA;AAC7C,KAAK,QAAQ,GAAG,OAAO,CAAC,WAAW,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAOtD,eAAO,MAAM,0BAA0B,GACnC,aAAa,SAAS,EACtB,SAAS,MAAM,EACf,UAAU,MAAM,EAChB,aAAa,MAAM,KACpB,SA2BF,CAAA;AAED,eAAO,MAAM,uBAAuB,GAChC,aAAa,SAAS,EACtB,SAAS,MAAM,EACf,aAAa,MAAM;;;;;;CAatB,CAAA;AAED,eAAO,MAAM,uBAAuB,GAChC,aAAa,SAAS,EACtB,SAAS,MAAM,EACf,SAAS,MAAM,EACf,aAAa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;CA8BtB,CAAA;AAED,eAAO,MAAM,8BAA8B,GAAI,MAAM,QAAQ,EAAE,KAAK,MAAM,KAAG,OAW5E,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,SAAS,SAAS,KAAG,QAAQ,GAAG,IAShE,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,EAAE,YAAY,GAAG,KAAG,MAiInE,CAAA;AAED,wBAAgB,eAAe,CAC3B,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,SAAS,EAAE,EACrB,MAAM,EAAE,MAAM,GACf,MAAM,EAAE,CAiBV;AAED,eAAO,MAAM,oBAAoB,GAAI,SAAS,SAAS,KAAG,OAazD,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,UAAU,SAAS,EAAE,EAAE,WAAW,MAAM,KAAG,MAE3E,CAAA"}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
2
|
import { isMessageCompacted } from "../shared-utils";
|
|
3
|
-
|
|
4
|
-
const
|
|
3
|
+
const SUMMARY_ID_HASH_LENGTH = 16;
|
|
4
|
+
const generateStableId = (prefix, seed) => {
|
|
5
|
+
const hash = createHash("sha256").update(seed).digest("hex").slice(0, SUMMARY_ID_HASH_LENGTH);
|
|
6
|
+
return `${prefix}_${hash}`;
|
|
7
|
+
};
|
|
5
8
|
const isGeminiModel = (modelID) => {
|
|
6
9
|
const lowerModelID = modelID.toLowerCase();
|
|
7
10
|
return lowerModelID.includes("gemini");
|
|
8
11
|
};
|
|
9
|
-
export const createSyntheticUserMessage = (baseMessage, content, variant) => {
|
|
12
|
+
export const createSyntheticUserMessage = (baseMessage, content, variant, stableSeed) => {
|
|
10
13
|
const userInfo = baseMessage.info;
|
|
11
14
|
const now = Date.now();
|
|
12
|
-
const
|
|
13
|
-
const
|
|
15
|
+
const deterministicSeed = stableSeed?.trim() || userInfo.id;
|
|
16
|
+
const messageId = generateStableId("msg_dcp_summary", deterministicSeed);
|
|
17
|
+
const partId = generateStableId("prt_dcp_summary", deterministicSeed);
|
|
14
18
|
return {
|
|
15
19
|
info: {
|
|
16
20
|
id: messageId,
|
|
@@ -32,9 +36,10 @@ export const createSyntheticUserMessage = (baseMessage, content, variant) => {
|
|
|
32
36
|
],
|
|
33
37
|
};
|
|
34
38
|
};
|
|
35
|
-
export const createSyntheticTextPart = (baseMessage, content) => {
|
|
39
|
+
export const createSyntheticTextPart = (baseMessage, content, stableSeed) => {
|
|
36
40
|
const userInfo = baseMessage.info;
|
|
37
|
-
const
|
|
41
|
+
const deterministicSeed = stableSeed?.trim() || userInfo.id;
|
|
42
|
+
const partId = generateStableId("prt_dcp_text", deterministicSeed);
|
|
38
43
|
return {
|
|
39
44
|
id: partId,
|
|
40
45
|
sessionID: userInfo.sessionID,
|
|
@@ -43,11 +48,12 @@ export const createSyntheticTextPart = (baseMessage, content) => {
|
|
|
43
48
|
text: content,
|
|
44
49
|
};
|
|
45
50
|
};
|
|
46
|
-
export const createSyntheticToolPart = (baseMessage, content, modelID) => {
|
|
51
|
+
export const createSyntheticToolPart = (baseMessage, content, modelID, stableSeed) => {
|
|
47
52
|
const userInfo = baseMessage.info;
|
|
48
53
|
const now = Date.now();
|
|
49
|
-
const
|
|
50
|
-
const
|
|
54
|
+
const deterministicSeed = stableSeed?.trim() || userInfo.id;
|
|
55
|
+
const partId = generateStableId("prt_dcp_tool", deterministicSeed);
|
|
56
|
+
const callId = generateStableId("call_dcp_tool", deterministicSeed);
|
|
51
57
|
// Gemini requires thoughtSignature bypass to accept synthetic tool parts
|
|
52
58
|
const toolPartMetadata = isGeminiModel(modelID)
|
|
53
59
|
? { google: { thoughtSignature: "skip_thought_signature_validator" } }
|
|
@@ -69,6 +75,26 @@ export const createSyntheticToolPart = (baseMessage, content, modelID) => {
|
|
|
69
75
|
},
|
|
70
76
|
};
|
|
71
77
|
};
|
|
78
|
+
export const appendMessageIdTagToToolOutput = (part, tag) => {
|
|
79
|
+
if (part.state?.status !== "completed" || typeof part.state.output !== "string") {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
if (part.state.output.includes(tag)) {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
const separator = part.state.output.length > 0 && !part.state.output.endsWith("\n") ? "\n" : "";
|
|
86
|
+
part.state.output = `${part.state.output}${separator}${tag}`;
|
|
87
|
+
return true;
|
|
88
|
+
};
|
|
89
|
+
export const findLastToolPart = (message) => {
|
|
90
|
+
for (let i = message.parts.length - 1; i >= 0; i--) {
|
|
91
|
+
const part = message.parts[i];
|
|
92
|
+
if (part.type === "tool") {
|
|
93
|
+
return part;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
};
|
|
72
98
|
/**
|
|
73
99
|
* Extracts a human-readable key from tool metadata for display purposes.
|
|
74
100
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../lib/messages/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../lib/messages/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAKpD,MAAM,sBAAsB,GAAG,EAAE,CAAA;AAEjC,MAAM,gBAAgB,GAAG,CAAC,MAAc,EAAE,IAAY,EAAU,EAAE;IAC9D,MAAM,IAAI,GAAG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AAE,CAAA;QACvD,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBACvB,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;oBACnD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;gBAC7B,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC;IACD,KAAK,CAAC,UAAU,GAAG,OAAO,CAAA;IAC1B,OAAO,OAAO,CAAA;AAClB,CAAC;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAAkB,EAAW,EAAE;IAChE,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;IAC/D,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,IAAI,CAAA;IACf,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,IAAI,CAAE,IAAY,CAAC,OAAO,EAAE,CAAC;YACzB,OAAO,KAAK,CAAA;QAChB,CAAC;IACL,CAAC;IAED,OAAO,IAAI,CAAA;AACf,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAAqB,EAAE,SAAiB,EAAU,EAAE;IACjF,OAAO,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,SAAS,CAAC,CAAA;AACjE,CAAC,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const COMPRESS = "Use this tool to collapse a contiguous range of conversation into a preserved summary.\n\nTHE PHILOSOPHY OF COMPRESS\n`compress` transforms verbose conversation sequences into dense, high-fidelity summaries. This is not cleanup - it is crystallization. Your summary becomes the authoritative record of what transpired.\n\nThink of compression as phase transitions: raw exploration becomes refined understanding. The original context served its purpose; your summary now carries that understanding forward.\n\nTHE SUMMARY\nYour summary must be EXHAUSTIVE. Capture file paths, function signatures, decisions made, constraints discovered, key findings... EVERYTHING that maintains context integrity. This is not a brief note - it is an authoritative record so faithful that the original conversation adds no value.\n\nYet be LEAN. Strip away the noise: failed attempts that led nowhere, verbose tool outputs, back-and-forth exploration. What remains should be pure signal - golden nuggets of detail that preserve full understanding with zero ambiguity.\n\nTHE WAYS OF COMPRESS\n`compress` when a chapter closes - when a phase of work is truly complete and the raw conversation has served its purpose:\n\nResearch concluded and findings are clear\nImplementation finished and verified\nExploration exhausted and patterns understood\n\nDo NOT compress when:\nYou may need exact code, error messages, or file contents from the range\nWork in that area is still active or may resume\nYou're mid-sprint on related functionality\n\nBefore compressing, ask: _\"Is this chapter closed?\"_ Compression is irreversible. The summary replaces everything in the range.\n\nBOUNDARY
|
|
1
|
+
export declare const COMPRESS = "Use this tool to collapse a contiguous range of conversation into a preserved summary.\n\nTHE PHILOSOPHY OF COMPRESS\n`compress` transforms verbose conversation sequences into dense, high-fidelity summaries. This is not cleanup - it is crystallization. Your summary becomes the authoritative record of what transpired.\n\nThink of compression as phase transitions: raw exploration becomes refined understanding. The original context served its purpose; your summary now carries that understanding forward.\n\nTHE SUMMARY\nYour summary must be EXHAUSTIVE. Capture file paths, function signatures, decisions made, constraints discovered, key findings... EVERYTHING that maintains context integrity. This is not a brief note - it is an authoritative record so faithful that the original conversation adds no value.\n\nWhen the selected range includes user messages, preserve the user's intent with extra care. Do not change scope, constraints, priorities, acceptance criteria, or requested outcomes.\n\nYet be LEAN. Strip away the noise: failed attempts that led nowhere, verbose tool outputs, back-and-forth exploration. What remains should be pure signal - golden nuggets of detail that preserve full understanding with zero ambiguity.\n\nTHE WAYS OF COMPRESS\n`compress` when a chapter closes - when a phase of work is truly complete and the raw conversation has served its purpose:\n\nResearch concluded and findings are clear\nImplementation finished and verified\nExploration exhausted and patterns understood\n\nDo NOT compress when:\nYou may need exact code, error messages, or file contents from the range\nWork in that area is still active or may resume\nYou're mid-sprint on related functionality\n\nBefore compressing, ask: _\"Is this chapter closed?\"_ Compression is irreversible. The summary replaces everything in the range.\n\nBOUNDARY IDS\nYou specify boundaries by ID.\n\nUse the injected IDs visible in the conversation:\n\n- `mNNNN` IDs identify raw messages\n- `bN` IDs identify previously compressed blocks\n\nRules:\n\n- Pick `startId` and `endId` directly from injected IDs in context.\n- IDs must exist in the current visible context.\n- `startId` must appear before `endId`.\n- Do not invent IDs.\n\nCOMPRESSED BLOCK PLACEHOLDERS\nWhen the selected range includes previously compressed blocks, use placeholders in this exact format:\n\n- `(bN)`\n\nRules:\n\n- Include every required placeholder exactly once.\n- Do not include placeholders for blocks outside the selected range.\n- Treat `(bN)` placeholders as reserved tokens and only use them intentionally.\n- If needed in prose, refer to a block as plain text like `compressed b3` (not as a placeholder token).\n\nTHE FORMAT OF COMPRESS\n`topic`: Short label (3-5 words) for display - e.g., \"Auth System Exploration\"\n`content`: Object containing:\n`startId`: Boundary ID marking the beginning of the range (`mNNNN` or `bN`)\n`endId`: Boundary ID marking the end of the range (`mNNNN` or `bN`)\n`summary`: Complete technical summary replacing all content in the range\n";
|
|
2
2
|
//# sourceMappingURL=compress.generated.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compress.generated.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/_codegen/compress.generated.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"compress.generated.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/_codegen/compress.generated.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ,8+FA6DpB,CAAA"}
|
|
@@ -11,6 +11,8 @@ Think of compression as phase transitions: raw exploration becomes refined under
|
|
|
11
11
|
THE SUMMARY
|
|
12
12
|
Your summary must be EXHAUSTIVE. Capture file paths, function signatures, decisions made, constraints discovered, key findings... EVERYTHING that maintains context integrity. This is not a brief note - it is an authoritative record so faithful that the original conversation adds no value.
|
|
13
13
|
|
|
14
|
+
When the selected range includes user messages, preserve the user's intent with extra care. Do not change scope, constraints, priorities, acceptance criteria, or requested outcomes.
|
|
15
|
+
|
|
14
16
|
Yet be LEAN. Strip away the noise: failed attempts that led nowhere, verbose tool outputs, back-and-forth exploration. What remains should be pure signal - golden nuggets of detail that preserve full understanding with zero ambiguity.
|
|
15
17
|
|
|
16
18
|
THE WAYS OF COMPRESS
|
|
@@ -27,30 +29,38 @@ You're mid-sprint on related functionality
|
|
|
27
29
|
|
|
28
30
|
Before compressing, ask: _"Is this chapter closed?"_ Compression is irreversible. The summary replaces everything in the range.
|
|
29
31
|
|
|
30
|
-
BOUNDARY
|
|
31
|
-
You specify boundaries by
|
|
32
|
+
BOUNDARY IDS
|
|
33
|
+
You specify boundaries by ID.
|
|
34
|
+
|
|
35
|
+
Use the injected IDs visible in the conversation:
|
|
36
|
+
|
|
37
|
+
- \`mNNNN\` IDs identify raw messages
|
|
38
|
+
- \`bN\` IDs identify previously compressed blocks
|
|
39
|
+
|
|
40
|
+
Rules:
|
|
41
|
+
|
|
42
|
+
- Pick \`startId\` and \`endId\` directly from injected IDs in context.
|
|
43
|
+
- IDs must exist in the current visible context.
|
|
44
|
+
- \`startId\` must appear before \`endId\`.
|
|
45
|
+
- Do not invent IDs.
|
|
32
46
|
|
|
33
|
-
|
|
47
|
+
COMPRESSED BLOCK PLACEHOLDERS
|
|
48
|
+
When the selected range includes previously compressed blocks, use placeholders in this exact format:
|
|
34
49
|
|
|
35
|
-
-
|
|
36
|
-
- The user's own words in their messages
|
|
37
|
-
- Tool result output text (distinctive substrings within the output)
|
|
38
|
-
- Previous compress summaries
|
|
39
|
-
- Tool input string values (individual values, not whole serialized objects)
|
|
50
|
+
- \`(bN)\`
|
|
40
51
|
|
|
41
|
-
|
|
52
|
+
Rules:
|
|
42
53
|
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
- Entire serialized JSON objects (key ordering may differ - pick a distinctive substring within instead)
|
|
54
|
+
- Include every required placeholder exactly once.
|
|
55
|
+
- Do not include placeholders for blocks outside the selected range.
|
|
56
|
+
- Treat \`(bN)\` placeholders as reserved tokens and only use them intentionally.
|
|
57
|
+
- If needed in prose, refer to a block as plain text like \`compressed b3\` (not as a placeholder token).
|
|
48
58
|
|
|
49
59
|
THE FORMAT OF COMPRESS
|
|
50
60
|
\`topic\`: Short label (3-5 words) for display - e.g., "Auth System Exploration"
|
|
51
61
|
\`content\`: Object containing:
|
|
52
|
-
\`
|
|
53
|
-
\`
|
|
62
|
+
\`startId\`: Boundary ID marking the beginning of the range (\`mNNNN\` or \`bN\`)
|
|
63
|
+
\`endId\`: Boundary ID marking the end of the range (\`mNNNN\` or \`bN\`)
|
|
54
64
|
\`summary\`: Complete technical summary replacing all content in the range
|
|
55
65
|
`;
|
|
56
66
|
//# sourceMappingURL=compress.generated.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compress.generated.js","sourceRoot":"","sources":["../../../../lib/prompts/_codegen/compress.generated.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,4DAA4D;AAC5D,iEAAiE;AAEjE,MAAM,CAAC,MAAM,QAAQ,GAAG
|
|
1
|
+
{"version":3,"file":"compress.generated.js","sourceRoot":"","sources":["../../../../lib/prompts/_codegen/compress.generated.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,4DAA4D;AAC5D,iEAAiE;AAEjE,MAAM,CAAC,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6DvB,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SYSTEM = "<system-reminder>\n<instruction name=context_management_protocol policy_level=critical>\nYou operate a context-constrained environment and MUST PROACTIVELY MANAGE IT TO AVOID CONTEXT ROT. Efficient context management is CRITICAL to maintaining performance and ensuring successful task completion.\n\nAVAILABLE TOOLS FOR CONTEXT MANAGEMENT\n<distill>`distill`: condense key findings from tool calls into high-fidelity distillation to preserve gained insights. Use to extract valuable knowledge to the user's request. BE THOROUGH, your distillation MUST be high-signal, low noise and complete</distill>\n<compress>`compress`: squash contiguous portion of the conversation and replace it with a low level technical summary. Use to filter noise from the conversation and retain purified understanding. Compress conversation phases ORGANICALLY as they get completed, think meso, not micro nor macro. Do not be cheap with that low level technical summary and BE MINDFUL of specifics that must be crystallized to retain UNAMBIGUOUS full picture.</compress>\n<prune>`prune`: remove individual tool calls that are noise, irrelevant, or superseded. No preservation of content. DO NOT let irrelevant tool calls accumulate. DO NOT PRUNE TOOL OUTPUTS THAT YOU MAY NEED LATER</prune>\n\n<distill>THE DISTILL TOOL\n`distill` is the favored way to target specific tools and crystalize their value into high-signal low-noise knowledge nuggets. Your distillation must be comprehensive, capturing technical details (symbols, signatures, logic, constraints) such that the raw output is no longer needed. THINK complete technical substitute. `distill` is typically best used when you are certain the raw information is not needed anymore, but the knowledge it contains is valuable to retain so you maintain context authenticity and understanding. Be conservative in your approach to distilling, but do NOT hesitate to distill when appropriate.\n</distill>\n\n<compress>THE COMPRESS TOOL\n`compress` is a sledgehammer and should be used accordingly. It's purpose is to reduce whole part of the conversation to its essence and technical details in order to leave room for newer context. Your summary MUST be technical and specific enough to preserve FULL understanding of WHAT TRANSPIRED, such that NO AMBIGUITY remains about what was done, found, or decided. Your compress summary must be thorough and precise. `compress` will replace everything in the range you match, user and assistant messages, tool inputs and outputs. It is preferred to not compress preemptively, but rather wait for natural breakpoints in the conversation. Those breakpoints are to be infered from user messages. You WILL NOT compress based on thinking that you are done with the task, wait for conversation queues that the user has moved on from current phase.\n\nThis tool will typically be used at the end of a phase of work, when conversation starts to accumulate noise that would better served summarized, or when you've done significant exploration and can FULLY synthesize your findings and understanding into a technical summary.\n\
|
|
1
|
+
export declare const SYSTEM = "<system-reminder>\n<instruction name=context_management_protocol policy_level=critical>\nYou operate a context-constrained environment and MUST PROACTIVELY MANAGE IT TO AVOID CONTEXT ROT. Efficient context management is CRITICAL to maintaining performance and ensuring successful task completion.\n\nAVAILABLE TOOLS FOR CONTEXT MANAGEMENT\n<distill>`distill`: condense key findings from tool calls into high-fidelity distillation to preserve gained insights. Use to extract valuable knowledge to the user's request. BE THOROUGH, your distillation MUST be high-signal, low noise and complete</distill>\n<compress>`compress`: squash contiguous portion of the conversation and replace it with a low level technical summary. Use to filter noise from the conversation and retain purified understanding. Compress conversation phases ORGANICALLY as they get completed, think meso, not micro nor macro. Do not be cheap with that low level technical summary and BE MINDFUL of specifics that must be crystallized to retain UNAMBIGUOUS full picture.</compress>\n<prune>`prune`: remove individual tool calls that are noise, irrelevant, or superseded. No preservation of content. DO NOT let irrelevant tool calls accumulate. DO NOT PRUNE TOOL OUTPUTS THAT YOU MAY NEED LATER</prune>\n\n<distill>THE DISTILL TOOL\n`distill` is the favored way to target specific tools and crystalize their value into high-signal low-noise knowledge nuggets. Your distillation must be comprehensive, capturing technical details (symbols, signatures, logic, constraints) such that the raw output is no longer needed. THINK complete technical substitute. `distill` is typically best used when you are certain the raw information is not needed anymore, but the knowledge it contains is valuable to retain so you maintain context authenticity and understanding. Be conservative in your approach to distilling, but do NOT hesitate to distill when appropriate.\n</distill>\n\n<compress>THE COMPRESS TOOL\n`compress` is a sledgehammer and should be used accordingly. It's purpose is to reduce whole part of the conversation to its essence and technical details in order to leave room for newer context. Your summary MUST be technical and specific enough to preserve FULL understanding of WHAT TRANSPIRED, such that NO AMBIGUITY remains about what was done, found, or decided. Your compress summary must be thorough and precise. `compress` will replace everything in the range you match, user and assistant messages, tool inputs and outputs. It is preferred to not compress preemptively, but rather wait for natural breakpoints in the conversation. Those breakpoints are to be infered from user messages. You WILL NOT compress based on thinking that you are done with the task, wait for conversation queues that the user has moved on from current phase. Use injected boundary IDs (`startId`/`endId`) to select ranges.\n\nThis tool will typically be used at the end of a phase of work, when conversation starts to accumulate noise that would better served summarized, or when you've done significant exploration and can FULLY synthesize your findings and understanding into a technical summary.\n\nUse only injected `mNNNN`/`bN` IDs that are visible in the current context. If compressed blocks are included in your range, preserve their content through required `(bN)` placeholders in your summary. Be VERY CAREFUL AND CONSERVATIVE when using `compress`.\n</compress>\n\n<prune>THE PRUNE TOOL\n`prune` is your last resort for context management. It is a blunt instrument that removes tool outputs entirely, without ANY preservation. It is best used to eliminate noise, irrelevant information, or superseded outputs that no longer add value to the conversation. You MUST NOT prune tool outputs that you may need later. Prune is a targeted nuke, not a general cleanup tool.\n\nContemplate only pruning when you are certain that the tool output is irrelevant to the current task or has been superseded by more recent information. If in doubt, defer for when you are definitive. Evaluate WHAT SHOULD be pruned before jumping the gun.\n</prune>\n\nTIMING\nPrefer managing context at the START of a new agentic loop (after receiving a user message) rather than at the END of your previous turn. At turn start, you have fresh signal about what the user needs next - you can better judge what's still relevant versus noise from prior work. Managing at turn end means making retention decisions before knowing what comes next.\n\nEVALUATE YOUR CONTEXT AND MANAGE REGULARLY TO AVOID CONTEXT ROT. AVOID USING MANAGEMENT TOOLS AS THE ONLY TOOL CALLS IN YOUR RESPONSE, PARALLELIZE WITH OTHER RELEVANT TOOLS TO TASK CONTINUATION (read, edit, bash...). It is imperative you understand the value or lack thereof of the context you manage and make informed decisions to maintain a decluttered, high-quality and relevant context.\n\nThe session is your responsibility, and effective context management is CRITICAL to your success. Be PROACTIVE, DELIBERATE, and STRATEGIC in your approach to context management. The session is your oyster - keep it clean, relevant, and high-quality to ensure optimal performance and successful task completion.\n\nBe respectful of the user's API usage, manage context methodically as you work through the task and avoid calling ONLY context management tools in your responses.\n</instruction>\n\n<manual><instruction name=manual_mode policy_level=critical>\nManual mode is enabled. Do NOT use distill, compress, or prune unless the user has explicitly triggered it through a manual marker.\n\n<prune>Only use the prune tool after seeing `<prune triggered manually>` in the current user instruction context.</prune>\n<distill>Only use the distill tool after seeing `<distill triggered manually>` in the current user instruction context.</distill>\n<compress>Only use the compress tool after seeing `<compress triggered manually>` in the current user instruction context.</compress>\n\nAfter completing a manually triggered context-management action, STOP IMMEDIATELY. Do NOT continue with any task execution. End your response right after the tool use completes and wait for the next user input.\n</instruction></manual>\n\n<instruction name=injected_context_handling policy_level=critical>\nThis chat environment injects context information on your behalf in the form of a <prunable-tools> list to help you manage context effectively. Carefully read the list and use it to inform your management decisions. The list is automatically updated after each turn to reflect the current state of manageable tools and context usage. If no list is present, do NOT attempt to prune anything.\nThere may be tools in session context that do not appear in the <prunable-tools> list, this is expected, remember that you can ONLY prune what you see in list.\n</instruction>\n</system-reminder>\n";
|
|
2
2
|
//# sourceMappingURL=system.generated.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system.generated.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/_codegen/system.generated.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"system.generated.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/_codegen/system.generated.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,MAAM,4sNAoDlB,CAAA"}
|
|
@@ -15,11 +15,11 @@ AVAILABLE TOOLS FOR CONTEXT MANAGEMENT
|
|
|
15
15
|
</distill>
|
|
16
16
|
|
|
17
17
|
<compress>THE COMPRESS TOOL
|
|
18
|
-
\`compress\` is a sledgehammer and should be used accordingly. It's purpose is to reduce whole part of the conversation to its essence and technical details in order to leave room for newer context. Your summary MUST be technical and specific enough to preserve FULL understanding of WHAT TRANSPIRED, such that NO AMBIGUITY remains about what was done, found, or decided. Your compress summary must be thorough and precise. \`compress\` will replace everything in the range you match, user and assistant messages, tool inputs and outputs. It is preferred to not compress preemptively, but rather wait for natural breakpoints in the conversation. Those breakpoints are to be infered from user messages. You WILL NOT compress based on thinking that you are done with the task, wait for conversation queues that the user has moved on from current phase.
|
|
18
|
+
\`compress\` is a sledgehammer and should be used accordingly. It's purpose is to reduce whole part of the conversation to its essence and technical details in order to leave room for newer context. Your summary MUST be technical and specific enough to preserve FULL understanding of WHAT TRANSPIRED, such that NO AMBIGUITY remains about what was done, found, or decided. Your compress summary must be thorough and precise. \`compress\` will replace everything in the range you match, user and assistant messages, tool inputs and outputs. It is preferred to not compress preemptively, but rather wait for natural breakpoints in the conversation. Those breakpoints are to be infered from user messages. You WILL NOT compress based on thinking that you are done with the task, wait for conversation queues that the user has moved on from current phase. Use injected boundary IDs (\`startId\`/\`endId\`) to select ranges.
|
|
19
19
|
|
|
20
20
|
This tool will typically be used at the end of a phase of work, when conversation starts to accumulate noise that would better served summarized, or when you've done significant exploration and can FULLY synthesize your findings and understanding into a technical summary.
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
Use only injected \`mNNNN\`/\`bN\` IDs that are visible in the current context. If compressed blocks are included in your range, preserve their content through required \`(bN)\` placeholders in your summary. Be VERY CAREFUL AND CONSERVATIVE when using \`compress\`.
|
|
23
23
|
</compress>
|
|
24
24
|
|
|
25
25
|
<prune>THE PRUNE TOOL
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persistence.d.ts","sourceRoot":"","sources":["../../../lib/state/persistence.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAEvC,oCAAoC;AACpC,MAAM,WAAW,cAAc;IAE3B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAEjC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;CACxB;AAED,MAAM,WAAW,qBAAqB;IAClC,WAAW,CAAC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AC,CAiCf;AAED,wBAAsB,gBAAgB,CAClC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACf,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAwFvC;AAED,MAAM,WAAW,eAAe;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,MAAM,CAAA;CACvB;AAED,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CA2ClF"}
|
|
@@ -64,18 +64,48 @@ export async function loadSessionState(sessionId, logger) {
|
|
|
64
64
|
return null;
|
|
65
65
|
}
|
|
66
66
|
if (Array.isArray(state.compressSummaries)) {
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
const migratedSummaries = [];
|
|
68
|
+
let nextBlockId = 1;
|
|
69
|
+
for (const entry of state.compressSummaries) {
|
|
70
|
+
if (entry === null ||
|
|
71
|
+
typeof entry !== "object" ||
|
|
72
|
+
typeof entry.anchorMessageId !== "string" ||
|
|
73
|
+
typeof entry.summary !== "string") {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
const blockId = typeof entry.blockId === "number" && Number.isInteger(entry.blockId)
|
|
77
|
+
? entry.blockId
|
|
78
|
+
: nextBlockId;
|
|
79
|
+
migratedSummaries.push({
|
|
80
|
+
blockId,
|
|
81
|
+
anchorMessageId: entry.anchorMessageId,
|
|
82
|
+
summary: entry.summary,
|
|
83
|
+
});
|
|
84
|
+
nextBlockId = Math.max(nextBlockId, blockId + 1);
|
|
85
|
+
}
|
|
86
|
+
if (migratedSummaries.length !== state.compressSummaries.length) {
|
|
72
87
|
logger.warn("Filtered out malformed compressSummaries entries", {
|
|
73
88
|
sessionId: sessionId,
|
|
74
89
|
original: state.compressSummaries.length,
|
|
75
|
-
valid:
|
|
90
|
+
valid: migratedSummaries.length,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
const seenBlockIds = new Set();
|
|
94
|
+
const dedupedSummaries = migratedSummaries.filter((summary) => {
|
|
95
|
+
if (seenBlockIds.has(summary.blockId)) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
seenBlockIds.add(summary.blockId);
|
|
99
|
+
return true;
|
|
100
|
+
});
|
|
101
|
+
if (dedupedSummaries.length !== migratedSummaries.length) {
|
|
102
|
+
logger.warn("Removed duplicate compress block IDs", {
|
|
103
|
+
sessionId: sessionId,
|
|
104
|
+
original: migratedSummaries.length,
|
|
105
|
+
valid: dedupedSummaries.length,
|
|
76
106
|
});
|
|
77
107
|
}
|
|
78
|
-
state.compressSummaries =
|
|
108
|
+
state.compressSummaries = dedupedSummaries;
|
|
79
109
|
}
|
|
80
110
|
else {
|
|
81
111
|
state.compressSummaries = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persistence.js","sourceRoot":"","sources":["../../../lib/state/persistence.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAA;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAsB3B,MAAM,WAAW,GAAG,IAAI,CACpB,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,EAC/D,UAAU,EACV,SAAS,EACT,QAAQ,EACR,KAAK,CACR,CAAA;AAED,KAAK,UAAU,gBAAgB;IAC3B,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAC3B,MAAM,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IACpD,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AAY,EAAE,CAAA;gBACzB,CAAC;YACL,CAAC;YAAC,MAAM,CAAC;gBACL,qBAAqB;YACzB,CAAC;QACL,CAAC;QAED,MAAM,CAAC,KAAK,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAA;IACjD,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QAClB,MAAM,CAAC,IAAI,CAAC,+BAA+B,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA;IAC3E,CAAC;IAED,OAAO,MAAM,CAAA;AACjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../lib/state/state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAsB,SAAS,EAAE,MAAM,SAAS,CAAA;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAWvC,eAAO,MAAM,YAAY,GACrB,QAAQ,GAAG,EACX,OAAO,YAAY,EACnB,QAAQ,MAAM,EACd,UAAU,SAAS,EAAE,EACrB,mBAAmB,OAAO,KAC3B,OAAO,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../lib/state/state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAsB,SAAS,EAAE,MAAM,SAAS,CAAA;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAWvC,eAAO,MAAM,YAAY,GACrB,QAAQ,GAAG,EACX,OAAO,YAAY,EACnB,QAAQ,MAAM,EACd,UAAU,SAAS,EAAE,EACrB,mBAAmB,OAAO,KAC3B,OAAO,CAAC,IAAI,CAwCd,CAAA;AAED,wBAAgB,kBAAkB,IAAI,YAAY,CA6BjD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CA2B3D;AAED,wBAAsB,wBAAwB,CAC1C,MAAM,EAAE,GAAG,EACX,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,SAAS,EAAE,EACrB,iBAAiB,EAAE,OAAO,GAC3B,OAAO,CAAC,IAAI,CAAC,CA+Bf"}
|
package/dist/lib/state/state.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { loadSessionState } from "./persistence";
|
|
1
|
+
import { loadSessionState, saveSessionState } from "./persistence";
|
|
2
2
|
import { isSubAgentSession, findLastCompactionTimestamp, countTurns, resetOnCompaction, loadPruneMap, } from "./utils";
|
|
3
3
|
import { getLastUserMessage } from "../shared-utils";
|
|
4
4
|
export const checkSession = async (client, state, logger, messages, manualModeDefault) => {
|
|
@@ -23,6 +23,11 @@ export const checkSession = async (client, state, logger, messages, manualModeDe
|
|
|
23
23
|
logger.info("Detected compaction - reset stale state", {
|
|
24
24
|
timestamp: lastCompactionTimestamp,
|
|
25
25
|
});
|
|
26
|
+
saveSessionState(state, logger).catch((error) => {
|
|
27
|
+
logger.warn("Failed to persist state reset after compaction", {
|
|
28
|
+
error: error instanceof Error ? error.message : String(error),
|
|
29
|
+
});
|
|
30
|
+
});
|
|
26
31
|
}
|
|
27
32
|
state.currentTurn = countTurns(state, messages);
|
|
28
33
|
};
|
|
@@ -43,6 +48,11 @@ export function createSessionState() {
|
|
|
43
48
|
},
|
|
44
49
|
toolParameters: new Map(),
|
|
45
50
|
toolIdList: [],
|
|
51
|
+
messageIds: {
|
|
52
|
+
byRawId: new Map(),
|
|
53
|
+
byRef: new Map(),
|
|
54
|
+
nextRef: 0,
|
|
55
|
+
},
|
|
46
56
|
nudgeCounter: 0,
|
|
47
57
|
lastToolPrune: false,
|
|
48
58
|
lastCompaction: 0,
|
|
@@ -67,6 +77,11 @@ export function resetSessionState(state) {
|
|
|
67
77
|
};
|
|
68
78
|
state.toolParameters.clear();
|
|
69
79
|
state.toolIdList = [];
|
|
80
|
+
state.messageIds = {
|
|
81
|
+
byRawId: new Map(),
|
|
82
|
+
byRef: new Map(),
|
|
83
|
+
nextRef: 0,
|
|
84
|
+
};
|
|
70
85
|
state.nudgeCounter = 0;
|
|
71
86
|
state.lastToolPrune = false;
|
|
72
87
|
state.lastCompaction = 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../lib/state/state.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../lib/state/state.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAClE,OAAO,EACH,iBAAiB,EACjB,2BAA2B,EAC3B,UAAU,EACV,iBAAiB,EACjB,YAAY,GACf,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAEpD,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAC7B,MAAW,EACX,KAAmB,EACnB,MAAc,EACd,QAAqB,EACrB,iBAA0B,EACb,EAAE;IACf,MAAM,eAAe,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAA;IACpD,IAAI,CAAC,eAAe,EAAE,CAAC;QACnB,OAAM;IACV,CAAC;IAED,MAAM,aAAa,GAAG,eAAe,CAAC,IAAI,CAAC,SAAS,CAAA;IAEpD,IAAI,KAAK,CAAC,SAAS,KAAK,IAAI,IAAI,KAAK,CAAC,SAAS,KAAK,aAAa,EAAE,CAAC;QAChE,MAAM,CAAC,IAAI,CAAC,oBAAoB,KAAK,CAAC,SAAS,OAAO,aAAa,EAAE,CAAC,CAAA;QACtE,IAAI,CAAC;YACD,MAAM,wBAAwB,CAC1B,MAAM,EACN,KAAK,EACL,aAAa,EACb,MAAM,EACN,QAAQ,EACR,iBAAiB,CACpB,CAAA;QACL,CAAC;QAAC,OAAO,GAAQ,EAA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BAAgB,IAAI,CAAC;KAC3D,CAAA;AACL,CAAC"}
|
|
@@ -17,6 +17,7 @@ export interface SessionStats {
|
|
|
17
17
|
totalPruneTokens: number;
|
|
18
18
|
}
|
|
19
19
|
export interface CompressSummary {
|
|
20
|
+
blockId: number;
|
|
20
21
|
anchorMessageId: string;
|
|
21
22
|
summary: string;
|
|
22
23
|
}
|
|
@@ -28,6 +29,11 @@ export interface PendingManualTrigger {
|
|
|
28
29
|
sessionId: string;
|
|
29
30
|
prompt: string;
|
|
30
31
|
}
|
|
32
|
+
export interface MessageIdState {
|
|
33
|
+
byRawId: Map<string, string>;
|
|
34
|
+
byRef: Map<string, string>;
|
|
35
|
+
nextRef: number;
|
|
36
|
+
}
|
|
31
37
|
export interface SessionState {
|
|
32
38
|
sessionId: string | null;
|
|
33
39
|
isSubAgent: boolean;
|
|
@@ -38,6 +44,7 @@ export interface SessionState {
|
|
|
38
44
|
stats: SessionStats;
|
|
39
45
|
toolParameters: Map<string, ToolParameterEntry>;
|
|
40
46
|
toolIdList: string[];
|
|
47
|
+
messageIds: MessageIdState;
|
|
41
48
|
nudgeCounter: number;
|
|
42
49
|
lastToolPrune: boolean;
|
|
43
50
|
lastCompaction: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../lib/state/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAEnD,MAAM,WAAW,SAAS;IACtB,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,IAAI,EAAE,CAAA;CAChB;AAED,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,CAAA;AAEtE,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,GAAG,CAAA;IACf,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,KAAK,CAAC,EAA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KAAK,EAAE,KAAK,CAAA;IACZ,iBAAiB,EAAE,eAAe,EAAE,CAAA;IACpC,KAAK,EAAE,YAAY,CAAA;IACnB,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;IAC/C,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,UAAU,EAAE,cAAc,CAAA;IAC1B,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,OAAO,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAA;CACxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../lib/state/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAGtD,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOxF;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,SAAS,EAAE,GAAG,MAAM,CAQzE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,MAAM,CAc7E;AAED,wBAAgB,YAAY,CACxB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,SAAS,CAAC,EAAE,MAAM,EAAE,GACrB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAIrB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../lib/state/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAGtD,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOxF;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,SAAS,EAAE,GAAG,MAAM,CAQzE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,MAAM,CAc7E;AAED,wBAAgB,YAAY,CACxB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,SAAS,CAAC,EAAE,MAAM,EAAE,GACrB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAIrB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAY3D"}
|
package/dist/lib/state/utils.js
CHANGED
|
@@ -44,6 +44,11 @@ export function resetOnCompaction(state) {
|
|
|
44
44
|
state.prune.tools = new Map();
|
|
45
45
|
state.prune.messages = new Map();
|
|
46
46
|
state.compressSummaries = [];
|
|
47
|
+
state.messageIds = {
|
|
48
|
+
byRawId: new Map(),
|
|
49
|
+
byRef: new Map(),
|
|
50
|
+
nextRef: 0,
|
|
51
|
+
};
|
|
47
52
|
state.nudgeCounter = 0;
|
|
48
53
|
state.lastToolPrune = false;
|
|
49
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../lib/state/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAEpD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,MAAW,EAAE,SAAiB;IAClE,IAAI,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,CAAC,CAAA;QAC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AA;AACpB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAmB;IACjD,KAAK,CAAC,cAAc,CAAC,KAAK,EAAE,CAAA;IAC5B,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAA;IAC7C,KAAK,CAAC,KAAK,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAA;IAChD,KAAK,CAAC,iBAAiB,GAAG,EAAE,CAAA;IAC5B,KAAK,CAAC,UAAU,GAAG;QACf,OAAO,EAAE,IAAI,GAAG,EAAkB;QAClC,KAAK,EAAE,IAAI,GAAG,EAAkB;QAChC,OAAO,EAAE,CAAC;KACb,CAAA;IACD,KAAK,CAAC,YAAY,GAAG,CAAC,CAAA;IACtB,KAAK,CAAC,aAAa,GAAG,KAAK,CAAA;AAC/B,CAAC"}
|
|
@@ -25,7 +25,7 @@ export const purgeErrors = (state, logger, config, messages) => {
|
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
27
|
const protectedTools = config.strategies.purgeErrors.protectedTools;
|
|
28
|
-
const turnThreshold = config.strategies.purgeErrors.turns;
|
|
28
|
+
const turnThreshold = Math.max(1, config.strategies.purgeErrors.turns);
|
|
29
29
|
const newPruneIds = [];
|
|
30
30
|
for (const id of unprunedIds) {
|
|
31
31
|
const metadata = state.toolParameters.get(id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"purge-errors.js","sourceRoot":"","sources":["../../../lib/strategies/purge-errors.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,0BAA0B,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAE5C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACvB,KAAmB,EACnB,MAAc,EACd,MAAoB,EACpB,QAAqB,EACjB,EAAE;IACN,IAAI,KAAK,CAAC,UAAU,IAAI,CAAC,MAAM,CAAC,UAAU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