Repository navigation
Update tools-layerfs to 0.9.0 (native backend, real trajectory page) - #365
Mola-maker wants to merge 5 commits into
Conversation
Port the standalone repo's 0.9.0 package (Mola-maker/magpie-layerfs) into the registry, on top of the merged 0.7.2: - 8 tools, now with the opt-in native backend (native-worker.mjs): native stays off by default (magpie.options.native: false); the sim backend is unchanged as the default, so the package still runs dependency-free with no binary shipped. - Trajectory page replays the real calling agent per commit (page/trajectory-live.js is written by the tools at runtime). - LayerFS 1.1.0 SDK surface port (native path only). - magpie-community#358 wording alignment carried over: tool descriptions and the errors a call answers name neither magpie nor its settings, so the no-magpie test passes (it is included verbatim). Verification (from the payload tree, before pushing): - bun test: 58 pass, 3 skip (native tests need an SDK checkout), 0 fail, across layerfs.test.mjs, page.test.mjs, no-magpie.test.mjs - bun scripts/check.mjs layerfs: ok Known caveat, stated plainly: the native path itself cannot be verified in the registry context — @layerfs/* is still not published to npm, so no version exists to pin, and the native tests skip here. The native backend lives and is fully tested in the standalone repo. Signed-off-by: mola <2249464964@qq.com>
yetone
left a comment
There was a problem hiding this comment.
Thanks for this. Requesting changes. Two points block it, both carried over from #318.
Blocking
- The native backend is back while the
@layerfsSDK is still unpublished. In #318 (item 4) the native path came out, and the condition for bringing it back was that the SDK is on npm with a pinned version the plugin depends on. In 0.9.0,native-worker.mjsstill does a dynamicimport(pathToFileURL(resolve(LAYERFS_SDK_PATH)))of whatever path the user's environment names, and runs it in the plugin host's child. That loads unversioned code from an arbitrary path that nobody reviewed. Please keep the native backend out until the SDK is published, then depend on a pinned version (or an optional dependency) and import it by name. - It writes into the installed plugin's own folder.
index.mjswritespage/trajectory-live.jsnext to the installed package (unlessMAGPIE_LAYERFS_PAGE_DIRis set). #318 item 8 asked for no writes into the plugin's install or cache folder: an update replaces that folder, two hosts with one install race on the same file, and an install can be read-only. Please put the live data in the plugin's data directory (or serve it from the page's own API), and havepage/index.htmlread it from there.
Smaller
- The test that waits for live data (
item 8 + r2 item 3 …) can wait up to 8s inside bun's default 5s timeout. It timed out once under load here and passes 3/3 alone. Please give it a stated timeout, or wait on the file instead of the debounce. trajectory()re-walks every branch's commit chain with sync reads after each burst of mutating calls. That runs in the shared plugin host, so a large store blocks every other plugin while it walks. Please make it incremental or async.package.jsonlost its trailing newline.
What was run at 565d3cd, in a sandbox HOME: bun test packages/layerfs, 56 pass, 3 skip, 2 fail. One failure is the no-magpie text test tripping on my scratch path, which contains "magpie" (not this PR). The other is the timeout above. No test reached the network.
Not run: the native backend itself, since there is no published SDK to run it against (fake-sdk.mjs only). The page wasn't opened in magpie either.
|
Following up on the review above with the numbers for the magpie runs every plugin in one Bun host process ( How it was measured. A synthetic store built through
The page data it produces is only about 200 KB. The cost comes from two things:
All of this happens after every burst of mutating calls (1.2s debounce), so agents that keep checkpointing in parallel stall the host for several seconds each time. A fix that I measured. Commit records never change once written, so keep an in-process This adds to the two blocking points above (the native import from Not run: the native backend's |
…im-only package, no install-folder writes) - Drop the native backend from the registry package: NativeBackend and the native option are gone, and a native request is refused loudly instead of silently running sim. native-worker.mjs and fake-sdk.mjs are deleted in follow-up commits (this push tool cannot delete files). The SDK is still not published to npm, so there is no pinned version to run; the 1.1.0 port stays in the standalone repo until then. - Remove the runtime page/trajectory-live.js write: the tools never write into the installed plugin folder; the page is back to the bundled sample. - trajectory() is incremental now (branch-head + events-hash fingerprint); the live-data tests go away with the mechanism; package.json trailing newline fixed. Verification: bun test packages/layerfs 54 pass / 0 fail; bun scripts/check.mjs layerfs ok; the suite leaves the page folder byte-identical.
…ntil the SDK is published)
|
Thanks for the review — all points addressed at c808a7d plus the two deletions above. Blocking
Smaller
What I ran at the new head: bun test packages/layerfs 54 pass / 0 fail; bun scripts/check.mjs layerfs ok. The page was not opened in magpie here either (same sandbox limit as before). |
…ommit summaries - readCommitSummary caches each commit summary (everything except the manifest, which trajectory never uses) per project/id: a rebuild reads only commits it has never seen, and a rebuild with nothing new reads no records at all. - The walk yields between branches (setImmediate), so even a first build over a large store never holds the shared plugin host event loop for its whole duration. - Guard test counts readCommit calls: 0 on a second rebuild with nothing new, exactly 1 (the new record) after one new checkpoint. - This replaces the fingerprint cache from the previous push: it only helped the no-change case and re-walked everything after any new checkpoint. Verification: bun test packages/layerfs 54 pass / 0 fail; bun scripts/check.mjs layerfs ok.
|
Follow-up on the trajectory() numbers — implemented your measured fix at 45be25a.
This replaces the fingerprint cache from the previous push (removed): it only helped the no-change case and re-walked everything after any new checkpoint — exactly the case your numbers cover. What I ran: bun test packages/layerfs 54 pass / 0 fail; bun scripts/check.mjs layerfs ok. I did not re-run your 5,000-file measurement here (no such harness in this sandbox); the guard test pins the read behavior the measurement depends on: no re-reads of history, ever. |
Port the standalone repo's 0.9.0 package (Mola-maker/magpie-layerfs) into the registry, on top of the merged 0.7.2 — sim-only, per the review.
What changes:
Verification (from the payload tree, before pushing):
Known caveat, stated plainly: the page shows the bundled sample, not the live trajectory — a magpie page cannot read plugin-private data (the bridge's reads are a fixed host list), so a live page needs host support for serving plugin data first.