@tarquinen/opencode-dcp 1.3.2-beta.0 → 1.4.0-beta.0

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 (119) hide show
  1. package/LICENSE +619 -21
  2. package/README.md +17 -8
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +12 -2
  5. package/dist/index.js.map +1 -1
  6. package/dist/lib/commands/context.d.ts.map +1 -1
  7. package/dist/lib/commands/context.js +8 -7
  8. package/dist/lib/commands/context.js.map +1 -1
  9. package/dist/lib/commands/stats.d.ts.map +1 -1
  10. package/dist/lib/commands/stats.js +13 -8
  11. package/dist/lib/commands/stats.js.map +1 -1
  12. package/dist/lib/commands/sweep.d.ts.map +1 -1
  13. package/dist/lib/commands/sweep.js +10 -9
  14. package/dist/lib/commands/sweep.js.map +1 -1
  15. package/dist/lib/config.d.ts +3 -1
  16. package/dist/lib/config.d.ts.map +1 -1
  17. package/dist/lib/config.js +47 -19
  18. package/dist/lib/config.js.map +1 -1
  19. package/dist/lib/hooks.d.ts +8 -1
  20. package/dist/lib/hooks.d.ts.map +1 -1
  21. package/dist/lib/hooks.js +10 -4
  22. package/dist/lib/hooks.js.map +1 -1
  23. package/dist/lib/messages/inject.d.ts +2 -1
  24. package/dist/lib/messages/inject.d.ts.map +1 -1
  25. package/dist/lib/messages/inject.js +39 -31
  26. package/dist/lib/messages/inject.js.map +1 -1
  27. package/dist/lib/messages/prune.js +6 -6
  28. package/dist/lib/messages/prune.js.map +1 -1
  29. package/dist/lib/messages/utils.d.ts +20 -4
  30. package/dist/lib/messages/utils.d.ts.map +1 -1
  31. package/dist/lib/messages/utils.js +47 -42
  32. package/dist/lib/messages/utils.js.map +1 -1
  33. package/dist/lib/prompts/_codegen/compress.generated.d.ts +2 -0
  34. package/dist/lib/prompts/_codegen/compress.generated.d.ts.map +1 -0
  35. package/dist/lib/prompts/_codegen/compress.generated.js +40 -0
  36. package/dist/lib/prompts/_codegen/compress.generated.js.map +1 -0
  37. package/dist/lib/prompts/_codegen/distill.generated.d.ts +2 -0
  38. package/dist/lib/prompts/_codegen/distill.generated.d.ts.map +1 -0
  39. package/dist/lib/prompts/_codegen/distill.generated.js +33 -0
  40. package/dist/lib/prompts/_codegen/distill.generated.js.map +1 -0
  41. package/dist/lib/prompts/{nudge.generated.d.ts → _codegen/nudge.generated.d.ts} +1 -1
  42. package/dist/lib/prompts/_codegen/nudge.generated.d.ts.map +1 -0
  43. package/dist/lib/prompts/{nudge.generated.js → _codegen/nudge.generated.js} +1 -1
  44. package/dist/lib/prompts/_codegen/nudge.generated.js.map +1 -0
  45. package/dist/lib/prompts/_codegen/prune.generated.d.ts +2 -0
  46. package/dist/lib/prompts/_codegen/prune.generated.d.ts.map +1 -0
  47. package/dist/lib/prompts/_codegen/prune.generated.js +23 -0
  48. package/dist/lib/prompts/_codegen/prune.generated.js.map +1 -0
  49. package/dist/lib/prompts/_codegen/system.generated.d.ts +2 -0
  50. package/dist/lib/prompts/_codegen/system.generated.d.ts.map +1 -0
  51. package/dist/lib/prompts/_codegen/system.generated.js +50 -0
  52. package/dist/lib/prompts/_codegen/system.generated.js.map +1 -0
  53. package/dist/lib/prompts/index.d.ts.map +1 -1
  54. package/dist/lib/prompts/index.js +5 -6
  55. package/dist/lib/prompts/index.js.map +1 -1
  56. package/dist/lib/protected-file-patterns.d.ts +2 -2
  57. package/dist/lib/protected-file-patterns.d.ts.map +1 -1
  58. package/dist/lib/protected-file-patterns.js +34 -7
  59. package/dist/lib/protected-file-patterns.js.map +1 -1
  60. package/dist/lib/shared-utils.js +1 -1
  61. package/dist/lib/shared-utils.js.map +1 -1
  62. package/dist/lib/state/persistence.d.ts +8 -2
  63. package/dist/lib/state/persistence.d.ts.map +1 -1
  64. package/dist/lib/state/persistence.js +6 -1
  65. package/dist/lib/state/persistence.js.map +1 -1
  66. package/dist/lib/state/state.d.ts.map +1 -1
  67. package/dist/lib/state/state.js +8 -6
  68. package/dist/lib/state/state.js.map +1 -1
  69. package/dist/lib/state/tool-cache.d.ts.map +1 -1
  70. package/dist/lib/state/tool-cache.js +6 -1
  71. package/dist/lib/state/tool-cache.js.map +1 -1
  72. package/dist/lib/state/types.d.ts +4 -2
  73. package/dist/lib/state/types.d.ts.map +1 -1
  74. package/dist/lib/state/utils.js +2 -2
  75. package/dist/lib/state/utils.js.map +1 -1
  76. package/dist/lib/strategies/deduplication.d.ts.map +1 -1
  77. package/dist/lib/strategies/deduplication.js +7 -6
  78. package/dist/lib/strategies/deduplication.js.map +1 -1
  79. package/dist/lib/strategies/purge-errors.d.ts.map +1 -1
  80. package/dist/lib/strategies/purge-errors.js +7 -6
  81. package/dist/lib/strategies/purge-errors.js.map +1 -1
  82. package/dist/lib/strategies/supersede-writes.d.ts.map +1 -1
  83. package/dist/lib/strategies/supersede-writes.js +10 -8
  84. package/dist/lib/strategies/supersede-writes.js.map +1 -1
  85. package/dist/lib/strategies/utils.d.ts +7 -0
  86. package/dist/lib/strategies/utils.d.ts.map +1 -1
  87. package/dist/lib/strategies/utils.js +58 -28
  88. package/dist/lib/strategies/utils.js.map +1 -1
  89. package/dist/lib/tools/compress.d.ts.map +1 -1
  90. package/dist/lib/tools/compress.js +35 -17
  91. package/dist/lib/tools/compress.js.map +1 -1
  92. package/dist/lib/tools/distill.d.ts.map +1 -1
  93. package/dist/lib/tools/distill.js +25 -25
  94. package/dist/lib/tools/distill.js.map +1 -1
  95. package/dist/lib/tools/prune-shared.d.ts.map +1 -1
  96. package/dist/lib/tools/prune-shared.js +7 -5
  97. package/dist/lib/tools/prune-shared.js.map +1 -1
  98. package/dist/lib/ui/notification.d.ts.map +1 -1
  99. package/dist/lib/ui/notification.js +63 -0
  100. package/dist/lib/ui/notification.js.map +1 -1
  101. package/package.json +3 -3
  102. package/dist/lib/prompts/compress-tool-spec.d.ts +0 -2
  103. package/dist/lib/prompts/compress-tool-spec.d.ts.map +0 -1
  104. package/dist/lib/prompts/compress-tool-spec.js +0 -58
  105. package/dist/lib/prompts/compress-tool-spec.js.map +0 -1
  106. package/dist/lib/prompts/distill-tool-spec.d.ts +0 -2
  107. package/dist/lib/prompts/distill-tool-spec.d.ts.map +0 -1
  108. package/dist/lib/prompts/distill-tool-spec.js +0 -48
  109. package/dist/lib/prompts/distill-tool-spec.js.map +0 -1
  110. package/dist/lib/prompts/nudge.generated.d.ts.map +0 -1
  111. package/dist/lib/prompts/nudge.generated.js.map +0 -1
  112. package/dist/lib/prompts/prune-tool-spec.d.ts +0 -2
  113. package/dist/lib/prompts/prune-tool-spec.d.ts.map +0 -1
  114. package/dist/lib/prompts/prune-tool-spec.js +0 -40
  115. package/dist/lib/prompts/prune-tool-spec.js.map +0 -1
  116. package/dist/lib/prompts/system.generated.d.ts +0 -2
  117. package/dist/lib/prompts/system.generated.d.ts.map +0 -1
  118. package/dist/lib/prompts/system.generated.js +0 -90
  119. package/dist/lib/prompts/system.generated.js.map +0 -1
