Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request radically restructures how Focusd executes custom user rules and classifications by decoupling the JavaScript engine from domain logic.
Key Changes:
@internal/sandbox): Extracted allv8gologic andesbuildtranspilation out of theusagepackage into a generic, standalone execution module.ContributorInterface): Introduced a registry system where external packages (likeusageor the new@focusd/corepackage) can globally inject polyfills, TS types, and native Go function callbacks (RegisterGlobals) directly into V8 isolates seamlessly on startup.sandbox.GenerateTypes()writes out a combinedtypes.d.tsfile from all contributors on startup. Monaco then fetches these types dynamically using the newinternal/fs/service.gosecurely through a Wails binding (ReadConfigFileSync).MinutesUsedInPeriodclosures per-execution). TheusageContributornow queries the usage Service natively since it attaches the database query directly to theRegisterGlobalsV8 isolate initialization.build/ios.This sets the stage for easy extensibility: if we want to add HTTP or filesystem capabilities to rules later, we only need to write a new
Contributorand register it!