@engineeros/connector 0.11.0 → 0.11.2
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 +51 -10
package/package.json
CHANGED
package/src/agent-harness.mjs
CHANGED
|
@@ -137,14 +137,25 @@ 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 (
|
|
149
|
+
firstSection &&
|
|
150
|
+
(content.startsWith(firstSection) ||
|
|
151
|
+
hasRequiredAssessmentSections(content, outputHeading))
|
|
152
|
+
) {
|
|
153
|
+
return `${outputHeading}\n\n${content}`;
|
|
154
|
+
}
|
|
155
|
+
const lines = content.split(/\r?\n/);
|
|
156
|
+
const headingIndex = lines.findIndex(
|
|
157
|
+
(line) => line.trim() === outputHeading,
|
|
158
|
+
);
|
|
148
159
|
const preamble =
|
|
149
160
|
headingIndex >= 0 ? lines.slice(0, headingIndex).join("\n") : content;
|
|
150
161
|
if (headingIndex < 0) {
|
|
@@ -163,8 +174,38 @@ export function normalizeAgentStructuredOutput(
|
|
|
163
174
|
`Agent response must return '${outputHeading}' as plain Markdown, without a code fence.`,
|
|
164
175
|
);
|
|
165
176
|
}
|
|
166
|
-
return normalized;
|
|
167
|
-
}
|
|
177
|
+
return normalized;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function hasRequiredAssessmentSections(content, outputHeading) {
|
|
181
|
+
const sections =
|
|
182
|
+
outputHeading === "# Workspace Assessment"
|
|
183
|
+
? [
|
|
184
|
+
"## Executive Summary",
|
|
185
|
+
"## Assessment Delta",
|
|
186
|
+
"## Current System Map",
|
|
187
|
+
"## Observed Capabilities",
|
|
188
|
+
"## Findings",
|
|
189
|
+
"## Implementation Scorecard",
|
|
190
|
+
"## Highest-Return Actions",
|
|
191
|
+
"## Commands Observed",
|
|
192
|
+
]
|
|
193
|
+
: [
|
|
194
|
+
"## Updated Executive Summary",
|
|
195
|
+
"## Assessment Delta",
|
|
196
|
+
"## Current System Map",
|
|
197
|
+
"## Capability Changes",
|
|
198
|
+
"## Finding Changes",
|
|
199
|
+
"## Scorecard Changes",
|
|
200
|
+
"## Highest-Return Actions",
|
|
201
|
+
"## Commands Observed",
|
|
202
|
+
];
|
|
203
|
+
return sections.every((section) =>
|
|
204
|
+
new RegExp(`(?:^|\\n)${section.replace(/[.*+?^${}()|[\\]\\]/g, "\\$&")}\\s*$`, "m").test(
|
|
205
|
+
content,
|
|
206
|
+
),
|
|
207
|
+
);
|
|
208
|
+
}
|
|
168
209
|
|
|
169
210
|
function bundledSkill(skillName) {
|
|
170
211
|
const cached = skillCache.get(skillName);
|