Commit Graph

838 Commits

Author SHA1 Message Date
85dd0a0a68 Fix duplicate sx-cssx-live style tags
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
Cache the style element reference in _cssx-style-el so flush-cssx-to-dom
never creates more than one. Previous code called dom-query on every
flush, which could miss the element during rapid successive calls,
creating duplicates.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 18:28:27 +00:00
41f4772ba7 Strip legacy CSS from SX app: no Prism, Ghost, FontAwesome extras
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 5m10s
Add css_extras parameter to create_base_app. Legacy apps (blog, market
etc) get the default extras (basics.css, cards.css, blog-content.css,
prism.css, FontAwesome). SX app passes css_extras=[] — it uses CSSX
for styling and custom highlighting, not Prism/FA/Ghost.

Reduces <style id="sx-css"> from ~100KB+ of irrelevant CSS to ~5KB
of Tailwind resets + only the utility rules the page actually uses.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 16:17:27 +00:00
ae1ba46b44 Add live CEK stepper island — interactive stepping debugger
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 33s
A defisland that lets users type an SX expression, step through CEK
evaluation one transition at a time, and see C/E/K registers update
live. Demonstrates that cek-step is pure data->data.

- cek.sx geography: add ~geography/cek/demo-stepper island with
  source input, step/run/reset buttons, state display, step history
- platform_js.py: register CEK stepping primitives (make-cek-state,
  cek-step, cek-terminal?, cek-value, make-env, sx-serialize) so
  island code can access them

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 16:02:41 +00:00
0047757af8 Add Platonic SX essay to philosophy section
Plato's allegory of the cave applied to web development: HTML/CSS/JS as
shadows on the wall, s-expressions as Forms, the bootstrapper as
demiurge, anamnesis as the wire format's efficiency, the divided line
as SX's rendering hierarchy, and the Form of the Good as the principle
that representation and thing represented should be identical.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 13:25:10 +00:00
b3cba5e281 Update foundations plan: all five layers complete, reframe next steps
The depth axis is done — CEK (Layer 0) through patterns (Layer 4) are
all specced, bootstrapped, and tested. Rewrite the plan to reflect
reality and reframe the next steps as validation (serialization,
stepping debugger, content-addressed computation) before building
superstructure (concurrent CEK, linear effects).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 13:20:07 +00:00
48d493e9cc Fix init.sx: move out of component directory to avoid server-side eval
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 5m26s
init-client.sx contains browser-only code (dom-listen, collect! cssx).
It was in sx/sx/ which load_sx_dir scans and evaluates server-side,
causing "Undefined symbol: dom-listen". Move to sx/init-client.sx
which is outside the component load path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 12:07:02 +00:00
7556cc303d Add CEK/frames specs and spec explorer to Language nav
- Add frames.sx and cek.sx to the reactive spec registry with prose
- Add CEK Frames and CEK Machine under Specs → Reactive in nav
- Add Spec Explorer link under Language section

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 11:35:56 +00:00
919998be1c Move SX app CSS and init behavior from Python to init.sx
Styles (indicator, jiggle animation) and nav aria-selected behavior
were inline Python strings in sx/app.py. Now they live in sx/sx/init.sx
as proper SX source — styles via collect! "cssx", nav via dom-listen.

The shell's inline_css is empty; CSSX handles style injection on boot.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 11:11:49 +00:00
2211655060 CEK-native higher-order forms: map, filter, reduce, some, every?, for-each
Some checks are pending
Build and Deploy / build-and-deploy (push) Has started running
Higher-order forms now step element-by-element through the CEK machine
using dedicated frames instead of delegating to tree-walk ho-map etc.
Each callback invocation goes through continue-with-call, so deref-as-shift
works inside map/filter/reduce callbacks in reactive island contexts.

- cek.sx: rewrite step-ho-* to use CEK frames, add frame handlers in
  step-continue for map, filter, reduce, for-each, some, every
- frames.sx: add SomeFrame, EveryFrame, MapIndexedFrame
- test-cek-reactive.sx: add 10 tests for CEK-native HO forms

