refactor: reorganize client transport and extension internals
- Split client, native, remote, serve, markdown, and SDK internals into focused packages with direct imports. - Move local and remote transport framing/protocol helpers behind clearer module boundaries. - Break up the extension injected DOM logic into a separate content dispatch bundle and dedicated content modules. - Add explicit client handling for passive remote discovery without noisy PQ warnings. - Keep behavior covered with updated unit, integration, and extension tests.
This commit is contained in:
@@ -9,6 +9,11 @@ export const LARGE_OPERATION_BATCH_SIZE = 25;
|
||||
export const LARGE_OPERATION_PAUSE_MS = 25;
|
||||
export const GENTLE_OPERATION_BATCH_SIZE = 8;
|
||||
export const GENTLE_OPERATION_PAUSE_MS = 100;
|
||||
const DEBUG_LARGE_OPERATIONS = false;
|
||||
|
||||
function debugLargeOperation(message: string) {
|
||||
if (DEBUG_LARGE_OPERATIONS) console.log(message);
|
||||
}
|
||||
|
||||
export async function hasAudibleTabs() {
|
||||
const audibleTabs = await chrome.tabs.query({ audible: true });
|
||||
@@ -19,11 +24,11 @@ let largeOperationQueue: Promise<void> = Promise.resolve();
|
||||
|
||||
export async function runLargeOperation<T>(name: string, fn: () => Promise<T>): Promise<T> {
|
||||
const run = largeOperationQueue.then(async () => {
|
||||
console.log(`[browser-cli] large operation start: ${name}`);
|
||||
debugLargeOperation(`[browser-cli] large operation start: ${name}`);
|
||||
try {
|
||||
return await fn();
|
||||
} finally {
|
||||
console.log(`[browser-cli] large operation done: ${name}`);
|
||||
debugLargeOperation(`[browser-cli] large operation done: ${name}`);
|
||||
}
|
||||
});
|
||||
largeOperationQueue = run.then(() => {}, () => {});
|
||||
|
||||
Reference in New Issue
Block a user