@tarquinen/opencode-dcp 2.2.7-beta0 → 2.2.9-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 (136) hide show
  1. package/README.md +61 -41
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +5 -2
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/commands/context.d.ts +5 -2
  6. package/dist/lib/commands/context.d.ts.map +1 -1
  7. package/dist/lib/commands/context.js +11 -4
  8. package/dist/lib/commands/context.js.map +1 -1
  9. package/dist/lib/commands/decompress.d.ts +12 -0
  10. package/dist/lib/commands/decompress.d.ts.map +1 -0
  11. package/dist/lib/commands/decompress.js +159 -0
  12. package/dist/lib/commands/decompress.js.map +1 -0
  13. package/dist/lib/commands/help.d.ts.map +1 -1
  14. package/dist/lib/commands/help.js +5 -1
  15. package/dist/lib/commands/help.js.map +1 -1
  16. package/dist/lib/commands/manual.d.ts.map +1 -1
  17. package/dist/lib/commands/manual.js +7 -5
  18. package/dist/lib/commands/manual.js.map +1 -1
  19. package/dist/lib/commands/recompress.d.ts +12 -0
  20. package/dist/lib/commands/recompress.d.ts.map +1 -0
  21. package/dist/lib/commands/recompress.js +137 -0
  22. package/dist/lib/commands/recompress.js.map +1 -0
  23. package/dist/lib/commands/sweep.d.ts.map +1 -1
  24. package/dist/lib/commands/sweep.js +5 -5
  25. package/dist/lib/commands/sweep.js.map +1 -1
  26. package/dist/lib/config.d.ts +3 -0
  27. package/dist/lib/config.d.ts.map +1 -1
  28. package/dist/lib/config.js +34 -1
  29. package/dist/lib/config.js.map +1 -1
  30. package/dist/lib/hooks.d.ts +3 -2
  31. package/dist/lib/hooks.d.ts.map +1 -1
  32. package/dist/lib/hooks.js +24 -4
  33. package/dist/lib/hooks.js.map +1 -1
  34. package/dist/lib/logger.d.ts.map +1 -1
  35. package/dist/lib/logger.js +1 -1
  36. package/dist/lib/logger.js.map +1 -1
  37. package/dist/lib/message-ids.d.ts.map +1 -1
  38. package/dist/lib/message-ids.js +3 -5
  39. package/dist/lib/message-ids.js.map +1 -1
  40. package/dist/lib/messages/inject/inject.d.ts +2 -1
  41. package/dist/lib/messages/inject/inject.d.ts.map +1 -1
  42. package/dist/lib/messages/inject/inject.js +8 -8
  43. package/dist/lib/messages/inject/inject.js.map +1 -1
  44. package/dist/lib/messages/inject/subagent-results.d.ts.map +1 -1
  45. package/dist/lib/messages/inject/subagent-results.js +3 -2
  46. package/dist/lib/messages/inject/subagent-results.js.map +1 -1
  47. package/dist/lib/messages/inject/utils.d.ts +3 -1
  48. package/dist/lib/messages/inject/utils.d.ts.map +1 -1
  49. package/dist/lib/messages/inject/utils.js +18 -24
  50. package/dist/lib/messages/inject/utils.js.map +1 -1
  51. package/dist/lib/messages/prune.js +0 -7
  52. package/dist/lib/messages/prune.js.map +1 -1
  53. package/dist/lib/messages/sync.d.ts.map +1 -1
  54. package/dist/lib/messages/sync.js +8 -0
  55. package/dist/lib/messages/sync.js.map +1 -1
  56. package/dist/lib/messages/utils.d.ts +1 -18
  57. package/dist/lib/messages/utils.d.ts.map +1 -1
  58. package/dist/lib/messages/utils.js +8 -48
  59. package/dist/lib/messages/utils.js.map +1 -1
  60. package/dist/lib/prompts/compress.d.ts +1 -1
  61. package/dist/lib/prompts/compress.d.ts.map +1 -1
  62. package/dist/lib/prompts/compress.js +0 -13
  63. package/dist/lib/prompts/compress.js.map +1 -1
  64. package/dist/lib/prompts/context-limit-nudge.d.ts +2 -0
  65. package/dist/lib/prompts/context-limit-nudge.d.ts.map +1 -0
  66. package/dist/lib/prompts/context-limit-nudge.js +25 -0
  67. package/dist/lib/prompts/context-limit-nudge.js.map +1 -0
  68. package/dist/lib/prompts/index.d.ts +2 -1
  69. package/dist/lib/prompts/index.d.ts.map +1 -1
  70. package/dist/lib/prompts/index.js +24 -12
  71. package/dist/lib/prompts/index.js.map +1 -1
  72. package/dist/lib/prompts/internal-overlays.d.ts +5 -0
  73. package/dist/lib/prompts/internal-overlays.d.ts.map +1 -0
  74. package/dist/lib/prompts/internal-overlays.js +43 -0
  75. package/dist/lib/prompts/internal-overlays.js.map +1 -0
  76. package/dist/lib/prompts/store.d.ts +24 -0
  77. package/dist/lib/prompts/store.d.ts.map +1 -0
  78. package/dist/lib/prompts/store.js +365 -0
  79. package/dist/lib/prompts/store.js.map +1 -0
  80. package/dist/lib/prompts/{_codegen/system.generated.d.ts → system.d.ts} +2 -2
  81. package/dist/lib/prompts/system.d.ts.map +1 -0
  82. package/dist/lib/prompts/{_codegen/system.generated.js → system.js} +5 -24
  83. package/dist/lib/prompts/system.js.map +1 -0
  84. package/dist/lib/prompts/turn-nudge.d.ts +1 -2
  85. package/dist/lib/prompts/turn-nudge.d.ts.map +1 -1
  86. package/dist/lib/prompts/turn-nudge.js +6 -16
  87. package/dist/lib/prompts/turn-nudge.js.map +1 -1
  88. package/dist/lib/protected-patterns.d.ts +5 -0
  89. package/dist/lib/protected-patterns.d.ts.map +1 -0
  90. package/dist/lib/{protected-file-patterns.js → protected-patterns.js} +21 -10
  91. package/dist/lib/protected-patterns.js.map +1 -0
  92. package/dist/lib/state/state.d.ts +1 -1
  93. package/dist/lib/state/state.js +2 -2
  94. package/dist/lib/state/state.js.map +1 -1
  95. package/dist/lib/state/types.d.ts +3 -1
  96. package/dist/lib/state/types.d.ts.map +1 -1
  97. package/dist/lib/state/utils.d.ts.map +1 -1
  98. package/dist/lib/state/utils.js +5 -0
  99. package/dist/lib/state/utils.js.map +1 -1
  100. package/dist/lib/strategies/deduplication.d.ts.map +1 -1
  101. package/dist/lib/strategies/deduplication.js +3 -3
  102. package/dist/lib/strategies/deduplication.js.map +1 -1
  103. package/dist/lib/strategies/purge-errors.d.ts.map +1 -1
  104. package/dist/lib/strategies/purge-errors.js +3 -3
  105. package/dist/lib/strategies/purge-errors.js.map +1 -1
  106. package/dist/lib/strategies/supersede-writes.js +2 -2
  107. package/dist/lib/strategies/supersede-writes.js.map +1 -1
  108. package/dist/lib/tools/compress.d.ts.map +1 -1
  109. package/dist/lib/tools/compress.js +58 -26
  110. package/dist/lib/tools/compress.js.map +1 -1
  111. package/dist/lib/tools/types.d.ts +2 -0
  112. package/dist/lib/tools/types.d.ts.map +1 -1
  113. package/dist/lib/tools/{compress-utils.d.ts → utils.d.ts} +13 -2
  114. package/dist/lib/tools/utils.d.ts.map +1 -0
  115. package/dist/lib/tools/{compress-utils.js → utils.js} +108 -10
  116. package/dist/lib/tools/utils.js.map +1 -0
  117. package/dist/lib/ui/notification.d.ts +1 -1
  118. package/dist/lib/ui/notification.d.ts.map +1 -1
  119. package/dist/lib/ui/notification.js +20 -8
  120. package/dist/lib/ui/notification.js.map +1 -1
  121. package/dist/lib/ui/utils.d.ts +1 -1
  122. package/dist/lib/ui/utils.d.ts.map +1 -1
  123. package/dist/lib/ui/utils.js +20 -9
  124. package/dist/lib/ui/utils.js.map +1 -1
  125. package/package.json +2 -4
  126. package/dist/lib/prompts/_codegen/system.generated.d.ts.map +0 -1
  127. package/dist/lib/prompts/_codegen/system.generated.js.map +0 -1
  128. package/dist/lib/prompts/nudge.d.ts +0 -2
  129. package/dist/lib/prompts/nudge.d.ts.map +0 -1
  130. package/dist/lib/prompts/nudge.js +0 -25
  131. package/dist/lib/prompts/nudge.js.map +0 -1
  132. package/dist/lib/protected-file-patterns.d.ts +0 -12
  133. package/dist/lib/protected-file-patterns.d.ts.map +0 -1
  134. package/dist/lib/protected-file-patterns.js.map +0 -1
  135. package/dist/lib/tools/compress-utils.d.ts.map +0 -1
  136. package/dist/lib/tools/compress-utils.js.map +0 -1
