@tarquinen/opencode-dcp 2.1.7 → 2.2.1-beta0

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.
Files changed (164) hide show
  1. package/README.md +100 -111
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +6 -29
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/commands/context.d.ts.map +1 -1
  6. package/dist/lib/commands/context.js +36 -8
  7. package/dist/lib/commands/context.js.map +1 -1
  8. package/dist/lib/commands/help.d.ts.map +1 -1
  9. package/dist/lib/commands/help.js +2 -6
  10. package/dist/lib/commands/help.js.map +1 -1
  11. package/dist/lib/commands/manual.d.ts +1 -3
  12. package/dist/lib/commands/manual.d.ts.map +1 -1
  13. package/dist/lib/commands/manual.js +4 -43
  14. package/dist/lib/commands/manual.js.map +1 -1
  15. package/dist/lib/commands/sweep.d.ts.map +1 -1
  16. package/dist/lib/commands/sweep.js +2 -12
  17. package/dist/lib/commands/sweep.js.map +1 -1
  18. package/dist/lib/config.d.ts +5 -20
  19. package/dist/lib/config.d.ts.map +1 -1
  20. package/dist/lib/config.js +172 -348
  21. package/dist/lib/config.js.map +1 -1
  22. package/dist/lib/hooks.d.ts +7 -0
  23. package/dist/lib/hooks.d.ts.map +1 -1
  24. package/dist/lib/hooks.js +26 -24
  25. package/dist/lib/hooks.js.map +1 -1
  26. package/dist/lib/logger.d.ts.map +1 -1
  27. package/dist/lib/logger.js +6 -0
  28. package/dist/lib/logger.js.map +1 -1
  29. package/dist/lib/messages/index.d.ts +2 -3
  30. package/dist/lib/messages/index.d.ts.map +1 -1
  31. package/dist/lib/messages/index.js +2 -3
  32. package/dist/lib/messages/index.js.map +1 -1
  33. package/dist/lib/messages/inject/inject.d.ts +6 -0
  34. package/dist/lib/messages/inject/inject.d.ts.map +1 -0
  35. package/dist/lib/messages/inject/inject.js +99 -0
  36. package/dist/lib/messages/inject/inject.js.map +1 -0
  37. package/dist/lib/messages/inject/utils.d.ts +20 -0
  38. package/dist/lib/messages/inject/utils.d.ts.map +1 -0
  39. package/dist/lib/messages/inject/utils.js +137 -0
  40. package/dist/lib/messages/inject/utils.js.map +1 -0
  41. package/dist/lib/messages/utils.d.ts +7 -11
  42. package/dist/lib/messages/utils.d.ts.map +1 -1
  43. package/dist/lib/messages/utils.js +33 -132
  44. package/dist/lib/messages/utils.js.map +1 -1
  45. package/dist/lib/prompts/_codegen/system.generated.d.ts +1 -1
  46. package/dist/lib/prompts/_codegen/system.generated.d.ts.map +1 -1
  47. package/dist/lib/prompts/_codegen/system.generated.js +36 -32
  48. package/dist/lib/prompts/_codegen/system.generated.js.map +1 -1
  49. package/dist/lib/prompts/compress.d.ts +2 -0
  50. package/dist/lib/prompts/compress.d.ts.map +1 -0
  51. package/dist/lib/prompts/compress.js +122 -0
  52. package/dist/lib/prompts/compress.js.map +1 -0
  53. package/dist/lib/prompts/index.d.ts +6 -10
  54. package/dist/lib/prompts/index.d.ts.map +1 -1
  55. package/dist/lib/prompts/index.js +17 -40
  56. package/dist/lib/prompts/index.js.map +1 -1
  57. package/dist/lib/prompts/iteration-nudge.d.ts +2 -0
  58. package/dist/lib/prompts/iteration-nudge.d.ts.map +1 -0
  59. package/dist/lib/prompts/iteration-nudge.js +9 -0
  60. package/dist/lib/prompts/iteration-nudge.js.map +1 -0
  61. package/dist/lib/prompts/nudge.d.ts +2 -0
  62. package/dist/lib/prompts/nudge.d.ts.map +1 -0
  63. package/dist/lib/prompts/nudge.js +40 -0
  64. package/dist/lib/prompts/nudge.js.map +1 -0
  65. package/dist/lib/prompts/turn-nudge.d.ts +2 -0
  66. package/dist/lib/prompts/turn-nudge.d.ts.map +1 -0
  67. package/dist/lib/prompts/turn-nudge.js +12 -0
  68. package/dist/lib/prompts/turn-nudge.js.map +1 -0
  69. package/dist/lib/state/persistence.d.ts +7 -2
  70. package/dist/lib/state/persistence.d.ts.map +1 -1
  71. package/dist/lib/state/persistence.js +58 -39
  72. package/dist/lib/state/persistence.js.map +1 -1
  73. package/dist/lib/state/state.d.ts.map +1 -1
  74. package/dist/lib/state/state.js +20 -8
  75. package/dist/lib/state/state.js.map +1 -1
  76. package/dist/lib/state/tool-cache.d.ts.map +1 -1
  77. package/dist/lib/state/tool-cache.js +3 -17
  78. package/dist/lib/state/tool-cache.js.map +1 -1
  79. package/dist/lib/state/types.d.ts +7 -8
  80. package/dist/lib/state/types.d.ts.map +1 -1
  81. package/dist/lib/state/utils.d.ts +2 -2
  82. package/dist/lib/state/utils.d.ts.map +1 -1
  83. package/dist/lib/state/utils.js +29 -19
  84. package/dist/lib/state/utils.js.map +1 -1
  85. package/dist/lib/strategies/deduplication.d.ts.map +1 -1
  86. package/dist/lib/strategies/deduplication.js +0 -11
  87. package/dist/lib/strategies/deduplication.js.map +1 -1
  88. package/dist/lib/strategies/index.d.ts +0 -1
  89. package/dist/lib/strategies/index.d.ts.map +1 -1
  90. package/dist/lib/strategies/index.js +0 -1
  91. package/dist/lib/strategies/index.js.map +1 -1
  92. package/dist/lib/strategies/purge-errors.d.ts.map +1 -1
  93. package/dist/lib/strategies/purge-errors.js +0 -11
  94. package/dist/lib/strategies/purge-errors.js.map +1 -1
  95. package/dist/lib/strategies/supersede-writes.d.ts.map +1 -1
  96. package/dist/lib/strategies/supersede-writes.js +0 -11
  97. package/dist/lib/strategies/supersede-writes.js.map +1 -1
  98. package/dist/lib/strategies/utils.d.ts +1 -0
  99. package/dist/lib/strategies/utils.d.ts.map +1 -1
  100. package/dist/lib/strategies/utils.js +15 -0
  101. package/dist/lib/strategies/utils.js.map +1 -1
  102. package/dist/lib/tools/compress-utils.d.ts +7 -4
  103. package/dist/lib/tools/compress-utils.d.ts.map +1 -1
  104. package/dist/lib/tools/compress-utils.js +34 -25
  105. package/dist/lib/tools/compress-utils.js.map +1 -1
  106. package/dist/lib/tools/compress.d.ts +2 -2
  107. package/dist/lib/tools/compress.d.ts.map +1 -1
  108. package/dist/lib/tools/compress.js +28 -58
  109. package/dist/lib/tools/compress.js.map +1 -1
  110. package/dist/lib/tools/index.d.ts +1 -3
  111. package/dist/lib/tools/index.d.ts.map +1 -1
  112. package/dist/lib/tools/index.js +0 -2
  113. package/dist/lib/tools/index.js.map +1 -1
  114. package/dist/lib/tools/types.d.ts +1 -1
  115. package/dist/lib/tools/types.d.ts.map +1 -1
  116. package/dist/lib/ui/notification.d.ts +2 -2
  117. package/dist/lib/ui/notification.d.ts.map +1 -1
  118. package/dist/lib/ui/notification.js +24 -28
  119. package/dist/lib/ui/notification.js.map +1 -1
  120. package/dist/lib/ui/utils.d.ts +3 -4
  121. package/dist/lib/ui/utils.d.ts.map +1 -1
  122. package/dist/lib/ui/utils.js +165 -24
  123. package/dist/lib/ui/utils.js.map +1 -1
  124. package/package.json +2 -1
  125. package/dist/lib/messages/inject.d.ts +0 -14
  126. package/dist/lib/messages/inject.d.ts.map +0 -1
  127. package/dist/lib/messages/inject.js +0 -266
  128. package/dist/lib/messages/inject.js.map +0 -1
  129. package/dist/lib/messages/sync.d.ts +0 -4
  130. package/dist/lib/messages/sync.d.ts.map +0 -1
  131. package/dist/lib/messages/sync.js +0 -29
  132. package/dist/lib/messages/sync.js.map +0 -1
  133. package/dist/lib/prompts/_codegen/compress-nudge.generated.d.ts +0 -2
  134. package/dist/lib/prompts/_codegen/compress-nudge.generated.d.ts.map +0 -1
  135. package/dist/lib/prompts/_codegen/compress-nudge.generated.js +0 -15
  136. package/dist/lib/prompts/_codegen/compress-nudge.generated.js.map +0 -1
  137. package/dist/lib/prompts/_codegen/compress.generated.d.ts +0 -2
  138. package/dist/lib/prompts/_codegen/compress.generated.d.ts.map +0 -1
  139. package/dist/lib/prompts/_codegen/compress.generated.js +0 -66
  140. package/dist/lib/prompts/_codegen/compress.generated.js.map +0 -1
  141. package/dist/lib/prompts/_codegen/distill.generated.d.ts +0 -2
  142. package/dist/lib/prompts/_codegen/distill.generated.d.ts.map +0 -1
  143. package/dist/lib/prompts/_codegen/distill.generated.js +0 -33
  144. package/dist/lib/prompts/_codegen/distill.generated.js.map +0 -1
  145. package/dist/lib/prompts/_codegen/nudge.generated.d.ts +0 -2
  146. package/dist/lib/prompts/_codegen/nudge.generated.d.ts.map +0 -1
  147. package/dist/lib/prompts/_codegen/nudge.generated.js +0 -17
  148. package/dist/lib/prompts/_codegen/nudge.generated.js.map +0 -1
  149. package/dist/lib/prompts/_codegen/prune.generated.d.ts +0 -2
  150. package/dist/lib/prompts/_codegen/prune.generated.d.ts.map +0 -1
  151. package/dist/lib/prompts/_codegen/prune.generated.js +0 -23
  152. package/dist/lib/prompts/_codegen/prune.generated.js.map +0 -1
  153. package/dist/lib/tools/distill.d.ts +0 -4
  154. package/dist/lib/tools/distill.d.ts.map +0 -1
  155. package/dist/lib/tools/distill.js +0 -41
  156. package/dist/lib/tools/distill.js.map +0 -1
  157. package/dist/lib/tools/prune-shared.d.ts +0 -8
  158. package/dist/lib/tools/prune-shared.d.ts.map +0 -1
  159. package/dist/lib/tools/prune-shared.js +0 -127
  160. package/dist/lib/tools/prune-shared.js.map +0 -1
  161. package/dist/lib/tools/prune.d.ts +0 -4
  162. package/dist/lib/tools/prune.d.ts.map +0 -1
  163. package/dist/lib/tools/prune.js +0 -28
  164. package/dist/lib/tools/prune.js.map +0 -1
