- 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
45 lines
1.1 KiB
JavaScript
45 lines
1.1 KiB
JavaScript
import {serialize} from 'node:v8';
|
|
|
|
// Validate the `ipcInput` option
|
|
export const validateIpcInputOption = ({ipcInput, ipc, serialization}) => {
|
|
if (ipcInput === undefined) {
|
|
return;
|
|
}
|
|
|
|
if (!ipc) {
|
|
throw new Error('The `ipcInput` option cannot be set unless the `ipc` option is `true`.');
|
|
}
|
|
|
|
validateIpcInput[serialization](ipcInput);
|
|
};
|
|
|
|
const validateAdvancedInput = ipcInput => {
|
|
try {
|
|
serialize(ipcInput);
|
|
} catch (error) {
|
|
throw new Error('The `ipcInput` option is not serializable with a structured clone.', {cause: error});
|
|
}
|
|
};
|
|
|
|
const validateJsonInput = ipcInput => {
|
|
try {
|
|
JSON.stringify(ipcInput);
|
|
} catch (error) {
|
|
throw new Error('The `ipcInput` option is not serializable with JSON.', {cause: error});
|
|
}
|
|
};
|
|
|
|
const validateIpcInput = {
|
|
advanced: validateAdvancedInput,
|
|
json: validateJsonInput,
|
|
};
|
|
|
|
// When the `ipcInput` option is set, it is sent as an initial IPC message to the subprocess
|
|
export const sendIpcInput = async (subprocess, ipcInput) => {
|
|
if (ipcInput === undefined) {
|
|
return;
|
|
}
|
|
|
|
await subprocess.sendMessage(ipcInput);
|
|
};
|