- 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
43 lines
1.6 KiB
JavaScript
43 lines
1.6 KiB
JavaScript
/*
|
|
* Copyright The OpenTelemetry Authors
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
import { ValueType, diag } from '@opentelemetry/api';
|
|
import { equalsCaseInsensitive } from './utils';
|
|
export function createInstrumentDescriptor(name, type, options) {
|
|
if (!isValidName(name)) {
|
|
diag.warn(`Invalid metric name: "${name}". The metric name should be a ASCII string with a length no greater than 255 characters.`);
|
|
}
|
|
return {
|
|
name,
|
|
type,
|
|
description: options?.description ?? '',
|
|
unit: options?.unit ?? '',
|
|
valueType: options?.valueType ?? ValueType.DOUBLE,
|
|
advice: options?.advice ?? {},
|
|
};
|
|
}
|
|
export function createInstrumentDescriptorWithView(view, instrument) {
|
|
return {
|
|
name: view.name ?? instrument.name,
|
|
description: view.description ?? instrument.description,
|
|
type: instrument.type,
|
|
unit: instrument.unit,
|
|
valueType: instrument.valueType,
|
|
advice: instrument.advice,
|
|
};
|
|
}
|
|
export function isDescriptorCompatibleWith(descriptor, otherDescriptor) {
|
|
// Names are case-insensitive strings.
|
|
return (equalsCaseInsensitive(descriptor.name, otherDescriptor.name) &&
|
|
descriptor.unit === otherDescriptor.unit &&
|
|
descriptor.type === otherDescriptor.type &&
|
|
descriptor.valueType === otherDescriptor.valueType);
|
|
}
|
|
// ASCII string with a length no greater than 255 characters.
|
|
// NB: the first character counted separately from the rest.
|
|
const NAME_REGEXP = /^[a-z][a-z0-9_.\-/]{0,254}$/i;
|
|
export function isValidName(name) {
|
|
return NAME_REGEXP.test(name);
|
|
}
|
|
//# sourceMappingURL=InstrumentDescriptor.js.map
|