- 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
67 lines
1.9 KiB
JavaScript
67 lines
1.9 KiB
JavaScript
/*
|
|
* Copyright The OpenTelemetry Authors
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
import { hashAttributes } from '../utils';
|
|
export class HashMap {
|
|
_valueMap = new Map();
|
|
_keyMap = new Map();
|
|
_hash;
|
|
constructor(hash) {
|
|
this._hash = hash;
|
|
}
|
|
get(key, hashCode) {
|
|
hashCode ??= this._hash(key);
|
|
return this._valueMap.get(hashCode);
|
|
}
|
|
getOrDefault(key, defaultFactory) {
|
|
const hash = this._hash(key);
|
|
if (this._valueMap.has(hash)) {
|
|
return this._valueMap.get(hash);
|
|
}
|
|
const val = defaultFactory();
|
|
if (!this._keyMap.has(hash)) {
|
|
this._keyMap.set(hash, key);
|
|
}
|
|
this._valueMap.set(hash, val);
|
|
return val;
|
|
}
|
|
set(key, value, hashCode) {
|
|
hashCode ??= this._hash(key);
|
|
if (!this._keyMap.has(hashCode)) {
|
|
this._keyMap.set(hashCode, key);
|
|
}
|
|
this._valueMap.set(hashCode, value);
|
|
}
|
|
has(key, hashCode) {
|
|
hashCode ??= this._hash(key);
|
|
return this._valueMap.has(hashCode);
|
|
}
|
|
*keys() {
|
|
const keyIterator = this._keyMap.entries();
|
|
let next = keyIterator.next();
|
|
while (next.done !== true) {
|
|
yield [next.value[1], next.value[0]];
|
|
next = keyIterator.next();
|
|
}
|
|
}
|
|
*entries() {
|
|
const valueIterator = this._valueMap.entries();
|
|
let next = valueIterator.next();
|
|
while (next.done !== true) {
|
|
// next.value[0] here can not be undefined
|
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
yield [this._keyMap.get(next.value[0]), next.value[1], next.value[0]];
|
|
next = valueIterator.next();
|
|
}
|
|
}
|
|
get size() {
|
|
return this._valueMap.size;
|
|
}
|
|
}
|
|
export class AttributeHashMap extends HashMap {
|
|
constructor() {
|
|
super(hashAttributes);
|
|
}
|
|
}
|
|
//# sourceMappingURL=HashMap.js.map
|