Commit Graph
7 Commits
Author SHA1 Message Date
yetone 319b0a6459 layerfs 0.10.2: the page shows its empty state before the first project, not Connecting for good
AlanWang1027713 on X (magpie v0.1.4026, macOS): Plugins -> LayerFS
轨迹 stays on "Connecting to the local trajectory service…".

The page's boot.js jumps its frame to the host's service on 43717, and
the service started only once a store with a project existed. With no
store the jump is refused. The README said the frame then shows the
browser's refused-to-connect page; that is Chromium. A WebKit frame
(magpie's window on macOS and Linux) keeps the old document when its
jump is refused, so it said Connecting for good.

The service now starts when the host loads, store or no store. With no
store (or an empty projects folder) it answers an empty recording
without building the backend, so nothing is written under ~ until a
tool call makes the first project. The empty state now reloads itself
every 5s like the full page, so the first provision shows up without
reopening the page. The retry on a held port no longer waits for a
store, and the store-race recheck it needed is gone.

Run on mote (Bun 1.4.2, temp HOME):
- bun test packages/layerfs: 69 pass, 0 fail. bun scripts/check.mjs: 0.
- Broken by hand: 0.10.1's index.mjs and app.js turn the two new
  tests red (the no-store service test and the empty-state reload).
- Real browsers (Playwright 1.62.0): a sandboxed frame doing boot.js's
  jump against a no-store host. 0.10.1: WebKit's frame stays on
  "Connecting to the local trajectory service…", Chromium's shows
  chrome-error. 0.10.2: both show the zh empty state
  ("还没有记录到轨迹…").

Not tried: the page inside the real magpie window with the plugin
installed.
2026-11-13 17:07:35 +08:00
yetone 3dd0f44c15 layerfs: the import-limit test uses a small limit, not 20,001 real files
The only red in `HOME=$(mktemp -d) bun test` at the root on mote (57f3f90)
was "item 3: an import over the file limit is refused, not swept in". It
timed out at 30s (34s) under the full suite. Run by itself it passes in
about 10s, which is the time to write 20,001 empty files. CI on ubuntu is
green. scanImportTree now takes { maxFiles } (the default is still
IMPORT_MAX_FILES), so the test checks 51 files against a limit of 50 and 51.
The test also pins the 20000 default.

Run on mote: layerfs.test.mjs 38 pass; scripts/check.mjs ok. The full
root suite at 57f3f90 had 3769 tests, 1 fail (this one). Broken by hand:
checkImportLimits compared against IMPORT_MAX_FILES again, and the test went
red. Not tried: running the old test under load again to watch it time out;
the full-suite log shows that.
No version bump: the default behaviour is unchanged.
2026-10-30 17:02:02 +08:00
mola 443c808517 layerfs 0.10.0: the page's live channel returns, out of the install's own folder (#441)
LayerFS's trajectory page is served by a loopback service the host starts once a store exists (no write into the install), keeps its view in location.hash across its 5 s reload, reports every skipped secret-shaped file in sorted order (#477), and drops the unloaded sample. By @Mola-maker.

Run at dfa99f7e merged onto current main:
- mote (macOS, Bun 1.4.2, temp HOME): bun test in packages/layerfs, 64 pass 0 fail, 2 of 2; bun scripts/check.mjs layerfs ok; the temp HOME held nothing from layerfs afterwards.
- WSL2 Ubuntu 24.04 (temp HOME): 64 pass 0 fail, 2 of 2 (#477's item 3 was red here on f3633eaf8).
- Broken by hand: dropping the `location.hash =` assignment in page/app.js turns the hash test red. Earlier rounds' breaks (Origin/Host checks, < escape, start gates, nosniff, sort, restore/settle/round, reload guard) each went red, see the 05:18 and 05:45 reviews.
- Earlier round: the page in a magpie-shaped sandboxed frame with pagePolicy CSP, Chromium and WebKit.
- PR checks: test and on-npm pass.
Not tried: a real magpie window.
2026-10-29 21:07:14 +08:00
mola 03f5952a8b layerfs 0.9.0: commits name their calling agent, trajectory reads each record once (#365)
layerfs 0.9.0 (sim-only): each provision, checkpoint, fork, publish and exec records the calling agent from the tool host's ctx.agent, and the page names it, ahead of the branch-name guess. trajectory() reads each commit record once per backend lifetime (summaries cached, manifest left out) and yields between branches, so a rebuild reads only new commits. Native backend requests are still refused loudly.

Run at e3c7ee94 (macOS): bun test packages/layerfs 57 pass (2 of 3 runs; the third hit ENOSPC on a full disk in 4 #360/accounting tests that pass in the others); origin/main 53 pass. bun scripts/check.mjs layerfs ok. Checked that magpie's host.js runTool passes ctx.agent as execute's second argument.
Not tried: the page in the real magpie app with a live agent.
2026-10-26 18:11:30 +08:00
yetone d43b228463 layerfs 0.7.3: workspace paths sit under ~/.layerfs-tools, so a tool result no longer names magpie (#360)
provision, resolve and exec answer the workspace's path, and a tool
result goes to the vendor in the agent's next request. With the default
root ~/.magpie-layerfs every provision named magpie upstream.

The default root is now ~/.layerfs-tools. A ~/.magpie-layerfs made by
0.7.2 or earlier is renamed to it once, at the first backend made, and
a link is left at the old path, so a session still holding an old
workspace path keeps working. A legacy root that is itself a link (the
user's own setup) is used where it is, as is one the rename is refused
on. MAGPIE_LAYERFS_HOME set by the user is unchanged. A second host
racing the rename finds the new root and uses it.

Run, in a sandbox HOME:
- bun test packages/layerfs: 53 pass, 0 fail. bun scripts/check.mjs
  layerfs: ok.
- The three #360 tests against the old default (defaultRoot answering
  ~/.magpie-layerfs): 2 of them red, the third (a user's link) is
  unchanged behaviour.
- Through magpie's real plugin host (origin/main 4dfd88206,
  plugin.Add of this package + plugin.RunTool "provision" in a
  testenv sandbox HOME): a fresh home answers
  ~/.layerfs-tools/workspaces/demo/main and makes nothing at the old
  name; a home with a ~/.magpie-layerfs holding a marker answers the
  new path, the marker is under ~/.layerfs-tools, and ~/.magpie-layerfs
  is a symlink.

Not tried: Windows (the link is a junction there), and moving a root
while an agent's exec runs in it.
2026-10-25 14:26:30 +08:00
yetone c02957a40b layerfs: the tests' cleanup hooks get a 120s bar, not bun's 5s (#362)
Both test files remove every temp dir in one afterAll. On a loaded box
that took 6-7.5s and went red against bun's default 5s hook timeout.
The hooks now carry their own bar.

Run: with a 7s Bun.sleepSync injected into layerfs.test.mjs's hook,
the old bar fails ("a beforeEach/afterEach hook timed out", 28 pass
1 fail) and the new one passes (28 pass 0 fail). Test-only change, so
no version bump.
2026-10-25 14:26:30 +08:00
mola e7f65641df Add layerfs: LayerFS workspaces as tools for every agent (#318)
New community tools package @magpie-community/tools-layerfs 0.7.1 (Mola-maker): LayerFS workspaces as tools for every agent. It imports a source folder into a versioned workspace under MAGPIE_LAYERFS_HOME (default ~/.magpie-layerfs), with checkpoints, history and diffs. Running commands (exec) is off unless the user turns it on. No network access. registry.json gains its one entry.

Run at the reviewed head 4795df0 (merges cleanly onto origin/main 1ae89aa):
- bun scripts/check.mjs layerfs: ok
- bun test in the package under a temp HOME: 48 of 48 pass, worktree clean after
- the seven points from the last review, each re-run:
  1. source guard: ~/.Config/Magpie, a symlink to ~/.config/magpie, ~/.AWS, ~/.CONFIG and a symlinked parent are all refused
  2. names: project a / branch b--c and project a--b / branch c no longer share a workspace; Main and main are apart
  3. layerfs_history {limit:1} at 200 checkpoints: 0.1 ms (151 ms before), no trajectory.json written
  4. native backend and its SDK path removed; asking for it throws a clear error
  5. repository points at this repo; README images pinned
  6. runShell: cat returns in 32 ms (2005 before), a backgrounded sleep doesn't hold the call, a timeout kills the process
  7. storedBytes equals stored content plus checkpoint records; the description says so
- read every line changed since 1c9e4c1: no path escape, no writes outside its home

Not tried: a real agent using the tools through magpie.
Known: something exec starts in the background keeps running after a successful call, like a normal shell, and can land in the next checkpoint.
2026-10-23 08:16:30 +08:00