89 tests pass (20 signal + 43 CEK + 26 CEK reactive).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 10:45:36 +00:00
d0a5ce1070 Remove invoke from platform interfaces, add cek-call integration tests
- platform_js.py: remove invoke function definition and PRIMITIVES
  registration, switch domListen handler wrapping to cek-call
- platform_py.py: remove invoke function definition
- run_signal_tests.py: remove invoke patch, use cek_call in batch wrapper
- run_cek_reactive_tests.py: remove invoke, fix primitive lookup to use
  two-level is_primitive/get_primitive, increase recursion limit for
  interpreted CEK evaluation
- test-cek-reactive.sx: add 7 new tests covering cek-call dispatch with
  computed, effect, cleanup, batch coalescing

All 79 tests pass (20 signal + 43 CEK + 16 CEK reactive).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 10:29:32 +00:00
6581211a10 Replace invoke with cek-call in adapters and engine
Completes the invoke→cek-call migration across all spec .sx files:
- adapter-sx.sx: map/filter/for-each in aser wire format
- adapter-dom.sx: island render update-fn
- engine.sx: fetch transform callback
- test-cek-reactive.sx: disposal test

Only async-invoke (adapter-async.sx) remains — separate async pattern.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 10:16:47 +00:00
455e48df07 Replace invoke with cek-call in reactive island primitives
All signal operations (computed, effect, batch, etc.) now dispatch
function calls through cek-call, which routes SX lambdas via cek-run
and native callables via apply. This replaces the invoke shim.

Key changes:
- cek.sx: add cek-call (defined before reactive-shift-deref), replace
  invoke in subscriber disposal and ReactiveResetFrame handler
- signals.sx: replace all 11 invoke calls with cek-call
- js.sx: fix octal escape in js-quote-string (char-from-code 0)
- platform_js.py: fix JS append to match Python (list concat semantics),
  add Continuation type guard in PLATFORM_CEK_JS, add scheduleIdle
  safety check, module ordering (cek before signals)
- platform_py.py: fix ident-char regex (remove [ ] from valid chars),
  module ordering (cek before signals)
- run_js_sx.py: emit PLATFORM_CEK_JS before transpiled spec files
- page-functions.sx: add cek and provide page functions for SX URLs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 10:11:48 +00:00
30d9d4aa4c Add missing plan routes for cek-reactive and reactive-runtime
Both plans had nav entries and component files but were missing from
the page-functions.sx case statement, causing 404s on their URLs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 02:02:54 +00:00
b06cc2daca Fix bootstrapper cell variable scoping for nested closures
Two bugs in _emit_define_as_def: (1) nested def's _current_cell_vars
was replaced instead of unioned with parent — inner functions lost
access to parent's cell vars (skip_ws/skip_comment used bare pos
instead of _cells['pos']). (2) statement-context set! didn't check
_current_cell_vars, always emitting bare assignment instead of
_cells[...]. (3) nested functions that access parent _cells no longer
shadow it with their own empty _cells = {}.

Fixes UnboundLocalError in bootstrapped parser (sx_parse skip_ws)
that crashed production URL routing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 01:46:15 +00:00
4b746e4c8b Bootstrap parser.sx to Python, add reactive runtime plan
Replace hand-written serialize/sx_serialize/sx_parse in Python with
spec-derived versions from parser.sx. Add parser as a Python adapter
alongside html/sx/async — all 48 parser spec tests pass.

