- 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
59 lines
1.8 KiB
JavaScript
59 lines
1.8 KiB
JavaScript
export function createResource(resource, encoder) {
|
|
const result = {
|
|
attributes: toAttributes(resource.attributes, encoder),
|
|
droppedAttributesCount: 0,
|
|
};
|
|
const schemaUrl = resource.schemaUrl;
|
|
if (schemaUrl && schemaUrl !== '')
|
|
result.schemaUrl = schemaUrl;
|
|
return result;
|
|
}
|
|
export function createInstrumentationScope(scope) {
|
|
return {
|
|
name: scope.name,
|
|
version: scope.version,
|
|
};
|
|
}
|
|
export function toAttributes(attributes, encoder) {
|
|
return Object.keys(attributes).map(key => toKeyValue(key, attributes[key], encoder));
|
|
}
|
|
export function toKeyValue(key, value, encoder) {
|
|
return {
|
|
key: key,
|
|
value: toAnyValue(value, encoder),
|
|
};
|
|
}
|
|
export function toAnyValue(value, encoder) {
|
|
const t = typeof value;
|
|
if (t === 'string')
|
|
return { stringValue: value };
|
|
if (t === 'number') {
|
|
if (!Number.isInteger(value))
|
|
return { doubleValue: value };
|
|
return { intValue: value };
|
|
}
|
|
if (t === 'boolean')
|
|
return { boolValue: value };
|
|
if (value instanceof Uint8Array)
|
|
return { bytesValue: encoder.encodeUint8Array(value) };
|
|
if (Array.isArray(value)) {
|
|
const values = new Array(value.length);
|
|
for (let i = 0; i < value.length; i++) {
|
|
values[i] = toAnyValue(value[i], encoder);
|
|
}
|
|
return { arrayValue: { values } };
|
|
}
|
|
if (t === 'object' && value != null) {
|
|
const keys = Object.keys(value);
|
|
const values = new Array(keys.length);
|
|
for (let i = 0; i < keys.length; i++) {
|
|
values[i] = {
|
|
key: keys[i],
|
|
value: toAnyValue(value[keys[i]], encoder),
|
|
};
|
|
}
|
|
return { kvlistValue: { values } };
|
|
}
|
|
return {};
|
|
}
|
|
//# sourceMappingURL=internal.js.map
|