@@ -1,14 +1,23 @@
1
1
  import { ulid } from "ulid";
2
2
  import { isMessageCompacted } from "../shared-utils";
3
+ import { formatTokenCount } from "../ui/utils";
3
4
  export const COMPRESS_SUMMARY_PREFIX = "[Compressed conversation block]\n\n";
5
+ export function formatContextHeader(contextInfo) {
6
+ if (!contextInfo || contextInfo.used === 0) {
7
+ return "";
8
+ }
9
+ const usedStr = formatTokenCount(contextInfo.used);
10
+ if (contextInfo.limit) {
11
+ const limitStr = formatTokenCount(contextInfo.limit);
12
+ const percentage = Math.round((contextInfo.used / contextInfo.limit) * 100);
13
+ return `Context: ~${usedStr} / ${limitStr} (${percentage}% used)\n`;
14
+ }
15
+ return `Context: ~${usedStr}\n`;
16
+ }
4
17
  const generateUniqueId = (prefix) => `${prefix}_${ulid()}`;
5
- export const isDeepSeekOrKimi = (providerID, modelID) => {
6
- const lowerProviderID = providerID.toLowerCase();
18
+ const isGeminiModel = (modelID) => {
7
19
  const lowerModelID = modelID.toLowerCase();
8
- return (lowerProviderID.includes("deepseek") ||
9
- lowerProviderID.includes("kimi") ||
10
- lowerModelID.includes("deepseek") ||
11
- lowerModelID.includes("kimi"));
20
+ return lowerModelID.includes("gemini");
12
21
  };
13
22
  export const createSyntheticUserMessage = (baseMessage, content, variant) => {
14
23
  const userInfo = baseMessage.info;
@@ -36,50 +45,30 @@ export const createSyntheticUserMessage = (baseMessage, content, variant) => {
36
45
  ],
37
46
  };
38
47
  };
