4.4 KiB
Work Order: Resolve connectorRuntime Module-Loading Regression
Current defect
The browser extension no longer creates a Markdown file in Downloads.
The extension console reports:
chrome-extension://.../connectorRuntime.js:1
Uncaught SyntaxError: Cannot use import statement outside a module
A separate page-level error also appears:
QuotaExceededError: Failed to execute 'setItem' on 'Storage':
Setting the value of
'cache/user-JY5yPfTiyFSprhKcrYXMA2gG/9e03f04b-55ee-4773-bb7b-47df25276387/system-connectors'
exceeded the quota.
Treat the QuotaExceededError as originating from the ChatGPT application unless repository evidence shows that the extension interacts with that storage key.
Objective
Restore the extension to the point where invoking capture reliably creates a Markdown file in the browser's Downloads location.
Required investigation
-
Identify where
connectorRuntime.jsis loaded. -
Identify the
importstatement or statements causing the parse failure. -
Determine whether
connectorRuntime.jsis intended to be:- an ES module,
- a bundled traditional script, or
- imported by another module.
-
Compare the current loading configuration with the last working implementation or repository history, where available.
-
Determine whether the regression was introduced by:
- adding an
importstatement to a non-module content script, - changing the manifest entry,
- changing script injection logic,
- moving code without updating module boundaries, or
- failing to include the file in the build/bundle process.
- adding an
Constraints
- Make the smallest change necessary to restore the intended module-loading behavior.
- Do not redesign the DOM extractor.
- Do not change conversation-selection logic.
- Do not modify Markdown normalization except where directly required by the module-loading repair.
- Do not suppress the syntax error without addressing its cause.
- Do not treat the ChatGPT
QuotaExceededErroras the extension root cause without evidence. - Preserve Manifest V3 compatibility.
Possible correction paths
Evaluate the repository and choose the correction consistent with the existing architecture. Possible approaches include:
Module-based loading
If connectorRuntime.js is intended to be an ES module, ensure it is loaded through a supported module mechanism.
For an extension service worker, this may require:
{
"background": {
"service_worker": "background.js",
"type": "module"
}
}
For a page or extension HTML document, this may require:
<script type="module" src="connectorRuntime.js"></script>
Do not assume that declaring a content script as a module is supported in the same way. Verify how the file is being executed.
Bundled or non-module loading
If connectorRuntime.js is a content script or injected traditional script, remove direct runtime import syntax by using the repository's intended bundling process or by restoring the prior dependency-loading pattern.
Do not simply concatenate files unless that is already the project’s build design.
Dynamic import
Use import() only if it is valid in the execution context and consistent with the extension architecture. Do not use it merely to hide a structural module problem.
Diagnostics
Add or retain narrowly scoped diagnostic logging around:
[Thoth] connector runtime loaded
[Thoth] capture requested
[Thoth] extraction completed
[Thoth] markdown generated
[Thoth] download requested
[Thoth] download completed: <download ID>
Errors should be logged with the failed stage and exception.
Acceptance criteria
- The extension loads without:
Cannot use import statement outside a module
-
Clicking the capture action reaches
connectorRuntime.js. -
The extension creates a
.mdfile in Downloads. -
The resulting file is non-empty.
-
The extension console contains no uncaught extension-originated exception during capture.
-
The ChatGPT page-level
QuotaExceededError, if still present, does not prevent extension capture. -
Document:
- the root cause,
- the file or manifest entry responsible,
- the corrective change,
- why the selected module-loading approach is correct,
- and the verification performed.
Out of scope
- Improving DOM selectors
- Solving missing historical turns
- Improving table conversion
- Improving citation conversion
- Changing the conversation intermediate model
- General refactoring