- 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
41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
'use strict';
|
|
|
|
let METADATA_SYMBOL;
|
|
|
|
if (typeof Symbol !== "function") {
|
|
METADATA_SYMBOL = "@@xmlMetadata";
|
|
} else {
|
|
METADATA_SYMBOL = Symbol("XML Node Metadata");
|
|
}
|
|
|
|
export default class XmlNode {
|
|
constructor(tagname) {
|
|
this.tagname = tagname;
|
|
this.child = []; //nested tags, text, cdata, comments in order
|
|
this[":@"] = Object.create(null); //attributes map
|
|
}
|
|
add(key, val) {
|
|
// this.child.push( {name : key, val: val, isCdata: isCdata });
|
|
if (key === "__proto__") key = "#__proto__";
|
|
this.child.push({ [key]: val });
|
|
}
|
|
addChild(node, startIndex) {
|
|
if (node.tagname === "__proto__") node.tagname = "#__proto__";
|
|
if (node[":@"] && Object.keys(node[":@"]).length > 0) {
|
|
this.child.push({ [node.tagname]: node.child, [":@"]: node[":@"] });
|
|
} else {
|
|
this.child.push({ [node.tagname]: node.child });
|
|
}
|
|
// if requested, add the startIndex
|
|
if (startIndex !== undefined) {
|
|
// Note: for now we just overwrite the metadata. If we had more complex metadata,
|
|
// we might need to do an object append here: metadata = { ...metadata, startIndex }
|
|
this.child[this.child.length - 1][METADATA_SYMBOL] = { startIndex };
|
|
}
|
|
}
|
|
/** symbol used for metadata */
|
|
static getMetaDataSymbol() {
|
|
return METADATA_SYMBOL;
|
|
}
|
|
}
|