39
- export const createSyntheticAssistantMessage = (baseMessage, content, variant) => {
48
+ export const createSyntheticTextPart = (baseMessage, content) => {
40
49
  const userInfo = baseMessage.info;
41
- const now = Date.now();
42
- const messageId = generateUniqueId("msg");
43
50
  const partId = generateUniqueId("prt");
44
51
  return {
45
- info: {
46
- id: messageId,
47
- sessionID: userInfo.sessionID,
48
- role: "assistant",
49
- agent: userInfo.agent || "code",
50
- parentID: userInfo.id,
51
- modelID: userInfo.model.modelID,
52
- providerID: userInfo.model.providerID,
53
- mode: "default",
54
- path: {
55
- cwd: "/",
56
- root: "/",
57
- },
58
- time: { created: now, completed: now },
59
- cost: 0,
60
- tokens: { input: 0, output: 0, reasoning: 0, cache: { read: 0, write: 0 } },
61
- ...(variant !== undefined && { variant }),
62
- },
63
- parts: [
64
- {
65
- id: partId,
66
- sessionID: userInfo.sessionID,
67
- messageID: messageId,
68
- type: "text",
69
- text: content,
70
- },
71
- ],
52
+ id: partId,
53
+ sessionID: userInfo.sessionID,
54
+ messageID: userInfo.id,
55
+ type: "text",
56
+ text: content,
72
57
  };
73
58
  };
74
- export const createSyntheticToolPart = (baseMessage, content) => {
59
+ export const createSyntheticToolPart = (baseMessage, content, modelID) => {
75
60
  const userInfo = baseMessage.info;
76
61
  const now = Date.now();
77
62
  const partId = generateUniqueId("prt");
78
63
  const callId = generateUniqueId("call");
64
+ // Gemini requires thoughtSignature bypass to accept synthetic tool parts
65
+ const toolPartMetadata = isGeminiModel(modelID)
66
+ ? { google: { thoughtSignature: "skip_thought_signature_validator" } }
67
+ : {};
79
68
  return {
80
69
  id: partId,
81
70
  sessionID: userInfo.sessionID,
82
- messageID: baseMessage.info.id,
71
+ messageID: userInfo.id,
83
72
  type: "tool",
84
73
  callID: callId,
85
74
  tool: "context_info",
@@ -88,7 +77,7 @@ export const createSyntheticToolPart = (baseMessage, content) => {
88
77
  input: {},
89
78
  output: content,
90
79
  title: "Context Info",
91
- metadata: {},
80
+ metadata: toolPartMetadata,
92
81
  time: { start: now, end: now },
93
82
  },
94
83
  };
@@ -113,11 +102,27 @@ export const extractParameterKey = (tool, parameters) => {
113
102
  }
114
103
  return parameters.filePath;
115
104
  }
116
- if (tool === "write" && parameters.filePath) {
105
+ if ((tool === "write" || tool === "edit" || tool === "multiedit") && parameters.filePath) {
117
106
  return parameters.filePath;
118
107
  }
119
- if (tool === "edit" && parameters.filePath) {
120
- return parameters.filePath;
108
+ if (tool === "apply_patch" && typeof parameters.patchText === "string") {
109
+ const pathRegex = /\*\*\* (?:Add|Delete|Update) File: ([^\n\r]+)/g;
110
+ const paths = [];
111
+ let match;
112
+ while ((match = pathRegex.exec(parameters.patchText)) !== null) {
113
+ paths.push(match[1].trim());
114
+ }
115
+ if (paths.length > 0) {
116
+ const uniquePaths = [...new Set(paths)];
117
+ const count = uniquePaths.length;
118
+ const plural = count > 1 ? "s" : "";
119
+ if (count === 1)
120
+ return uniquePaths[0];
121
+ if (count === 2)
122
+ return uniquePaths.join(", ");
123
+ return `${count} file${plural}: ${uniquePaths[0]}, ${uniquePaths[1]}...`;
124
+ }
125
+ return "patch";
121
126
  }
122
127
  if (tool === "list") {
123
128
  return parameters.path || "(current directory)";
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../lib/messages/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAKpD,MAAM,CAAC,MAAM,uBAAuB,GAAG,qCAAqC,CAAA;AAE5E,MAAM,gBAAgB,GAAG,CAAC,MAAc,EA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C;YACnB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBACvB,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;oBACnD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;gBAC7B,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC;IACD,OAAO,OAAO,CAAA;AAClB,CAAC;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAAkB,EAAW,EAAE;IAChE,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;IAC/D,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,IAAI,CAAA;IACf,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,IAAI,CAAE,IAAY,CAAC,OAAO,EAAE,CAAC;YACzB,OAAO,KAAK,CAAA;QAChB,CAAC;IACL,CAAC;IAED,OAAO,IAAI,CAAA;AACf,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAAqB,EAAE,SAAiB,EAAU,EAAE;IACjF,OAAO,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,SAAS,CAAC,CAAA;AACjE,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const COMPRESS = "Use this tool to collapse a contiguous range of conversation into a preserved summary.\n\nTHE PHILOSOPHY OF COMPRESS\n`compress` transforms verbose conversation sequences into dense, high-fidelity summaries. This is not cleanup - it is crystallization. Your summary becomes the authoritative record of what transpired.\n\nThink of compression as phase transitions: raw exploration becomes refined understanding. The original context served its purpose; your summary now carries that understanding forward.\n\nTHE SUMMARY\nYour summary must be EXHAUSTIVE. Capture file paths, function signatures, decisions made, constraints discovered, key findings... EVERYTHING that maintains context integrity. This is not a brief note - it is an authoritative record so faithful that the original conversation adds no value.\n\nYet be LEAN. Strip away the noise: failed attempts that led nowhere, verbose tool outputs, back-and-forth exploration. What remains should be pure signal - golden nuggets of detail that preserve full understanding with zero ambiguity.\n\nTHE WAYS OF COMPRESS\n`compress` when a chapter closes - when a phase of work is truly complete and the raw conversation has served its purpose:\n\nResearch concluded and findings are clear\nImplementation finished and verified\nExploration exhausted and patterns understood\n\nDo NOT compress when:\nYou may need exact code, error messages, or file contents from the range\nWork in that area is still active or may resume\nYou're mid-sprint on related functionality\n\nBefore compressing, ask: _\"Is this chapter closed?\"_ Compression is irreversible. The summary replaces everything in the range.\n\nBOUNDARY MATCHING\nYou specify boundaries by matching unique text strings in the conversation. CRITICAL: In code-centric conversations, strings repeat often. Provide sufficiently unique text to match exactly once. If a match fails (not found or found multiple times), the tool will error - extend your boundary string with more surrounding context in order to make SURE the tool does NOT error.\n\nTHE FORMAT OF COMPRESS\n`topic`: Short label (3-5 words) for display - e.g., \"Auth System Exploration\"\n`content`: Object containing:\n`startString`: Unique text string marking the beginning of the range\n`endString`: Unique text string marking the end of the range\n`summary`: Complete technical summary replacing all content in the range\n";
2
+ //# sourceMappingURL=compress.generated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compress.generated.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/_codegen/compress.generated.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ,k2EAmCpB,CAAA"}
@@ -0,0 +1,40 @@
1
+ // AUTO-GENERATED FILE - DO NOT EDIT
2
+ // Generated from compress.md by scripts/generate-prompts.ts
3
+ // To modify, edit compress.md and run `npm run generate:prompts`
4
+ export const COMPRESS = `Use this tool to collapse a contiguous range of conversation into a preserved summary.
5
+
6
+ THE PHILOSOPHY OF COMPRESS
7
+ \`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.
8
+
9
+ Think of compression as phase transitions: raw exploration becomes refined understanding. The original context served its purpose; your summary now carries that understanding forward.
10
+
11
+ THE SUMMARY
12
+ Your summary must be EXHAUSTIVE. Capture file paths, function signatures, decisions made, constraints discovered, key findings... EVERYTHING that maintains context integrity. This is not a brief note - it is an authoritative record so faithful that the original conversation adds no value.
13
+
14
+ Yet be LEAN. Strip away the noise: failed attempts that led nowhere, verbose tool outputs, back-and-forth exploration. What remains should be pure signal - golden nuggets of detail that preserve full understanding with zero ambiguity.
15
+
16
+ THE WAYS OF COMPRESS
17
+ \`compress\` when a chapter closes - when a phase of work is truly complete and the raw conversation has served its purpose:
18
+
19
+ Research concluded and findings are clear
20
+ Implementation finished and verified
21
+ Exploration exhausted and patterns understood
22
+
23
+ Do NOT compress when:
24
+ You may need exact code, error messages, or file contents from the range
25
+ Work in that area is still active or may resume
26
+ You're mid-sprint on related functionality
27
+
28
+ Before compressing, ask: _"Is this chapter closed?"_ Compression is irreversible. The summary replaces everything in the range.
29
+
30
+ BOUNDARY MATCHING
31
+ You specify boundaries by matching unique text strings in the conversation. CRITICAL: In code-centric conversations, strings repeat often. Provide sufficiently unique text to match exactly once. If a match fails (not found or found multiple times), the tool will error - extend your boundary string with more surrounding context in order to make SURE the tool does NOT error.
32
+
33
+ THE FORMAT OF COMPRESS
34
+ \`topic\`: Short label (3-5 words) for display - e.g., "Auth System Exploration"
35
+ \`content\`: Object containing:
36
+ \`startString\`: Unique text string marking the beginning of the range
37
+ \`endString\`: Unique text string marking the end of the range
38
+ \`summary\`: Complete technical summary replacing all content in the range
39
+ `;
40
+ //# sourceMappingURL=compress.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compress.generated.js","sourceRoot":"","sources":["../../../../lib/prompts/_codegen/compress.generated.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,4DAA4D;AAC5D,iEAAiE;AAEjE,MAAM,CAAC,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCvB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const DISTILL = "Use this tool to distill relevant findings from a selection of raw tool outputs into preserved knowledge, in order to denoise key bits and parts of context.\n\nTHE PRUNABLE TOOLS LIST\nA <prunable-tools> will show in context when outputs are available for distillation (you don't need to look for it). Each entry follows the format `ID: tool, parameter (~token usage)` (e.g., `20: read, /path/to/file.ts (~1500 tokens)`). You MUST select outputs by their numeric ID. THESE ARE YOUR ONLY VALID TARGETS.\n\nTHE PHILOSOPHY OF DISTILLATION\n`distill` is your favored instrument for transforming raw tool outputs into preserved knowledge. This is not mere summarization; it is high-fidelity extraction that makes the original output obsolete.\n\nYour distillation must be COMPLETE. Capture function signatures, type definitions, business logic, constraints, configuration values... EVERYTHING essential. Think of it as creating a high signal technical substitute so faithful that re-fetching the original would yield no additional value. Be thorough; be comprehensive; leave no ambiguity, ensure that your distillation stands alone, and is designed for easy retrieval and comprehension.\n\nAIM FOR IMPACT. Distillation is most powerful when applied to outputs that contain signal buried in noise. A single line requires no distillation; a hundred lines of API documentation do. Make sure the distillation is meaningful.\n\nTHE WAYS OF DISTILL\n`distill` when you have extracted the essence from tool outputs and the raw form has served its purpose.\nHere are some examples:\nEXPLORATION: You've read extensively and grasp the architecture. The original file contents are no longer needed; your understanding, synthesized, is sufficient.\nPRESERVATION: Valuable technical details (signatures, logic, constraints) coexist with noise. Preserve the former; discard the latter.\n\nNot everything should be distilled. Prefer keeping raw outputs when:\nPRECISION MATTERS: You will edit the file, grep for exact strings, or need line-accurate references. Distillation sacrifices precision for essence.\nUNCERTAINTY REMAINS: If you might need to re-examine the original, defer. Distillation is irreversible; be certain before you commit.\n\nBefore distilling, ask yourself: _\"Will I need the raw output for upcoming work?\"_ If you plan to edit a file you just read, keep it intact. Distillation is for completed exploration, not active work.\n\nTHE FORMAT OF DISTILL\n`targets`: Array of objects, each containing:\n`id`: Numeric ID (as string) from the `<prunable-tools>` list\n`distillation`: Complete technical substitute for that tool output\n";
2
+ //# sourceMappingURL=distill.generated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"distill.generated.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/_codegen/distill.generated.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,OAAO,+kFA4BnB,CAAA"}
@@ -0,0 +1,33 @@
1
+ // AUTO-GENERATED FILE - DO NOT EDIT
2
+ // Generated from distill.md by scripts/generate-prompts.ts
3
+ // To modify, edit distill.md and run `npm run generate:prompts`
4
+ export const DISTILL = `Use this tool to distill relevant findings from a selection of raw tool outputs into preserved knowledge, in order to denoise key bits and parts of context.
5
+
6
+ THE PRUNABLE TOOLS LIST
7
+ A <prunable-tools> will show in context when outputs are available for distillation (you don't need to look for it). Each entry follows the format \`ID: tool, parameter (~token usage)\` (e.g., \`20: read, /path/to/file.ts (~1500 tokens)\`). You MUST select outputs by their numeric ID. THESE ARE YOUR ONLY VALID TARGETS.
8
+
9
+ THE PHILOSOPHY OF DISTILLATION
10
+ \`distill\` is your favored instrument for transforming raw tool outputs into preserved knowledge. This is not mere summarization; it is high-fidelity extraction that makes the original output obsolete.
11
+
12
+ Your distillation must be COMPLETE. Capture function signatures, type definitions, business logic, constraints, configuration values... EVERYTHING essential. Think of it as creating a high signal technical substitute so faithful that re-fetching the original would yield no additional value. Be thorough; be comprehensive; leave no ambiguity, ensure that your distillation stands alone, and is designed for easy retrieval and comprehension.
13
+
14
+ AIM FOR IMPACT. Distillation is most powerful when applied to outputs that contain signal buried in noise. A single line requires no distillation; a hundred lines of API documentation do. Make sure the distillation is meaningful.
15
+
16
+ THE WAYS OF DISTILL
17
+ \`distill\` when you have extracted the essence from tool outputs and the raw form has served its purpose.
18
+ Here are some examples:
19
+ EXPLORATION: You've read extensively and grasp the architecture. The original file contents are no longer needed; your understanding, synthesized, is sufficient.
20
+ PRESERVATION: Valuable technical details (signatures, logic, constraints) coexist with noise. Preserve the former; discard the latter.
21
+
22
+ Not everything should be distilled. Prefer keeping raw outputs when:
23
+ PRECISION MATTERS: You will edit the file, grep for exact strings, or need line-accurate references. Distillation sacrifices precision for essence.
24
+ UNCERTAINTY REMAINS: If you might need to re-examine the original, defer. Distillation is irreversible; be certain before you commit.
25
+
26
+ Before distilling, ask yourself: _"Will I need the raw output for upcoming work?"_ If you plan to edit a file you just read, keep it intact. Distillation is for completed exploration, not active work.
27
+
28
+ THE FORMAT OF DISTILL
29
+ \`targets\`: Array of objects, each containing:
30
+ \`id\`: Numeric ID (as string) from the \`<prunable-tools>\` list
31
+ \`distillation\`: Complete technical substitute for that tool output
32
+ `;
33
+ //# sourceMappingURL=distill.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"distill.generated.js","sourceRoot":"","sources":["../../../../lib/prompts/_codegen/distill.generated.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,2DAA2D;AAC3D,gEAAgE;AAEhE,MAAM,CAAC,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BtB,CAAA"}
@@ -1,2 +1,2 @@
1
- export declare const NUDGE = "<instruction name=context_management_required>\nCRITICAL CONTEXT WARNING\nYour context window is filling with tool. Strict adherence to context hygiene is required.\n\nPROTOCOL\nYou should prioritize context management, but do not interrupt a critical atomic operation if one is in progress. Once the immediate step is done, you must perform context management.\n\nIMMEDIATE ACTION REQUIRED\n<distill>KNOWLEDGE PRESERVATION: If holding valuable raw data you POTENTIALLY will need in your task, use the `distill` tool. Produce a high-fidelity distillation to preserve insights - be thorough</distill>\n<prune>NOISE REMOVAL: If you read files or ran commands that yielded no value, use the `prune` tool to remove them. If newer tools supersedes older ones, prune the old</prune>\n<compress>PHASE COMPLETION: If a phase is complete, use the `compress` tool to condense the entire sequence into a detailed summary</compress>\n</instruction>\n";
1
+ export declare const NUDGE = "<instruction name=context_management_required>\nCRITICAL CONTEXT WARNING\nYour context window is filling with tool. Strict adherence to context hygiene is required.\n\nPROTOCOL\nYou should prioritize context management, but do not interrupt a critical atomic operation if one is in progress. Once the immediate step is done, you must perform context management.\n\nIMMEDIATE ACTION REQUIRED\n<distill>KNOWLEDGE PRESERVATION: If holding valuable raw data you POTENTIALLY will need in your task, use the `distill` tool. Produce a high-fidelity distillation to preserve insights - be thorough</distill>\n<compress>PHASE COMPLETION: If a phase is complete, use the `compress` tool to condense the entire sequence into a detailed summary</compress>\n<prune>NOISE REMOVAL: If you read files or ran commands that yielded no value, use the `prune` tool to remove them. If newer tools supersedes older ones, prune the old</prune>\n</instruction>\n";
2
2
  //# sourceMappingURL=nudge.generated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nudge.generated.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/_codegen/nudge.generated.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,KAAK,+6BAYjB,CAAA"}
@@ -10,8 +10,8 @@ You should prioritize context management, but do not interrupt a critical atomic
10
10
 
11
11
  IMMEDIATE ACTION REQUIRED
12
12
  <distill>KNOWLEDGE PRESERVATION: If holding valuable raw data you POTENTIALLY will need in your task, use the \`distill\` tool. Produce a high-fidelity distillation to preserve insights - be thorough</distill>
13
- <prune>NOISE REMOVAL: If you read files or ran commands that yielded no value, use the \`prune\` tool to remove them. If newer tools supersedes older ones, prune the old</prune>
14
13
  <compress>PHASE COMPLETION: If a phase is complete, use the \`compress\` tool to condense the entire sequence into a detailed summary</compress>
14
+ <prune>NOISE REMOVAL: If you read files or ran commands that yielded no value, use the \`prune\` tool to remove them. If newer tools supersedes older ones, prune the old</prune>
15
15
  </instruction>
16
16
  `;
17
17
  //# sourceMappingURL=nudge.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nudge.generated.js","sourceRoot":"","sources":["../../../../lib/prompts/_codegen/nudge.generated.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,yDAAyD;AACzD,8DAA8D;AAE9D,MAAM,CAAC,MAAM,KAAK,GAAG;;;;;;;;;;;;CAYpB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const PRUNE = "Use this tool to remove tool outputs from context entirely. No preservation - pure deletion.\n\nTHE PRUNABLE TOOLS LIST\nA `<prunable-tools>` section surfaces in context showing outputs eligible for removal. Each line reads `ID: tool, parameter (~token usage)` (e.g., `20: read, /path/to/file.ts (~1500 tokens)`). Reference outputs by their numeric ID - these are your ONLY valid targets for pruning.\n\nTHE WAYS OF PRUNE\n`prune` is surgical excision - eliminating noise (irrelevant or unhelpful outputs), superseded information (older outputs replaced by newer data), or wrong targets (you accessed something that turned out to be irrelevant). Use it to keep your context lean and focused.\n\nBATCH WISELY! Pruning is most effective when consolidated. Don't prune a single tiny output - accumulate several candidates before acting.\n\nDo NOT prune when:\nNEEDED LATER: You plan to edit the file or reference this context for implementation.\nUNCERTAINTY: If you might need to re-examine the original, keep it.\n\nBefore pruning, ask: _\"Is this noise, or will it serve me?\"_ If the latter, keep it. Pruning that forces re-fetching is a net loss.\n\nTHE FORMAT OF PRUNE\n`ids`: Array of numeric IDs (as strings) from the `<prunable-tools>` list\n";
2
+ //# sourceMappingURL=prune.generated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prune.generated.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/_codegen/prune.generated.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,KAAK,quCAkBjB,CAAA"}
@@ -0,0 +1,23 @@
1
+ // AUTO-GENERATED FILE - DO NOT EDIT
2
+ // Generated from prune.md by scripts/generate-prompts.ts
3
+ // To modify, edit prune.md and run `npm run generate:prompts`
4
+ export const PRUNE = `Use this tool to remove tool outputs from context entirely. No preservation - pure deletion.
5
+
6
+ THE PRUNABLE TOOLS LIST
7
+ A \`<prunable-tools>\` section surfaces in context showing outputs eligible for removal. Each line reads \`ID: tool, parameter (~token usage)\` (e.g., \`20: read, /path/to/file.ts (~1500 tokens)\`). Reference outputs by their numeric ID - these are your ONLY valid targets for pruning.
8
+
9
+ THE WAYS OF PRUNE
10
+ \`prune\` is surgical excision - eliminating noise (irrelevant or unhelpful outputs), superseded information (older outputs replaced by newer data), or wrong targets (you accessed something that turned out to be irrelevant). Use it to keep your context lean and focused.
11
+
12
+ BATCH WISELY! Pruning is most effective when consolidated. Don't prune a single tiny output - accumulate several candidates before acting.
13
+
14
+ Do NOT prune when:
15
+ NEEDED LATER: You plan to edit the file or reference this context for implementation.
16
+ UNCERTAINTY: If you might need to re-examine the original, keep it.
17
+
18
+ Before pruning, ask: _"Is this noise, or will it serve me?"_ If the latter, keep it. Pruning that forces re-fetching is a net loss.
19
+
20
+ THE FORMAT OF PRUNE
21
+ \`ids\`: Array of numeric IDs (as strings) from the \`<prunable-tools>\` list
22
+ `;
23
+ //# sourceMappingURL=prune.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prune.generated.js","sourceRoot":"","sources":["../../../../lib/prompts/_codegen/prune.generated.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,yDAAyD;AACzD,8DAA8D;AAE9D,MAAM,CAAC,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;CAkBpB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const SYSTEM = "<system-reminder>\n<instruction name=context_management_protocol policy_level=critical>\nYou operate a context-constrained environment and MUST PROACTIVELY MANAGE IT TO AVOID CONTEXT ROT. Efficient context management is CRITICAL to maintaining performance and ensuring successful task completion.\n\nAVAILABLE TOOLS FOR CONTEXT MANAGEMENT\n<distill>`distill`: condense key findings from tool calls into high-fidelity distillation to preserve gained insights. Use to extract valuable knowledge to the user's request. BE THOROUGH, your distillation MUST be high-signal, low noise and complete</distill>\n<compress>`compress`: squash contiguous portion of the conversation and replace it with a low level technical summary. Use to filter noise from the conversation and retain purified understanding. Compress conversation phases ORGANICALLY as they get completed, think meso, not micro nor macro. Do not be cheap with that low level technical summary and BE MINDFUL of specifics that must be crystallized to retain UNAMBIGUOUS full picture.</compress>\n<prune>`prune`: remove individual tool calls that are noise, irrelevant, or superseded. No preservation of content. DO NOT let irrelevant tool calls accumulate. DO NOT PRUNE TOOL OUTPUTS THAT YOU MAY NEED LATER</prune>\n\n<distill>THE DISTILL TOOL\n`distill` is the favored way to target specific tools and crystalize their value into high-signal low-noise knowledge nuggets. Your distillation must be comprehensive, capturing technical details (symbols, signatures, logic, constraints) such that the raw output is no longer needed. THINK complete technical substitute. `distill` is typically best used when you are certain the raw information is not needed anymore, but the knowledge it contains is valuable to retain so you maintain context authenticity and understanding. Be conservative in your approach to distilling, but do NOT hesitate to distill when appropriate.\n</distill>\n\n<compress>THE COMPRESS TOOL\n`compress` is a sledgehammer and should be used accordingly. It's purpose is to reduce whole part of the conversation to its essence and technical details in order to leave room for newer context. Your summary MUST be technical and specific enough to preserve FULL understanding of WHAT TRANSPIRED, such that NO AMBIGUITY remains about what was done, found, or decided. Your compress summary must be thorough and precise. `compress` will replace everything in the range you match, user and assistant messages, tool inputs and outputs. It is preferred to not compress preemptively, but rather wait for natural breakpoints in the conversation. Those breakpoints are to be infered from user messages. You WILL NOT compress based on thinking that you are done with the task, wait for conversation queues that the user has moved on from current phase.\n\nWhen the context usage indicator is high (around 80% or above), prioritize using `compress` to reduce verbosity and keep room for future context.\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\nMake sure to match enough of the context with start and end strings so you're not faced with an error calling the tool. 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<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.\nAim to keep the context usage indicator below roughly 80% so there is room for future turns and tool outputs.\nThere may be tools in session context that do not appear in the <prunable-tools> list, this is expected, remember that you can ONLY prune what you see in list.\n</instruction>\n</system-reminder>\n";
2
+ //# sourceMappingURL=system.generated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system.generated.d.ts","sourceRoot":"","sources":["../../../../lib/prompts/_codegen/system.generated.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,MAAM,mgMA6ClB,CAAA"}
@@ -0,0 +1,50 @@
1
+ // AUTO-GENERATED FILE - DO NOT EDIT
2
+ // Generated from system.md by scripts/generate-prompts.ts
3
+ // To modify, edit system.md and run `npm run generate:prompts`
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.
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>
12
+
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>
16
+
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.
19
+
20
+ When the context usage indicator is high (around 80% or above), prioritize using \`compress\` to reduce verbosity and keep room for future context.
21
+
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.
23
+
24
+ Make sure to match enough of the context with start and end strings so you're not faced with an error calling the tool. Be VERY CAREFUL AND CONSERVATIVE when using \`compress\`.
25
+ </compress>
26
+
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.
29
+
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>
32
+
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.
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.
37
+
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
+
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
+ </instruction>
42
+
43
+ <instruction name=injected_context_handling policy_level=critical>
44
+ 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.
45
+ Aim to keep the context usage indicator below roughly 80% so there is room for future turns and tool outputs.
46
+ 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.
47
+ </instruction>
48
+ </system-reminder>
49
+ `;
50
+ //# sourceMappingURL=system.generated.js.map
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6CrB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/prompts/index.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,SAAS;IACtB,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,OAAO,CAAA;IACjB,KAAK,EAAE,OAAO,CAAA;CACjB;AAgBD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAE3D;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAEpD;AAQD,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAW9E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/prompts/index.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,SAAS;IACtB,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,OAAO,CAAA;IACjB,KAAK,EAAE,OAAO,CAAA;CACjB;AAgBD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAE3D;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAEpD;AAQD,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAW9E"}
@@ -1,10 +1,9 @@
1
- // Tool specs
2
- import { PRUNE_TOOL_SPEC } from "./prune-tool-spec";
3
- import { DISTILL_TOOL_SPEC } from "./distill-tool-spec";
4
- import { COMPRESS_TOOL_SPEC } from "./compress-tool-spec";
5
1
  // Generated prompts (from .md files via scripts/generate-prompts.ts)
6
- import { SYSTEM as SYSTEM_PROMPT } from "./system.generated";
7
- import { NUDGE } from "./nudge.generated";
2
+ import { SYSTEM as SYSTEM_PROMPT } from "./_codegen/system.generated";
3
+ import { NUDGE } from "./_codegen/nudge.generated";
4
+ import { PRUNE as PRUNE_TOOL_SPEC } from "./_codegen/prune.generated";
5
+ import { DISTILL as DISTILL_TOOL_SPEC } from "./_codegen/distill.generated";
6
+ import { COMPRESS as COMPRESS_TOOL_SPEC } from "./_codegen/compress.generated";
8
7
  function processConditionals(template, flags) {
9
8
  const tools = ["distill", "compress", "prune"];
10
9
  let result = template;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/prompts/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAEzD,qEAAqE;AACrE,OAAO,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAQzC,SAAS,mBAAmB,CAAC,QAAgB,EAAE,KAAgB;IAC3D,MAAM,KAAK,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,CAAU,CAAA;IACvD,IAAI,MAAM,GAAG,QAAQ,CAAA;IACrB,4B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AAC,OAAO,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAA;AAC1D,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAgB;IAC/C,OAAO,mBAAmB,CAAC,aAAa,EAAE,KAAK,CAAC,CAAA;AACpD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAgB;IACxC,OAAO,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AAC5C,CAAC;AAED,MAAM,OAAO,GAA2B;IACpC,iBAAiB,EAAE,eAAe;IAClC,mBAAmB,EAAE,iBAAiB;IACtC,oBAAoB,EAAE,kBAAkB;CAC3C,CAAA;AAED,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,IAA6B;IAClE,IAAI,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3B,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAA;IAChD,CAAC;IACD,IAAI,IAAI,EAAE,CAAC;QACP,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9C,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,SAAS,GAAG,QAAQ,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,CAAA;QAC3E,CAAC;IACL,CAAC;IACD,OAAO,OAAO,CAAA;AAClB,CAAC"}
@@ -7,6 +7,6 @@
7
7
  * - `**` matches across `/`.
8
8
  */
9
9
  export declare function matchesGlob(inputPath: string, pattern: string): boolean;
10
- export declare function getFilePathFromParameters(parameters: unknown): string | undefined;
11
- export declare function isProtectedFilePath(filePath: string | undefined, patterns: string[]): boolean;
10
+ export declare function getFilePathsFromParameters(tool: string, parameters: unknown): string[];
11
+ export declare function isProtected(filePaths: string[], patterns: string[]): boolean;
12
12
  //# sourceMappingURL=protected-file-patterns.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"protected-file-patterns.d.ts","sourceRoot":"","sources":["../../lib/protected-file-patterns.ts"],"names":[],"mappings":"AAQA;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAiDvE;AAED,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAOjF;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAK7F"}
1
+ {"version":3,"file":"protected-file-patterns.d.ts","sourceRoot":"","sources":["../../lib/protected-file-patterns.ts"],"names":[],"mappings":"AAQA;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAiDvE;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,GAAG,MAAM,EAAE,CAsCtF;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAK5E"}
@@ -52,18 +52,45 @@ export function matchesGlob(inputPath, pattern) {
52
52
  regex += "$";
53
53
  return new RegExp(regex).test(input);
54
54
  }
55
- export function getFilePathFromParameters(parameters) {
55
+ export function getFilePathsFromParameters(tool, parameters) {
56
56
  if (typeof parameters !== "object" || parameters === null) {
57
- return undefined;
57
+ return [];
58
58
  }
59
- const filePath = parameters.filePath;
60
- return typeof filePath === "string" && filePath.length > 0 ? filePath : undefined;
59
+ const paths = [];
60
+ const params = parameters;
61
+ // 1. apply_patch uses patchText with embedded paths
62
+ if (tool === "apply_patch" && typeof params.patchText === "string") {
63
+ const pathRegex = /\*\*\* (?:Add|Delete|Update) File: ([^\n\r]+)/g;
64
+ let match;
65
+ while ((match = pathRegex.exec(params.patchText)) !== null) {
66
+ paths.push(match[1].trim());
67
+ }
68
+ }
69
+ // 2. multiedit uses top-level filePath and nested edits array
70
+ if (tool === "multiedit") {
71
+ if (typeof params.filePath === "string") {
72
+ paths.push(params.filePath);
73
+ }
74
+ if (Array.isArray(params.edits)) {
75
+ for (const edit of params.edits) {
76
+ if (edit && typeof edit.filePath === "string") {
77
+ paths.push(edit.filePath);
78
+ }
79
+ }
80
+ }
81
+ }
82
+ // 3. Default check for common filePath parameter (read, write, edit, etc)
83
+ if (typeof params.filePath === "string") {
84
+ paths.push(params.filePath);
85
+ }
86
+ // Return unique non-empty paths
87
+ return [...new Set(paths)].filter((p) => p.length > 0);
61
88
  }
62
- export function isProtectedFilePath(filePath, patterns) {
63
- if (!filePath)
89
+ export function isProtected(filePaths, patterns) {
90
+ if (!filePaths || filePaths.length === 0)
64
91
  return false;
65
92
  if (!patterns || patterns.length === 0)
66
93
  return false;
67
- return patterns.some((pattern) => matchesGlob(filePath, pattern));
94
+ return filePaths.some((path) => patterns.some((pattern) => matchesGlob(path, pattern)));
68
95
  }
69
96
  //# sourceMappingURL=protected-file-patterns.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"protected-file-patterns.js","sourceRoot":"","sources":["../../lib/protected-file-patterns.ts"],"names":[],"mappings":"AAAA,SAAS,aAAa,CAAC,KAAa;IAChC,OAAO,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AACxC,CAAC;AAED,SAAS,gBAAgB,CAAC,EAAU;IAChC,OAAO,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;AACxD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,SAAiB,EAAE,OAAe;IAC1D,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAA;IAE1B,MAAM,KAAK,GAAG,aAAa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AC1D,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,SAAmB,EAAE,QAAkB;IAC/D,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAA;IACtD,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAA;IAEpD,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;AAC3F,CAAC"}
@@ -3,7 +3,7 @@ export const isMessageCompacted = (state, msg) => {
3
3
  if (msg.info.time.created < state.lastCompaction) {
4
4
  return true;
5
5
  }
6
- if (state.prune.messageIds.includes(msg.info.id)) {
6
+ if (state.prune.messageIds.has(msg.info.id)) {
7
7
  return true;
8
8
  }
9
9
  return false;
@@ -1 +1 @@
1
- {"version":3,"file":"shared-utils.js","sourceRoot":"","sources":["../../lib/shared-utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAEvD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAmB,EAAE,GAAc,EAAW,EAAE;IAC/E,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,cAAc,EAAE,CAAC;QAC/C,OAAO,IAAI,CAAA;IACf,CAAC;IACD,IAAI,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;QAC/C,OAAO,IAAI,CAAA;IACf,CAAC;IACD,OAAO,KAAK,CAAA;AAChB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAC9B,QAAqB,EACrB,UAAmB,EACH,EAAE;IAClB,MAA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,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,EAAE,CAAC;YACzD,OAAO,GAAG,CAAA;QACd,CAAC;IACL,CAAC;IACD,OAAO,IAAI,CAAA;AACf,CAAC,CAAA"}
@@ -3,11 +3,16 @@
3
3
  * Persists pruned tool IDs across sessions so they survive OpenCode restarts.
4
4
  * Storage location: ~/.local/share/opencode/storage/plugin/dcp/{sessionId}.json
5
5
  */
6
- import type { SessionState, SessionStats, Prune, CompressSummary } from "./types";
6
+ import type { SessionState, SessionStats, CompressSummary } from "./types";
7
7
  import type { Logger } from "../logger";
8
+ /** Prune state as stored on disk (arrays for JSON compatibility) */
9
+ export interface PersistedPrune {
10
+ toolIds: string[];
11
+ messageIds: string[];
12
+ }
8
13
  export interface PersistedSessionState {
9
14
  sessionName?: string;
10
- prune: Prune;
15
+ prune: PersistedPrune;
11
16
  compressSummaries: CompressSummary[];
12
17
  stats: SessionStats;
13
18
  lastUpdated: string;
@@ -17,6 +22,7 @@ export declare function loadSessionState(sessionId: string, logger: Logger): Pro
17
22
  export interface AggregatedStats {
18
23
  totalTokens: number;
19
24
  totalTools: number;
25
+ totalMessages: number;
20
26
  sessionCount: number;
21
27
  }
22
28
  export declare function loadAllSessionStats(logger: Logger): Promise<AggregatedStats>;