@tarquinen/opencode-dcp 1.1.2-beta.0 → 1.1.3

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 (79) hide show
  1. package/README.md +24 -24
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +18 -19
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/config.d.ts +6 -8
  6. package/dist/lib/config.d.ts.map +1 -1
  7. package/dist/lib/config.js +60 -76
  8. package/dist/lib/config.js.map +1 -1
  9. package/dist/lib/hooks.d.ts +0 -3
  10. package/dist/lib/hooks.d.ts.map +1 -1
  11. package/dist/lib/hooks.js +3 -25
  12. package/dist/lib/hooks.js.map +1 -1
  13. package/dist/lib/messages/index.d.ts +2 -1
  14. package/dist/lib/messages/index.d.ts.map +1 -1
  15. package/dist/lib/messages/index.js +2 -1
  16. package/dist/lib/messages/index.js.map +1 -1
  17. package/dist/lib/messages/inject.d.ts +5 -0
  18. package/dist/lib/messages/inject.d.ts.map +1 -0
  19. package/dist/lib/messages/inject.js +99 -0
  20. package/dist/lib/messages/inject.js.map +1 -0
  21. package/dist/lib/messages/prune.d.ts +0 -1
  22. package/dist/lib/messages/prune.d.ts.map +1 -1
  23. package/dist/lib/messages/prune.js +38 -117
  24. package/dist/lib/messages/prune.js.map +1 -1
  25. package/dist/lib/messages/utils.d.ts +0 -1
  26. package/dist/lib/messages/utils.d.ts.map +1 -1
  27. package/dist/lib/messages/utils.js +27 -27
  28. package/dist/lib/messages/utils.js.map +1 -1
  29. package/dist/lib/prompts/index.d.ts +2 -0
  30. package/dist/lib/prompts/index.d.ts.map +1 -0
  31. package/dist/lib/prompts/index.js +13 -0
  32. package/dist/lib/prompts/index.js.map +1 -0
  33. package/dist/lib/shared-utils.d.ts +0 -1
  34. package/dist/lib/shared-utils.d.ts.map +1 -1
  35. package/dist/lib/shared-utils.js +0 -9
  36. package/dist/lib/shared-utils.js.map +1 -1
  37. package/dist/lib/state/state.js +2 -2
  38. package/dist/lib/state/state.js.map +1 -1
  39. package/dist/lib/state/types.d.ts +1 -1
  40. package/dist/lib/state/types.d.ts.map +1 -1
  41. package/dist/lib/strategies/index.d.ts +1 -1
  42. package/dist/lib/strategies/index.d.ts.map +1 -1
  43. package/dist/lib/strategies/index.js +1 -1
  44. package/dist/lib/strategies/index.js.map +1 -1
  45. package/dist/lib/strategies/purge-errors.d.ts +13 -0
  46. package/dist/lib/strategies/purge-errors.d.ts.map +1 -0
  47. package/dist/lib/strategies/purge-errors.js +54 -0
  48. package/dist/lib/strategies/purge-errors.js.map +1 -0
  49. package/dist/lib/strategies/tools.d.ts.map +1 -1
  50. package/dist/lib/strategies/tools.js +4 -7
  51. package/dist/lib/strategies/tools.js.map +1 -1
  52. package/dist/lib/ui/notification.d.ts +2 -3
  53. package/dist/lib/ui/notification.d.ts.map +1 -1
  54. package/dist/lib/ui/notification.js +13 -36
  55. package/dist/lib/ui/notification.js.map +1 -1
  56. package/dist/lib/ui/utils.d.ts +2 -0
  57. package/dist/lib/ui/utils.d.ts.map +1 -1
  58. package/dist/lib/ui/utils.js +14 -0
  59. package/dist/lib/ui/utils.js.map +1 -1
  60. package/package.json +2 -5
  61. package/dist/lib/model-selector.d.ts +0 -17
  62. package/dist/lib/model-selector.d.ts.map +0 -1
  63. package/dist/lib/model-selector.js +0 -141
  64. package/dist/lib/model-selector.js.map +0 -1
  65. package/dist/lib/prompt.d.ts +0 -3
  66. package/dist/lib/prompt.d.ts.map +0 -1
  67. package/dist/lib/prompt.js +0 -128
  68. package/dist/lib/prompt.js.map +0 -1
  69. package/dist/lib/prompts/assistant/nudge/nudge-both.txt +0 -10
  70. package/dist/lib/prompts/assistant/nudge/nudge-discard.txt +0 -9
  71. package/dist/lib/prompts/assistant/nudge/nudge-extract.txt +0 -9
  72. package/dist/lib/prompts/assistant/system/system-prompt-both.txt +0 -44
  73. package/dist/lib/prompts/assistant/system/system-prompt-discard.txt +0 -36
  74. package/dist/lib/prompts/assistant/system/system-prompt-extract.txt +0 -36
  75. package/dist/lib/prompts/on-idle-analysis.txt +0 -30
  76. package/dist/lib/strategies/on-idle.d.ts +0 -14
  77. package/dist/lib/strategies/on-idle.d.ts.map +0 -1
  78. package/dist/lib/strategies/on-idle.js +0 -220
  79. package/dist/lib/strategies/on-idle.js.map +0 -1