@@ -8,14 +8,6 @@ const generateStableId = (prefix, seed) => {
8
8
  const hash = createHash("sha256").update(seed).digest("hex").slice(0, SUMMARY_ID_HASH_LENGTH);
9
9
  return `${prefix}_${hash}`;
10
10
  };
11
- const isGeminiModel = (modelID) => {
12
- const lowerModelID = modelID.toLowerCase();
13
- return lowerModelID.includes("gemini");
14
- };
15
- export const rejectsTextParts = (modelID) => {
16
- const lowerModelID = modelID.toLowerCase();
17
- return lowerModelID.includes("claude") || lowerModelID.includes("deepseek");
18
- };
19
11
  export const createSyntheticUserMessage = (baseMessage, content, variant, stableSeed) => {
20
12
  const userInfo = baseMessage.info;
21
13
  const now = Date.now();
@@ -55,38 +47,6 @@ export const createSyntheticTextPart = (baseMessage, content, stableSeed) => {
55
47
  text: content,
56
48
  };
57
49
  };
58
- export const createSyntheticToolPart = (baseMessage, content, modelID, stableSeed) => {
59
- const userInfo = baseMessage.info;
60
- const now = Date.now();
61
- const deterministicSeed = stableSeed?.trim() || userInfo.id;
62
- const partId = generateStableId("prt_dcp_tool", deterministicSeed);
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}`;
65
- // Gemini requires a thought signature on synthetic function calls.
66
- // This must live on part metadata so it maps to callProviderMetadata.
67
- const toolPartMetadata = isGeminiModel(modelID)
68
- ? {
69
- google: { thoughtSignature: "skip_thought_signature_validator" },
70
- vertex: { thoughtSignature: "skip_thought_signature_validator" },
71
- }
72
- : undefined;
73
- return {
74
- id: partId,
75
- sessionID: userInfo.sessionID,
76
- messageID: userInfo.id,
77
- type: "tool",
78
- callID: callId,
79
- tool: "context_info",
80
- ...(toolPartMetadata ? { metadata: toolPartMetadata } : {}),
81
- state: {
82
- status: "completed",
83
- input: {},
84
- output: finalContent,
85
- title: "Context Info",
86
- time: { start: now, end: now },
87
- },
88
- };
89
- };
90
50
  export const appendIdToTool = (part, tag) => {
91
51
  if (part.type !== "tool") {
92
52
  return false;
@@ -139,22 +99,22 @@ export const isIgnoredUserMessage = (message) => {
139
99
  }
140
100
  return true;
141
101
  };
102
+ export const stripHallucinationsFromString = (text) => {
103
+ return text
104
+ .replace(TURN_NUDGE_BLOCK_REGEX, "")
105
+ .replace(ITERATION_NUDGE_BLOCK_REGEX, "")
106
+ .replace(DCP_MESSAGE_ID_TAG_REGEX, "");
107
+ };
142
108
  export const stripHallucinations = (messages) => {
143
109
  for (const message of messages) {
144
110
  for (const part of message.parts) {
145
111
  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, "");
112
+ part.text = stripHallucinationsFromString(part.text);
150
113
  }
151
114
  if (part.type === "tool" &&
152
115
  part.state?.status === "completed" &&
153
116
  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, "");
117
+ part.state.output = stripHallucinationsFromString(part.state.output);
158
118
  }
159
119
  }
160
120
  }
@@ -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;AAIpD,MAAM,sBAAsB,GAAG,EAAE,CAAA;AACjC,MAAM,wBAAwB,GAAG,kDAAkD,CAAA;AACnF,MAAM,sBAAsB,GAAG,gEAAgE,CAAA;AAC/F,MAAM,2BAA2B,GAC7B,qEAAqE,CAAA;AAEzE,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,aAAa,GAAG,CAAC,OAAe,EAAW,EAAE;IAC/C,MAAM,YAAY,GAAG,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AAK,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 = "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";
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";
2
2
  //# sourceMappingURL=compress.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compress.d.ts","sourceRoot":"","sources":["../../../lib/prompts/compress.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,utMAwHpB,CAAA"}
1
+ {"version":3,"file":"compress.d.ts","sourceRoot":"","sources":["../../../lib/prompts/compress.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,w1LA2GpB,CAAA"}
@@ -105,18 +105,5 @@ Do not invent IDs. Use only IDs that are present in context.
105
105
 
106
106
  PARALLEL COMPRESS EXECUTION
107
107
  When 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.
108
-
109
- THE FORMAT OF COMPRESS
110
-
111
- \`\`\`
112
- {
113
- topic: string, // Short label (3-5 words) - e.g., "Auth System Exploration"
114
- content: {
115
- startId: string, // Boundary ID at range start: mNNNN or bN
116
- endId: string, // Boundary ID at range end: mNNNN or bN
117
- summary: string // Complete technical summary replacing all content in range
118
- }
119
- }
120
- \`\`\`
121
108
  `;
