@bluecopa/harness 0.1.0-snapshot.41 → 0.1.0-snapshot.42
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 +1 -1
- package/src/arc/agent-runner.ts +20 -0
- package/src/interfaces/hooks.ts +2 -1
package/package.json
CHANGED
package/src/arc/agent-runner.ts
CHANGED
|
@@ -344,6 +344,26 @@ export class AgentRunner {
|
|
|
344
344
|
const text = rawText || 'Done.';
|
|
345
345
|
messages.push({ role: 'assistant', content: text });
|
|
346
346
|
|
|
347
|
+
// RunComplete hook: allow middleware to inspect and optionally continue
|
|
348
|
+
if (config.hookRunner) {
|
|
349
|
+
const decision = await config.hookRunner.run({
|
|
350
|
+
event: 'RunComplete',
|
|
351
|
+
metadata: {
|
|
352
|
+
messages,
|
|
353
|
+
steps: step + 1,
|
|
354
|
+
output: text,
|
|
355
|
+
},
|
|
356
|
+
});
|
|
357
|
+
if (!decision.allow) {
|
|
358
|
+
// Hook wants the agent to keep going — inject reason as user guidance
|
|
359
|
+
messages.push({
|
|
360
|
+
role: 'user',
|
|
361
|
+
content: decision.reason ?? 'Continue — a required post-completion step was not performed.',
|
|
362
|
+
});
|
|
363
|
+
continue; // re-enter the loop for one more LLM step
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
347
367
|
// Structured output: use generateObject on terminal step when schema is set
|
|
348
368
|
if (config.outputSchema) {
|
|
349
369
|
try {
|