28 lines
1.1 KiB
Markdown
28 lines
1.1 KiB
Markdown
# kernel/ — unknown-language Foreign Kernel
|
|
|
|
`mocklang` is **not** a built-in Marqdo language. `kernel.json` registers it at
|
|
run time through the existing external-kernel registry:
|
|
|
|
```bash
|
|
MARQDO_BIN=/abs/path/to/frozen/marqdo
|
|
"$MARQDO_BIN" run kernel/demo.mq.md \
|
|
--kernel kernel/kernel.json \
|
|
--allow-foreign
|
|
```
|
|
|
|
It implements `spec/foreign.md` v1:
|
|
|
|
* argv[1] is a path to the inert `Code` resource taken from `ref("#内核程序")`;
|
|
* stdin receives one `{"wire_version":1,"kind":"request","input":...}` envelope;
|
|
* stdout receives exactly one type-tagged Value Wire v1 value for
|
|
`foreign.call`.
|
|
|
|
The descriptor pins the provider executable by SHA-256. `kernel.json.digest`
|
|
is the SHA-256 of `mocklang`; `tests/test_positive.py` asserts the pin and
|
|
`python3 scripts/refresh_kernel_digest.py` refreshes it after an edit. The
|
|
suite also proves the digest is enforced by tampering with a copy.
|
|
|
|
The `demo.mq.md` file also shows that the code fence is **inert**: `check`
|
|
succeeds without any kernel registered, and only the explicit `foreign.call`
|
|
starts the process.
|