FE-1582: Add an in-browser optimization runtime to petrinaut-core - #9515
Draft
kube wants to merge 4 commits into
Draft
FE-1582: Add an in-browser optimization runtime to petrinaut-core#9515kube wants to merge 4 commits into
kube wants to merge 4 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
kube
force-pushed
the
claude/web-optimizer-core-runtime
branch
from
September 3, 2026 00:33
4dc40cf to
2c318e3
Compare
kube
force-pushed
the
claude/web-optimizer-core-runtime
branch
from
September 3, 2026 03:23
2c318e3 to
283de29
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## claude/web-optimizer-python-core #9515 +/- ##
===================================================================
Coverage ? 60.89%
===================================================================
Files ? 1461
Lines ? 146725
Branches ? 6744
===================================================================
Hits ? 89343
Misses ? 56264
Partials ? 1118
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
kube
force-pushed
the
claude/web-optimizer-core-runtime
branch
from
September 3, 2026 05:40
283de29 to
8f0faf8
Compare
kube
force-pushed
the
claude/web-optimizer-core-runtime
branch
from
September 3, 2026 22:00
8f0faf8 to
d424e5c
Compare
kube
force-pushed
the
claude/web-optimizer-core-runtime
branch
from
September 3, 2026 22:23
d424e5c to
186e031
Compare
kube
force-pushed
the
claude/web-optimizer-core-runtime
branch
from
September 4, 2026 04:36
186e031 to
289bcf0
Compare
kube
force-pushed
the
claude/web-optimizer-core-runtime
branch
from
September 4, 2026 04:54
289bcf0 to
5d76a1e
Compare
kube
force-pushed
the
claude/web-optimizer-core-runtime
branch
from
September 4, 2026 11:23
5d76a1e to
f47c52d
Compare
kube
force-pushed
the
claude/web-optimizer-core-runtime
branch
from
September 4, 2026 12:02
f47c52d to
01e05ef
Compare
kube
force-pushed
the
claude/web-optimizer-core-runtime
branch
from
September 4, 2026 12:16
01e05ef to
44d1e14
Compare
kube
force-pushed
the
claude/web-optimizer-core-runtime
branch
from
September 4, 2026 12:27
44d1e14 to
9e5b2fa
Compare
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
Before this PR, the only optimization capability was the remote one: a host handed Petrinaut a
PetrinautOptimizationthat talked to the Python service, and the service spawned a CLI process to simulate each trial. Running the study anywhere else meant re-implementing the protocol, and the host had no say in how trials were computed.This PR adds an in-browser optimization runtime to
@hashintel/petrinaut-core. A module Web Worker loads Pyodide, installs the pinned Optuna packages and the shared Python study library, and drives the study by ask and tell. Optimizer never simulates: aPetrinautConnectedOptimizationis connected to aPetrinautOptimizationChannelthe host implements, and every trial goes through that channel. Capability that comes back satisfies the existingPetrinautOptimizationcontract and adds a connected lifecycle on top: a finished or stopped study stays in the worker until released, so the host can extend it with more trials on the same sampler history, and a run may keep up to four trials in flight.Links
Changes
Optimization contract
PetrinautOptimizationChannel,PetrinautOptimizationTrialRequestandPetrinautOptimizationTrialOutcomedescribe one trial handed to the hostPetrinautConnectedOptimizationandPetrinautOptimizationSourcelet a host supply either a remote capability or one to connect locallyPetrinautConnectedOptimizationCapabilityis whatconnectreturnsoptimization/describe.tsowns the describe result, suggested-value validation, trial seed derivation and scenario value resolutionBrowser runtime
browser-optimizationentry:createBrowserOptimizationreturns a connected optimizationworkers/optimizerentry: a module worker that importspyodide.mjsfrom the configured index URL, loads the distribution packages, installs Optuna and colorlog withdeps=False, writes the Python sources into the virtual filesystem and runs the study@local/petrinaut-optimizer-corethrough?rawimports at build time; versions come from itsruntime-lock.jsonKnown issues
Test coverage
browser-optimization.test.ts:study-runner.pyodide.test.ts:run-log.test.ts,pyodide-config.test.ts,optimization/describe.test.ts:@hashintel/petrinaut-clisuite:How to test
yarn workspace @hashintel/petrinaut-core test:unityarn workspace @hashintel/petrinaut-core build