- sabia-core: descoberta de interfaces, controle de modo monitor/canal via iw (ponte até ter nl80211 nativo), captura crua 802.11 via AF_PACKET (sem libpcap), parsing de radiotap e quadros de gerenciamento (beacon/probe/EAPOL), agregação em tabela de APs/ clientes, escrita de .pcap, trilha de auditoria encadeada por hash, auto-atualização via GitHub releases (curl, sem dependências de rede extras) - sabia-cli: `sabia iface`, `sabia scan`, `sabia update`, `sabia audit-verify`, `sabia ui` (servidor local + navegador, protegido por token, mesma filosofia do Guará) - OpenWolf inicializado para memória de projeto entre agentes
14 lines
680 B
TypeScript
14 lines
680 B
TypeScript
/** PR #69 @liveoakwag, extended with a persisted high-water mark.
|
|
* Caller MUST hold buglog.json.lock while allocating and persisting.
|
|
*/
|
|
export function nextBugId(log: { bugs: Array<{ id?: unknown }>; next_id?: number }): string {
|
|
let next = Number.isSafeInteger(log.next_id) && log.next_id! > 0 ? log.next_id! : 1;
|
|
for (const bug of log.bugs) {
|
|
const match = /^bug-(\d+)$/.exec(String(bug?.id ?? ""));
|
|
if (match && Number.isSafeInteger(Number(match[1]))) next = Math.max(next, Number(match[1]) + 1);
|
|
}
|
|
if (!Number.isSafeInteger(next + 1)) throw new Error("Bug ID space exhausted");
|
|
log.next_id = next + 1;
|
|
return `bug-${String(next).padStart(3, "0")}`;
|
|
}
|