@@ -0,0 +1,137 @@
1
+ import { createSyntheticTextPart, createSyntheticToolPart, isIgnoredUserMessage, rejectsTextParts, } from "../utils";
2
+ import { getLastUserMessage } from "../../shared-utils";
3
+ import { getCurrentTokenUsage } from "../../strategies/utils";
4
+ import { CONTEXT_LIMIT_NUDGE, ITERATION_NUDGE_PROMPT, TURN_NUDGE_PROMPT } from "../../prompts";
5
+ export function getNudgeFrequency(config) {
6
+ return Math.max(1, Math.floor(config.compress.nudgeFrequency || 1));
7
+ }
8
+ export function getIterationNudgeThreshold(config) {
9
+ return Math.max(1, Math.floor(config.compress.iterationNudgeThreshold || 1));
10
+ }
11
+ export function findLastNonIgnoredMessage(messages) {
12
+ for (let i = messages.length - 1; i >= 0; i--) {
13
+ const message = messages[i];
14
+ if (message.info.role === "user" && isIgnoredUserMessage(message)) {
15
+ continue;
16
+ }
17
+ return { message, index: i };
18
+ }
19
+ return null;
20
+ }
21
+ export function countMessagesAfterIndex(messages, index) {
22
+ let count = 0;
23
+ for (let i = index + 1; i < messages.length; i++) {
24
+ const message = messages[i];
25
+ if (message.info.role === "user" && isIgnoredUserMessage(message)) {
26
+ continue;
27
+ }
28
+ count++;
29
+ }
30
+ return count;
31
+ }
32
+ export function messageHasCompress(message) {
33
+ const parts = Array.isArray(message.parts) ? message.parts : [];
34
+ return parts.some((part) => part.type === "tool" && part.state.status === "completed" && part.tool === "compress");
35
+ }
36
+ export function getModelInfo(messages) {
37
+ const lastUserMessage = getLastUserMessage(messages);
38
+ if (!lastUserMessage) {
39
+ return {
40
+ providerId: undefined,
41
+ modelId: undefined,
42
+ };
43
+ }
44
+ const userInfo = lastUserMessage.info;
45
+ return {
46
+ providerId: userInfo.model.providerID,
47
+ modelId: userInfo.model.modelID,
48
+ };
49
+ }
50
+ function resolveContextLimit(config, state, providerId, modelId) {
51
+ const parseLimitValue = (limit) => {
52
+ if (limit === undefined) {
53
+ return undefined;
54
+ }
55
+ if (typeof limit === "number") {
56
+ return limit;
57
+ }
58
+ if (!limit.endsWith("%") || state.modelContextLimit === undefined) {
59
+ return undefined;
60
+ }
61
+ const parsedPercent = parseFloat(limit.slice(0, -1));
62
+ if (isNaN(parsedPercent)) {
63
+ return undefined;
64
+ }
65
+ const roundedPercent = Math.round(parsedPercent);
66
+ const clampedPercent = Math.max(0, Math.min(100, roundedPercent));
67
+ return Math.round((clampedPercent / 100) * state.modelContextLimit);
68
+ };
69
+ const modelLimits = config.compress.modelLimits;
70
+ if (modelLimits && providerId !== undefined && modelId !== undefined) {
71
+ const providerModelId = `${providerId}/${modelId}`;
72
+ const modelLimit = modelLimits[providerModelId];
73
+ if (modelLimit !== undefined) {
74
+ return parseLimitValue(modelLimit);
75
+ }
76
+ }
77
+ return parseLimitValue(config.compress.contextLimit);
78
+ }
79
+ export function isContextOverLimit(config, state, providerId, modelId, messages) {
80
+ const contextLimit = resolveContextLimit(config, state, providerId, modelId);
81
+ if (contextLimit === undefined) {
82
+ return false;
83
+ }
84
+ const currentTokens = getCurrentTokenUsage(messages);
85
+ return currentTokens > contextLimit;
86
+ }
87
+ export function addAnchor(anchorMessageIds, anchorMessageId, anchorMessageIndex, messages, interval) {
88
+ if (anchorMessageIndex < 0) {
89
+ return false;
90
+ }
91
+ let latestAnchorMessageIndex = -1;
92
+ for (let i = messages.length - 1; i >= 0; i--) {
93
+ if (anchorMessageIds.has(messages[i].info.id)) {
94
+ latestAnchorMessageIndex = i;
95
+ break;
96
+ }
97
+ }
98
+ const shouldAdd = latestAnchorMessageIndex < 0 || anchorMessageIndex - latestAnchorMessageIndex >= interval;
99
+ if (!shouldAdd) {
100
+ return false;
101
+ }
102
+ const previousSize = anchorMessageIds.size;
103
+ anchorMessageIds.add(anchorMessageId);
104
+ return anchorMessageIds.size !== previousSize;
105
+ }
106
+ function applyAnchoredNudge(anchorMessageIds, messages, modelId, hintText) {
107
+ if (anchorMessageIds.size === 0) {
108
+ return;
109
+ }
110
+ for (const anchorMessageId of anchorMessageIds) {
111
+ const messageIndex = messages.findIndex((message) => message.info.id === anchorMessageId);
112
+ if (messageIndex === -1) {
113
+ continue;
114
+ }
115
+ const message = messages[messageIndex];
116
+ if (message.info.role === "user") {
117
+ message.parts.push(createSyntheticTextPart(message, hintText));
118
+ continue;
119
+ }
120
+ if (message.info.role !== "assistant") {
121
+ continue;
122
+ }
123
+ const toolModelId = modelId || "";
124
+ if (rejectsTextParts(toolModelId)) {
125
+ message.parts.push(createSyntheticToolPart(message, hintText, toolModelId));
126
+ }
127
+ else {
128
+ message.parts.push(createSyntheticTextPart(message, hintText));
129
+ }
130
+ }
131
+ }
132
+ export function applyAnchoredNudges(state, messages, modelId) {
133
+ applyAnchoredNudge(state.nudges.contextLimitAnchors, messages, modelId, CONTEXT_LIMIT_NUDGE);
134
+ applyAnchoredNudge(state.nudges.turnNudgeAnchors, messages, modelId, TURN_NUDGE_PROMPT);
135
+ applyAnchoredNudge(state.nudges.iterationNudgeAnchors, messages, modelId, ITERATION_NUDGE_PROMPT);
136
+ }
137
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../lib/messages/inject/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,uBAAuB,EACvB,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,GACnB,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAY9F,MAAM,UAAU,iBAAiB,CAAC,MAAoB;IAClD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,IAAI,CAAC,CAAC,CAAC,CAAA;AACvE,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,MAAoB;IAC3D,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,uBAAuB,IAAI,CAAC,CAAC,CAAC,CAAA;AAChF,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,QAAqB;IAC3D,KAAK,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5C,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;QAC3B,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,oBAAoB,CAAC,OAAO,CAAC,EAAE,CAAC;YAChE,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C,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAA;QAClE,CAAC;IACL,CAAC;AACL,CAAC;AAED,MAAM,UAAU,mBAAmB,CAC/B,KAAmB,EACnB,QAAqB,EACrB,OAA2B;IAE3B,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,mBAAmB,EAAE,QAAQ,EAAE,OAAO,EAAE,mBAAmB,CAAC,CAAA;IAC5F,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,gBAAgB,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAA;IACvF,kBAAkB,CACd,KAAK,CAAC,MAAM,CAAC,qBAAqB,EAClC,QAAQ,EACR,OAAO,EACP,sBAAsB,CACzB,CAAA;AACL,CAAC"}
@@ -1,9 +1,5 @@
1
- import { Logger } from "../logger";
2
1
  import type { SessionState, WithParts } from "../state";