@@ -1,128 +0,0 @@
1
- import { readFileSync } from "fs";
2
- import { join } from "path";
3
- export function loadPrompt(name, vars) {
4
- const filePath = join(__dirname, "prompts", `${name}.txt`);
5
- let content = readFileSync(filePath, "utf8").trim();
6
- if (vars) {
7
- for (const [key, value] of Object.entries(vars)) {
8
- content = content.replace(new RegExp(`\\{\\{${key}\\}\\}`, "g"), value);
9
- }
10
- }
11
- return content;
12
- }
13
- function minimizeMessages(messages, alreadyPrunedIds, protectedToolCallIds) {
14
- const prunedIdsSet = alreadyPrunedIds
15
- ? new Set(alreadyPrunedIds.map((id) => id.toLowerCase()))
16
- : new Set();
17
- const protectedIdsSet = protectedToolCallIds
18
- ? new Set(protectedToolCallIds.map((id) => id.toLowerCase()))
19
- : new Set();
20
- return messages
21
- .map((msg) => {
22
- const minimized = {
23
- role: msg.info?.role,
24
- };
25
- if (msg.parts) {
26
- minimized.parts = msg.parts
27
- .filter((part) => {
28
- if (part.type === "step-start" || part.type === "step-finish") {
29
- return false;
30
- }
31
- return true;
32
- })
33
- .map((part) => {
34
- if (part.type === "text") {
35
- if (part.ignored) {
36
- return null;
37
- }
38
- return {
39
- type: "text",
40
- text: part.text,
41
- };
42
- }
43
- // TODO: This should use the opencode normalized system instead of per provider settings
44
- if (part.type === "reasoning") {
45
- // Calculate encrypted content size if present
46
- let encryptedContentLength = 0;
47
- if (part.metadata?.openai?.reasoningEncryptedContent) {
48
- encryptedContentLength =
49
- part.metadata.openai.reasoningEncryptedContent.length;
50
- }
51
- else if (part.metadata?.anthropic?.signature) {
52
- encryptedContentLength = part.metadata.anthropic.signature.length;
53
- }
54
- else if (part.metadata?.google?.thoughtSignature) {
55
- encryptedContentLength =
56
- part.metadata.google.thoughtSignature.length;
57
- }
58
- return {
59
- type: "reasoning",
60
- text: part.text,
61
- textLength: part.text?.length || 0,
62
- encryptedContentLength,
63
- ...(part.time && { time: part.time }),
64
- ...(part.metadata && { metadataKeys: Object.keys(part.metadata) }),
65
- };
66
- }
67
- if (part.type === "tool") {
68
- const callIDLower = part.callID?.toLowerCase();
69
- const isAlreadyPruned = prunedIdsSet.has(callIDLower);
70
- const isProtected = protectedIdsSet.has(callIDLower);
71
- let displayCallID = part.callID;
72
- if (isAlreadyPruned) {
73
- displayCallID = "<already-pruned>";
74
- }
75
- else if (isProtected) {
76
- displayCallID = "<protected>";
77
- }
78
- const toolPart = {
79
- type: "tool",
80
- toolCallID: displayCallID,
81
- tool: part.tool,
82
- };
83
- if (part.state?.output) {
84
- toolPart.output = part.state.output;
85
- }
86
- if (part.state?.input) {
87
- const input = part.state.input;
88
- if (input.filePath &&
89
- (part.tool === "write" ||
90
- part.tool === "edit" ||
91
- part.tool === "multiedit" ||
92
- part.tool === "patch")) {
93
- toolPart.input = input;
94
- }
95
- else if (input.filePath) {
96
- toolPart.input = { filePath: input.filePath };
97
- }
98
- else if (input.tool_calls && Array.isArray(input.tool_calls)) {
99
- toolPart.input = {
100
- batch_summary: `${input.tool_calls.length} tool calls`,
101
- tools: input.tool_calls.map((tc) => tc.tool),
102
- };
103
- }
104
- else {
105
- toolPart.input = input;
106
- }
107
- }
108
- return toolPart;
109
- }
110
- return null;
111
- })
112
- .filter(Boolean);
113
- }
114
- return minimized;
115
- })
116
- .filter((msg) => {
117
- return msg.parts && msg.parts.length > 0;
118
- });
119
- }
120
- export function buildAnalysisPrompt(unprunedToolCallIds, messages, alreadyPrunedIds, protectedToolCallIds) {
121
- const minimizedMessages = minimizeMessages(messages, alreadyPrunedIds, protectedToolCallIds);
122
- const messagesJson = JSON.stringify(minimizedMessages, null, 2).replace(/\\n/g, "\n");
123
- return loadPrompt("on-idle-analysis", {
124
- available_tool_call_ids: unprunedToolCallIds.join(", "),
125
- session_history: messagesJson,
126
- });
127
- }
128
- //# sourceMappingURL=prompt.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../lib/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE3B,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,IAA6B;IAClE,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,GAAG,IAAI,MAAM,CAAC,CAAA;IAC1D,IAAI,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAA;IACnD,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;AAED,SAAS,gBAAgB,CACrB,QAAe,EACf,gBAA2B,EAC3B,oBAA+B;IAE/B,MAAM,YAAY,GAAG,gBAAgB;QACjC,CAAC,CAAC,IAAI,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;QACzD,CAAC,CAAC,IAAI,GAAG,EAAE,CAAA;IACf,MAAM,eAAe,GAAG,oBAAoB;QACxC,CAAC,CAAC,IAAI,GAAG,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;QAC7D,CAAC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KAAK,CAAC,MAAM,GAAG,CAAC,CAAA;IAC5C,CAAC,CAAC,CAAA;AACV,CAAC;AAED,MAAM,UAAU,mBAAmB,CAC/B,mBAA6B,EAC7B,QAAe,EACf,gBAA2B,EAC3B,oBAA+B;IAE/B,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,oBAAoB,CAAC,CAAA;IAC5F,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAErF,OAAO,UAAU,CAAC,kBAAkB,EAAE;QAClC,uBAAuB,EAAE,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC;QACvD,eAAe,EAAE,YAAY;KAChC,CAAC,CAAA;AACN,CAAC"}
@@ -1,10 +0,0 @@
1
- <instruction name=context_management_required>
2
- **CRITICAL CONTEXT WARNING:** My context window is filling with tool outputs. I must adhere strictly to context hygiene.
3
-
4
- **Immediate Actions Required:**
5
- 1. **Task Completion:** If a sub-task is complete, I will decide: use `discard` if no valuable context to preserve (default), or use `extract` if insights are worth keeping.
6
- 2. **Noise Removal:** If I read files or ran commands that yielded no value, I will use `discard` to remove them.
7
- 3. **Knowledge Preservation:** If I am holding valuable raw data I'll need to reference later, I will use `extract` to distill the insights and remove the raw entry.
8
-
9
- **Protocol:** I should prioritize this cleanup, but I will not interrupt a critical atomic operation if one is in progress. Once the immediate step is done, I must perform context management.
10
- </instruction>
@@ -1,9 +0,0 @@
1
- <instruction name=context_management_required>
2
- **CRITICAL CONTEXT WARNING:** My context window is filling with tool outputs. I must adhere strictly to context hygiene.
3
-
4
- **Immediate Actions Required:**
5
- 1. **Task Completion:** If a sub-task is complete, I will use the `discard` tool to remove the tools used.
6
- 2. **Noise Removal:** If I read files or ran commands that yielded no value, I will use the `discard` tool to remove them.
7
-
8
- **Protocol:** I should prioritize this cleanup, but I will not interrupt a critical atomic operation if one is in progress. Once the immediate step is done, I must discard unneeded tool outputs.
9
- </instruction>
@@ -1,9 +0,0 @@
1
- <instruction name=context_management_required>
2
- **CRITICAL CONTEXT WARNING:** My context window is filling with tool outputs. I must adhere strictly to context hygiene.
3
-
4
- **Immediate Actions Required:**
5
- 1. **Task Completion:** If I have completed work, I will extract key findings from the tools used. I will scale distillation depth to the value of the content.
6
- 2. **Knowledge Preservation:** If I am holding valuable raw data I'll need to reference later, I will use the `extract` tool with high-fidelity distillation to preserve the insights and remove the raw entry.
7
-
8
- **Protocol:** I should prioritize this cleanup, but I will not interrupt a critical atomic operation if one is in progress. Once the immediate step is done, I must extract valuable findings from tool outputs.
9
- </instruction>
@@ -1,44 +0,0 @@
1
- <system-reminder>
2
- <instruction name=context_management_protocol policy_level=critical>
3
-
4
- ENVIRONMENT
5
- You are operating in a context-constrained environment and thus must proactively manage your context window using the `discard` and `extract` tools. A <prunable-tools> list is injected by the environment as an assistant message, and always contains up to date information. Use this information when deciding what to prune.
6
-
7
- TWO TOOLS FOR CONTEXT MANAGEMENT
8
- - `discard`: Remove tool outputs that are no longer needed (completed tasks, noise, outdated info). No preservation of content.
9
- - `extract`: Extract key findings into distilled knowledge before removing raw outputs. Use when you need to preserve information.
10
-
11
- CHOOSING THE RIGHT TOOL
12
- Ask: "Is this output clearly noise or irrelevant?"
13
- - **Yes** → `discard` (pure cleanup, no preservation)
14
- - **No** → `extract` (default - preserves key findings)
15
-
16
- Common scenarios:
17
- - Task complete, no valuable context → `discard`
18
- - Task complete, insights worth remembering → `extract`
19
- - Noise, irrelevant, or superseded outputs → `discard`
20
- - Valuable context needed later but raw output too large → `extract`
21
-
22
- PRUNE METHODICALLY - BATCH YOUR ACTIONS
23
- Every tool call adds to your context debt. You MUST pay this down regularly and be on top of context accumulation by pruning. Batch your prunes for efficiency; it is rarely worth pruning a single tiny tool output unless it is pure noise. Evaluate what SHOULD be pruned before jumping the gun.
24
-
25
- You WILL evaluate pruning when ANY of these are true:
26
- - Task or sub-task is complete
27
- - You are about to start a new phase of work
28
- - Write or edit operations are complete (pruning removes the large input content)
29
-
30
- You MUST NOT prune when:
31
- - The tool output will be needed for upcoming implementation work
32
- - The output contains files or context you'll need to reference when making edits
33
-
34
- Pruning that forces you to re-call the same tool later is a net loss. Only prune when you're confident the information won't be needed again.
35
-
36
- NOTES
37
- When in doubt, keep it. Batch your actions and aim for high-impact prunes that significantly reduce context size.
38
- FAILURE TO PRUNE will result in context leakage and DEGRADED PERFORMANCES.
39
- There may be tools in session context that do not appear in the <prunable-tools> list, this is expected, you can ONLY prune what you see in <prunable-tools>.
40
-
41
- If you see a user message containing only `[internal: context sync - no response needed]`, this is an internal system marker used for context injection - it is NOT user input. Do not acknowledge it, do not respond to it, and do not mention it. Simply continue with your current task or wait for actual user input.
42
-
43
- </instruction>
44
- </system-reminder>
@@ -1,36 +0,0 @@
1
- <system-reminder>
2
- <instruction name=context_management_protocol policy_level=critical>
3
-
4
- ENVIRONMENT
5
- You are operating in a context-constrained environment and thus must proactively manage your context window using the `discard` tool. A <prunable-tools> list is injected by the environment as an assistant message, and always contains up to date information. Use this information when deciding what to discard.
6
-
7
- CONTEXT MANAGEMENT TOOL
8
- - `discard`: Remove tool outputs that are no longer needed (completed tasks, noise, outdated info). No preservation of content.
9
-
10
- DISCARD METHODICALLY - BATCH YOUR ACTIONS
11
- Every tool call adds to your context debt. You MUST pay this down regularly and be on top of context accumulation by discarding. Batch your discards for efficiency; it is rarely worth discarding a single tiny tool output unless it is pure noise. Evaluate what SHOULD be discarded before jumping the gun.
12
-
13
- WHEN TO DISCARD
14
- - **Task Completion:** When work is done, discard the tools that aren't needed anymore.
15
- - **Noise Removal:** If outputs are irrelevant, unhelpful, or superseded by newer info, discard them.
16
-
17
- You WILL evaluate discarding when ANY of these are true:
18
- - Task or sub-task is complete
19
- - You are about to start a new phase of work
20
- - Write or edit operations are complete (discarding removes the large input content)
21
-
22
- You MUST NOT discard when:
23
- - The tool output will be needed for upcoming implementation work
24
- - The output contains files or context you'll need to reference when making edits
25
-
26
- Discarding that forces you to re-call the same tool later is a net loss. Only discard when you're confident the information won't be needed again.
27
-
28
- NOTES
29
- When in doubt, keep it. Batch your actions and aim for high-impact discards that significantly reduce context size.
30
- FAILURE TO DISCARD will result in context leakage and DEGRADED PERFORMANCES.
31
- There may be tools in session context that do not appear in the <prunable-tools> list, this is expected, you can ONLY discard what you see in <prunable-tools>.
32
-
33
- If you see a user message containing only `[internal: context sync - no response needed]`, this is an internal system marker used for context injection - it is NOT user input. Do not acknowledge it, do not respond to it, and do not mention it. Simply continue with your current task or wait for actual user input.
34
-
35
- </instruction>
36
- </system-reminder>
@@ -1,36 +0,0 @@
1
- <system-reminder>
2
- <instruction name=context_management_protocol policy_level=critical>
3
-
4
- ENVIRONMENT
5
- You are operating in a context-constrained environment and thus must proactively manage your context window using the `extract` tool. A <prunable-tools> list is injected by the environment as an assistant message, and always contains up to date information. Use this information when deciding what to extract.
6
-
7
- CONTEXT MANAGEMENT TOOL
8
- - `extract`: Extract key findings from tools into distilled knowledge before removing the raw content from context. Use this to preserve important information while reducing context size.
9
-
10
- EXTRACT METHODICALLY - BATCH YOUR ACTIONS
11
- Every tool call adds to your context debt. You MUST pay this down regularly and be on top of context accumulation by extracting. Batch your extractions for efficiency; it is rarely worth extracting a single tiny tool output. Evaluate what SHOULD be extracted before jumping the gun.
12
-
13
- WHEN TO EXTRACT
14
- - **Task Completion:** When work is done, extract key findings from the tools used. Scale distillation depth to the value of the content.
15
- - **Knowledge Preservation:** When you have valuable context you want to preserve but need to reduce size, use high-fidelity distillation. Your distillation must be comprehensive, capturing technical details (signatures, logic, constraints) such that the raw output is no longer needed. THINK: high signal, complete technical substitute.
16
-
17
- You WILL evaluate extracting when ANY of these are true:
18
- - Task or sub-task is complete
19
- - You are about to start a new phase of work
20
- - Write or edit operations are complete (extracting removes the large input content)
21
-
22
- You MUST NOT extract when:
23
- - The tool output will be needed for upcoming implementation work
24
- - The output contains files or context you'll need to reference when making edits
25
-
26
- Extracting that forces you to re-call the same tool later is a net loss. Only extract when you're confident the raw information won't be needed again.
27
-
28
- NOTES
29
- When in doubt, keep it. Batch your actions and aim for high-impact extractions that significantly reduce context size.
30
- FAILURE TO EXTRACT will result in context leakage and DEGRADED PERFORMANCES.
31
- There may be tools in session context that do not appear in the <prunable-tools> list, this is expected, you can ONLY extract what you see in <prunable-tools>.
32
-
33
- If you see a user message containing only `[internal: context sync - no response needed]`, this is an internal system marker used for context injection - it is NOT user input. Do not acknowledge it, do not respond to it, and do not mention it. Simply continue with your current task or wait for actual user input.
34
-
35
- </instruction>
36
- </system-reminder>
@@ -1,30 +0,0 @@
1
- You are a conversation analyzer that identifies obsolete tool outputs in a coding session.
2
-
3
- Your task: Analyze the session history and identify tool call IDs whose outputs are NO LONGER RELEVANT to the current conversation context.
4
-
5
- Guidelines for identifying obsolete tool calls:
6
- 1. Exploratory reads that didn't lead to actual edits or meaningful discussion AND were not explicitly requested to be retained
7
- 2. Tool outputs from debugging/fixing an error that has now been resolved
8
- 3. Failed or incorrect tool attempts that were immediately corrected (e.g., reading a file from the wrong path, then reading from the correct path)
9
-
10
- DO NOT prune:
11
- - Tool calls whose outputs are actively being discussed
12
- - Tool calls that produced errors still being debugged
13
- - Tool calls that are the MOST RECENT activity in the conversation (these may be intended for future use)
14
-
15
- IMPORTANT: Available tool call IDs for analysis: {{available_tool_call_ids}}
16
-
17
- The session history below may contain tool calls with IDs not in the available list above, these cannot be pruned. These are either:
18
- 1. Protected tools (marked with toolCallID "<protected>")
19
- 2. Already-pruned tools (marked with toolCallID "<already-pruned>")
20
-
21
- ONLY return IDs from the available list above.
22
-
23
- Session history (each tool call has a "toolCallID" field):
24
- {{session_history}}
25
-
26
- You MUST respond with valid JSON matching this exact schema:
27
- {
28
- "pruned_tool_call_ids": ["id1", "id2", ...],
29
- "reasoning": "explanation of why these IDs were selected"
30
- }
@@ -1,14 +0,0 @@
1
- import type { SessionState } from "../state";
2
- import type { Logger } from "../logger";
3
- import type { PluginConfig } from "../config";
4
- export interface OnIdleResult {
5
- prunedCount: number;
6
- tokensSaved: number;
7
- prunedIds: string[];
8
- }
9
- /**
10
- * Run the onIdle pruning strategy.
11
- * This is called when the session transitions to idle state.
12
- */
13
- export declare function runOnIdle(client: any, state: SessionState, logger: Logger, config: PluginConfig, workingDirectory?: string): Promise<void | null>;
14
- //# sourceMappingURL=on-idle.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"on-idle.d.ts","sourceRoot":"","sources":["../../../lib/strategies/on-idle.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAiC,MAAM,UAAU,CAAA;AAC3E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAQ7C,MAAM,WAAW,YAAY;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,EAAE,CAAA;CACtB;AA6LD;;;GAGG;AACH,wBAAsB,SAAS,CAC3B,MAAM,EAAE,GAAG,EACX,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,YAAY,EACpB,gBAAgB,CAAC,EAAE,MAAM,GAC1B,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAgHtB"}
@@ -1,220 +0,0 @@
1
- import { z } from "zod";
2
- import { buildAnalysisPrompt } from "../prompt";
3
- import { selectModel } from "../model-selector";
4
- import { saveSessionState } from "../state/persistence";
5
- import { sendUnifiedNotification } from "../ui/notification";
6
- import { calculateTokensSaved, getCurrentParams } from "./utils";
7
- import { isMessageCompacted } from "../shared-utils";
8
- /**
9
- * Parse messages to extract tool information.
10
- */
11
- function parseMessages(state, messages, toolParametersCache) {
12
- const toolCallIds = [];
13
- const toolMetadata = new Map();
14
- for (const msg of messages) {
15
- if (isMessageCompacted(state, msg)) {
16
- continue;
17
- }
18
- if (msg.parts) {
19
- for (const part of msg.parts) {
20
- if (part.type === "tool" && part.callID) {
21
- toolCallIds.push(part.callID);
22
- const cachedData = toolParametersCache.get(part.callID);
23
- const parameters = cachedData?.parameters ?? part.state?.input ?? {};
24
- toolMetadata.set(part.callID, {
25
- tool: part.tool,
26
- parameters: parameters,
27
- status: part.state?.status,
28
- error: part.state?.status === "error" ? part.state.error : undefined,
29
- turn: cachedData?.turn ?? 0,
30
- });
31
- }
32
- }
33
- }
34
- }
35
- return { toolCallIds, toolMetadata };
36
- }
37
- /**
38
- * Replace pruned tool outputs in messages for LLM analysis.
39
- */
40
- function replacePrunedToolOutputs(messages, prunedIds) {
41
- if (prunedIds.length === 0)
42
- return messages;
43
- const prunedIdsSet = new Set(prunedIds);
44
- return messages.map((msg) => {
45
- if (!msg.parts)
46
- return msg;
47
- return {
48
- ...msg,
49
- parts: msg.parts.map((part) => {
50
- if (part.type === "tool" &&
51
- part.callID &&
52
- prunedIdsSet.has(part.callID) &&
53
- part.state?.output) {
54
- return {
55
- ...part,
56
- state: {
57
- ...part.state,
58
- output: "[Output removed to save context - information superseded or no longer needed]",
59
- },
60
- };
61
- }
62
- return part;
63
- }),
64
- };
65
- });
66
- }
67
- /**
68
- * Run LLM analysis to determine which tool calls can be pruned.
69
- */
70
- async function runLlmAnalysis(client, state, logger, config, messages, unprunedToolCallIds, alreadyPrunedIds, toolMetadata, workingDirectory) {
71
- const protectedToolCallIds = [];
72
- const prunableToolCallIds = unprunedToolCallIds.filter((id) => {
73
- const metadata = toolMetadata.get(id);
74
- if (metadata && config.strategies.onIdle.protectedTools.includes(metadata.tool)) {
75
- protectedToolCallIds.push(id);
76
- return false;
77
- }
78
- return true;
79
- });
80
- if (prunableToolCallIds.length === 0) {
81
- return [];
82
- }
83
- // Get model info from messages
84
- let validModelInfo = undefined;
85
- if (messages.length > 0) {
86
- const lastMessage = messages[messages.length - 1];
87
- const model = lastMessage.info?.model;
88
- if (model?.providerID && model?.modelID) {
89
- validModelInfo = {
90
- providerID: model.providerID,
91
- modelID: model.modelID,
92
- };
93
- }
94
- }
95
- const modelSelection = await selectModel(validModelInfo, logger, config.strategies.onIdle.model, workingDirectory);
96
- logger.info(`OnIdle Model: ${modelSelection.modelInfo.providerID}/${modelSelection.modelInfo.modelID}`, {
97
- source: modelSelection.source,
98
- });
99
- if (modelSelection.failedModel && config.strategies.onIdle.showModelErrorToasts) {
100
- const skipAi = modelSelection.source === "fallback" && config.strategies.onIdle.strictModelSelection;
101
- try {
102
- await client.tui.showToast({
103
- body: {
104
- title: skipAi ? "DCP: AI analysis skipped" : "DCP: Model fallback",
105
- message: skipAi
106
- ? `${modelSelection.failedModel.providerID}/${modelSelection.failedModel.modelID} failed\nAI analysis skipped (strictModelSelection enabled)`
107
- : `${modelSelection.failedModel.providerID}/${modelSelection.failedModel.modelID} failed\nUsing ${modelSelection.modelInfo.providerID}/${modelSelection.modelInfo.modelID}`,
108
- variant: "info",
109
- duration: 5000,
110
- },
111
- });
112
- }
113
- catch {
114
- // Ignore toast errors
115
- }
116
- }
117
- if (modelSelection.source === "fallback" && config.strategies.onIdle.strictModelSelection) {
118
- logger.info("Skipping AI analysis (fallback model, strictModelSelection enabled)");
119
- return [];
120
- }
121
- const { generateObject } = await import("ai");
122
- const sanitizedMessages = replacePrunedToolOutputs(messages, alreadyPrunedIds);
123
- const analysisPrompt = buildAnalysisPrompt(prunableToolCallIds, sanitizedMessages, alreadyPrunedIds, protectedToolCallIds);
124
- const result = await generateObject({
125
- model: modelSelection.model,
126
- schema: z.object({
127
- pruned_tool_call_ids: z.array(z.string()),
128
- reasoning: z.string(),
129
- }),
130
- prompt: analysisPrompt,
131
- });
132
- const rawLlmPrunedIds = result.object.pruned_tool_call_ids;
133
- const llmPrunedIds = rawLlmPrunedIds.filter((id) => prunableToolCallIds.includes(id));
134
- // Always log LLM output as debug
135
- const reasoning = result.object.reasoning.replace(/\n+/g, " ").replace(/\s+/g, " ").trim();
136
- logger.debug(`OnIdle LLM output`, {
137
- pruned_tool_call_ids: rawLlmPrunedIds,
138
- reasoning: reasoning,
139
- });
140
- return llmPrunedIds;
141
- }
142
- /**
143
- * Run the onIdle pruning strategy.
144
- * This is called when the session transitions to idle state.
145
- */
146
- export async function runOnIdle(client, state, logger, config, workingDirectory) {
147
- try {
148
- if (!state.sessionId) {
149
- return null;
150
- }
151
- const sessionId = state.sessionId;
152
- // Fetch session info and messages
153
- const [sessionInfoResponse, messagesResponse] = await Promise.all([
154
- client.session.get({ path: { id: sessionId } }),
155
- client.session.messages({ path: { id: sessionId } }),
156
- ]);
157
- const sessionInfo = sessionInfoResponse.data;
158
- const messages = messagesResponse.data || messagesResponse;
159
- if (!messages || messages.length < 3) {
160
- return null;
161
- }
162
- const currentParams = getCurrentParams(messages, logger);
163
- const { toolCallIds, toolMetadata } = parseMessages(state, messages, state.toolParameters);
164
- const alreadyPrunedIds = state.prune.toolIds;
165
- const unprunedToolCallIds = toolCallIds.filter((id) => !alreadyPrunedIds.includes(id));
166
- if (unprunedToolCallIds.length === 0) {
167
- return null;
168
- }
169
- // Count prunable tools (excluding protected)
170
- const candidateCount = unprunedToolCallIds.filter((id) => {
171
- const metadata = toolMetadata.get(id);
172
- return !metadata || !config.strategies.onIdle.protectedTools.includes(metadata.tool);
173
- }).length;
174
- if (candidateCount === 0) {
175
- return null;
176
- }
177
- // Run LLM analysis
178
- const llmPrunedIds = await runLlmAnalysis(client, state, logger, config, messages, unprunedToolCallIds, alreadyPrunedIds, toolMetadata, workingDirectory);
179
- const newlyPrunedIds = llmPrunedIds.filter((id) => !alreadyPrunedIds.includes(id));
180
- if (newlyPrunedIds.length === 0) {
181
- return null;
182
- }
183
- // Log the tool IDs being pruned with their tool names
184
- for (const id of newlyPrunedIds) {
185
- const metadata = toolMetadata.get(id);
186
- const toolName = metadata?.tool || "unknown";
187
- logger.info(`OnIdle pruning tool: ${toolName}`, { callID: id });
188
- }
189
- // Update state
190
- const allPrunedIds = [...new Set([...alreadyPrunedIds, ...newlyPrunedIds])];
191
- state.prune.toolIds = allPrunedIds;
192
- state.stats.pruneTokenCounter += calculateTokensSaved(state, messages, newlyPrunedIds);
193
- // Build tool metadata map for notification
194
- const prunedToolMetadata = new Map();
195
- for (const id of newlyPrunedIds) {
196
- const metadata = toolMetadata.get(id);
197
- if (metadata) {
198
- prunedToolMetadata.set(id, metadata);
199
- }
200
- }
201
- // Send notification
202
- await sendUnifiedNotification(client, logger, config, state, sessionId, newlyPrunedIds, prunedToolMetadata, undefined, // reason
203
- currentParams, workingDirectory || "");
204
- state.stats.totalPruneTokens += state.stats.pruneTokenCounter;
205
- state.stats.pruneTokenCounter = 0;
206
- state.nudgeCounter = 0;
207
- state.lastToolPrune = true;
208
- // Persist state
209
- const sessionName = sessionInfo?.title;
210
- saveSessionState(state, logger, sessionName).catch((err) => {
211
- logger.error("Failed to persist state", { error: err.message });
212
- });
213
- logger.info(`OnIdle: Pruned ${newlyPrunedIds.length}/${candidateCount} tools`);
214
- }
215
- catch (error) {
216
- logger.error("OnIdle analysis failed", { error: error.message });
217
- return null;
218
- }
219
- }
220
- //# sourceMappingURL=on-idle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"on-idle.js","sourceRoot":"","sources":["../../../lib/strategies/on-idle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAa,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAC5D,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAQpD;;GAEG;AACH,SAAS,aAAa,CAClB,KAAmB,EACnB,QAAqB,EACrB,mBAAoD;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