Add reactive runtime plan to sx-docs: 7 feature layers (ref, foreign
FFI, state machines, commands with undo/redo, render loops, keyed
lists, client-first app shell) — zero new platform primitives.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 01:45:17 +00:00
f96506024e Add CEK Machine section under Geography with live island demos
geography/cek.sx: overview page (three registers, deref-as-shift
explanation) + demo page with 5 live islands (counter, computed chain,
reactive attrs, stopwatch effect+cleanup, batch coalescing). Nav entry,
router routes, defpage definitions. CEK exports (cekRun, makeCekState,
makeReactiveResetFrame, evalExpr) added to Sx public API via
platform_js.py.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 01:37:16 +00:00
203f9a49a1 Fix remaining test runners for CEK-default mode: override to tree-walk
run_type_tests.py, run_signal_tests.py, run_continuation_tests.py all
needed the same sx_ref.eval_expr/trampoline override to tree-walk that
was applied to the CEK test runners. Without this, transpiled HO forms
(ho_map, etc.) re-entered CEK mid-evaluation causing "Unknown frame
type: map" errors. All 186 tests now pass across 5 suites.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 01:17:47 +00:00
893c767238 Add CEK reactive tests (9/9), fix test runners for CEK-default mode
test-cek-reactive.sx: 9 tests across 4 suites — deref pass-through,
signal without reactive-reset, reactive-reset shift with continuation
capture, scope disposal cleanup. run_cek_reactive_tests.py: new runner
loading signals+frames+cek. Both test runners override sx_ref.eval_expr
back to tree-walk so interpreted .sx uses tree-walk internally.
Plan page added to sx-docs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 01:13:31 +00:00
5c4a8c8cc2 Implement deref-as-shift: ReactiveResetFrame, DerefFrame, continuation capture
frames.sx: ReactiveResetFrame + DerefFrame constructors,
kont-capture-to-reactive-reset, has-reactive-reset-frame?.
cek.sx: deref as CEK special form, step-sf-deref pushes DerefFrame,
reactive-shift-deref captures continuation as signal subscriber,
ReactiveResetFrame in step-continue calls update-fn on re-render.
adapter-dom.sx: cek-reactive-text/cek-reactive-attr using cek-run
with ReactiveResetFrame for implicit DOM bindings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 01:13:21 +00:00
90febbd91e Bootstrap CEK as default evaluator on both JS and Python sides
SPEC_MODULES + SPEC_MODULE_ORDER for frames/cek in platform_js.py,
PLATFORM_CEK_JS + CEK_FIXUPS_JS constants, auto-inclusion in
run_js_sx.py, 70+ RENAMES in js.sx. Python: CEK always-include in
bootstrap_py.py, eval_expr/trampoline overridden to cek_run in
platform_py.py with _tree_walk_* preserved for test runners.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 01:13:11 +00:00
f3a9f3ccc0 Collapse signal platform primitives into pure SX dicts
Replace _Signal class (Python) and SxSignal constructor (JS) with plain
dicts keyed by "__signal". Nine platform accessor functions become ~20
lines of pure SX in signals.sx. type-of returns "dict" for signals;
signal? is now a structural predicate (dict? + has-key?).

Net: -168 lines platform, +120 lines SX. Zero platform primitives for
reactivity — signals compile to any host via the bootstrappers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 00:04:38 +00:00
dcc73a68d5 Collapse reactive islands into scopes: replace TrackingContext and *island-scope* with scope-push!/scope-pop!/context
Reactive tracking (deref/computed/effect dep discovery) and island lifecycle
now use the general scoped effects system instead of parallel infrastructure.
Two scope names: "sx-reactive" for tracking context, "sx-island-scope" for
island disposable collection. Eliminates ~98 net lines: _TrackingContext class,
7 tracking context platform functions (Python + JS), *island-scope* global,
and corresponding RENAME_MAP entries. All 20 signal tests pass (17 original +
3 new scope integration tests), plus CEK/continuation/type tests clean.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:09:09 +00:00
1765216335 Implement explicit CEK machine, continuations, effect signatures, fix dynamic-wind and inspect shadowing
Three-phase foundations implementation:

Phase A — Activate dormant shift/reset continuations with 24 SX-native tests
covering basic semantics, predicates, stored continuations, nested reset,
scope interaction, and TCO.

Phase B — Bridge compile-time effect system to runtime: boundary_parser extracts
46 effect annotations, platform provides populate_effect_annotations() and
check_component_effects() for static analysis. 6 new type tests.

Phase C — Explicit CEK machine (frames.sx + cek.sx): evaluation state as data
({control, env, kont, phase, value}), 21 frame types, two-phase step function
(step-eval/step-continue), native shift/reset via frame capture. Bootstrapper
integration: --spec-modules cek transpiles to Python with iterative cek_run.
43 interpreted + 49 transpiled tests passing.

