@engineeros/connector 0.11.0 → 0.11.1
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/agent-harness.mjs +15 -8
package/package.json
CHANGED
package/src/agent-harness.mjs
CHANGED
|
@@ -137,14 +137,21 @@ export function normalizeAgentStructuredOutput(
|
|
|
137
137
|
"EngineerOS structured output requires a heading contract.",
|
|
138
138
|
);
|
|
139
139
|
}
|
|
140
|
-
const content = String(response || "").trim();
|
|
141
|
-
if (!content) {
|
|
142
|
-
throw new Error("Agent completed without returning a response.");
|
|
143
|
-
}
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
140
|
+
const content = String(response || "").trim();
|
|
141
|
+
if (!content) {
|
|
142
|
+
throw new Error("Agent completed without returning a response.");
|
|
143
|
+
}
|
|
144
|
+
const firstSection = {
|
|
145
|
+
"# Workspace Assessment": "## Executive Summary",
|
|
146
|
+
"# Workspace Assessment Delta": "## Updated Executive Summary",
|
|
147
|
+
}[outputHeading];
|
|
148
|
+
if (firstSection && content.startsWith(firstSection)) {
|
|
149
|
+
return `${outputHeading}\n\n${content}`;
|
|
150
|
+
}
|
|
151
|
+
const lines = content.split(/\r?\n/);
|
|
152
|
+
const headingIndex = lines.findIndex(
|
|
153
|
+
(line) => line.trim() === outputHeading,
|
|
154
|
+
);
|
|
148
155
|
const preamble =
|
|
149
156
|
headingIndex >= 0 ? lines.slice(0, headingIndex).join("\n") : content;
|
|
150
157
|
if (headingIndex < 0) {
|