@tarquinen/opencode-dcp 0.4.1 → 0.4.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -20
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -15
- package/dist/index.js.map +1 -1
- package/dist/lib/config.js +2 -2
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/core/janitor.d.ts +3 -25
- package/dist/lib/core/janitor.d.ts.map +1 -1
- package/dist/lib/core/janitor.js +2 -11
- package/dist/lib/core/janitor.js.map +1 -1
- package/dist/lib/core/strategies/deduplication.d.ts +1 -1
- package/dist/lib/core/strategies/index.d.ts +32 -2
- package/dist/lib/core/strategies/index.d.ts.map +1 -1
- package/dist/lib/core/strategies/index.js.map +1 -1
- package/dist/lib/fetch-wrapper/formats/anthropic.d.ts +8 -0
- package/dist/lib/fetch-wrapper/formats/anthropic.d.ts.map +1 -0
- package/dist/lib/fetch-wrapper/formats/anthropic.js +122 -0
- package/dist/lib/fetch-wrapper/formats/anthropic.js.map +1 -0
- package/dist/lib/fetch-wrapper/formats/bedrock.d.ts +3 -9
- package/dist/lib/fetch-wrapper/formats/bedrock.d.ts.map +1 -1
- package/dist/lib/fetch-wrapper/formats/bedrock.js +25 -45
- package/dist/lib/fetch-wrapper/formats/bedrock.js.map +1 -1
- package/dist/lib/fetch-wrapper/formats/gemini.d.ts +1 -7
- package/dist/lib/fetch-wrapper/formats/gemini.d.ts.map +1 -1
- package/dist/lib/fetch-wrapper/formats/gemini.js +30 -23
- package/dist/lib/fetch-wrapper/formats/gemini.js.map +1 -1
- package/dist/lib/fetch-wrapper/formats/index.d.ts +1 -0
- package/dist/lib/fetch-wrapper/formats/index.d.ts.map +1 -1
- package/dist/lib/fetch-wrapper/formats/index.js +1 -0
- package/dist/lib/fetch-wrapper/formats/index.js.map +1 -1
- package/dist/lib/fetch-wrapper/formats/openai-chat.d.ts +0 -11
- package/dist/lib/fetch-wrapper/formats/openai-chat.d.ts.map +1 -1
- package/dist/lib/fetch-wrapper/formats/openai-chat.js +33 -25
- package/dist/lib/fetch-wrapper/formats/openai-chat.js.map +1 -1
- package/dist/lib/fetch-wrapper/formats/openai-responses.d.ts +0 -8
- package/dist/lib/fetch-wrapper/formats/openai-responses.d.ts.map +1 -1
- package/dist/lib/fetch-wrapper/formats/openai-responses.js +29 -21
- package/dist/lib/fetch-wrapper/formats/openai-responses.js.map +1 -1
- package/dist/lib/fetch-wrapper/handler.d.ts +0 -10
- package/dist/lib/fetch-wrapper/handler.d.ts.map +1 -1
- package/dist/lib/fetch-wrapper/handler.js +74 -41
- package/dist/lib/fetch-wrapper/handler.js.map +1 -1
- package/dist/lib/fetch-wrapper/index.d.ts +4 -5
- package/dist/lib/fetch-wrapper/index.d.ts.map +1 -1
- package/dist/lib/fetch-wrapper/index.js +16 -7
- package/dist/lib/fetch-wrapper/index.js.map +1 -1
- package/dist/lib/fetch-wrapper/prunable-list.d.ts +8 -0
- package/dist/lib/fetch-wrapper/prunable-list.d.ts.map +1 -0
- package/dist/lib/fetch-wrapper/prunable-list.js +38 -0
- package/dist/lib/fetch-wrapper/prunable-list.js.map +1 -0
- package/dist/lib/fetch-wrapper/tool-tracker.d.ts +8 -0
- package/dist/lib/fetch-wrapper/tool-tracker.d.ts.map +1 -0
- package/dist/lib/fetch-wrapper/tool-tracker.js +7 -0
- package/dist/lib/fetch-wrapper/tool-tracker.js.map +1 -0
- package/dist/lib/fetch-wrapper/types.d.ts +31 -46
- package/dist/lib/fetch-wrapper/types.d.ts.map +1 -1
- package/dist/lib/fetch-wrapper/types.js +6 -44
- package/dist/lib/fetch-wrapper/types.js.map +1 -1
- package/dist/lib/hooks.d.ts +6 -2
- package/dist/lib/hooks.d.ts.map +1 -1
- package/dist/lib/hooks.js +21 -11
- package/dist/lib/hooks.js.map +1 -1
- package/dist/lib/prompts/nudge.txt +8 -5
- package/dist/lib/prompts/synthetic.txt +18 -30
- package/dist/lib/prompts/tool.txt +46 -63
- package/dist/lib/pruning-tool.d.ts +1 -1
- package/dist/lib/pruning-tool.d.ts.map +1 -1
- package/dist/lib/pruning-tool.js +41 -18
- package/dist/lib/pruning-tool.js.map +1 -1
- package/dist/lib/state/id-mapping.d.ts +0 -1
- package/dist/lib/state/id-mapping.d.ts.map +1 -1
- package/dist/lib/state/id-mapping.js +0 -3
- package/dist/lib/state/id-mapping.js.map +1 -1
- package/dist/lib/state/index.d.ts +3 -0
- package/dist/lib/state/index.d.ts.map +1 -1
- package/dist/lib/state/index.js.map +1 -1
- package/dist/lib/state/tool-cache.d.ts +5 -12
- package/dist/lib/state/tool-cache.d.ts.map +1 -1
- package/dist/lib/state/tool-cache.js +47 -72
- package/dist/lib/state/tool-cache.js.map +1 -1
- package/dist/lib/ui/display-utils.d.ts +12 -0
- package/dist/lib/ui/display-utils.d.ts.map +1 -1
- package/dist/lib/ui/display-utils.js +66 -0
- package/dist/lib/ui/display-utils.js.map +1 -1
- package/dist/lib/ui/notification.d.ts +5 -12
- package/dist/lib/ui/notification.d.ts.map +1 -1
- package/dist/lib/ui/notification.js +32 -141
- package/dist/lib/ui/notification.js.map +1 -1
- package/package.json +1 -1
- package/dist/lib/api-formats/prunable-list.d.ts +0 -49
- package/dist/lib/api-formats/prunable-list.d.ts.map +0 -1
- package/dist/lib/api-formats/prunable-list.js +0 -112
- package/dist/lib/api-formats/prunable-list.js.map +0 -1
- package/dist/lib/api-formats/synth-instruction.d.ts +0 -29
- package/dist/lib/api-formats/synth-instruction.d.ts.map +0 -1
- package/dist/lib/api-formats/synth-instruction.js +0 -171
- package/dist/lib/api-formats/synth-instruction.js.map +0 -1
- package/dist/lib/core/strategies/types.d.ts +0 -35
- package/dist/lib/core/strategies/types.d.ts.map +0 -1
- package/dist/lib/core/strategies/types.js +0 -6
- package/dist/lib/core/strategies/types.js.map +0 -1
package/dist/lib/hooks.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { runOnIdle } from "./core/janitor";
|
|
2
|
-
import { resetToolTrackerCount } from "./
|
|
2
|
+
import { resetToolTrackerCount } from "./fetch-wrapper/tool-tracker";
|
|
3
3
|
import { clearAllMappings } from "./state/id-mapping";
|
|
4
4
|
export async function isSubagentSession(client, sessionID) {
|
|
5
5
|
try {
|
|
@@ -43,7 +43,7 @@ export function createEventHandler(client, janitorCtx, logger, config, toolTrack
|
|
|
43
43
|
/**
|
|
44
44
|
* Creates the chat.params hook for model caching and Google tool call mapping.
|
|
45
45
|
*/
|
|
46
|
-
export function createChatParamsHandler(client, state, logger) {
|
|
46
|
+
export function createChatParamsHandler(client, state, logger, toolTracker) {
|
|
47
47
|
return async (input, _output) => {
|
|
48
48
|
const sessionId = input.sessionID;
|
|
49
49
|
let providerID = input.provider?.info?.id || input.provider?.id;
|
|
@@ -53,11 +53,14 @@ export function createChatParamsHandler(client, state, logger) {
|
|
|
53
53
|
}
|
|
54
54
|
if (state.lastSeenSessionId && state.lastSeenSessionId !== sessionId) {
|
|
55
55
|
logger.info("chat.params", "Session changed, resetting state", {
|
|
56
|
-
from: state.lastSeenSessionId
|
|
57
|
-
to: sessionId
|
|
56
|
+
from: state.lastSeenSessionId,
|
|
57
|
+
to: sessionId
|
|
58
58
|
});
|
|
59
59
|
clearAllMappings();
|
|
60
60
|
state.toolParameters.clear();
|
|
61
|
+
if (toolTracker) {
|
|
62
|
+
resetToolTrackerCount(toolTracker);
|
|
63
|
+
}
|
|
61
64
|
}
|
|
62
65
|
state.lastSeenSessionId = sessionId;
|
|
63
66
|
if (!state.checkedSessions.has(sessionId)) {
|
|
@@ -79,7 +82,7 @@ export function createChatParamsHandler(client, state, logger) {
|
|
|
79
82
|
try {
|
|
80
83
|
const messagesResponse = await client.session.messages({
|
|
81
84
|
path: { id: sessionId },
|
|
82
|
-
query: { limit:
|
|
85
|
+
query: { limit: 500 }
|
|
83
86
|
});
|
|
84
87
|
const messages = messagesResponse.data || messagesResponse;
|
|
85
88
|
if (Array.isArray(messages)) {
|
|
@@ -94,12 +97,6 @@ export function createChatParamsHandler(client, state, logger) {
|
|
|
94
97
|
toolCallsByName.set(toolName, []);
|
|
95
98
|
}
|
|
96
99
|
toolCallsByName.get(toolName).push(callId);
|
|
97
|
-
if (!state.toolParameters.has(callId)) {
|
|
98
|
-
state.toolParameters.set(callId, {
|
|
99
|
-
tool: part.tool,
|
|
100
|
-
parameters: part.input ?? {}
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
100
|
}
|
|
104
101
|
}
|
|
105
102
|
}
|
|
@@ -126,4 +123,17 @@ export function createChatParamsHandler(client, state, logger) {
|
|
|
126
123
|
}
|
|
127
124
|
};
|
|
128
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Finds the current agent from messages by scanning backward for user messages.
|
|
128
|
+
*/
|
|
129
|
+
export function findCurrentAgent(messages) {
|
|
130
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
131
|
+
const msg = messages[i];
|
|
132
|
+
const info = msg.info;
|
|
133
|
+
if (info?.role === 'user') {
|
|
134
|
+
return info.agent || 'build';
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
129
139
|
//# sourceMappingURL=hooks.js.map
|
package/dist/lib/hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../lib/hooks.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAG1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../lib/hooks.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAG1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,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EAAE,CAAC,CAAC;wBACpC,SAAS,EAAE,eAAe,CAAC,IAAI;wBAC/B,eAAe,EAAE,KAAK,CAAC,cAAc,CAAC,IAAI;qBAC7C,CAAC,CAAA;gBACN,CAAC;YACL,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBAClB,MAAM,CAAC,KAAK,CAAC,aAAa,EAAE,0CAA0C,EAAE;oBACpE,KAAK,EAAE,KAAK,CAAC,OAAO;iBACvB,CAAC,CAAA;YACN,CAAC;QACL,CAAC;IACL,CAAC,CAAA;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAe;IAC5C,KAAK,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5C,MAAM,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;QACvB,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAA;QACrB,IAAI,IAAI,EAAE,IAAI,KAAK,MAAM,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC,KAAK,IAAI,OAAO,CAAA;QAChC,CAAC;IACL,CAAC;IACD,OAAO,SAAS,CAAA;AACpB,CAAC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
</system-reminder>
|
|
1
|
+
<instruction name=context_management_required>
|
|
2
|
+
**CRITICAL CONTEXT WARNING:** Your context window is filling with tool outputs. Strict adherence to context hygiene is required.
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
**Immediate Actions Required:**
|
|
5
|
+
1. **Garbage Collect:** If you read files or ran commands that yielded no value, prune them NOW. Do not summarize them.
|
|
6
|
+
2. **Task Cleanup:** If a sub-task is complete, prune the tools used.
|
|
7
|
+
3. **Consolidate:** If you are holding valuable raw data, you *must* distill the insights into your narrative and prune the raw entry.
|
|
8
|
+
|
|
9
|
+
**Protocol:** You should prioritize this cleanup, but do not interrupt a critical atomic operation if one is in progress. Once the immediate step is done, you must prune.
|
|
7
10
|
</instruction>
|
|
@@ -1,38 +1,26 @@
|
|
|
1
1
|
<system-reminder>
|
|
2
|
-
|
|
3
|
-
</system-reminder>
|
|
4
|
-
|
|
5
|
-
<instruction name=signal_management>
|
|
6
|
-
After calling a series of tools, YOU ALWAYS HAVE TO distill signals from their results in your next message. This ensures tracability of your reasoning, informs the user of your findings, and is PARAMOUNT to best context window management practices.
|
|
2
|
+
<instruction name=context_management_protocol policy_level=critical>
|
|
7
3
|
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
ENVIRONMENT
|
|
5
|
+
You are operating in a context-constrained environment and thus must proactively manage your context window using the `prune` tool. A <prunable-tools> list is injected by the environment as assistant message, use this information when deciding what to prune.
|
|
10
6
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
</instruction>
|
|
7
|
+
PRUNE EARLY, PRUNE OFTEN - BUT PRUNE METHODICALLY
|
|
8
|
+
Every tool call adds to your context debt. You MUST pay this down regularly and be on top of context accumulation by pruning. Evaluate what SHOULD be pruned before jumping the gun.
|
|
14
9
|
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
WHEN TO PRUNE? THE THREE SCENARIOS TO CONSIDER
|
|
11
|
+
1. TASK COMPLETION: When work is done, quietly prune the tools that aren't needed anymore
|
|
12
|
+
2. NOISE REMOVAL: If outputs are irrelevant, unhelpful, or superseded by newer info, prune IMMEDIATELY. No distillation - gun it down
|
|
13
|
+
3. CONTEXT CONSOLIDATION: When pruning valuable context to the task at hand, you MUST ALWAYS distill key findings into your narrative BEFORE pruning. Be surgical and strategic in what you extract. THINK: high signal, low noise
|
|
17
14
|
|
|
18
|
-
|
|
15
|
+
You WILL use the `prune` tool when ANY of these are true:
|
|
16
|
+
- Task or sub-task is complete
|
|
17
|
+
- You are about to start a new phase of work
|
|
18
|
+
- You have distilled enough information in your messages to prune related tools
|
|
19
|
+
- Context contains tools output that are unhelpful, noise, or made obsolete by newer outputs
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
- Before starting a new phase of work where old tool outputs are no longer needed to inform your next actions.
|
|
21
|
+
NOTES
|
|
22
|
+
When in doubt, prune out. Prune often yet remain strategic about it.
|
|
23
|
+
FAILURE TO PRUNE will result in context leakage and DEGRADED PERFORMANCES.
|
|
24
24
|
|
|
25
|
-
CRITICAL:
|
|
26
|
-
You must ALWAYS narrate your findings in a message BEFORE using the `prune` tool. Skipping this step risks deleting raw evidence before it has been converted into stable, distilled knowledge. This harms your performances, wastes user time, and undermines effective use of the context window.
|
|
27
|
-
|
|
28
|
-
EXAMPLE WORKFLOW:
|
|
29
|
-
1. You call several tools (read, bash, grep...) to investigate a bug.
|
|
30
|
-
2. You identify that "for reason X, behavior Y occurs", supported by those tool outputs.
|
|
31
|
-
3. In your next message, you EXPLICITLY narrate:
|
|
32
|
-
- What you did (which tools, what you were looking for).
|
|
33
|
-
- What you found (the key facts / signals).
|
|
34
|
-
- What you concluded (how this affects the task or next step).
|
|
35
|
-
>YOU MUST ALWAYS THINK HIGH SIGNAL LOW NOISE FOR THIS NARRATION
|
|
36
|
-
4. ONLY AFTER the narration, you call the `prune` tool with a brief reason (e.g. "exploration for bug X complete; moving on to next bug").
|
|
37
|
-
</instruction>
|
|
38
25
|
</instruction>
|
|
26
|
+
</system-reminder>
|
|
@@ -1,73 +1,56 @@
|
|
|
1
|
-
Prunes tool outputs from context to manage conversation size
|
|
1
|
+
Prunes tool outputs from context to manage conversation size and reduce noise.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## IMPORTANT: The Prunable List
|
|
4
|
+
A `<prunable-tools>` list is injected into assistant messages showing available tool outputs you can prune. Each line has the format `ID: tool, parameter` (e.g., `20: read, /path/to/file.ts`). Use these numeric IDs to select which tools to prune.
|
|
4
5
|
|
|
5
|
-
## CRITICAL:
|
|
6
|
+
## CRITICAL: When and How to Prune
|
|
6
7
|
|
|
7
|
-
You
|
|
8
|
+
You must use this tool in three specific scenarios. The rules for distillation (summarizing findings) differ for each. **You must specify the reason as the first element of the `ids` array** to indicate which scenario applies.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
### 1. Task Completion (Clean Up) — reason: `completion`
|
|
11
|
+
**When:** You have successfully completed a specific unit of work (e.g., fixed a bug, wrote a file, answered a question).
|
|
12
|
+
**Action:** Prune the tools used for that task.
|
|
13
|
+
**Distillation:** NOT REQUIRED. Since the task is done, the raw data is no longer needed. Simply state that the task is complete.
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
- What you found (the key facts/signals)
|
|
16
|
-
- What you concluded (how this affects the task or next step)
|
|
17
|
-
3. ONLY AFTER narrating, call `prune` with the numeric IDs of outputs no longer needed
|
|
15
|
+
### 2. Removing Noise (Garbage Collection) — reason: `noise`
|
|
16
|
+
**When:** You have read files or run commands that turned out to be irrelevant, unhelpful, or outdated (meaning later tools have provided fresher, more valid information).
|
|
17
|
+
**Action:** Prune these specific tool outputs immediately.
|
|
18
|
+
**Distillation:** FORBIDDEN. Do not pollute the context by summarizing useless information. Just cut it out.
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
### 3. Context Conservation (Research & Consolidation) — reason: `consolidation`
|
|
21
|
+
**When:** You have gathered useful information. Prune frequently as you work (e.g., after reading a few files), rather than waiting for a "long" phase to end.
|
|
22
|
+
**Action:** Convert raw data into distilled knowledge. This allows you to discard large outputs (like full file reads) while keeping only the specific parts you need (like a single function signature or constant).
|
|
23
|
+
**Distillation:** MANDATORY. Before pruning, you *must* explicitly summarize the key findings from *every* tool you plan to prune.
|
|
24
|
+
- **Extract specific value:** If you read a large file but only care about one function, record that function's details and prune the whole read.
|
|
25
|
+
- Narrative format: "I found X in file Y..."
|
|
26
|
+
- Capture all relevant details (function names, logic, constraints).
|
|
27
|
+
- Once distilled into your response history, the raw tool output can be safely pruned.
|
|
20
28
|
|
|
21
|
-
##
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
<prunable-tools>
|
|
26
|
-
1: read, src/foo.ts
|
|
27
|
-
2: bash, run tests
|
|
28
|
-
3: grep, "error" in logs/
|
|
29
|
-
</prunable-tools>
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
To prune outputs 1 and 3, call: `prune({ ids: [1, 3] })`
|
|
33
|
-
|
|
34
|
-
## When to Use This Tool
|
|
35
|
-
|
|
36
|
-
**Key heuristic: Distill, then prune when you finish something and are about to start something else.**
|
|
37
|
-
|
|
38
|
-
Ask yourself: "Have I just completed a discrete unit of work?" If yes, narrate your findings, then prune before moving on.
|
|
39
|
-
|
|
40
|
-
**After completing a unit of work:**
|
|
41
|
-
- Made a commit
|
|
42
|
-
- Fixed a bug and confirmed it works
|
|
43
|
-
- Answered a question the user asked
|
|
44
|
-
- Finished implementing a feature or function
|
|
45
|
-
- Completed one item in a list and moving to the next
|
|
46
|
-
|
|
47
|
-
**After repetitive or exploratory work:**
|
|
48
|
-
- Explored multiple files that didn't lead to changes
|
|
49
|
-
- Iterated on a difficult problem where some approaches didn't pan out
|
|
50
|
-
- Used the same tool multiple times (e.g., re-reading a file, running repeated build/type checks)
|
|
29
|
+
## Best Practices
|
|
30
|
+
- **Don't wait too long:** Prune frequently to keep the context agile.
|
|
31
|
+
- **Be surgical:** You can mix strategies. Prune noise without comment, while distilling useful context in the same turn.
|
|
32
|
+
- **Verify:** Ensure you have captured what you need before deleting useful raw data.
|
|
51
33
|
|
|
52
34
|
## Examples
|
|
53
35
|
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
36
|
+
<example_noise>
|
|
37
|
+
Assistant: [Reads 'wrong_file.ts']
|
|
38
|
+
This file isn't relevant to the auth system. I'll remove it to clear the context.
|
|
39
|
+
[Uses prune with ids: ["noise", 5]]
|
|
40
|
+
</example_noise>
|
|
41
|
+
|
|
42
|
+
<example_consolidation>
|
|
43
|
+
Assistant: [Reads 5 different config files]
|
|
44
|
+
I have analyzed the configuration. Here is the distillation:
|
|
45
|
+
- 'config.ts' uses port 3000.
|
|
46
|
+
- 'db.ts' connects to mongo:27017.
|
|
47
|
+
- The other 3 files were defaults.
|
|
48
|
+
I have preserved the signals above, so I am now pruning the raw reads.
|
|
49
|
+
[Uses prune with ids: ["consolidation", 10, 11, 12, 13, 14]]
|
|
50
|
+
</example_consolidation>
|
|
51
|
+
|
|
52
|
+
<example_completion>
|
|
53
|
+
Assistant: [Runs tests, they pass]
|
|
54
|
+
The tests passed. The feature is verified.
|
|
55
|
+
[Uses prune with ids: ["completion", 20, 21]]
|
|
56
|
+
</example_completion>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { tool } from "@opencode-ai/plugin";
|
|
2
2
|
import type { PluginState } from "./state";
|
|
3
3
|
import type { PluginConfig } from "./config";
|
|
4
|
-
import type { ToolTracker } from "./
|
|
4
|
+
import type { ToolTracker } from "./fetch-wrapper/tool-tracker";
|
|
5
5
|
import { type NotificationContext } from "./ui/notification";
|
|
6
6
|
import type { Logger } from "./logger";
|
|
7
7
|
export interface PruneToolContext {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pruning-tool.d.ts","sourceRoot":"","sources":["../../lib/pruning-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"pruning-tool.d.ts","sourceRoot":"","sources":["../../lib/pruning-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAK/D,OAAO,EAA2B,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAIrF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAQtC,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,GAAG,CAAA;IACX,KAAK,EAAE,WAAW,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,YAAY,CAAA;IACpB,eAAe,EAAE,mBAAmB,CAAA;IACpC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC7B,GAAG,EAAE,gBAAgB,EACrB,WAAW,EAAE,WAAW,GACzB,UAAU,CAAC,OAAO,IAAI,CAAC,CA4HzB"}
|
package/dist/lib/pruning-tool.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { tool } from "@opencode-ai/plugin";
|
|
2
|
-
import { resetToolTrackerCount } from "./
|
|
3
|
-
import { isSubagentSession } from "./hooks";
|
|
2
|
+
import { resetToolTrackerCount } from "./fetch-wrapper/tool-tracker";
|
|
3
|
+
import { isSubagentSession, findCurrentAgent } from "./hooks";
|
|
4
4
|
import { getActualId } from "./state/id-mapping";
|
|
5
|
-
import {
|
|
5
|
+
import { sendUnifiedNotification } from "./ui/notification";
|
|
6
|
+
import { formatPruningResultForTool } from "./ui/display-utils";
|
|
6
7
|
import { ensureSessionRestored } from "./state";
|
|
7
8
|
import { saveSessionState } from "./state/persistence";
|
|
8
9
|
import { estimateTokensBatch } from "./tokenizer";
|
|
@@ -17,10 +18,13 @@ export function createPruningTool(ctx, toolTracker) {
|
|
|
17
18
|
return tool({
|
|
18
19
|
description: TOOL_DESCRIPTION,
|
|
19
20
|
args: {
|
|
20
|
-
ids: tool.schema.array(tool.schema.
|
|
21
|
+
ids: tool.schema.array(tool.schema.union([
|
|
22
|
+
tool.schema.enum(["completion", "noise", "consolidation"]),
|
|
23
|
+
tool.schema.number()
|
|
24
|
+
])).describe("First element is the reason ('completion', 'noise', 'consolidation'), followed by numeric IDs to prune"),
|
|
21
25
|
},
|
|
22
26
|
async execute(args, toolCtx) {
|
|
23
|
-
const { client, state, logger, config, notificationCtx
|
|
27
|
+
const { client, state, logger, config, notificationCtx } = ctx;
|
|
24
28
|
const sessionId = toolCtx.sessionID;
|
|
25
29
|
if (await isSubagentSession(client, sessionId)) {
|
|
26
30
|
return "Pruning is unavailable in subagent sessions. Do not call this tool again. Continue with your current task - if you were in the middle of work, proceed with your next step. If you had just finished, provide your final summary/findings to return to the main agent.";
|
|
@@ -28,14 +32,36 @@ export function createPruningTool(ctx, toolTracker) {
|
|
|
28
32
|
if (!args.ids || args.ids.length === 0) {
|
|
29
33
|
return "No IDs provided. Check the <prunable-tools> list for available IDs to prune.";
|
|
30
34
|
}
|
|
35
|
+
// Parse reason from first element, numeric IDs from the rest
|
|
36
|
+
const firstElement = args.ids[0];
|
|
37
|
+
const validReasons = ["completion", "noise", "consolidation"];
|
|
38
|
+
let reason;
|
|
39
|
+
let numericIds;
|
|
40
|
+
if (typeof firstElement === "string" && validReasons.includes(firstElement)) {
|
|
41
|
+
reason = firstElement;
|
|
42
|
+
numericIds = args.ids.slice(1).filter((id) => typeof id === "number");
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
numericIds = args.ids.filter((id) => typeof id === "number");
|
|
46
|
+
}
|
|
47
|
+
if (numericIds.length === 0) {
|
|
48
|
+
return "No numeric IDs provided. Format: [reason, id1, id2, ...] where reason is 'completion', 'noise', or 'consolidation'.";
|
|
49
|
+
}
|
|
31
50
|
await ensureSessionRestored(state, sessionId, logger);
|
|
32
|
-
const prunedIds =
|
|
51
|
+
const prunedIds = numericIds
|
|
33
52
|
.map(numId => getActualId(sessionId, numId))
|
|
34
53
|
.filter((id) => id !== undefined);
|
|
35
54
|
if (prunedIds.length === 0) {
|
|
36
55
|
return "None of the provided IDs were valid. Check the <prunable-tools> list for available IDs.";
|
|
37
56
|
}
|
|
38
|
-
|
|
57
|
+
// Fetch messages to calculate tokens and find current agent
|
|
58
|
+
const messagesResponse = await client.session.messages({
|
|
59
|
+
path: { id: sessionId },
|
|
60
|
+
query: { limit: 200 }
|
|
61
|
+
});
|
|
62
|
+
const messages = messagesResponse.data || messagesResponse;
|
|
63
|
+
const currentAgent = findCurrentAgent(messages);
|
|
64
|
+
const tokensSaved = await calculateTokensSavedFromMessages(messages, prunedIds);
|
|
39
65
|
const currentStats = state.stats.get(sessionId) ?? {
|
|
40
66
|
totalToolsPruned: 0,
|
|
41
67
|
totalTokensSaved: 0,
|
|
@@ -73,8 +99,9 @@ export function createPruningTool(ctx, toolTracker) {
|
|
|
73
99
|
aiPrunedIds: prunedIds,
|
|
74
100
|
toolMetadata,
|
|
75
101
|
gcPending: null,
|
|
76
|
-
sessionStats
|
|
77
|
-
|
|
102
|
+
sessionStats,
|
|
103
|
+
reason
|
|
104
|
+
}, currentAgent);
|
|
78
105
|
toolTracker.skipNextIdle = true;
|
|
79
106
|
if (config.nudge_freq > 0) {
|
|
80
107
|
resetToolTrackerCount(toolTracker);
|
|
@@ -84,23 +111,19 @@ export function createPruningTool(ctx, toolTracker) {
|
|
|
84
111
|
tokensSaved,
|
|
85
112
|
llmPrunedIds: prunedIds,
|
|
86
113
|
toolMetadata,
|
|
87
|
-
sessionStats
|
|
114
|
+
sessionStats,
|
|
115
|
+
reason
|
|
88
116
|
};
|
|
89
|
-
|
|
90
|
-
return formatPruningResultForTool(result, workingDirectory) + postPruneGuidance;
|
|
117
|
+
return formatPruningResultForTool(result, ctx.workingDirectory);
|
|
91
118
|
},
|
|
92
119
|
});
|
|
93
120
|
}
|
|
94
121
|
/**
|
|
95
122
|
* Calculates approximate tokens saved by pruning the given tool call IDs.
|
|
123
|
+
* Uses pre-fetched messages to avoid duplicate API calls.
|
|
96
124
|
*/
|
|
97
|
-
async function
|
|
125
|
+
async function calculateTokensSavedFromMessages(messages, prunedIds) {
|
|
98
126
|
try {
|
|
99
|
-
const messagesResponse = await client.session.messages({
|
|
100
|
-
path: { id: sessionId },
|
|
101
|
-
query: { limit: 200 }
|
|
102
|
-
});
|
|
103
|
-
const messages = messagesResponse.data || messagesResponse;
|
|
104
127
|
const toolOutputs = new Map();
|
|
105
128
|
for (const msg of messages) {
|
|
106
129
|
if (msg.role === 'tool' && msg.tool_call_id) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pruning-tool.js","sourceRoot":"","sources":["../../lib/pruning-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"pruning-tool.js","sourceRoot":"","sources":["../../lib/pruning-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAK1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,uBAAuB,EAA4B,MAAM,mBAAmB,CAAA;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAEjD,OAAO,EAAE,UA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A;QACvD,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,EAAE,CAAC,CAAC,CAAA;IAC7D,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QAClB,OAAO,SAAS,CAAC,MAAM,GAAG,GAAG,CAAA;IACjC,CAAC;AACL,CAAC"}
|
|
@@ -21,6 +21,5 @@ export interface IdMapping {
|
|
|
21
21
|
*/
|
|
22
22
|
export declare function getOrCreateNumericId(sessionId: string, actualId: string): number;
|
|
23
23
|
export declare function getActualId(sessionId: string, numericId: number): string | undefined;
|
|
24
|
-
export declare function clearSessionMapping(sessionId: string): void;
|
|
25
24
|
export declare function clearAllMappings(): void;
|
|
26
25
|
//# sourceMappingURL=id-mapping.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id-mapping.d.ts","sourceRoot":"","sources":["../../../lib/state/id-mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,SAAS;IACtB,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACpC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACpC,MAAM,EAAE,MAAM,CAAA;CACjB;AAkBD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAehF;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGpF;AAED,wBAAgB,
|
|
1
|
+
{"version":3,"file":"id-mapping.d.ts","sourceRoot":"","sources":["../../../lib/state/id-mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,SAAS;IACtB,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACpC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACpC,MAAM,EAAE,MAAM,CAAA;CACjB;AAkBD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAehF;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGpF;AAED,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC"}
|
|
@@ -45,9 +45,6 @@ export function getActualId(sessionId, numericId) {
|
|
|
45
45
|
const mapping = sessionMappings.get(sessionId);
|
|
46
46
|
return mapping?.numericToActual.get(numericId);
|
|
47
47
|
}
|
|
48
|
-
export function clearSessionMapping(sessionId) {
|
|
49
|
-
sessionMappings.delete(sessionId);
|
|
50
|
-
}
|
|
51
48
|
export function clearAllMappings() {
|
|
52
49
|
sessionMappings.clear();
|
|
53
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id-mapping.js","sourceRoot":"","sources":["../../../lib/state/id-mapping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAQH,8BAA8B;AAC9B,MAAM,eAAe,GAAG,IAAI,GAAG,EAAqB,CAAA;AAEpD,SAAS,iBAAiB,CAAC,SAAiB;IACxC,IAAI,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IAC5C,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,OAAO,GAAG;YACN,eAAe,EAAE,IAAI,GAAG,EAAE;YAC1B,eAAe,EAAE,IAAI,GAAG,EAAE;YAC1B,MAAM,EAAE,CAAC;SACZ,CAAA;QACD,eAAe,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IAC3C,CAAC;IACD,OAAO,OAAO,CAAA;AAClB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,S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D,OAAO,OAAO,CAAA;AAClB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,SAAiB,EAAE,QAAgB;IACpE,MAAM,OAAO,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAA;IAE5C,0BAA0B;IAC1B,MAAM,QAAQ,GAAG,OAAO,CAAC,eAAe,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IACtD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,QAAQ,CAAA;IACnB,CAAC;IAED,gBAAgB;IAChB,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,EAAE,CAAA;IAClC,OAAO,CAAC,eAAe,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;IAChD,OAAO,CAAC,eAAe,CAAC,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA;IAEhD,OAAO,SAAS,CAAA;AACpB,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,SAAiB,EAAE,SAAiB;IAC5D,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IAC9C,OAAO,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;AAClD,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC5B,eAAe,CAAC,KAAK,EAAE,CAAA;AAC3B,CAAC"}
|
|
@@ -12,9 +12,12 @@ export interface PluginState {
|
|
|
12
12
|
subagentSessions: Set<string>;
|
|
13
13
|
lastSeenSessionId: string | null;
|
|
14
14
|
}
|
|
15
|
+
export type ToolStatus = "pending" | "running" | "completed" | "error";
|
|
15
16
|
export interface ToolParameterEntry {
|
|
16
17
|
tool: string;
|
|
17
18
|
parameters: any;
|
|
19
|
+
status?: ToolStatus;
|
|
20
|
+
error?: string;
|
|
18
21
|
}
|
|
19
22
|
export interface ModelInfo {
|
|
20
23
|
providerID: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/state/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAGvC,MAAM,WAAW,WAAW;IACxB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;IAChC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IAChC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;IAC/C,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IAC7B,qBAAqB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IACvD,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC7B,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC5B,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC7B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAA;CACnC;AAED,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,GAAG,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/state/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAGvC,MAAM,WAAW,WAAW;IACxB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;IAChC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IAChC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;IAC/C,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IAC7B,qBAAqB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IACvD,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC7B,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC5B,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC7B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAA;CACnC;AAED,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,CAAA;AAEtE,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,GAAG,CAAA;IACf,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,SAAS;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;CAClB;AAED,wBAAgB,iBAAiB,IAAI,WAAW,CAa/C;AAED,wBAAsB,qBAAqB,CACvC,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CA0Bf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/state/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/state/index.ts"],"names":[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GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YAC9B,MAAM,KAAK,GAAiB;gBACxB,gBAAgB,EAAE,SAAS,CAAC,KAAK,CAAC,gBAAgB;gBAClD,gBAAgB,EAAE,SAAS,CAAC,KAAK,CAAC,gBAAgB;gBAClD,aAAa,EAAE,SAAS,CAAC,KAAK,CAAC,aAAa,IAAI,CAAC;gBACjD,YAAY,EAAE,SAAS,CAAC,KAAK,CAAC,YAAY,IAAI,CAAC;aAClD,CAAA;YACD,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;QACrC,CAAC;IACL,CAAC;AACL,CAAC"}
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
import type { PluginState } from "./index";
|
|
2
2
|
import type { Logger } from "../logger";
|
|
3
|
+
import type { ToolTracker } from "../fetch-wrapper/tool-tracker";
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* Supports:
|
|
8
|
-
* - OpenAI format: message.tool_calls[] with id, function.name, function.arguments
|
|
9
|
-
* - Anthropic format: message.content[] with type='tool_use', id, name, input
|
|
5
|
+
* Sync tool parameters from OpenCode's session.messages() API.
|
|
6
|
+
* This is the single source of truth for tool parameters, replacing
|
|
7
|
+
* format-specific parsing from LLM API requests.
|
|
10
8
|
*/
|
|
11
|
-
export declare function
|
|
12
|
-
/**
|
|
13
|
-
* Cache tool parameters from OpenAI Responses API format.
|
|
14
|
-
* Extracts from input array items with type='function_call'.
|
|
15
|
-
*/
|
|
16
|
-
export declare function cacheToolParametersFromInput(input: any[], state: PluginState, logger?: Logger): void;
|
|
9
|
+
export declare function syncToolCache(client: any, sessionId: string, state: PluginState, tracker?: ToolTracker, protectedTools?: Set<string>, logger?: Logger): Promise<void>;
|
|
17
10
|
/**
|
|
18
11
|
* Trim the tool parameters cache to prevent unbounded memory growth.
|
|
19
12
|
* Uses FIFO eviction - removes oldest entries first.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-cache.d.ts","sourceRoot":"","sources":["../../../lib/state/tool-cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"tool-cache.d.ts","sourceRoot":"","sources":["../../../lib/state/tool-cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAc,MAAM,SAAS,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAKhE;;;;GAIG;AACH,wBAAsB,aAAa,CAC/B,MAAM,EAAE,GAAG,EACX,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,WAAW,EAClB,OAAO,CAAC,EAAE,WAAW,EACrB,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EAC5B,MAAM,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CA2Df;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAWhE"}
|