@inflexa-ai/harness 0.26.2 → 0.26.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.
|
@@ -24,6 +24,10 @@ const xmlParser = new XMLParser({
|
|
|
24
24
|
attributeNamePrefix: "@_",
|
|
25
25
|
isArray: (name) => ["PubmedArticle", "Author", "MeshHeading", "AbstractText", "sec", "p", "record"].includes(name),
|
|
26
26
|
textNodeName: "#text",
|
|
27
|
+
// Each consumer reads a text node as a string. Without this option the
|
|
28
|
+
// parser turns a numeric text node into a number, and a year-only PubDate
|
|
29
|
+
// then crashes the year extraction in `parseEsummary`.
|
|
30
|
+
parseTagValue: false,
|
|
27
31
|
});
|
|
28
32
|
function getItemValue(items, name) {
|
|
29
33
|
if (items === undefined)
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* entire tool call is one step in the parent loop (PR #3 caches it whole,
|
|
15
15
|
* so the child never replays).
|
|
16
16
|
*/
|
|
17
|
-
import { ok } from "neverthrow";
|
|
17
|
+
import { err, ok } from "neverthrow";
|
|
18
18
|
import { z } from "zod";
|
|
19
19
|
import { finalText, runAgent } from "../../loop/run-agent.js";
|
|
20
20
|
import { passthroughStep } from "../../loop/run-step.js";
|
|
@@ -70,7 +70,7 @@ export function createLiteratureReviewerTool(deps) {
|
|
|
70
70
|
}),
|
|
71
71
|
describeCall: "none",
|
|
72
72
|
execute: async ({ brief }, ctx) => {
|
|
73
|
-
const { messages: transcript } = await runAgent(agent, [{ role: "user", content: brief }], forSubAgent(ctx.session, AGENT_ID), {
|
|
73
|
+
const { messages: transcript, finish } = await runAgent(agent, [{ role: "user", content: brief }], forSubAgent(ctx.session, AGENT_ID), {
|
|
74
74
|
provider: deps.provider,
|
|
75
75
|
signal: ctx.signal,
|
|
76
76
|
emit: ctx.emit,
|
|
@@ -82,7 +82,15 @@ export function createLiteratureReviewerTool(deps) {
|
|
|
82
82
|
// same frame, same call path, same loop-local step names.
|
|
83
83
|
invocationId: ctx.invocationId,
|
|
84
84
|
});
|
|
85
|
-
|
|
85
|
+
const report = finalText(transcript);
|
|
86
|
+
// A child run can end with no final text. Examples are a terminal
|
|
87
|
+
// reply with no text block, and a capped-out run whose wrap-up is
|
|
88
|
+
// empty. An ok result with an empty report hides that failure, so
|
|
89
|
+
// the tool returns an error that names the finish reason.
|
|
90
|
+
if (report.trim() === "") {
|
|
91
|
+
return err({ error: `The literature reviewer gave no report (finish reason: ${finish.reason}). Retry, or narrow the brief.`, retryable: true });
|
|
92
|
+
}
|
|
93
|
+
return ok({ report });
|
|
86
94
|
},
|
|
87
95
|
});
|
|
88
96
|
}
|
package/package.json
CHANGED