- 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
38 lines
1.3 KiB
JavaScript
38 lines
1.3 KiB
JavaScript
export function isStream(stream, {checkOpen = true} = {}) {
|
|
return stream !== null
|
|
&& typeof stream === 'object'
|
|
&& (stream.writable || stream.readable || !checkOpen || (stream.writable === undefined && stream.readable === undefined))
|
|
&& typeof stream.pipe === 'function';
|
|
}
|
|
|
|
export function isWritableStream(stream, {checkOpen = true} = {}) {
|
|
return isStream(stream, {checkOpen})
|
|
&& (stream.writable || !checkOpen)
|
|
&& typeof stream.write === 'function'
|
|
&& typeof stream.end === 'function'
|
|
&& typeof stream.writable === 'boolean'
|
|
&& typeof stream.writableObjectMode === 'boolean'
|
|
&& typeof stream.destroy === 'function'
|
|
&& typeof stream.destroyed === 'boolean';
|
|
}
|
|
|
|
export function isReadableStream(stream, {checkOpen = true} = {}) {
|
|
return isStream(stream, {checkOpen})
|
|
&& (stream.readable || !checkOpen)
|
|
&& typeof stream.read === 'function'
|
|
&& typeof stream.readable === 'boolean'
|
|
&& typeof stream.readableObjectMode === 'boolean'
|
|
&& typeof stream.destroy === 'function'
|
|
&& typeof stream.destroyed === 'boolean';
|
|
}
|
|
|
|
export function isDuplexStream(stream, options) {
|
|
return isWritableStream(stream, options)
|
|
&& isReadableStream(stream, options);
|
|
}
|
|
|
|
export function isTransformStream(stream, options) {
|
|
return isDuplexStream(stream, options)
|
|
&& typeof stream._transform === 'function';
|
|
}
|