Bug fixes:
- inspect() shadowed by `import inspect` in PLATFORM_ASYNC_PY — renamed to
  `import inspect as _inspect`
- dynamic-wind missing platform functions (call_thunk, push_wind!, pop_wind!) —
  added with try/finally error safety via dynamic_wind_call

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 22:14:55 +00:00
11fdd1a840 Unify scoped effects: scope as general primitive, provide as sugar
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 12m54s
- Add `scope` special form to eval.sx: (scope name body...) or
  (scope name :value v body...) — general dynamic scope primitive
- `provide` becomes sugar: (provide name value body...) calls scope
- Rename provide-push!/provide-pop! to scope-push!/scope-pop! throughout
  all adapters (async, dom, html, sx) and platform implementations
- Update boundary.sx: Tier 5 now "Scoped effects" with scope-push!/
  scope-pop! as primary, provide-push!/provide-pop! as aliases
- Add scope form handling to async adapter and aser wire format
- Update sx-browser.js, sx_ref.py (bootstrapped output)
- Add scopes.sx docs page, update provide/spreads/demo docs
- Update nav-data, page-functions, docs page definitions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 17:30:34 +00:00
6ca46bb295 Exclude reader-macro-demo.sx from component loader
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
Rename to .sx.future — the file uses #z3 reader macros that aren't
implemented yet, causing a ParseError that blocks ALL component loading
and breaks the provide docs page.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 17:28:26 +00:00
e1a5e3eb89 Reframe spreads article around provide/emit! as the mechanism
Lead with provide/emit! from the first sentence. make-spread/spread?/spread-attrs
are now presented as user-facing API on top of the provide/emit! substrate,
not as independent primitives. Restructured sections, removed redundant
"deeper primitive" content that duplicated the new section I.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 16:12:47 +00:00
aef990735f Add provide/emit! geography article, update spreads article, fix foundations rendering
- New geography article (provide.sx): four primitives, demos, nested scoping,
  adapter comparison, spec explorer links
- Updated spreads article section VI: provide/emit! is now implemented, not planned
- Fixed foundations.sx: ~docs/code-block → ~docs/code (undefined component
  was causing the page to silently fail to render)
- Added nav entry and defpage route for provide/emit! article

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 16:04:52 +00:00
04d3b2ecaf Use separate CI build directory to avoid clobbering dev working tree
CI was doing git reset --hard on /root/rose-ash (the dev directory),
flipping the checked-out branch and causing empty diffs when merging.
Now builds in /root/rose-ash-ci and uses push event SHAs for diffing.
Also adds --resolve-image always to stack deploys.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 15:42:00 +00:00
c4a999d0d0 Merge branch 'worktree-api-urls' into macros 2026-03-13 15:41:40 +00:00
2de4ba8c57 Refactor spread to use provide/emit! internally
Spreads now emit their attrs into the nearest element's provide scope
instead of requiring per-child spread? checks at every intermediate
layer. emit! is tolerant (no-op when no provider), so spreads in
non-element contexts silently vanish.

- adapter-html: element/lake/marsh wrap children in provide, collect
  emitted; removed 14 spread filters from fragment, forms, components
- adapter-sx: aser wraps result to catch spread values from fn calls;
  aser-call uses provide with attr-parts/child-parts ordering
- adapter-async: same pattern for both render and aser paths
- adapter-dom: added emit! in spread dispatch + provide in element
  rendering; kept spread? checks for reactive/island and DOM safety
- platform: emit! returns NIL when no provider instead of erroring
- 3 new aser tests: stored spread, nested element, silent drop

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 15:41:32 +00:00
ee969a343c Merge branch 'macros'
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m58s
2026-03-13 12:41:09 +00:00
400d6d4086 Merge branch 'worktree-api-urls' into macros 2026-03-13 12:20:27 +00:00
dbf16929fa Merge branch 'worktree-api-urls'
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
2026-03-13 12:20:22 +00:00
859aad4333 Fix spread serialization in aser/async-aser wire format
Spread values from make-spread were crashing the wire format serializer:
- serialize() had no "spread" case, fell through to (str val) producing
  Python repr "<shared.sx.ref.sx_ref._Spread...>" which was treated as
  an undefined symbol
