@bluecopa/harness 0.1.0-snapshot.13 → 0.1.0-snapshot.15
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/package.json
CHANGED
|
@@ -727,8 +727,7 @@ export function createAgent(runtime: AgentRuntime) {
|
|
|
727
727
|
if (event.type === 'text_delta') {
|
|
728
728
|
finalText += event.text;
|
|
729
729
|
yield event;
|
|
730
|
-
}
|
|
731
|
-
if (event.type === 'tool_start') {
|
|
730
|
+
} else if (event.type === 'tool_start') {
|
|
732
731
|
pendingTools.push({
|
|
733
732
|
type: 'tool',
|
|
734
733
|
name: event.name,
|
|
@@ -736,6 +735,11 @@ export function createAgent(runtime: AgentRuntime) {
|
|
|
736
735
|
...(event.toolCallId != null ? { toolCallId: event.toolCallId } : {}),
|
|
737
736
|
});
|
|
738
737
|
yield event;
|
|
738
|
+
} else {
|
|
739
|
+
// Forward all other events (tool_end, step_start, step_end, done)
|
|
740
|
+
// from self-managing loops like ArcLoop
|
|
741
|
+
yield event;
|
|
742
|
+
if (event.type === 'done') return;
|
|
739
743
|
}
|
|
740
744
|
}
|
|
741
745
|
|
|
@@ -170,6 +170,9 @@ export interface VercelAgentLoopConfig {
|
|
|
170
170
|
export class VercelAgentLoop implements AgentLoop {
|
|
171
171
|
private readonly model: string;
|
|
172
172
|
private readonly systemPrompt: string;
|
|
173
|
+
/** System prompt as array with Anthropic cache_control for prompt caching. */
|
|
174
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
175
|
+
private readonly cachedSystemPrompt: any;
|
|
173
176
|
private readonly tools: Record<string, AnyTool>;
|
|
174
177
|
private readonly validToolNames: Set<string>;
|
|
175
178
|
|
|
@@ -189,6 +192,13 @@ export class VercelAgentLoop implements AgentLoop {
|
|
|
189
192
|
'When the task is fully complete, respond with a brief text summary (no tool call).',
|
|
190
193
|
].join(' ');
|
|
191
194
|
|
|
195
|
+
// Wrap system prompt with Anthropic cache_control for prompt caching
|
|
196
|
+
this.cachedSystemPrompt = [{
|
|
197
|
+
type: 'text',
|
|
198
|
+
text: this.systemPrompt,
|
|
199
|
+
providerOptions: { anthropic: { cacheControl: { type: 'ephemeral' } } },
|
|
200
|
+
}];
|
|
201
|
+
|
|
192
202
|
if (config.apiKey) {
|
|
193
203
|
process.env.ANTHROPIC_API_KEY = config.apiKey;
|
|
194
204
|
}
|
|
@@ -204,7 +214,7 @@ export class VercelAgentLoop implements AgentLoop {
|
|
|
204
214
|
model: anthropic(this.model),
|
|
205
215
|
tools: this.tools,
|
|
206
216
|
toolChoice: 'auto',
|
|
207
|
-
system: this.
|
|
217
|
+
system: this.cachedSystemPrompt,
|
|
208
218
|
messages: toModelMessages(messages),
|
|
209
219
|
stopWhen: stepCountIs(1),
|
|
210
220
|
});
|
|
@@ -253,7 +263,7 @@ export class VercelAgentLoop implements AgentLoop {
|
|
|
253
263
|
model: anthropic(this.model),
|
|
254
264
|
tools: this.tools,
|
|
255
265
|
toolChoice: 'auto',
|
|
256
|
-
system: this.
|
|
266
|
+
system: this.cachedSystemPrompt,
|
|
257
267
|
messages: toModelMessages(messages),
|
|
258
268
|
stopWhen: stepCountIs(1),
|
|
259
269
|
});
|