agent-ecosystem/agent-teams-controller/src/internal/capture.js
iliya 6091f4f7ae feat: enhance workspace management and MCP integration
- Added new workspace commands for type checking, building, and testing across multiple packages.
- Updated CI workflow to include paths for new packages and utilize workspace commands.
- Refactored MCP server to integrate with the agent-teams-controller, enhancing task management capabilities.
- Improved task boundary detection and logging for MCP tools, ensuring better tracking of task states.
- Updated documentation and prompts to reflect new MCP tool usage, replacing previous teamctl.js references.
2026-03-07 15:02:55 +02:00

31 lines
765 B
JavaScript

function captureStreamOutput(stream, fn) {
let output = '';
const originalWrite = stream.write.bind(stream);
stream.write = ((chunk, encoding, callback) => {
output += typeof chunk === 'string' ? chunk : Buffer.from(chunk).toString(encoding || 'utf8');
if (typeof callback === 'function') {
callback();
}
return true;
});
try {
const result = fn();
if (result && typeof result.then === 'function') {
return result.finally(() => {
stream.write = originalWrite;
}).then((value) => ({ value, output }));
}
stream.write = originalWrite;
return { value: result, output };
} catch (error) {
stream.write = originalWrite;
throw error;
}
}
module.exports = {
captureStreamOutput,
};