122
109
  //# sourceMappingURL=compress.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"compress.js","sourceRoot":"","sources":["../../../lib/prompts/compress.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwHvB,CAAA"}
1
+ {"version":3,"file":"compress.js","sourceRoot":"","sources":["../../../lib/prompts/compress.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2GvB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const CONTEXT_LIMIT_NUDGE = "<instruction name=context_buildup_warning>\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\nRANGE STRATEGY (MANDATORY)\nPrioritize one large, closed, high-yield compression range first.\nThis overrides the normal preference for many small compressions.\nOnly split into multiple compressions if one large range would reduce summary quality or make boundary selection unsafe.\n\nRANGE SELECTION\nStart from older, resolved history and capture as much stale context as safely possible in one pass.\nAvoid the newest active working slice unless it is clearly closed.\nUse visible injected boundary IDs for compression (`mNNNN` for messages, `bN` for compressed blocks), and ensure `startId` appears before `endId`.\n\nSUMMARY REQUIREMENTS\nYour summary must cover all essential details from the selected range so work can continue without reopening raw messages.\nIf the compressed range includes user messages, preserve user intent exactly. Prefer direct quotes for short user messages to avoid semantic drift.\n</instruction>\n";
2
+ //# sourceMappingURL=context-limit-nudge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-limit-nudge.d.ts","sourceRoot":"","sources":["../../../lib/prompts/context-limit-nudge.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,k1CAuB/B,CAAA"}
@@ -0,0 +1,25 @@
1
+ export const CONTEXT_LIMIT_NUDGE = `<instruction name=context_buildup_warning>
2
+ CRITICAL WARNING: MAX CONTEXT LIMIT REACHED
3
+
4
+ You are at or beyond the configured max context threshold. This is an emergency context-recovery moment.
5
+
6
+ You MUST use the \`compress\` tool now. Do not continue normal exploration until compression is handled.
7
+
8
+ If you are in the middle of a critical atomic operation, finish that atomic step first, then compress immediately.
9
+
10
+ RANGE STRATEGY (MANDATORY)
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
16
+ Start from older, resolved history and capture as much stale context as safely possible in one pass.
17
+ Avoid the newest active working slice unless it is clearly closed.
18
+ Use visible injected boundary IDs for compression (\`mNNNN\` for messages, \`bN\` for compressed blocks), and ensure \`startId\` appears before \`endId\`.
19
+
20
+ SUMMARY REQUIREMENTS
21
+ Your summary must cover all essential details from the selected range so work can continue without reopening raw messages.
22
+ If the compressed range includes user messages, preserve user intent exactly. Prefer direct quotes for short user messages to avoid semantic drift.
23
+ </instruction>
24
+ `;
25
+ //# sourceMappingURL=context-limit-nudge.js.map
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;;;CAuBlC,CAAA"}
@@ -1,2 +1,3 @@
1
- export declare function renderSystemPrompt(manual?: boolean, subagent?: boolean): string;
1
+ import type { RuntimePrompts } from "./store";
2
+ export declare function renderSystemPrompt(prompts: RuntimePrompts, manual?: boolean, subagent?: boolean): string;
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/prompts/index.ts"],"names":[],"mappings":"AAOA,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,CAa/E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/prompts/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAsB7C,wBAAgB,kBAAkB,CAC9B,OAAO,EAAE,cAAc,EACvB,MAAM,CAAC,EAAE,OAAO,EAChB,QAAQ,CAAC,EAAE,OAAO,GACnB,MAAM,CAaR"}
@@ -1,17 +1,29 @@
1
- import { SYSTEM as SYSTEM_PROMPT } from "./_codegen/system.generated";
2
- function stripConditionalTag(content, tagName) {
3
- const regex = new RegExp(`<${tagName}>[\\s\\S]*?</${tagName}>`, "g");
4
- return content.replace(regex, "");
1
+ function stripLegacyInlineComments(content) {
2
+ return content.replace(/^[ \t]*\/\/.*?\/\/[ \t]*$/gm, "");
5
3
  }
6
- export function renderSystemPrompt(manual, subagent) {
7
- let result = SYSTEM_PROMPT;
8
- result = result.replace(/\/\/.*?\/\//g, "");
9
- if (!manual) {
10
- result = stripConditionalTag(result, "manual");
4
+ function injectIntoSystemReminder(systemPrompt, overlays) {
5
+ if (overlays.length === 0) {
6
+ return systemPrompt;
11
7
  }
12
- if (!subagent) {
13
- result = stripConditionalTag(result, "subagent");
8
+ const closeTag = "</system-reminder>";
9
+ const closeTagIndex = systemPrompt.lastIndexOf(closeTag);
10
+ if (closeTagIndex === -1) {
11
+ return [systemPrompt, ...overlays].join("\n\n");
14
12
  }
15
- return result.replace(/\n([ \t]*\n)+/g, "\n\n").trim();
13
+ const beforeClose = systemPrompt.slice(0, closeTagIndex).trimEnd();
14
+ const afterClose = systemPrompt.slice(closeTagIndex);
15
+ return `${beforeClose}\n\n${overlays.join("\n\n")}\n\n${afterClose}`;
16
+ }
17
+ export function renderSystemPrompt(prompts, manual, subagent) {
18
+ const overlays = [];
19
+ if (manual) {
20
+ overlays.push(prompts.manualOverlay.trim());
21
+ }
22
+ if (subagent) {
23
+ overlays.push(prompts.subagentOverlay.trim());
24
+ }
25
+ const strippedSystem = stripLegacyInlineComments(prompts.system).trim();
26
+ const withOverlays = injectIntoSystemReminder(strippedSystem, overlays);
27
+ return withOverlays.replace(/\n([ \t]*\n)+/g, "\n\n").trim();
16
28
  }
17
29
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/prompts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAErE,SAAS,mBAAmB,CAAC,OAAe,EAAE,OAAe;IACzD,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,IAAI,OAAO,gBAAgB,OAAO,GAAG,EAAE,GAAG,CAAC,CAAA;IACpE,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;AACrC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,MAAgB,EAAE,QAAkB;IACnE,IAAI,MAAM,GAAG,aAAa,CAAA;IAC1B,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;IAE3C,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,MAAM,GAAG,mBAAmB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;IAClD,CAAC;IAED,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC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CAAC;IAED,IAAI,QAAQ,EAAE,CAAC;QACX,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,CAAA;IACjD,CAAC;IAED,MAAM,cAAc,GAAG,yBAAyB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAA;IACvE,MAAM,YAAY,GAAG,wBAAwB,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAA;IACvE,OAAO,YAAY,CAAC,OAAO,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAA;AAChE,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const MANUAL_MODE_SYSTEM_OVERLAY = "<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\nIssue exactly ONE compress call per manual trigger. Do NOT launch multiple compress calls 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</instruction>\n";
2
+ export declare const SUBAGENT_SYSTEM_OVERLAY = "<instruction name=subagent_prompt_safety policy_level=critical>\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</instruction>\n";
3
+ export declare const NESTED_FORMAT_OVERLAY = "\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```";
4
+ export declare const FLAT_FORMAT_OVERLAY = "\nTHE FORMAT OF COMPRESS\n\n```\n{\n topic: string, // Short label (3-5 words) - e.g., \"Auth System Exploration\"\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```";
5
+ //# sourceMappingURL=internal-overlays.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal-overlays.d.ts","sourceRoot":"","sources":["../../../lib/prompts/internal-overlays.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B,0sBAStC,CAAA;AAED,eAAO,MAAM,uBAAuB,gYAOnC,CAAA;AAED,eAAO,MAAM,qBAAqB,kYAY3B,CAAA;AAEP,eAAO,MAAM,mBAAmB,+WAUzB,CAAA"}
@@ -0,0 +1,43 @@
1
+ export const MANUAL_MODE_SYSTEM_OVERLAY = `<instruction name=manual_mode policy_level=critical>
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 call per manual trigger. Do NOT launch multiple compress calls 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
+ </instruction>
10
+ `;
11
+ export const SUBAGENT_SYSTEM_OVERLAY = `<instruction name=subagent_prompt_safety policy_level=critical>
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
+ </instruction>
18
+ `;
19
+ export const NESTED_FORMAT_OVERLAY = `
20
+ THE FORMAT OF COMPRESS
21
+
22
+ \`\`\`
23
+ {
24
+ topic: string, // Short label (3-5 words) - e.g., "Auth System Exploration"
25
+ content: {
26
+ startId: string, // Boundary ID at range start: mNNNN or bN
27
+ endId: string, // Boundary ID at range end: mNNNN or bN
28
+ summary: string // Complete technical summary replacing all content in range
29
+ }
30
+ }
31
+ \`\`\``;
32
+ export const FLAT_FORMAT_OVERLAY = `
33
+ THE FORMAT OF COMPRESS
34
+
35
+ \`\`\`
36
+ {
37
+ topic: string, // Short label (3-5 words) - e.g., "Auth System Exploration"
38
+ startId: string, // Boundary ID at range start: mNNNN or bN
39
+ endId: string, // Boundary ID at range end: mNNNN or bN
40
+ summary: string // Complete technical summary replacing all content in range
41
+ }
42
+ \`\`\``;
43
+ //# sourceMappingURL=internal-overlays.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal-overlays.js","sourceRoot":"","sources":["../../../lib/prompts/internal-overlays.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,0BAA0B,GAAG;;;;;;;;;CASzC,CAAA;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;CAOtC,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;OAY9B,CAAA;AAEP,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;OAU5B,CAAA"}
@@ -0,0 +1,24 @@
1
+ import type { Logger } from "../logger";
2
+ export type PromptKey = "system" | "compress" | "context-limit-nudge" | "turn-nudge" | "iteration-nudge";
3
+ export interface RuntimePrompts {
4
+ system: string;
5
+ compress: string;
6
+ contextLimitNudge: string;
7
+ turnNudge: string;
8
+ iterationNudge: string;
9
+ manualOverlay: string;
10
+ subagentOverlay: string;
11
+ }
12
+ export declare const PROMPT_KEYS: PromptKey[];
13
+ export declare class PromptStore {
14
+ private readonly logger;
15
+ private readonly paths;
16
+ private readonly customPromptsEnabled;
17
+ private runtimePrompts;
18
+ constructor(logger: Logger, workingDirectory: string, customPromptsEnabled?: boolean);
19
+ getRuntimePrompts(): RuntimePrompts;
20
+ reload(): void;
21
+ private getOverrideCandidates;
22
+ private ensureDefaultFiles;
23
+ }
24
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../lib/prompts/store.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAQvC,MAAM,MAAM,SAAS,GACf,QAAQ,GACR,UAAU,GACV,qBAAqB,GACrB,YAAY,GACZ,iBAAiB,CAAA;AA8BvB,MAAM,WAAW,cAAc;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,iBAAiB,EAAE,MAAM,CAAA;IACzB,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE,MAAM,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;IACrB,eAAe,EAAE,MAAM,CAAA;CAC1B;AAgDD,eAAO,MAAM,WAAW,EAAE,SAAS,EAMlC,CAAA;AAgOD,qBAAa,WAAW;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;IAC/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;IACnC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAS;IAC9C,OAAO,CAAC,cAAc,CAAgB;gBAE1B,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,oBAAoB,UAAQ;IAYlF,iBAAiB,IAAI,cAAc;IAInC,MAAM,IAAI,IAAI;IAiDd,OAAO,CAAC,qBAAqB;IAsB7B,OAAO,CAAC,kBAAkB;CAkD7B"}