- 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
85 lines
2.6 KiB
JavaScript
85 lines
2.6 KiB
JavaScript
/*
|
|
* Copyright The OpenTelemetry Authors
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
class NoopAttributesProcessor {
|
|
process(incoming, _context) {
|
|
return incoming;
|
|
}
|
|
}
|
|
class MultiAttributesProcessor {
|
|
_processors;
|
|
constructor(processors) {
|
|
this._processors = processors;
|
|
}
|
|
process(incoming, context) {
|
|
let filteredAttributes = incoming;
|
|
for (const processor of this._processors) {
|
|
filteredAttributes = processor.process(filteredAttributes, context);
|
|
}
|
|
return filteredAttributes;
|
|
}
|
|
}
|
|
class AllowListProcessor {
|
|
_allowedAttributeNames;
|
|
constructor(allowedAttributeNames) {
|
|
this._allowedAttributeNames = allowedAttributeNames;
|
|
}
|
|
process(incoming, _context) {
|
|
const filteredAttributes = {};
|
|
Object.keys(incoming).forEach(attributeName => {
|
|
if (this._allowedAttributeNames.includes(attributeName)) {
|
|
filteredAttributes[attributeName] = incoming[attributeName];
|
|
}
|
|
});
|
|
return filteredAttributes;
|
|
}
|
|
}
|
|
class DenyListProcessor {
|
|
_deniedAttributeNames;
|
|
constructor(deniedAttributeNames) {
|
|
this._deniedAttributeNames = deniedAttributeNames;
|
|
}
|
|
process(incoming, _context) {
|
|
const filteredAttributes = {};
|
|
Object.keys(incoming).forEach(attributeName => {
|
|
if (!this._deniedAttributeNames.includes(attributeName)) {
|
|
filteredAttributes[attributeName] = incoming[attributeName];
|
|
}
|
|
});
|
|
return filteredAttributes;
|
|
}
|
|
}
|
|
/**
|
|
* @internal
|
|
*
|
|
* Create an {@link IAttributesProcessor} that acts as a simple pass-through for attributes.
|
|
*/
|
|
export function createNoopAttributesProcessor() {
|
|
return NOOP;
|
|
}
|
|
/**
|
|
* @internal
|
|
*
|
|
* Create an {@link IAttributesProcessor} that applies all processors from the provided list in order.
|
|
*
|
|
* @param processors Processors to apply in order.
|
|
*/
|
|
export function createMultiAttributesProcessor(processors) {
|
|
return new MultiAttributesProcessor(processors);
|
|
}
|
|
/**
|
|
* Create an {@link IAttributesProcessor} that filters by allowed attribute names and drops any names that are not in the
|
|
* allow list.
|
|
*/
|
|
export function createAllowListAttributesProcessor(attributeAllowList) {
|
|
return new AllowListProcessor(attributeAllowList);
|
|
}
|
|
/**
|
|
* Create an {@link IAttributesProcessor} that drops attributes based on the names provided in the deny list
|
|
*/
|
|
export function createDenyListAttributesProcessor(attributeDenyList) {
|
|
return new DenyListProcessor(attributeDenyList);
|
|
}
|
|
const NOOP = new NoopAttributesProcessor();
|
|
//# sourceMappingURL=AttributesProcessor.js.map
|