included more features
This commit is contained in:
parent
9049531298
commit
58afa54a7d
|
|
@ -119,7 +119,7 @@ example: true
|
||||||
|
|
||||||
- AI_REPO_STOP(): emergency stop
|
- AI_REPO_STOP(): emergency stop
|
||||||
- AI_REPO.clearHistory: clear dedupe history
|
- AI_REPO.clearHistory: clear dedupe history
|
||||||
- window.AI_REPO_COMMANDER: monitor, config, tests, history
|
- window.AI_REPO: monitor, config, tests, history
|
||||||
|
|
||||||
## Security Model
|
## Security Model
|
||||||
- Bridge key stored locally and masked, never logged
|
- Bridge key stored locally and masked, never logged
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,27 @@
|
||||||
this.info(`${icon} ${action} [${status}]`, extra);
|
this.info(`${icon} ${action} [${status}]`, extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Special logger for preventing log spam from aggressive loops or frequently repeated operations.
|
||||||
|
*
|
||||||
|
* Use this when logging inside tight loops, mutation observers, or frequently-fired events
|
||||||
|
* to avoid polluting the logs and making it hard to find other information.
|
||||||
|
*
|
||||||
|
* Features:
|
||||||
|
* - Limits each unique message to max 10 occurrences
|
||||||
|
* - Only logs within the watch window (default 120s from logger start)
|
||||||
|
* - Shows occurrence count (e.g., "Processing message (3x)")
|
||||||
|
* - WARN messages bypass the time window restriction
|
||||||
|
*
|
||||||
|
* @param {string} kind - Log level: 'ERROR', 'WARN', or 'INFO'
|
||||||
|
* @param {string} msg - The message to log
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* // Inside a mutation observer that fires rapidly:
|
||||||
|
* observer.observe(() => {
|
||||||
|
* log.logLoop('INFO', 'Processing DOM mutation'); // Won't spam after 10 times
|
||||||
|
* });
|
||||||
|
*/
|
||||||
logLoop(kind, msg) {
|
logLoop(kind, msg) {
|
||||||
const k = `${kind}:${msg}`;
|
const k = `${kind}:${msg}`;
|
||||||
const cur = this.loopCounts.get(k) || 0;
|
const cur = this.loopCounts.get(k) || 0;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
const log = () => window.AI_REPO_LOGGER;
|
const log = () => window.AI_REPO_LOGGER;
|
||||||
|
|
||||||
function findComposer() {
|
function findComposer() {
|
||||||
const sels = [
|
const selectors = [
|
||||||
'#prompt-textarea',
|
'#prompt-textarea',
|
||||||
'.ProseMirror#prompt-textarea',
|
'.ProseMirror#prompt-textarea',
|
||||||
'.ProseMirror[role="textbox"][contenteditable="true"]',
|
'.ProseMirror[role="textbox"][contenteditable="true"]',
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
'textarea',
|
'textarea',
|
||||||
'[contenteditable="true"]'
|
'[contenteditable="true"]'
|
||||||
];
|
];
|
||||||
for (const s of sels) {
|
for (const s of selectors) {
|
||||||
const el = document.querySelector(s);
|
const el = document.querySelector(s);
|
||||||
if (!el) continue;
|
if (!el) continue;
|
||||||
const st = window.getComputedStyle(el);
|
const st = window.getComputedStyle(el);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue