json: add v2 JsonDoc/JsonNode plugin with runtime provider switch; vendored yyjson + FFI; loader resolve(name)->method_id; PyVM JSON shims; smokes + CI gate; disable MiniVmPrints fallbacks by default

- plugin_loader_v2: store per-Box resolve() from TypeBox FFI; add resolve_method_id() and use in invoke_instance_method
- plugin_loader_unified: resolve_method() falls back to loader’s resolve when TOML lacks method entries
- nyash.toml: register JsonDocBox/JsonNodeBox methods (birth/parse/root/error; kind/get/size/at/str/int/bool)
- plugins/nyash-json-plugin:
  * serde/yyjson provider switch via env NYASH_JSON_PROVIDER (default serde)
  * vendored yyjson (c/yyjson) + shim; parse/root/get/size/at/str/int/bool implemented for yyjson
  * TLV void returns aligned to tag=9
- PyVM: add minimal JsonDocBox/JsonNodeBox shims in ops_box.py (for dev path)
- tests/smokes: add jsonbox_{parse_ok,parse_err,nested,collect_prints}; wire two into min-gate CI
- tools: collect_prints_mixed now uses JSON-based app
- MiniVmPrints: move BinaryOp and fallback heuristics behind a dev toggle (default OFF)
- CURRENT_TASK.md: updated with provider policy and fallback stance
This commit is contained in:
Selfhosting Dev
2025-09-22 06:16:20 +09:00
parent 0f96f2297d
commit 27568eb4a6
25 changed files with 20816 additions and 60 deletions

View File

@ -1,5 +1,9 @@
[env]
# Put environment defaults used by tools or examples if needed
# Enable using resolver by default (can be disabled with NYASH_SKIP_TOML_ENV=1)
NYASH_ENABLE_USING = "1"
# Enable dev sugar preexpand for @ local alias (line-head) during parsing
NYASH_DEV_AT_LOCAL = "1"
[using]
paths = ["apps", "lib", "."]
@ -17,6 +21,7 @@ selfhost.vm.scan = "apps/selfhost-vm/boxes/mini_vm_scan.nyash"
selfhost.vm.binop = "apps/selfhost-vm/boxes/mini_vm_binop.nyash"
selfhost.vm.compare = "apps/selfhost-vm/boxes/mini_vm_compare.nyash"
selfhost.vm.prints = "apps/selfhost-vm/boxes/mini_vm_prints.nyash"
selfhost.vm.seam = "apps/selfhost-vm/boxes/seam_inspector.nyash"
# v2 Plugin libraries (loader reads these for TypeBox ABI)
[libraries]
@ -213,6 +218,38 @@ hexEncode = { method_id = 5 }
hexDecode = { method_id = 6 }
fini = { method_id = 4294967295 }
[libraries."libnyash_json_plugin.so"]
boxes = ["JsonDocBox", "JsonNodeBox"]
path = "plugins/nyash-json-plugin/target/release/libnyash_json_plugin.so"
[libraries."libnyash_json_plugin.so".JsonDocBox]
type_id = 70
abi_version = 1
singleton = false
[libraries."libnyash_json_plugin.so".JsonDocBox.methods]
birth = { method_id = 0 }
parse = { method_id = 1 }
root = { method_id = 2 }
error = { method_id = 3 }
fini = { method_id = 4294967295 }
[libraries."libnyash_json_plugin.so".JsonNodeBox]
type_id = 71
abi_version = 1
singleton = false
[libraries."libnyash_json_plugin.so".JsonNodeBox.methods]
birth = { method_id = 0 }
kind = { method_id = 1 }
get = { method_id = 2 }
size = { method_id = 3 }
at = { method_id = 4 }
str = { method_id = 5 }
int = { method_id = 6 }
bool = { method_id = 7 }
fini = { method_id = 4294967295 }
[libraries."libnyash_toml_plugin.so"]
boxes = ["TOMLBox"]
path = "plugins/nyash-toml-plugin/target/release/libnyash_toml_plugin.so"