- aser-call/async-aser-call didn't handle spread children — now merges
  spread attrs as keyword args into the parent element
- aser-fragment/async-aser-fragment didn't filter spreads — now filters
  them (fragments have no parent element to merge into)
- serialize() now handles spread type: (make-spread {:key "val"})

Added 3 aser-spreads tests. All 562 tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 12:20:16 +00:00
c95e320825 Merge branch 'worktree-api-urls' into macros
Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
2026-03-13 12:07:05 +00:00
427dee13f0 Add scoped-effects + foundations to defpage plan-page dispatch
The plans were routed in page-functions.sx (GraphSX URL eval) but
missing from the defpage case in docs.sx (server-side slug route).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 12:06:56 +00:00
a7de0e9410 Merge branch 'worktree-api-urls' into macros 2026-03-13 12:04:30 +00:00
214963ea6a Unicode escapes, variadic infix fix, spreads demos, scoped-effects + foundations plans
- Add \uXXXX unicode escape support to parser.py and parser.sx spec
- Add char-from-code primitive (Python chr(), JS String.fromCharCode())
- Fix variadic infix operators in both bootstrappers (js.sx, py.sx) —
  (+ a b c d) was silently dropping terms, now left-folds correctly
- Rebootstrap sx_ref.py and sx-browser.js with all fixes
- Fix 3 pre-existing map-dict test failures in shared/sx/tests/run.py
- Add live demos alongside examples in spreads essay (side-by-side layout)
- Add scoped-effects plan: algebraic effects as unified foundation for
  spread/collect/island/lake/signal/context
- Add foundations plan: CEK machine, the computational floor, three-axis
  model (depth/topology/linearity), Curry-Howard correspondence
- Route both plans in page-functions.sx and nav-data.sx

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 12:03:58 +00:00
2fc391696c Merge branch 'worktree-api-urls' into macros 2026-03-13 10:46:53 +00:00
28a6560963 Replace \uXXXX escapes with actual UTF-8 characters in .sx files
SX parser doesn't process \u escapes — they render as literal text.
Use actual UTF-8 characters (→, —, £, ⬡) directly in source.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 10:46:53 +00:00
cee0ca7667 Merge branch 'worktree-api-urls' into macros 2026-03-13 10:44:10 +00:00
98036b2292 Add syntax highlighting to spreads page code blocks
Use (highlight "..." "lisp") page helper instead of raw strings
for ~docs/code :code values.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 10:44:09 +00:00
6d0c0b2230 Merge branch 'worktree-api-urls' into macros 2026-03-13 05:42:51 +00:00
9d0bd3b0e7 Fix spreads page: remove (code) tags from table list data
(code "...") is an HTML tag — works in render context but not inside
(list ...) which fully evaluates args. Use plain strings in table rows.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 05:42:47 +00:00
2329533d1a Merge branch 'worktree-api-urls' into macros 2026-03-13 05:35:56 +00:00
085f959323 Add spreads page function for SX URL routing
Without this, /sx/(geography.(spreads)) 404s because spreads isn't
defined as a page function to return the content component.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 05:35:50 +00:00
fe911625e3 Merge branch 'worktree-api-urls' into macros 2026-03-13 05:31:40 +00:00
9806aec60c Add Spreads page under Geography — spread/collect/reactive-spread docs
Documents the three orthogonal primitives (spread, collect!, reactive-spread),
their operation across server/client/morph boundaries, CSSX as use case,
semantic style variables, and the planned provide/context/emit! unification.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 05:25:42 +00:00
36b070f796 Add reactive spreads — signal-driven attribute injection in islands
When a spread value (e.g. from ~cssx/tw) appears inside an island with
signal-dependent tokens, reactive-spread tracks deps and updates the
element's class/attrs when signals change. Old classes are surgically
removed, new ones appended, and freshly collected CSS rules are flushed
to the live stylesheet. Multiple reactive spreads on one element are safe.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 05:16:13 +00:00
ae6c6d06a7 Merge branch 'worktree-api-urls' into macros 2026-03-13 04:51:05 +00:00