hs: query targets, prolog hook, loop scripts, new plans, WASM regen

Hyperscript compiler/runtime:
- query target support in set/fire/put commands
- hs-set-prolog-hook! / hs-prolog-hook / hs-prolog in runtime
- runtime log-capture cleanup

Scripts: sx-loops-up/down, sx-hs-e-up/down, sx-primitives-down
Plans: datalog, elixir, elm, go, koka, minikanren, ocaml, hs-bucket-f,
       designs (breakpoint, null-safety, step-limit, tell, cookies, eval,
       plugin-system)
lib/prolog/hs-bridge.sx: initial hook-based bridge draft
lib/common-lisp/tests/runtime.sx: CL runtime tests

WASM: regenerate sx_browser.bc.js from updated hs sources

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-06 09:19:56 +00:00
parent c311d4ebc4
commit 985671cd76
31 changed files with 16041 additions and 7056 deletions

View File

@@ -200,14 +200,21 @@ async def eval_sx_url(raw_path: str) -> Any:
ocaml_ctx = {"_helper_service": "sx"}
if is_htmx_request():
# HTMX: single-pass — OOB wrapper + content in ONE aser_slot
# HTMX: render everything to HTML server-side.
# aser_slot left content component calls unexpanded (browser
# doesn't have their definitions). bridge.render expands all
# server-affinity components — ~layouts/doc, content pages,
# syntax highlighting — before the response is sent.
# handle-html-response in engine.sx processes sx-swap-oob
# attributes (filter/aside/root-menu/sx-nav) as OOB swaps,
# then puts the remaining #main-panel section in the target.
oob_ast = [
Symbol("~shared:layout/oob-sx"),
Keyword("content"), wrapped_ast,
]
content_sx = SxExpr(await bridge.aser_slot(
serialize(oob_ast), ctx=ocaml_ctx))
return sx_response(content_sx)
html = await bridge.render(serialize(oob_ast), ctx=ocaml_ctx)
return await make_response(html, 200,
{"Content-Type": "text/html; charset=utf-8"})
else:
# Full page: single OCaml call — aser-slot + shell render
full_ast = [
@@ -236,9 +243,18 @@ async def eval_sx_url(raw_path: str) -> Any:
logger.error("SX URL render failed for %s: %s", raw_path, e, exc_info=True)
return None
# Return response (Python path)
# Return response (Python path — SX_USE_OCAML=0 only)
if is_htmx_request():
return sx_response(await oob_page_sx(content=content_sx))
from shared.sx.async_eval import async_render
from shared.sx.jinja_bridge import get_component_env
oob_ast = [
Symbol("~shared:layout/oob-sx"),
Keyword("content"), wrapped_ast,
]
env2 = dict(get_component_env())
html = await async_render(oob_ast, env2, ctx)
return await make_response(html, 200,
{"Content-Type": "text/html; charset=utf-8"})
else:
tctx = await get_template_context()
html = await full_page_sx(tctx, header_rows="", content=content_sx)