@coffer-org/plugin-claude-agent 2.0.0 → 2.1.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.
- package/dist/runtime/agent.d.ts +2 -0
- package/dist/runtime/agent.js +11 -1
- package/package.json +3 -3
package/dist/runtime/agent.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export { modelId } from './config.ts';
|
|
|
17
17
|
export declare function makeClient(cfg: Pick<AgentConfig, 'authMode' | 'anthropicApiKey' | 'globalCredentials'>): Anthropic;
|
|
18
18
|
export declare function esc(s: string): string;
|
|
19
19
|
export declare function renderContent(m: ConvMessage): string;
|
|
20
|
+
export declare const MAX_TOOL_RESULT_CHARS = 100000;
|
|
21
|
+
export declare function capToolResult(text: string): string;
|
|
20
22
|
export interface TurnParts {
|
|
21
23
|
thinking: string;
|
|
22
24
|
text: string;
|
package/dist/runtime/agent.js
CHANGED
|
@@ -65,6 +65,13 @@ export function renderContent(m) {
|
|
|
65
65
|
const author = m.sender ? `<author>${esc(m.sender)}</author>\n` : '';
|
|
66
66
|
return `${author}<body>${esc(m.content)}</body>`;
|
|
67
67
|
}
|
|
68
|
+
export const MAX_TOOL_RESULT_CHARS = 100_000;
|
|
69
|
+
export function capToolResult(text) {
|
|
70
|
+
if (text.length <= MAX_TOOL_RESULT_CHARS)
|
|
71
|
+
return text;
|
|
72
|
+
return (`${text.slice(0, MAX_TOOL_RESULT_CHARS)}\n\n[truncated: ${text.length} chars total. ` +
|
|
73
|
+
`Narrow the call — use limit/offset or filters, or count instead of listing.]`);
|
|
74
|
+
}
|
|
68
75
|
export function collectReasoning(turns) {
|
|
69
76
|
const parts = [];
|
|
70
77
|
for (const t of turns) {
|
|
@@ -243,7 +250,10 @@ export async function runAgent(request, deps = {}) {
|
|
|
243
250
|
log.warn(`tool ${b.name} threw: ${content}`);
|
|
244
251
|
}
|
|
245
252
|
}
|
|
246
|
-
|
|
253
|
+
const capped = capToolResult(content);
|
|
254
|
+
if (capped !== content)
|
|
255
|
+
log.warn(`tool ${b.name} returned ${content.length} chars — truncated`);
|
|
256
|
+
results.push({ type: 'tool_result', tool_use_id: b.id, content: capped, is_error: isError });
|
|
247
257
|
}
|
|
248
258
|
}
|
|
249
259
|
traceMessage(tracer, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coffer-org/plugin-claude-agent",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=24"
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@anthropic-ai/sdk": "^0.111.0",
|
|
29
|
-
"@coffer-org/mcp": "^2.
|
|
29
|
+
"@coffer-org/mcp": "^2.1.0",
|
|
30
30
|
"@coffer-org/sdk": "^2.0.0",
|
|
31
|
-
"@coffer-org/server": "^2.0
|
|
31
|
+
"@coffer-org/server": "^2.1.0",
|
|
32
32
|
"@langfuse/otel": "^4.6.1",
|
|
33
33
|
"@langfuse/tracing": "^4.6.1",
|
|
34
34
|
"@opentelemetry/sdk-trace-node": "^2.8.0",
|