@tarquinen/opencode-dcp 3.1.4 → 3.1.6
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/README.md +4 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/commands/compression-targets.d.ts +1 -0
- package/dist/lib/commands/compression-targets.d.ts.map +1 -1
- package/dist/lib/commands/compression-targets.js +1 -0
- package/dist/lib/commands/compression-targets.js.map +1 -1
- package/dist/lib/commands/context.d.ts.map +1 -1
- package/dist/lib/commands/context.js +5 -7
- package/dist/lib/commands/context.js.map +1 -1
- package/dist/lib/commands/decompress.js +1 -1
- package/dist/lib/commands/decompress.js.map +1 -1
- package/dist/lib/commands/help.js +2 -2
- package/dist/lib/commands/help.js.map +1 -1
- package/dist/lib/commands/manual.js +3 -3
- package/dist/lib/commands/manual.js.map +1 -1
- package/dist/lib/commands/recompress.js +1 -1
- package/dist/lib/commands/recompress.js.map +1 -1
- package/dist/lib/commands/stats.d.ts.map +1 -1
- package/dist/lib/commands/stats.js +42 -7
- package/dist/lib/commands/stats.js.map +1 -1
- package/dist/lib/commands/sweep.d.ts.map +1 -1
- package/dist/lib/commands/sweep.js +4 -3
- package/dist/lib/commands/sweep.js.map +1 -1
- package/dist/lib/compress/message-utils.d.ts +2 -2
- package/dist/lib/compress/message-utils.d.ts.map +1 -1
- package/dist/lib/compress/message-utils.js +88 -32
- package/dist/lib/compress/message-utils.js.map +1 -1
- package/dist/lib/compress/message.d.ts.map +1 -1
- package/dist/lib/compress/message.js +11 -7
- package/dist/lib/compress/message.js.map +1 -1
- package/dist/lib/compress/pipeline.d.ts.map +1 -1
- package/dist/lib/compress/pipeline.js +4 -2
- package/dist/lib/compress/pipeline.js.map +1 -1
- package/dist/lib/compress/protected-content.js +1 -1
- package/dist/lib/compress/range.d.ts.map +1 -1
- package/dist/lib/compress/range.js +7 -3
- package/dist/lib/compress/range.js.map +1 -1
- package/dist/lib/compress/search.js +2 -2
- package/dist/lib/compress/search.js.map +1 -1
- package/dist/lib/compress/state.d.ts +2 -1
- package/dist/lib/compress/state.d.ts.map +1 -1
- package/dist/lib/compress/state.js +16 -0
- package/dist/lib/compress/state.js.map +1 -1
- package/dist/lib/compress/timing.d.ts +18 -0
- package/dist/lib/compress/timing.d.ts.map +1 -0
- package/dist/lib/compress/timing.js +42 -0
- package/dist/lib/compress/timing.js.map +1 -0
- package/dist/lib/compress/types.d.ts +2 -0
- package/dist/lib/compress/types.d.ts.map +1 -1
- package/dist/lib/{shared-utils.d.ts → compress-permission.d.ts} +2 -5
- package/dist/lib/compress-permission.d.ts.map +1 -0
- package/dist/lib/compress-permission.js +10 -0
- package/dist/lib/compress-permission.js.map +1 -0
- package/dist/lib/config.js +2 -2
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/hooks.d.ts +3 -0
- package/dist/lib/hooks.d.ts.map +1 -1
- package/dist/lib/hooks.js +73 -3
- package/dist/lib/hooks.js.map +1 -1
- package/dist/lib/message-ids.js +1 -1
- package/dist/lib/messages/inject/inject.d.ts.map +1 -1
- package/dist/lib/messages/inject/inject.js +15 -19
- package/dist/lib/messages/inject/inject.js.map +1 -1
- package/dist/lib/messages/inject/utils.d.ts +0 -1
- package/dist/lib/messages/inject/utils.d.ts.map +1 -1
- package/dist/lib/messages/inject/utils.js +7 -33
- package/dist/lib/messages/inject/utils.js.map +1 -1
- package/dist/lib/messages/priority.js +3 -3
- package/dist/lib/messages/priority.js.map +1 -1
- package/dist/lib/messages/prune.d.ts.map +1 -1
- package/dist/lib/messages/prune.js +2 -1
- package/dist/lib/messages/prune.js.map +1 -1
- package/dist/lib/messages/query.d.ts +7 -0
- package/dist/lib/messages/query.d.ts.map +1 -0
- package/dist/lib/messages/query.js +39 -0
- package/dist/lib/messages/query.js.map +1 -0
- package/dist/lib/messages/reasoning-strip.js +1 -1
- package/dist/lib/messages/reasoning-strip.js.map +1 -1
- package/dist/lib/messages/utils.d.ts +3 -5
- package/dist/lib/messages/utils.d.ts.map +1 -1
- package/dist/lib/messages/utils.js +30 -42
- package/dist/lib/messages/utils.js.map +1 -1
- package/dist/lib/prompts/compress-message.d.ts +1 -1
- package/dist/lib/prompts/compress-message.d.ts.map +1 -1
- package/dist/lib/prompts/compress-message.js +11 -12
- package/dist/lib/prompts/compress-message.js.map +1 -1
- package/dist/lib/prompts/compress-range.d.ts +1 -1
- package/dist/lib/prompts/compress-range.d.ts.map +1 -1
- package/dist/lib/prompts/compress-range.js +1 -1
- package/dist/lib/prompts/context-limit-nudge.d.ts +1 -1
- package/dist/lib/prompts/context-limit-nudge.d.ts.map +1 -1
- package/dist/lib/prompts/context-limit-nudge.js +3 -9
- package/dist/lib/prompts/context-limit-nudge.js.map +1 -1
- package/dist/lib/prompts/extensions/nudge.d.ts +5 -0
- package/dist/lib/prompts/extensions/nudge.d.ts.map +1 -0
- package/dist/lib/prompts/extensions/nudge.js +35 -0
- package/dist/lib/prompts/extensions/nudge.js.map +1 -0
- package/dist/lib/prompts/extensions/system.d.ts +4 -0
- package/dist/lib/prompts/extensions/system.d.ts.map +1 -0
- package/dist/lib/prompts/extensions/system.js +30 -0
- package/dist/lib/prompts/extensions/system.js.map +1 -0
- package/dist/lib/prompts/extensions/tool.d.ts +3 -0
- package/dist/lib/prompts/extensions/tool.d.ts.map +1 -0
- package/dist/lib/prompts/extensions/tool.js +34 -0
- package/dist/lib/prompts/extensions/tool.js.map +1 -0
- package/dist/lib/prompts/index.d.ts +1 -1
- package/dist/lib/prompts/index.d.ts.map +1 -1
- package/dist/lib/prompts/index.js +12 -13
- package/dist/lib/prompts/index.js.map +1 -1
- package/dist/lib/prompts/iteration-nudge.d.ts +1 -1
- package/dist/lib/prompts/iteration-nudge.d.ts.map +1 -1
- package/dist/lib/prompts/iteration-nudge.js +0 -2
- package/dist/lib/prompts/iteration-nudge.js.map +1 -1
- package/dist/lib/prompts/store.d.ts +2 -2
- package/dist/lib/prompts/store.d.ts.map +1 -1
- package/dist/lib/prompts/store.js +6 -6
- package/dist/lib/prompts/store.js.map +1 -1
- package/dist/lib/prompts/system.d.ts +1 -1
- package/dist/lib/prompts/system.d.ts.map +1 -1
- package/dist/lib/prompts/system.js +0 -13
- package/dist/lib/prompts/system.js.map +1 -1
- package/dist/lib/prompts/turn-nudge.d.ts +1 -1
- package/dist/lib/prompts/turn-nudge.d.ts.map +1 -1
- package/dist/lib/prompts/turn-nudge.js +1 -2
- package/dist/lib/prompts/turn-nudge.js.map +1 -1
- package/dist/lib/state/persistence.d.ts.map +1 -1
- package/dist/lib/state/persistence.js +13 -16
- 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 +10 -1
- package/dist/lib/state/state.js.map +1 -1
- package/dist/lib/state/tool-cache.js +2 -2
- package/dist/lib/state/tool-cache.js.map +1 -1
- package/dist/lib/state/types.d.ts +4 -0
- package/dist/lib/state/types.d.ts.map +1 -1
- package/dist/lib/state/utils.d.ts +8 -6
- package/dist/lib/state/utils.d.ts.map +1 -1
- package/dist/lib/state/utils.js +29 -3
- package/dist/lib/state/utils.js.map +1 -1
- package/dist/lib/strategies/deduplication.js +1 -1
- package/dist/lib/strategies/deduplication.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/{strategies/utils.d.ts → token-utils.d.ts} +5 -3
- package/dist/lib/token-utils.d.ts.map +1 -0
- package/dist/lib/{strategies/utils.js → token-utils.js} +24 -17
- package/dist/lib/token-utils.js.map +1 -0
- package/dist/lib/ui/notification.d.ts.map +1 -1
- package/dist/lib/ui/notification.js +10 -6
- package/dist/lib/ui/notification.js.map +1 -1
- package/dist/lib/ui/utils.js +2 -2
- package/dist/lib/ui/utils.js.map +1 -1
- package/package.json +4 -2
- package/dist/lib/prompts/internal-overlays.d.ts +0 -5
- package/dist/lib/prompts/internal-overlays.d.ts.map +0 -1
- package/dist/lib/prompts/internal-overlays.js +0 -49
- package/dist/lib/prompts/internal-overlays.js.map +0 -1
- package/dist/lib/prompts/message-priority-guidance.d.ts +0 -2
- package/dist/lib/prompts/message-priority-guidance.d.ts.map +0 -1
- package/dist/lib/prompts/message-priority-guidance.js +0 -9
- package/dist/lib/prompts/message-priority-guidance.js.map +0 -1
- package/dist/lib/shared-utils.d.ts.map +0 -1
- package/dist/lib/shared-utils.js +0 -37
- package/dist/lib/shared-utils.js.map +0 -1
- package/dist/lib/strategies/utils.d.ts.map +0 -1
- package/dist/lib/strategies/utils.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prune.d.ts","sourceRoot":"","sources":["../../../lib/messages/prune.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"prune.d.ts","sourceRoot":"","sources":["../../../lib/messages/prune.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAW7C,eAAO,MAAM,KAAK,GACd,OAAO,YAAY,EACnB,QAAQ,MAAM,EACd,QAAQ,YAAY,EACpB,UAAU,SAAS,EAAE,KACtB,IAMF,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { isMessageCompacted
|
|
1
|
+
import { isMessageCompacted } from "../state/utils";
|
|
2
2
|
import { createSyntheticUserMessage, replaceBlockIdsWithBlocked } from "./utils";
|
|
3
|
+
import { getLastUserMessage } from "./query";
|
|
3
4
|
const PRUNED_TOOL_OUTPUT_REPLACEMENT = "[Output removed to save context - information superseded or no longer needed]";
|
|
4
5
|
const PRUNED_TOOL_ERROR_INPUT_REPLACEMENT = "[input removed due to failed tool call]";
|
|
5
6
|
const PRUNED_QUESTION_INPUT_REPLACEMENT = "[questions removed - see output for user's answers]";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prune.js","sourceRoot":"","sources":["../../../lib/messages/prune.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"prune.js","sourceRoot":"","sources":["../../../lib/messages/prune.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAA;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAG5C,MAAM,8BAA8B,GAChC,+EAA+E,CAAA;AACnF,MAAM,mCAAmC,GAAG,yCAAyC,CAAA;AACrF,MAAM,iCAAiC,GAAG,qDAAqD,CAAA;AAE/F,MAAM,CAAC,MAAM,KAAK,GAAG,CACjB,KAAmB,EACnB,MAAc,EACd,MAAoB,EACpB,QAAqB,EACjB,EAAE;IACN,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;IACvD,yCAAyC;IACzC,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;IACzC,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;IACxC,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;AAC5C,CAAC,CAAA;AAED,MAAM,aAAa,GAAG,CAAC,KAAmB,EAAE,MAAc,EAAE,QAAqB,EAAQ,EAAE;IACvF,MAAM,gBAAgB,GAAa,EAAE,CAAA;IAErC,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC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CACJ,CAAA;oBAED,MAAM,CAAC,IAAI,CAAC,2BAA2B,EAAE;wBACrC,eAAe,EAAE,KAAK;wBACtB,aAAa,EAAE,cAAc,CAAC,MAAM;qBACvC,CAAC,CAAA;gBACN,CAAC;qBAAM,CAAC;oBACJ,MAAM,CAAC,IAAI,CAAC,4CAA4C,EAAE;wBACtD,eAAe,EAAE,KAAK;qBACzB,CAAC,CAAA;gBACN,CAAC;YACL,CAAC;QACL,CAAC;QAED,2CAA2C;QAC3C,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAC9D,IAAI,UAAU,IAAI,UAAU,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrD,SAAQ;QACZ,CAAC;QAED,6BAA6B;QAC7B,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACpB,CAAC;IAED,kCAAkC;IAClC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAA;IACnB,QAAQ,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAA;AAC5B,CAAC,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PluginConfig } from "../config";
|
|
2
|
+
import type { WithParts } from "../state";
|
|
3
|
+
export declare const getLastUserMessage: (messages: WithParts[], startIndex?: number) => WithParts | null;
|
|
4
|
+
export declare const messageHasCompress: (message: WithParts) => boolean;
|
|
5
|
+
export declare const isIgnoredUserMessage: (message: WithParts) => boolean;
|
|
6
|
+
export declare function isProtectedUserMessage(config: PluginConfig, message: WithParts): boolean;
|
|
7
|
+
//# sourceMappingURL=query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../lib/messages/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEzC,eAAO,MAAM,kBAAkB,GAC3B,UAAU,SAAS,EAAE,EACrB,aAAa,MAAM,KACpB,SAAS,GAAG,IASd,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,SAAS,SAAS,KAAG,OAUvD,CAAA;AAED,eAAO,MAAM,oBAAoB,GAAI,SAAS,SAAS,KAAG,OAiBzD,CAAA;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,SAAS,GAAG,OAAO,CAOxF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export const getLastUserMessage = (messages, startIndex) => {
|
|
2
|
+
const start = startIndex ?? messages.length - 1;
|
|
3
|
+
for (let i = start; i >= 0; i--) {
|
|
4
|
+
const msg = messages[i];
|
|
5
|
+
if (msg.info.role === "user" && !isIgnoredUserMessage(msg)) {
|
|
6
|
+
return msg;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return null;
|
|
10
|
+
};
|
|
11
|
+
export const messageHasCompress = (message) => {
|
|
12
|
+
if (message.info.role !== "assistant") {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
const parts = Array.isArray(message.parts) ? message.parts : [];
|
|
16
|
+
return parts.some((part) => part.type === "tool" && part.tool === "compress" && part.state?.status === "completed");
|
|
17
|
+
};
|
|
18
|
+
export const isIgnoredUserMessage = (message) => {
|
|
19
|
+
if (message.info.role !== "user") {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
const parts = Array.isArray(message.parts) ? message.parts : [];
|
|
23
|
+
if (parts.length === 0) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
for (const part of parts) {
|
|
27
|
+
if (!part.ignored) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return true;
|
|
32
|
+
};
|
|
33
|
+
export function isProtectedUserMessage(config, message) {
|
|
34
|
+
return (config.compress.mode === "message" &&
|
|
35
|
+
config.compress.protectUserMessages &&
|
|
36
|
+
message.info.role === "user" &&
|
|
37
|
+
!isIgnoredUserMessage(message));
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../lib/messages/query.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAC9B,QAAqB,EACrB,UAAmB,EACH,EAAE;IAClB,MAAM,KAAK,GAAG,UAAU,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAA;IAC/C,KAAK,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC9B,MAAM,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;QACvB,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,EAAE,CAAC;YACzD,OAAO,GAAG,CAAA;QACd,CAAC;IACL,CAAC;IACD,OAAO,IAAI,CAAA;AACf,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAkB,EAAW,EAAE;IAC9D,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QACpC,OAAO,KAAK,CAAA;IAChB,CAAC;IAED,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;IAC/D,OAAO,KAAK,CAAC,IAAI,CACb,CAAC,IAAI,EAAE,EAAE,CACL,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,KAAK,WAAW,CAC7F,CAAA;AACL,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAAkB,EAAW,EAAE;IAChE,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAA;IAChB,CAAC;IAED,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,UAAU,sBAAsB,CAAC,MAAoB,EAAE,OAAkB;IAC3E,OAAO,CACH,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,SAAS;QAClC,MAAM,CAAC,QAAQ,CAAC,mBAAmB;QACnC,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM;QAC5B,CAAC,oBAAoB,CAAC,OAAO,CAAC,CACjC,CAAA;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reasoning-strip.js","sourceRoot":"","sources":["../../../lib/messages/reasoning-strip.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"reasoning-strip.js","sourceRoot":"","sources":["../../../lib/messages/reasoning-strip.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAE5C;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAqB;IACpD,MAAM,eAAe,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAA;IACpD,IAAI,eAAe,EAAE,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QACxC,OAAM;IACV,CAAC;IAED,MAAM,OAAO,GAAG,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAA;IAClD,MAAM,UAAU,GAAG,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAA;IAExD,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACzB,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;YACpC,OAAM;QACV,CAAC;QAED,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,KAAK,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,UAAU,KAAK,UAAU,EAAE,CAAC;YAC7E,OAAM;QACV,CAAC;QAED,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACvC,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;gBAC5E,OAAO,IAAI,CAAA;YACf,CAAC;YAED,IAAI,CAAC,CAAC,UAAU,IAAI,IAAI,CAAC,EAAE,CAAC;gBACxB,OAAO,IAAI,CAAA;YACf,CAAC;YAED,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAA;YAC7C,OAAO,IAAI,CAAA;QACf,CAAC,CAAC,CAAA;IACN,CAAC,CAAC,CAAA;AACN,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { PluginConfig } from "../config";
|
|
2
1
|
import type { SessionState, WithParts } from "../state";
|
|
3
2
|
export declare const createSyntheticUserMessage: (baseMessage: WithParts, content: string, variant?: string, stableSeed?: string) => WithParts;
|
|
4
3
|
export declare const createSyntheticTextPart: (baseMessage: WithParts, content: string, stableSeed?: string) => {
|
|
@@ -15,13 +14,12 @@ type ToolPart = Extract<MessagePart, {
|
|
|
15
14
|
type TextPart = Extract<MessagePart, {
|
|
16
15
|
type: "text";
|
|
17
16
|
}>;
|
|
18
|
-
export declare const appendToTextPart: (part: TextPart, injection: string) => boolean;
|
|
19
17
|
export declare const appendToLastTextPart: (message: WithParts, injection: string) => boolean;
|
|
20
|
-
export declare const
|
|
18
|
+
export declare const appendToTextPart: (part: TextPart, injection: string) => boolean;
|
|
19
|
+
export declare const appendToAllToolParts: (message: WithParts, tag: string) => boolean;
|
|
21
20
|
export declare const appendToToolPart: (part: ToolPart, tag: string) => boolean;
|
|
21
|
+
export declare const hasContent: (message: WithParts) => boolean;
|
|
22
22
|
export declare function buildToolIdList(state: SessionState, messages: WithParts[]): string[];
|
|
23
|
-
export declare const isIgnoredUserMessage: (message: WithParts) => boolean;
|
|
24
|
-
export declare function isProtectedUserMessage(config: PluginConfig, message: WithParts): boolean;
|
|
25
23
|
export declare const replaceBlockIdsWithBlocked: (text: string) => string;
|
|
26
24
|
export declare const stripHallucinationsFromString: (text: string) => string;
|
|
27
25
|
export declare const stripHallucinations: (messages: WithParts[]) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../lib/messages/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../lib/messages/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAcvD,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,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;AACtD,KAAK,QAAQ,GAAG,OAAO,CAAC,WAAW,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAEtD,eAAO,MAAM,oBAAoB,GAAI,SAAS,SAAS,EAAE,WAAW,MAAM,KAAG,OAO5E,CAAA;AAaD,eAAO,MAAM,gBAAgB,GAAI,MAAM,QAAQ,EAAE,WAAW,MAAM,KAAG,OAgBpE,CAAA;AAED,eAAO,MAAM,oBAAoB,GAAI,SAAS,SAAS,EAAE,KAAK,MAAM,KAAG,OAQtE,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,MAAM,QAAQ,EAAE,KAAK,MAAM,KAAG,OAU9D,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,SAAS,SAAS,KAAG,OAU/C,CAAA;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,CAiBpF;AAED,eAAO,MAAM,0BAA0B,GAAI,MAAM,MAAM,KAAG,MAEzD,CAAA;AAED,eAAO,MAAM,6BAA6B,GAAI,MAAM,MAAM,KAAG,MAE5D,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,UAAU,SAAS,EAAE,KAAG,IAgB3D,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
-
import { isMessageCompacted } from "../
|
|
2
|
+
import { isMessageCompacted } from "../state/utils";
|
|
3
3
|
const SUMMARY_ID_HASH_LENGTH = 16;
|
|
4
4
|
const DCP_BLOCK_ID_TAG_REGEX = /(<dcp-message-id(?=[\s>])[^>]*>)b\d+(<\/dcp-message-id>)/g;
|
|
5
5
|
const DCP_PAIRED_TAG_REGEX = /<dcp[^>]*>[\s\S]*?<\/dcp[^>]*>/gi;
|
|
@@ -47,6 +47,22 @@ export const createSyntheticTextPart = (baseMessage, content, stableSeed) => {
|
|
|
47
47
|
text: content,
|
|
48
48
|
};
|
|
49
49
|
};
|
|
50
|
+
export const appendToLastTextPart = (message, injection) => {
|
|
51
|
+
const textPart = findLastTextPart(message);
|
|
52
|
+
if (!textPart) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
return appendToTextPart(textPart, injection);
|
|
56
|
+
};
|
|
57
|
+
const findLastTextPart = (message) => {
|
|
58
|
+
for (let i = message.parts.length - 1; i >= 0; i--) {
|
|
59
|
+
const part = message.parts[i];
|
|
60
|
+
if (part.type === "text") {
|
|
61
|
+
return part;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
};
|
|
50
66
|
export const appendToTextPart = (part, injection) => {
|
|
51
67
|
if (typeof part.text !== "string") {
|
|
52
68
|
return false;
|
|
@@ -62,21 +78,24 @@ export const appendToTextPart = (part, injection) => {
|
|
|
62
78
|
part.text = baseText.length > 0 ? `${baseText}\n\n${normalizedInjection}` : normalizedInjection;
|
|
63
79
|
return true;
|
|
64
80
|
};
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (part.type === "
|
|
69
|
-
|
|
81
|
+
export const appendToAllToolParts = (message, tag) => {
|
|
82
|
+
let injected = false;
|
|
83
|
+
for (const part of message.parts) {
|
|
84
|
+
if (part.type === "tool") {
|
|
85
|
+
injected = appendToToolPart(part, tag) || injected;
|
|
70
86
|
}
|
|
71
87
|
}
|
|
72
|
-
return
|
|
88
|
+
return injected;
|
|
73
89
|
};
|
|
74
|
-
export const
|
|
75
|
-
|
|
76
|
-
if (!textPart) {
|
|
90
|
+
export const appendToToolPart = (part, tag) => {
|
|
91
|
+
if (part.state?.status !== "completed" || typeof part.state.output !== "string") {
|
|
77
92
|
return false;
|
|
78
93
|
}
|
|
79
|
-
|
|
94
|
+
if (part.state.output.includes(tag)) {
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
part.state.output = `${part.state.output}${tag}`;
|
|
98
|
+
return true;
|
|
80
99
|
};
|
|
81
100
|
export const hasContent = (message) => {
|
|
82
101
|
return message.parts.some((part) => (part.type === "text" &&
|
|
@@ -86,16 +105,6 @@ export const hasContent = (message) => {
|
|
|
86
105
|
part.state?.status === "completed" &&
|
|
87
106
|
typeof part.state.output === "string"));
|
|
88
107
|
};
|
|
89
|
-
export const appendToToolPart = (part, tag) => {
|
|
90
|
-
if (part.state?.status !== "completed" || typeof part.state.output !== "string") {
|
|
91
|
-
return false;
|
|
92
|
-
}
|
|
93
|
-
if (part.state.output.includes(tag)) {
|
|
94
|
-
return true;
|
|
95
|
-
}
|
|
96
|
-
part.state.output = `${part.state.output}${tag}`;
|
|
97
|
-
return true;
|
|
98
|
-
};
|
|
99
108
|
export function buildToolIdList(state, messages) {
|
|
100
109
|
const toolIds = [];
|
|
101
110
|
for (const msg of messages) {
|
|
@@ -114,27 +123,6 @@ export function buildToolIdList(state, messages) {
|
|
|
114
123
|
state.toolIdList = toolIds;
|
|
115
124
|
return toolIds;
|
|
116
125
|
}
|
|
117
|
-
export const isIgnoredUserMessage = (message) => {
|
|
118
|
-
if (message.info.role !== "user") {
|
|
119
|
-
return false;
|
|
120
|
-
}
|
|
121
|
-
const parts = Array.isArray(message.parts) ? message.parts : [];
|
|
122
|
-
if (parts.length === 0) {
|
|
123
|
-
return true;
|
|
124
|
-
}
|
|
125
|
-
for (const part of parts) {
|
|
126
|
-
if (!part.ignored) {
|
|
127
|
-
return false;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return true;
|
|
131
|
-
};
|
|
132
|
-
export function isProtectedUserMessage(config, message) {
|
|
133
|
-
return (config.compress.mode === "message" &&
|
|
134
|
-
config.compress.protectUserMessages &&
|
|
135
|
-
message.info.role === "user" &&
|
|
136
|
-
!isIgnoredUserMessage(message));
|
|
137
|
-
}
|
|
138
126
|
export const replaceBlockIdsWithBlocked = (text) => {
|
|
139
127
|
return text.replace(DCP_BLOCK_ID_TAG_REGEX, "$1BLOCKED$2");
|
|
140
128
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../lib/messages/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../lib/messages/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAGnD,MAAM,sBAAsB,GAAG,EAAE,CAAA;AACjC,MAAM,sBAAsB,GAAG,2DAA2D,CAAA;AAC1F,MAAM,oBAAoB,GAAG,kCAAkC,CAAA;AAC/D,MAAM,sBAAsB,GAAG,iBAAiB,CAAA;AAEhD,MAAM,gBAAgB,GAAG,CAAC,MAAc,EAAE,IAAY,EAAU,EAAE;IAC9D,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,sBAAsB,CAAC,CAAA;IAC7F,OAAO,GAAG,MAAM,IAAI,IAAI,EAAE,CAAA;AAC9B,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACtC,WAAsB,EACtB,OAAe,EACf,OAAgB,EAChB,UAAmB,EACV,EAAE;IACX,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAmB,CAAA;IAChD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;IACtB,MAAM,iBAAiB,GAAG,UAAU,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AAoB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAA;AACrF,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,QAAqB,EAAQ,EAAE;IAC/D,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC7B,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YAC/B,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACxD,IAAI,CAAC,IAAI,GAAG,6BAA6B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACxD,CAAC;YAED,IACI,IAAI,CAAC,IAAI,KAAK,MAAM;gBACpB,IAAI,CAAC,KAAK,EAAE,MAAM,KAAK,WAAW;gBAClC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,QAAQ,EACvC,CAAC;gBACC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,6BAA6B,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;YACxE,CAAC;QACL,CAAC;IACL,CAAC;AACL,CAAC,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const COMPRESS_MESSAGE = "Collapse selected individual messages in the conversation into detailed summaries.\n\nTHE SUMMARY\nYour summary must be EXHAUSTIVE. Capture file paths, function signatures, decisions made, constraints discovered, key findings, tool outcomes, and user intent details that matter... EVERYTHING that preserves the value of the selected message after the raw message is removed.\n\nUSER INTENT FIDELITY\nWhen a selected message contains user intent, preserve that intent with extra care. Do not change scope, constraints, priorities, acceptance criteria, or requested outcomes.\nDirectly quote short user instructions when that best preserves exact meaning.\n\nYet be LEAN. Strip away the noise: failed attempts that led nowhere, verbose tool output, and repetition. What remains should be pure signal - golden nuggets of detail that preserve full understanding with zero ambiguity.\n\nMESSAGE IDS\nYou specify individual raw messages by ID using the injected IDs visible in the conversation:\n\n- `mNNNN` IDs identify raw messages\n\nEach message has an ID inside XML metadata tags like `<dcp-message-id priority=\"high\">m0007</dcp-message-id>`.\nThe ID tag appears
|
|
1
|
+
export declare const COMPRESS_MESSAGE = "Collapse selected individual messages in the conversation into detailed summaries.\n\nTHE SUMMARY\nYour summary must be EXHAUSTIVE. Capture file paths, function signatures, decisions made, constraints discovered, key findings, tool outcomes, and user intent details that matter... EVERYTHING that preserves the value of the selected message after the raw message is removed.\n\nUSER INTENT FIDELITY\nWhen a selected message contains user intent, preserve that intent with extra care. Do not change scope, constraints, priorities, acceptance criteria, or requested outcomes.\nDirectly quote short user instructions when that best preserves exact meaning.\n\nYet be LEAN. Strip away the noise: failed attempts that led nowhere, verbose tool output, and repetition. What remains should be pure signal - golden nuggets of detail that preserve full understanding with zero ambiguity.\nIf a message contains no significant technical decisions, code changes, or user requirements, produce a minimal one-line summary rather than a detailed one.\n\nMESSAGE IDS\nYou specify individual raw messages by ID using the injected IDs visible in the conversation:\n\n- `mNNNN` IDs identify raw messages\n\nEach message has an ID inside XML metadata tags like `<dcp-message-id priority=\"high\">m0007</dcp-message-id>`.\nThe same ID tag appears in every tool output of the message it belongs to \u2014 each unique ID identifies one complete message.\nTreat these tags as message metadata only, not as content to summarize. Use only the inner `mNNNN` value as the `messageId`.\nThe `priority` attribute indicates relative context cost. You MUST compress high-priority messages when their full text is no longer necessary for the active task.\nIf prior compress-tool results are present, always compress and summarize them minimally only as part of a broader compression pass. Do not invoke the compress tool solely to re-compress an earlier compression result.\nMessages marked as `<dcp-message-id>BLOCKED</dcp-message-id>` cannot be compressed.\n\nRules:\n\n- Pick each `messageId` directly from injected IDs visible in context.\n- Only use raw message IDs of the form `mNNNN`.\n- Ignore XML attributes such as `priority` when copying the ID; use only the inner `mNNNN` value.\n- Do not invent IDs. Use only IDs that are present in context.\n\nBATCHING\nSelect MANY messages in a single tool call when they are safe to compress.\nEach entry should summarize exactly one message, and the tool can receive as many entries as needed in one batch.\n\nGENERAL CLEANUP\nUse the topic \"general cleanup\" for broad cleanup passes.\nDuring general cleanup, compress all medium and high-priority messages that are not relevant to the active task.\nOptimize for reducing context footprint, not for grouping messages by topic.\nDo not compress away still-active instructions, unresolved questions, or constraints that are likely to matter soon.\nPrioritize the earliest messages in the context as they will be the least relevant to the active task.\n";
|
|
2
2
|
//# sourceMappingURL=compress-message.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compress-message.d.ts","sourceRoot":"","sources":["../../../lib/prompts/compress-message.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"compress-message.d.ts","sourceRoot":"","sources":["../../../lib/prompts/compress-message.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,k9FAyC5B,CAAA"}
|
|
@@ -8,6 +8,7 @@ When a selected message contains user intent, preserve that intent with extra ca
|
|
|
8
8
|
Directly quote short user instructions when that best preserves exact meaning.
|
|
9
9
|
|
|
10
10
|
Yet be LEAN. Strip away the noise: failed attempts that led nowhere, verbose tool output, and repetition. What remains should be pure signal - golden nuggets of detail that preserve full understanding with zero ambiguity.
|
|
11
|
+
If a message contains no significant technical decisions, code changes, or user requirements, produce a minimal one-line summary rather than a detailed one.
|
|
11
12
|
|
|
12
13
|
MESSAGE IDS
|
|
13
14
|
You specify individual raw messages by ID using the injected IDs visible in the conversation:
|
|
@@ -15,9 +16,10 @@ You specify individual raw messages by ID using the injected IDs visible in the
|
|
|
15
16
|
- \`mNNNN\` IDs identify raw messages
|
|
16
17
|
|
|
17
18
|
Each message has an ID inside XML metadata tags like \`<dcp-message-id priority="high">m0007</dcp-message-id>\`.
|
|
18
|
-
The ID tag appears
|
|
19
|
+
The same ID tag appears in every tool output of the message it belongs to — each unique ID identifies one complete message.
|
|
19
20
|
Treat these tags as message metadata only, not as content to summarize. Use only the inner \`mNNNN\` value as the \`messageId\`.
|
|
20
|
-
The \`priority\` attribute indicates relative context cost.
|
|
21
|
+
The \`priority\` attribute indicates relative context cost. You MUST compress high-priority messages when their full text is no longer necessary for the active task.
|
|
22
|
+
If prior compress-tool results are present, always compress and summarize them minimally only as part of a broader compression pass. Do not invoke the compress tool solely to re-compress an earlier compression result.
|
|
21
23
|
Messages marked as \`<dcp-message-id>BLOCKED</dcp-message-id>\` cannot be compressed.
|
|
22
24
|
|
|
23
25
|
Rules:
|
|
@@ -25,20 +27,17 @@ Rules:
|
|
|
25
27
|
- Pick each \`messageId\` directly from injected IDs visible in context.
|
|
26
28
|
- Only use raw message IDs of the form \`mNNNN\`.
|
|
27
29
|
- Ignore XML attributes such as \`priority\` when copying the ID; use only the inner \`mNNNN\` value.
|
|
28
|
-
- Do NOT use compressed block IDs like \`bN\`.
|
|
29
30
|
- Do not invent IDs. Use only IDs that are present in context.
|
|
30
|
-
- Do not target prior compressed blocks or block summaries.
|
|
31
31
|
|
|
32
32
|
BATCHING
|
|
33
|
-
Select MANY messages in a single tool call when they are
|
|
33
|
+
Select MANY messages in a single tool call when they are safe to compress.
|
|
34
34
|
Each entry should summarize exactly one message, and the tool can receive as many entries as needed in one batch.
|
|
35
|
-
When several messages are equally safe to compress, prefer higher-priority messages first.
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
GENERAL CLEANUP
|
|
37
|
+
Use the topic "general cleanup" for broad cleanup passes.
|
|
38
|
+
During general cleanup, compress all medium and high-priority messages that are not relevant to the active task.
|
|
39
|
+
Optimize for reducing context footprint, not for grouping messages by topic.
|
|
40
|
+
Do not compress away still-active instructions, unresolved questions, or constraints that are likely to matter soon.
|
|
41
|
+
Prioritize the earliest messages in the context as they will be the least relevant to the active task.
|
|
43
42
|
`;
|
|
44
43
|
//# sourceMappingURL=compress-message.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compress-message.js","sourceRoot":"","sources":["../../../lib/prompts/compress-message.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG
|
|
1
|
+
{"version":3,"file":"compress-message.js","sourceRoot":"","sources":["../../../lib/prompts/compress-message.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyC/B,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const COMPRESS_RANGE = "Collapse a range in the conversation into a detailed summary.\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\nUSER INTENT FIDELITY\nWhen the compressed range includes user messages, preserve the user's intent with extra care. Do not change scope, constraints, priorities, acceptance criteria, or requested outcomes.\nDirectly quote user messages when they are short enough to include safely. Direct quotes are preferred when they best preserve exact meaning.\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\nCOMPRESSED BLOCK PLACEHOLDERS\nWhen the selected range includes previously compressed blocks, use this exact placeholder format when referencing one:\n\n- `(bN)`\n\nCompressed block sections in context are clearly marked with a header:\n\n- `[Compressed conversation section]`\n\nCompressed block IDs always use the `bN` form (never `mNNNN`) and are represented in the same XML metadata tag format.\n\nRules:\n\n- Include every required block placeholder exactly once.\n- Do not invent placeholders for blocks outside the selected range.\n- Treat `(bN)` placeholders as RESERVED TOKENS. Do not emit `(bN)` text anywhere except intentional placeholders.\n- If you need to mention a block in prose, use plain text like `compressed bN` (not as a placeholder).\n- Preflight check before finalizing: the set of `(bN)` placeholders in your summary must exactly match the required set, with no duplicates.\n\nThese placeholders are semantic references. They will be replaced with the full stored compressed block content when the tool processes your output.\n\nFLOW PRESERVATION WITH PLACEHOLDERS\nWhen you use compressed block placeholders, write the surrounding summary text so it still reads correctly AFTER placeholder expansion.\n\n- Treat each placeholder as a stand-in for a full conversation segment, not as a short label.\n- Ensure transitions before and after each placeholder preserve chronology and causality.\n- Do not write text that depends on the placeholder staying literal (for example, \"as noted in `(b2)`\").\n- Your final meaning must be coherent once each placeholder is replaced with its full compressed block content.\n\nBOUNDARY IDS\nYou specify boundaries by ID using the injected IDs visible in the conversation:\n\n- `mNNNN` IDs identify raw messages\n- `bN` IDs identify previously compressed blocks\n\nEach message has an ID inside XML metadata tags like `<dcp-message-id>...</dcp-message-id>`.\nThe ID tag appears
|
|
1
|
+
export declare const COMPRESS_RANGE = "Collapse a range in the conversation into a detailed summary.\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\nUSER INTENT FIDELITY\nWhen the compressed range includes user messages, preserve the user's intent with extra care. Do not change scope, constraints, priorities, acceptance criteria, or requested outcomes.\nDirectly quote user messages when they are short enough to include safely. Direct quotes are preferred when they best preserve exact meaning.\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\nCOMPRESSED BLOCK PLACEHOLDERS\nWhen the selected range includes previously compressed blocks, use this exact placeholder format when referencing one:\n\n- `(bN)`\n\nCompressed block sections in context are clearly marked with a header:\n\n- `[Compressed conversation section]`\n\nCompressed block IDs always use the `bN` form (never `mNNNN`) and are represented in the same XML metadata tag format.\n\nRules:\n\n- Include every required block placeholder exactly once.\n- Do not invent placeholders for blocks outside the selected range.\n- Treat `(bN)` placeholders as RESERVED TOKENS. Do not emit `(bN)` text anywhere except intentional placeholders.\n- If you need to mention a block in prose, use plain text like `compressed bN` (not as a placeholder).\n- Preflight check before finalizing: the set of `(bN)` placeholders in your summary must exactly match the required set, with no duplicates.\n\nThese placeholders are semantic references. They will be replaced with the full stored compressed block content when the tool processes your output.\n\nFLOW PRESERVATION WITH PLACEHOLDERS\nWhen you use compressed block placeholders, write the surrounding summary text so it still reads correctly AFTER placeholder expansion.\n\n- Treat each placeholder as a stand-in for a full conversation segment, not as a short label.\n- Ensure transitions before and after each placeholder preserve chronology and causality.\n- Do not write text that depends on the placeholder staying literal (for example, \"as noted in `(b2)`\").\n- Your final meaning must be coherent once each placeholder is replaced with its full compressed block content.\n\nBOUNDARY IDS\nYou specify boundaries by ID using the injected IDs visible in the conversation:\n\n- `mNNNN` IDs identify raw messages\n- `bN` IDs identify previously compressed blocks\n\nEach message has an ID inside XML metadata tags like `<dcp-message-id>...</dcp-message-id>`.\nThe same ID tag appears in every tool output of the message it belongs to \u2014 each unique ID identifies one complete message.\nTreat these tags as boundary metadata only, not as tool result content.\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. Use only IDs that are present in context.\n\nBATCHING\nWhen multiple independent ranges are ready and their boundaries do not overlap, include all of them as separate entries in the `content` array of a single tool call. Each entry should have its own `startId`, `endId`, and `summary`.\n";
|
|
2
2
|
//# sourceMappingURL=compress-range.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compress-range.d.ts","sourceRoot":"","sources":["../../../lib/prompts/compress-range.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"compress-range.d.ts","sourceRoot":"","sources":["../../../lib/prompts/compress-range.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,k/GA2D1B,CAAA"}
|
|
@@ -45,7 +45,7 @@ You specify boundaries by ID using the injected IDs visible in the conversation:
|
|
|
45
45
|
- \`bN\` IDs identify previously compressed blocks
|
|
46
46
|
|
|
47
47
|
Each message has an ID inside XML metadata tags like \`<dcp-message-id>...</dcp-message-id>\`.
|
|
48
|
-
The ID tag appears
|
|
48
|
+
The same ID tag appears in every tool output of the message it belongs to — each unique ID identifies one complete message.
|
|
49
49
|
Treat these tags as boundary metadata only, not as tool result content.
|
|
50
50
|
|
|
51
51
|
Rules:
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const CONTEXT_LIMIT_NUDGE = "<dcp-system-reminder>\nCRITICAL WARNING: MAX CONTEXT LIMIT REACHED\n\nYou are at or beyond the configured max context threshold. This is an emergency context-recovery moment.\n\nYou MUST use the `compress` tool now. Do not continue normal exploration until compression is handled.\n\nIf you are in the middle of a critical atomic operation, finish that atomic step first, then compress immediately.\n\
|
|
1
|
+
export declare const CONTEXT_LIMIT_NUDGE = "<dcp-system-reminder>\nCRITICAL WARNING: MAX CONTEXT LIMIT REACHED\n\nYou are at or beyond the configured max context threshold. This is an emergency context-recovery moment.\n\nYou MUST use the `compress` tool now. Do not continue normal exploration until compression is handled.\n\nIf you are in the middle of a critical atomic operation, finish that atomic step first, then compress immediately.\n\nSELECTION PROCESS\nStart from older, resolved history and capture as much stale context as safely possible in one pass.\nAvoid the newest active working messages unless it is clearly closed.\n\nSUMMARY REQUIREMENTS\nYour summary MUST cover all essential details from the selected messages so work can continue.\nIf the compressed range includes user messages, preserve user intent exactly. Prefer direct quotes for short user messages to avoid semantic drift.\n</dcp-system-reminder>\n";
|
|
2
2
|
//# sourceMappingURL=context-limit-nudge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-limit-nudge.d.ts","sourceRoot":"","sources":["../../../lib/prompts/context-limit-nudge.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"context-limit-nudge.d.ts","sourceRoot":"","sources":["../../../lib/prompts/context-limit-nudge.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,43BAiB/B,CAAA"}
|
|
@@ -7,18 +7,12 @@ You MUST use the \`compress\` tool now. Do not continue normal exploration until
|
|
|
7
7
|
|
|
8
8
|
If you are in the middle of a critical atomic operation, finish that atomic step first, then compress immediately.
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
Prioritize one large, closed, high-yield compression range first.
|
|
12
|
-
This overrides the normal preference for many small compressions.
|
|
13
|
-
Only split into multiple compressions if one large range would reduce summary quality or make boundary selection unsafe.
|
|
14
|
-
|
|
15
|
-
RANGE SELECTION
|
|
10
|
+
SELECTION PROCESS
|
|
16
11
|
Start from older, resolved history and capture as much stale context as safely possible in one pass.
|
|
17
|
-
Avoid the newest active working
|
|
18
|
-
Use visible injected boundary IDs for compression (\`mNNNN\` for messages, \`bN\` for compressed blocks), and ensure \`startId\` appears before \`endId\`.
|
|
12
|
+
Avoid the newest active working messages unless it is clearly closed.
|
|
19
13
|
|
|
20
14
|
SUMMARY REQUIREMENTS
|
|
21
|
-
Your summary
|
|
15
|
+
Your summary MUST cover all essential details from the selected messages so work can continue.
|
|
22
16
|
If the compressed range includes user messages, preserve user intent exactly. Prefer direct quotes for short user messages to avoid semantic drift.
|
|
23
17
|
</dcp-system-reminder>
|
|
24
18
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-limit-nudge.js","sourceRoot":"","sources":["../../../lib/prompts/context-limit-nudge.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG
|
|
1
|
+
{"version":3,"file":"context-limit-nudge.js","sourceRoot":"","sources":["../../../lib/prompts/context-limit-nudge.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;CAiBlC,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SessionState } from "../../state";
|
|
2
|
+
export declare function buildCompressedBlockGuidance(state: SessionState): string;
|
|
3
|
+
export declare function renderMessagePriorityGuidance(priorityLabel: string, refs: string[]): string;
|
|
4
|
+
export declare function appendGuidanceToDcpTag(nudgeText: string, guidance: string): string;
|
|
5
|
+
//# sourceMappingURL=nudge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nudge.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/extensions/nudge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAaxE;AAED,wBAAgB,6BAA6B,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAQ3F;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAelF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export function buildCompressedBlockGuidance(state) {
|
|
2
|
+
const refs = Array.from(state.prune.messages.activeBlockIds)
|
|
3
|
+
.filter((id) => Number.isInteger(id) && id > 0)
|
|
4
|
+
.sort((a, b) => a - b)
|
|
5
|
+
.map((id) => `b${id}`);
|
|
6
|
+
const blockCount = refs.length;
|
|
7
|
+
const blockList = blockCount > 0 ? refs.join(", ") : "none";
|
|
8
|
+
return [
|
|
9
|
+
"Compressed block context:",
|
|
10
|
+
`- Active compressed blocks in this session: ${blockCount} (${blockList})`,
|
|
11
|
+
"- If your selected compression range includes any listed block, include each required placeholder exactly once in the summary using `(bN)`.",
|
|
12
|
+
].join("\n");
|
|
13
|
+
}
|
|
14
|
+
export function renderMessagePriorityGuidance(priorityLabel, refs) {
|
|
15
|
+
const refList = refs.length > 0 ? refs.join(", ") : "none";
|
|
16
|
+
return [
|
|
17
|
+
"Message priority context:",
|
|
18
|
+
"- Higher-priority older messages consume more context and should be compressed right away if it is safe to do so.",
|
|
19
|
+
`- ${priorityLabel}-priority message IDs before this point: ${refList}`,
|
|
20
|
+
].join("\n");
|
|
21
|
+
}
|
|
22
|
+
export function appendGuidanceToDcpTag(nudgeText, guidance) {
|
|
23
|
+
if (!guidance.trim()) {
|
|
24
|
+
return nudgeText;
|
|
25
|
+
}
|
|
26
|
+
const closeTag = "</dcp-system-reminder>";
|
|
27
|
+
const closeTagIndex = nudgeText.lastIndexOf(closeTag);
|
|
28
|
+
if (closeTagIndex === -1) {
|
|
29
|
+
return nudgeText;
|
|
30
|
+
}
|
|
31
|
+
const beforeClose = nudgeText.slice(0, closeTagIndex).trimEnd();
|
|
32
|
+
const afterClose = nudgeText.slice(closeTagIndex);
|
|
33
|
+
return `${beforeClose}\n\n${guidance}\n${afterClose}`;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=nudge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nudge.js","sourceRoot":"","sources":["../../../../lib/prompts/extensions/nudge.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,4BAA4B,CAAC,KAAmB;IAC5D,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC;SACvD,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;SAC9C,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;SACrB,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;IAC1B,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAA;IAC9B,MAAM,SAAS,GAAG,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAA;IAE3D,OAAO;QACH,2BAA2B;QAC3B,+CAA+C,UAAU,KAAK,SAAS,GAAG;QAC1E,6IAA6I;KAChJ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAChB,CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,aAAqB,EAAE,IAAc;IAC/E,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAA;IAE1D,OAAO;QACH,2BAA2B;QAC3B,mHAAmH;QACnH,KAAK,aAAa,4CAA4C,OAAO,EAAE;KAC1E,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAChB,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,SAAiB,EAAE,QAAgB;IACtE,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;QACnB,OAAO,SAAS,CAAA;IACpB,CAAC;IAED,MAAM,QAAQ,GAAG,wBAAwB,CAAA;IACzC,MAAM,aAAa,GAAG,SAAS,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;IAErD,IAAI,aAAa,KAAK,CAAC,CAAC,EAAE,CAAC;QACvB,OAAO,SAAS,CAAA;IACpB,CAAC;IAED,MAAM,WAAW,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,OAAO,EAAE,CAAA;IAC/D,MAAM,UAAU,GAAG,SAAS,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;IACjD,OAAO,GAAG,WAAW,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAA;AACzD,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const MANUAL_MODE_SYSTEM_EXTENSION = "<dcp-system-reminder>\nManual mode is enabled. Do NOT use compress unless the user has explicitly triggered it through a manual marker.\n\nOnly use the compress tool after seeing `<compress triggered manually>` in the current user instruction context.\n\nIssue exactly ONE compress tool per manual trigger. Do NOT launch multiple compress tools in parallel. Each trigger grants a single compression; after it completes, wait for the next trigger.\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</dcp-system-reminder>\n";
|
|
2
|
+
export declare const SUBAGENT_SYSTEM_EXTENSION = "<dcp-system-reminder>\nYou are operating in a subagent environment.\n\nThe initial subagent instruction is imperative and must be followed exactly.\nIt is the only user message intentionally not assigned a message ID, and therefore is not eligible for compression.\nAll subsequent messages in the session will have IDs.\n</dcp-system-reminder>\n";
|
|
3
|
+
export declare function buildProtectedToolsExtension(protectedTools: string[]): string;
|
|
4
|
+
//# sourceMappingURL=system.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/extensions/system.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,mrBASxC,CAAA;AAED,eAAO,MAAM,yBAAyB,8VAOrC,CAAA;AAED,wBAAgB,4BAA4B,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,MAAM,CAW7E"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const MANUAL_MODE_SYSTEM_EXTENSION = `<dcp-system-reminder>
|
|
2
|
+
Manual mode is enabled. Do NOT use compress unless the user has explicitly triggered it through a manual marker.
|
|
3
|
+
|
|
4
|
+
Only use the compress tool after seeing \`<compress triggered manually>\` in the current user instruction context.
|
|
5
|
+
|
|
6
|
+
Issue exactly ONE compress tool per manual trigger. Do NOT launch multiple compress tools in parallel. Each trigger grants a single compression; after it completes, wait for the next trigger.
|
|
7
|
+
|
|
8
|
+
After 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.
|
|
9
|
+
</dcp-system-reminder>
|
|
10
|
+
`;
|
|
11
|
+
export const SUBAGENT_SYSTEM_EXTENSION = `<dcp-system-reminder>
|
|
12
|
+
You are operating in a subagent environment.
|
|
13
|
+
|
|
14
|
+
The initial subagent instruction is imperative and must be followed exactly.
|
|
15
|
+
It is the only user message intentionally not assigned a message ID, and therefore is not eligible for compression.
|
|
16
|
+
All subsequent messages in the session will have IDs.
|
|
17
|
+
</dcp-system-reminder>
|
|
18
|
+
`;
|
|
19
|
+
export function buildProtectedToolsExtension(protectedTools) {
|
|
20
|
+
if (protectedTools.length === 0) {
|
|
21
|
+
return "";
|
|
22
|
+
}
|
|
23
|
+
const toolList = protectedTools.map((t) => `\`${t}\``).join(", ");
|
|
24
|
+
return `<dcp-system-reminder>
|
|
25
|
+
The following tools are environment-managed: ${toolList}.
|
|
26
|
+
Their outputs are automatically preserved during compression.
|
|
27
|
+
Do not include their content in compress tool summaries — the environment retains it independently.
|
|
28
|
+
</dcp-system-reminder>`;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=system.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.js","sourceRoot":"","sources":["../../../../lib/prompts/extensions/system.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;;;;;;CAS3C,CAAA;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;CAOxC,CAAA;AAED,MAAM,UAAU,4BAA4B,CAAC,cAAwB;IACjE,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO,EAAE,CAAA;IACb,CAAC;IAED,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACjE,OAAO;+CACoC,QAAQ;;;uBAGhC,CAAA;AACvB,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const RANGE_FORMAT_EXTENSION = "\nTHE FORMAT OF COMPRESS\n\n```\n{\n topic: string, // Short label (3-5 words) - e.g., \"Auth System Exploration\"\n content: [ // One or more ranges to compress\n {\n startId: string, // Boundary ID at range start: mNNNN or bN\n endId: string, // Boundary ID at range end: mNNNN or bN\n summary: string // Complete technical summary replacing all content in range\n }\n ]\n}\n```";
|
|
2
|
+
export declare const MESSAGE_FORMAT_EXTENSION = "\nTHE FORMAT OF COMPRESS\n\n```\n{\n topic: string, // Short label (3-5 words) for the overall batch\n content: [ // One or more messages to compress independently\n {\n messageId: string, // Raw message ID only: mNNNN (ignore metadata attributes like priority)\n topic: string, // Short label (3-5 words) for this one message summary\n summary: string // Complete technical summary replacing that one message\n }\n ]\n}\n```";
|
|
3
|
+
//# sourceMappingURL=tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/extensions/tool.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,sBAAsB,gcAc5B,CAAA;AAEP,eAAO,MAAM,wBAAwB,2eAc9B,CAAA"}
|