# Execution state

Keep under roughly 120 lines. Replace stale detail instead of appending.

## Status

- Phase: `complete`
- Blocker: none
- User decision required: none outstanding

## Repository layout (restructured)

    src/
      kernel/ fs/ net/ shell/     the linux-mimicking core
      node/      module shims, commonjs engine, esm transform
      python/    cpython, syscalls, pip, resolver, worker, abi, local-builder
      worker/    pods, sync channel, worker host
      tools/     esbuild, rolldown, ffmpeg hosts
      container/ pkg/ agent/ preview/ hosting/
    docs/        every markdown file: agent/, python/, handoff.md
    python-runtime/  the Python build pipeline (Makefile, scripts, recipes)

`src/runtime/` is gone. Moves were done with `git mv` and every relative import
recomputed programmatically. Four references were strings rather than import
specifiers -- two `dist/` paths whose depth changed, a `/src/runtime/python/`
check in config.ts, and a test allowlist -- and those caused 79 failures until
found. There was no dead code to remove: 2 of 130 source files are unreferenced
and both are ambient `.d.ts` files tsconfig loads implicitly.

## Packages: nothing to pre-build any more

`pip install <anything>` now builds a wheel when the index has none.

- `scripts/auto_recipe.py` writes a recipe from what PyPI and the source
  already state: identity, verified sdist, and the declared PEP 517 backend.
  Backends with no adapter are refused by name. Build requirements the lock has
  never seen are pinned at that moment rather than dropped.
- `src/python/local-builder.ts` runs the pipeline; `bin/sandboxedjs-build-wheels.mjs`
  serves the index and builds on request, for browsers that have no compiler.
- Opt-in, defaulting on only in Node from a checkout. Submit-and-poll, because
  a connection held open for a minutes-long build reads as an unreachable
  service.
- Verified: `pip install ujson` with no recipe -> generated, built, indexed,
  installed, imported, both locally and through the service.

## Two real defects found and fixed

- The browser's default wheel index was filtered to the wheels whose bytes are
  inlined in the bundle, so every other built wheel was invisible -- `pip
  install numpy` reported no usable distribution while numpy sat unreferenced
  beside the interpreter. The index now lists all built wheels, served from
  next to the interpreter, with the inlined bytes as an overlay keyed by
  filename.
- The post-build index read went through pip's memoizing cache and returned the
  pre-build copy, so a package was built twice.

## Pre-existing failures, verified not caused by this work

11 tests, reproduced identically in a clean worktree at HEAD: `python-syscalls`
(5), `cpython` (2), `python-abi/baseline` (3), `python-runtime/asyncio` (1).
Also: pytest's default output capture fails in the container
(`OSError: [Errno 8] Bad file descriptor`), so upstream suites need
`--capture=no`.

## Unverified

`import numpy` in a browser. The embedded browser used for testing blocks
nested module workers loaded over HTTP, which the runtime needs to start Python
at all -- `python3 --version` times out there too, and so does a trivial nested
worker. `pip install numpy` was verified in that browser and returns 0.

## Last evidence

`npx vitest run`: 610 passed, 24 skipped, 12 failed (the 11 above plus one
PyPI-network flake that passes in isolation). `npm run typecheck`: pass.
`npm run build`: pass. All 16 wheels byte-identical across rebuilds.

## Compact checkpoint template## Compact checkpoint template## Compact checkpoint template## Compact checkpoint template## Compact checkpoint template## Compact checkpoint template## Compact checkpoint template## Compact checkpoint template## Compact checkpoint template

Replace the sections above after each meaningful loop:

```text
Phase: <name>
Current task: <path>
Last completed task: <path or none>
Blocker: <one sentence or none>
User decision required: <yes/no and exact decision>
Last evidence:
- <command>: <pass/fail and decisive result>
Next action: <one concrete action>
Files changed this loop: <paths>
```

