Files
zCode-CLI-X/~/.npm-cache/execa@9.6.1@@@1/lib/io/pipeline.js
admin 875c7f9b91 feat: Complete zCode CLI X with Telegram bot integration
- Add full Telegram bot functionality with Z.AI API integration
- Implement 4 tools: Bash, FileEdit, WebSearch, Git
- Add 3 agents: Code Reviewer, Architect, DevOps Engineer
- Add 6 skills for common coding tasks
- Add systemd service file for 24/7 operation
- Add nginx configuration for HTTPS webhook
- Add comprehensive documentation
- Implement WebSocket server for real-time updates
- Add logging system with Winston
- Add environment validation

🤖 zCode CLI X - Agentic coder with Z.AI + Telegram integration
2026-05-05 09:01:26 +00:00

49 lines
1.3 KiB
JavaScript

import {finished} from 'node:stream/promises';
import {isStandardStream} from '../utils/standard-stream.js';
// Similar to `Stream.pipeline(source, destination)`, but does not destroy standard streams
export const pipeStreams = (source, destination) => {
source.pipe(destination);
onSourceFinish(source, destination);
onDestinationFinish(source, destination);
};
// `source.pipe(destination)` makes `destination` end when `source` ends.
// But it does not propagate aborts or errors. This function does it.
const onSourceFinish = async (source, destination) => {
if (isStandardStream(source) || isStandardStream(destination)) {
return;
}
try {
await finished(source, {cleanup: true, readable: true, writable: false});
} catch {}
endDestinationStream(destination);
};
export const endDestinationStream = destination => {
if (destination.writable) {
destination.end();
}
};
// We do the same thing in the other direction as well.
const onDestinationFinish = async (source, destination) => {
if (isStandardStream(source) || isStandardStream(destination)) {
return;
}
try {
await finished(destination, {cleanup: true, readable: false, writable: true});
} catch {}
abortSourceStream(source);
};
export const abortSourceStream = source => {
if (source.readable) {
source.destroy();
}
};