3
- type MessagePart = WithParts["parts"][number];
4
- type ToolPart = Extract<MessagePart, {
5
- type: "tool";
6
- }>;
2
+ export declare const rejectsTextParts: (modelID: string) => boolean;
7
3
  export declare const createSyntheticUserMessage: (baseMessage: WithParts, content: string, variant?: string, stableSeed?: string) => WithParts;
8
4
  export declare const createSyntheticTextPart: (baseMessage: WithParts, content: string, stableSeed?: string) => {
9
5
  id: string;
@@ -29,14 +25,14 @@ export declare const createSyntheticToolPart: (baseMessage: WithParts, content:
29
25
  callID: string;
30
26
  tool: string;
31
27
  };
28
+ type MessagePart = WithParts["parts"][number];
29
+ type ToolPart = Extract<MessagePart, {
30
+ type: "tool";
31
+ }>;
32
32
  export declare const appendMessageIdTagToToolOutput: (part: ToolPart, tag: string) => boolean;
33
33
  export declare const findLastToolPart: (message: WithParts) => ToolPart | null;
34
- /**
35
- * Extracts a human-readable key from tool metadata for display purposes.
36
- */
37
- export declare const extractParameterKey: (tool: string, parameters: any) => string;
38
- export declare function buildToolIdList(state: SessionState, messages: WithParts[], logger: Logger): string[];
34
+ export declare function buildToolIdList(state: SessionState, messages: WithParts[]): string[];
39
35
  export declare const isIgnoredUserMessage: (message: WithParts) => boolean;
40
- export declare const findMessageIndex: (messages: WithParts[], messageId: string) => number;
36
+ export declare const stripHallucinations: (messages: WithParts[]) => void;
41
37
  export {};
42
38
  //# 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;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;WAkCV,GAAG;;;;;;;;;;;;;;;CAEf,CAAA;AAED,eAAO,MAAM,8BAA8B,GAAI,MAAM,QAAQ,EAAE,KAAK,MAAM,KAAG,OAU5E,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,EAA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AG,OAazD,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,UAAU,SAAS,EAAE,KAAG,IAsB3D,CAAA"}
@@ -1,6 +1,9 @@
1
1
  import { createHash } from "node:crypto";
2
2
  import { isMessageCompacted } from "../shared-utils";
3
3
  const SUMMARY_ID_HASH_LENGTH = 16;
4
+ const DCP_MESSAGE_ID_TAG_REGEX = /<dcp-message-id>(?:m\d+|b\d+)<\/dcp-message-id>/g;
5
+ const TURN_NUDGE_BLOCK_REGEX = /<instruction\s+name=turn_nudge\b[^>]*>[\s\S]*?<\/instruction>/g;
6
+ const ITERATION_NUDGE_BLOCK_REGEX = /<instruction\s+name=iteration_nudge\b[^>]*>[\s\S]*?<\/instruction>/g;
4
7
  const generateStableId = (prefix, seed) => {
5
8
  const hash = createHash("sha256").update(seed).digest("hex").slice(0, SUMMARY_ID_HASH_LENGTH);
6
9
  return `${prefix}_${hash}`;
@@ -9,6 +12,10 @@ const isGeminiModel = (modelID) => {
9
12
  const lowerModelID = modelID.toLowerCase();
10
13
  return lowerModelID.includes("gemini");
11
14
  };
15
+ export const rejectsTextParts = (modelID) => {
16
+ const lowerModelID = modelID.toLowerCase();
17
+ return lowerModelID.includes("claude") || lowerModelID.includes("deepseek");
18
+ };
12
19
  export const createSyntheticUserMessage = (baseMessage, content, variant, stableSeed) => {
13
20
  const userInfo = baseMessage.info;
14
21
  const now = Date.now();
@@ -54,9 +61,9 @@ export const createSyntheticToolPart = (baseMessage, content, modelID, stableSee
54
61
  const deterministicSeed = stableSeed?.trim() || userInfo.id;
55
62
  const partId = generateStableId("prt_dcp_tool", deterministicSeed);
56
63
  const callId = generateStableId("call_dcp_tool", deterministicSeed);
64
+ const finalContent = `<system-reminder>\nThis tool was called by the environment and is not available to the LLM.\n</system-reminder>\n${content}`;
57
65
  // Gemini requires a thought signature on synthetic function calls.
58
- // Keep this metadata both on the part and on state so whichever
59
- // conversion path is used can forward it to providerOptions.
66
+ // This must live on part metadata so it maps to callProviderMetadata.
60
67
  const toolPartMetadata = isGeminiModel(modelID)
61
68
  ? {
62
69
  google: { thoughtSignature: "skip_thought_signature_validator" },
@@ -74,14 +81,16 @@ export const createSyntheticToolPart = (baseMessage, content, modelID, stableSee
74
81
  state: {
75
82
  status: "completed",
76
83
  input: {},
77
- output: content,
84
+ output: finalContent,
78
85
  title: "Context Info",
79
- ...(toolPartMetadata ? { metadata: toolPartMetadata } : {}),
80
86
  time: { start: now, end: now },
81
87
  },
82
88
  };
83
89
  };
84
90
  export const appendMessageIdTagToToolOutput = (part, tag) => {
91
+ if (part.type !== "tool") {
92
+ return false;
93
+ }
85
94
  if (part.state?.status !== "completed" || typeof part.state.output !== "string") {
86
95
  return false;
87
96
  }
@@ -100,132 +109,7 @@ export const findLastToolPart = (message) => {
100
109
  }
101
110
  return null;
102
111
  };
103
- /**
104
- * Extracts a human-readable key from tool metadata for display purposes.
105
- */
106
- export const extractParameterKey = (tool, parameters) => {
107
- if (!parameters)
108
- return "";
109
- if (tool === "read" && parameters.filePath) {
110
- const offset = parameters.offset;
111
- const limit = parameters.limit;
112
- if (offset !== undefined && limit !== undefined) {
113
- return `${parameters.filePath} (lines ${offset}-${offset + limit})`;
114
- }
115
- if (offset !== undefined) {
116
- return `${parameters.filePath} (lines ${offset}+)`;
117
- }
118
- if (limit !== undefined) {
119
- return `${parameters.filePath} (lines 0-${limit})`;
120
- }
121
- return parameters.filePath;
122
- }
123
- if ((tool === "write" || tool === "edit" || tool === "multiedit") && parameters.filePath) {
124
- return parameters.filePath;
125
- }
126
- if (tool === "apply_patch" && typeof parameters.patchText === "string") {
127
- const pathRegex = /\*\*\* (?:Add|Delete|Update) File: ([^\n\r]+)/g;
128
- const paths = [];
129
- let match;
130
- while ((match = pathRegex.exec(parameters.patchText)) !== null) {
131
- paths.push(match[1].trim());
132
- }
133
- if (paths.length > 0) {
134
- const uniquePaths = [...new Set(paths)];
135
- const count = uniquePaths.length;
136
- const plural = count > 1 ? "s" : "";
137
- if (count === 1)
138
- return uniquePaths[0];
139
- if (count === 2)
140
- return uniquePaths.join(", ");
141
- return `${count} file${plural}: ${uniquePaths[0]}, ${uniquePaths[1]}...`;
142
- }
143
- return "patch";
144
- }
145
- if (tool === "list") {
146
- return parameters.path || "(current directory)";
147
- }
148
- if (tool === "glob") {
149
- if (parameters.pattern) {
150
- const pathInfo = parameters.path ? ` in ${parameters.path}` : "";
151
- return `"${parameters.pattern}"${pathInfo}`;
152
- }
153
- return "(unknown pattern)";
154
- }
155
- if (tool === "grep") {
156
- if (parameters.pattern) {
157
- const pathInfo = parameters.path ? ` in ${parameters.path}` : "";
158
- return `"${parameters.pattern}"${pathInfo}`;
159
- }
160
- return "(unknown pattern)";
161
- }
162
- if (tool === "bash") {
163
- if (parameters.description)
164
- return parameters.description;
165
- if (parameters.command) {
166
- return parameters.command.length > 50
167
- ? parameters.command.substring(0, 50) + "..."
168
- : parameters.command;
169
- }
170
- }
171
- if (tool === "webfetch" && parameters.url) {
172
- return parameters.url;
173
- }
174
- if (tool === "websearch" && parameters.query) {
175
- return `"${parameters.query}"`;
176
- }
177
- if (tool === "codesearch" && parameters.query) {
178
- return `"${parameters.query}"`;
179
- }
180
- if (tool === "todowrite") {
181
- return `${parameters.todos?.length || 0} todos`;
182
- }
183
- if (tool === "todoread") {
184
- return "read todo list";
185
- }
186
- if (tool === "task" && parameters.description) {
187
- return parameters.description;
188
- }
189
- if (tool === "skill" && parameters.name) {
190
- return parameters.name;
191
- }
192
- if (tool === "lsp") {
193
- const op = parameters.operation || "lsp";
194
- const path = parameters.filePath || "";
195
- const line = parameters.line;
196
- const char = parameters.character;
197
- if (path && line !== undefined && char !== undefined) {
198
- return `${op} ${path}:${line}:${char}`;
199
- }
200
- if (path) {
201
- return `${op} ${path}`;
202
- }
203
- return op;
204
- }
205
- if (tool === "question") {
206
- const questions = parameters.questions;
207
- if (Array.isArray(questions) && questions.length > 0) {
208
- const headers = questions
209
- .map((q) => q.header || "")
210
- .filter(Boolean)
211
- .slice(0, 3);
212
- const count = questions.length;
213
- const plural = count > 1 ? "s" : "";
214
- if (headers.length > 0) {
215
- const suffix = count > 3 ? ` (+${count - 3} more)` : "";
216
- return `${count} question${plural}: ${headers.join(", ")}${suffix}`;
217
- }
218
- return `${count} question${plural}`;
219
- }
220
- return "question";
221
- }
222
- const paramStr = JSON.stringify(parameters);
223
- if (paramStr === "{}" || paramStr === "[]" || paramStr === "null") {
224
- return "";
225
- }
226
- return paramStr.substring(0, 50);
227
- };
228
- export function buildToolIdList(state, messages, logger) {
112
+ export function buildToolIdList(state, messages) {
229
113
  const toolIds = [];
230
114
  for (const msg of messages) {
231
115
  if (isMessageCompacted(state, msg)) {
@@ -255,7 +139,24 @@ export const isIgnoredUserMessage = (message) => {
255
139
  }
256
140
  return true;
257
141
  };
258
- export const findMessageIndex = (messages, messageId) => {
259
- return messages.findIndex((msg) => msg.info.id === messageId);
142
+ export const stripHallucinations = (messages) => {
143
+ for (const message of messages) {
144
+ for (const part of message.parts) {
145
+ if (part.type === "text" && typeof part.text === "string") {
146
+ part.text = part.text
147
+ .replace(TURN_NUDGE_BLOCK_REGEX, "")
148
+ .replace(ITERATION_NUDGE_BLOCK_REGEX, "")
149
+ .replace(DCP_MESSAGE_ID_TAG_REGEX, "");
150
+ }
151
+ if (part.type === "tool" &&
152
+ part.state?.status === "completed" &&
153
+ typeof part.state.output === "string") {
154
+ part.state.output = part.state.output
155
+ .replace(TURN_NUDGE_BLOCK_REGEX, "")
156
+ .replace(ITERATION_NUDGE_BLOCK_REGEX, "")
157
+ .replace(DCP_MESSAGE_ID_TAG_REGEX, "");
158
+ }
159
+ }
160
+ }
260
161
  };
261
162
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
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,MAA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,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACxD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI;qBAChB,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAC;qBACnC,OAAO,CAAC,2BAA2B,EAAE,EAAE,CAAC;qBACxC,OAAO,CAAC,wBAAwB,EAAE,EAAE,CAAC,CAAA;YAC9C,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,IAAI,CAAC,KAAK,CAAC,MAAM;qBAChC,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAC;qBACnC,OAAO,CAAC,2BAA2B,EAAE,EAAE,CAAC;qBACxC,OAAO,CAAC,wBAAwB,EAAE,EAAE,CAAC,CAAA;YAC9C,CAAC;QACL,CAAC;IACL,CAAC;AACL,CAAC,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. Use injected boundary IDs (`startId`/`endId`) to select ranges.\n\nInjected boundary IDs are surfaced as XML tags in conversation context, e.g. `<dcp-message-id>m0001</dcp-message-id>` for message IDs and `<dcp-message-id>b3</dcp-message-id>` for compressed blocks. These IDs are internal boundary markers for `compress` only. Do not reference, explain, or surface these IDs in normal user-facing responses unless you are actively constructing a `compress` tool call.\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";
1
+ export declare const SYSTEM = "<system-reminder>\n<instruction name=compress_tool attention_level=high>\nYou operate in a context-constrained environment. Manage context continuously to avoid buildup and preserve retrieval quality. Efficient context management is paramount for your agentic performance.\n\nThe ONLY tool you have for context management is `compress`. It replaces a contiguous portion of the conversation (inclusive) with a technical summary you produce.\n\nOPERATING STANCE\nPrefer short, closed, summary-safe ranges.\nWhen multiple independent stale ranges exist, prefer several short compressions (in parallel when possible) over one large-range compression.\n\nUse `compress` as steady housekeeping while you work.\n\nCADENCE, SIGNALS, AND LATENCY\n\n- No fixed threshold mandates compression\n- Prioritize closedness and independence over raw range size\n- Prefer smaller, regular compressions over infrequent massive compressions for better latency and summary quality\n- When multiple independent stale ranges are ready, batch compressions in parallel\n\nBOUNDARY MATCHING\n`compress` uses inclusive ID boundaries via `content.startId` and `content.endId`. IDs are injected in context as message refs (`mNNNN`) and compressed block refs (`bN`).\n\nEach message has an ID inside XML metadata tags like `<dcp-message-id>...</dcp-message-id>`.\nTreat these tags as boundary metadata only, not as tool result content.\n\nOnly choose IDs currently visible in context. Do not invent IDs.\n\nRESPECT THE CHRONOLOGY OF THE RANGE\n`content.startId` MUST refer to an item above/before `content.endId`\n`content.endId` MUST refer to an item below/after `content.startId`\nAlways provide boundaries via the tool schema fields `content.startId` and `content.endId`.\n\nTHE SUMMARY STANDARD\nYour summary MUST be technical and specific enough to preserve FULL understanding of what transpired, such that NO ambiguity remains about what asked, found, planned, done, or decided - yet noise free\n\nWhen compressing ranges that include user messages, preserve user intent faithfully. Do not reinterpret or redirect the request. Directly quote short user messages when that is the most reliable way to preserve exact meaning.\n\nPreserve key details: file paths, symbols, signatures, constraints, decisions, outcomes, commands, etc.. in order to produce a high fidelity, authoritative technical record\n\nDO NOT COMPRESS IF\n\n- raw context is still relevant and needed for edits or precise references\n- the task in the target range is still actively in progress\n\nEvaluate conversation signal-to-noise REGULARLY. Use `compress` deliberately with quality-first summaries. Prefer multiple short, independent range compressions before considering broader ranges, and prioritize ranges intelligently to maintain a high-signal context window that supports your agency\n\nIt is of your responsibility to keep a sharp, high-quality context window for optimal performance\n</instruction>\n\n<manual><instruction name=manual_mode policy_level=critical>\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\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</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,gmOAsDlB,CAAA"}
1
+ {"version":3,"file":"system.generated.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/_codegen/system.generated.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,MAAM,87GA0DlB,CAAA"}
@@ -2,58 +2,62 @@
2
2
  // Generated from system.md by scripts/generate-prompts.ts
3
3
  // To modify, edit system.md and run `npm run generate:prompts`
4
4
  export const SYSTEM = `<system-reminder>
5
- <instruction name=context_management_protocol policy_level=critical>
6
- You 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.
5
+ <instruction name=compress_tool attention_level=high>
6
+ You operate in a context-constrained environment. Manage context continuously to avoid buildup and preserve retrieval quality. Efficient context management is paramount for your agentic performance.
7
7
 
8
- AVAILABLE TOOLS FOR CONTEXT MANAGEMENT
9
- <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>
10
- <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>
11
- <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>
8
+ The ONLY tool you have for context management is \`compress\`. It replaces a contiguous portion of the conversation (inclusive) with a technical summary you produce.
12
9
 
13
- <distill>THE DISTILL TOOL
14
- \`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.
15
- </distill>
10
+ OPERATING STANCE
11
+ Prefer short, closed, summary-safe ranges.
12
+ When multiple independent stale ranges exist, prefer several short compressions (in parallel when possible) over one large-range compression.
16
13
 
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. Use injected boundary IDs (\`startId\`/\`endId\`) to select ranges.
14
+ Use \`compress\` as steady housekeeping while you work.
19
15
 
20
- Injected boundary IDs are surfaced as XML tags in conversation context, e.g. \`<dcp-message-id>m0001</dcp-message-id>\` for message IDs and \`<dcp-message-id>b3</dcp-message-id>\` for compressed blocks. These IDs are internal boundary markers for \`compress\` only. Do not reference, explain, or surface these IDs in normal user-facing responses unless you are actively constructing a \`compress\` tool call.
16
+ CADENCE, SIGNALS, AND LATENCY
21
17
 
22
- 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.
18
+ - No fixed threshold mandates compression
19
+ - Prioritize closedness and independence over raw range size
20
+ - Prefer smaller, regular compressions over infrequent massive compressions for better latency and summary quality
21
+ - When multiple independent stale ranges are ready, batch compressions in parallel
23
22
 
24
- 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\`.
25
- </compress>
23
+ BOUNDARY MATCHING
24
+ \`compress\` uses inclusive ID boundaries via \`content.startId\` and \`content.endId\`. IDs are injected in context as message refs (\`mNNNN\`) and compressed block refs (\`bN\`).
26
25
 
27
- <prune>THE PRUNE TOOL
28
- \`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.
26
+ Each message has an ID inside XML metadata tags like \`<dcp-message-id>...</dcp-message-id>\`.
27
+ Treat these tags as boundary metadata only, not as tool result content.
29
28
 
30
- Contemplate 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.
31
- </prune>
29
+ Only choose IDs currently visible in context. Do not invent IDs.
32
30
 
33
- TIMING
34
- Prefer 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.
31
+ RESPECT THE CHRONOLOGY OF THE RANGE
32
+ \`content.startId\` MUST refer to an item above/before \`content.endId\`
33
+ \`content.endId\` MUST refer to an item below/after \`content.startId\`
34
+ Always provide boundaries via the tool schema fields \`content.startId\` and \`content.endId\`.
35
35
 
36
- EVALUATE 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.
36
+ THE SUMMARY STANDARD
37
+ Your summary MUST be technical and specific enough to preserve FULL understanding of what transpired, such that NO ambiguity remains about what asked, found, planned, done, or decided - yet noise free
37
38
 
38
- The 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.
39
+ When compressing ranges that include user messages, preserve user intent faithfully. Do not reinterpret or redirect the request. Directly quote short user messages when that is the most reliable way to preserve exact meaning.
39
40
 
40
- Be 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.
41
+ Preserve key details: file paths, symbols, signatures, constraints, decisions, outcomes, commands, etc.. in order to produce a high fidelity, authoritative technical record
42
+
43
+ DO NOT COMPRESS IF
44
+
45
+ - raw context is still relevant and needed for edits or precise references
46
+ - the task in the target range is still actively in progress
47
+
48
+ Evaluate conversation signal-to-noise REGULARLY. Use \`compress\` deliberately with quality-first summaries. Prefer multiple short, independent range compressions before considering broader ranges, and prioritize ranges intelligently to maintain a high-signal context window that supports your agency
49
+
50
+ It is of your responsibility to keep a sharp, high-quality context window for optimal performance
41
51
  </instruction>
42
52
 
43
53
  <manual><instruction name=manual_mode policy_level=critical>
44
- Manual mode is enabled. Do NOT use distill, compress, or prune unless the user has explicitly triggered it through a manual marker.
54
+ Manual mode is enabled. Do NOT use compress unless the user has explicitly triggered it through a manual marker.
45
55
 
46
- <prune>Only use the prune tool after seeing \`<prune triggered manually>\` in the current user instruction context.</prune>
47
- <distill>Only use the distill tool after seeing \`<distill triggered manually>\` in the current user instruction context.</distill>
48
- <compress>Only use the compress tool after seeing \`<compress triggered manually>\` in the current user instruction context.</compress>
56
+ Only use the compress tool after seeing \`<compress triggered manually>\` in the current user instruction context.
49
57
 
50
58
  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.
51
59
  </instruction></manual>
52
60
 
53
- <instruction name=injected_context_handling policy_level=critical>
54
- This 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.
55
- There 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.
56
- </instruction>
57
61
  </system-reminder>
58
62
  `;
59
63
  //# sourceMappingURL=system.generated.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"system.generated.js","sourceRoot":"","sources":["../../../../lib/prompts/_codegen/system.generated.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,0DAA0D;AAC1D,+DAA+D;AAE/D,MAAM,CAAC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDrB,CAAA"}
1
+ {"version":3,"file":"system.generated.js","sourceRoot":"","sources":["../../../../lib/prompts/_codegen/system.generated.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,0DAA0D;AAC1D,+DAA+D;AAE/D,MAAM,CAAC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DrB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const COMPRESS = "Your only tool for context management, use it to collapse a range in the conversation into a detailed 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\nOne method, many safe ranges:\n\n- short, closed ranges for disposable noise\n- short, closed ranges for resolved investigative slices\n- short, closed ranges for completed implementation chunks\n\nDefault to multiple short, bounded compressions. Prefer several safe range compressions over one large sweep whenever independent ranges are available.\n\nCADENCE, SIGNALS, AND LATENCY\nUse `compress` during work whenever a slice is summary-safe; do not wait for the user to send another message.\n\n- no fixed threshold forces compression\n- prioritize closedness and independence over raw range size\n- qualitative signals still matter most (stale exploration, noisy tool bursts, resolved branches)\n\nPREFER smaller, regular compressions OVER infrequent large compressions for better latency and better summary fidelity.\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\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\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\nCompress when a range is genuinely closed 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\nCompress smaller ranges when:\nYou need to discard dead-end noise without waiting for a whole chapter to close\nYou need to preserve key findings from a narrow slice while freeing context quickly\nYou can bound a stale range cleanly with injected IDs\n\nDo NOT compress when:\nYou may need exact code, error messages, or file contents from the range in the immediate next steps\nWork in that area is still active or likely to resume immediately\nYou cannot identify reliable boundaries yet\n\nBefore compressing, ask: _\"Is this range closed enough to become summary-only right now?\"_ 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- Prefer boundaries that produce short, closed ranges.\n\nID SOURCES\n\n- There is always an ID available for each message in XML tags like `<dcp-message-id>...</dcp-message-id>`.\n- Compressed blocks are addressable by `bN` IDs.\n\nTreat `<dcp-message-id>...</dcp-message-id>` as metadata only. It is not part of the tool result semantics.\n\nDo not invent IDs. Use only IDs that are present in context.\n\nPARALLEL COMPRESS EXECUTION\nWhen multiple independent ranges are ready and their boundaries do not overlap, launch MULTIPLE `compress` calls in parallel in a single response. This is the PREFERRED pattern over a single large-range compression when the work can be safely split. Run compression sequentially only when ranges overlap or when a later range depends on the result of an earlier compression.\n\nTHE FORMAT OF COMPRESS\n\n```\n{\n topic: string, // Short label (3-5 words) - e.g., \"Auth System Exploration\"\n content: {\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
+ //# sourceMappingURL=compress.d.ts.map