@elurjs/universal 0.1.13 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -68
- package/cli/dev.mjs +108 -77
- package/cli/inspect.mjs +3 -2
- package/cli/sdui.mjs +28 -5
- package/docs/INSTALACION-Y-DEV.md +4 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,103 +1,111 @@
|
|
|
1
1
|
# Elur Universal — framework
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
`../Elur-Universal-Documento-Arquitectura-v6.0.pdf` (
|
|
3
|
+
A single framework: **one IR, one reconciler, pure backends**. Master document:
|
|
4
|
+
`../Elur-Universal-Documento-Arquitectura-v6.0.pdf` (the v5 proposal lives in
|
|
5
5
|
`../planes/PROPUESTA-DOCUMENTO-MAESTRO-v5.md`).
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
`docs/IMPLEMENTACION-NATIVA-v5.md` ·
|
|
7
|
+
Current status: `docs/ESTADO.md` (living source per commit) · pending and
|
|
8
|
+
deferred work: `docs/PENDIENTES.md` · consolidated native implementation:
|
|
9
|
+
`docs/IMPLEMENTACION-NATIVA-v5.md` · SOTA audit and roadmap:
|
|
10
10
|
`docs/AUDITORIA-STATE-OF-THE-ART-2026-11.md`.
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## Structure
|
|
13
13
|
|
|
14
14
|
```text
|
|
15
15
|
src/
|
|
16
|
-
ir/ IRNode/IRDocument, irVersion, builder
|
|
16
|
+
ir/ IRNode/IRDocument, irVersion, ui`` builder, semantics.ts
|
|
17
17
|
reconciler/ IR + signals → DisplayOps (DOM-free, engine-agnostic)
|
|
18
|
-
transport/ Display List
|
|
19
|
-
router/
|
|
20
|
-
adapters/
|
|
21
|
-
ssr/
|
|
22
|
-
hydration/
|
|
23
|
-
|
|
24
|
-
(
|
|
25
|
-
|
|
18
|
+
transport/ Binary Display List (runtime) + JSON (debug)
|
|
19
|
+
router/ Universal router — DOM-free core + adapters
|
|
20
|
+
adapters/ Kit integration (bridge, SSR, request, history, nav)
|
|
21
|
+
ssr/ SSR applicator (createHtmlApplicator) + render-page
|
|
22
|
+
hydration/ Reserved (data-elur / hydrate() pending consumer)
|
|
23
|
+
sdui/ Server-driven UI: envelope, lowering, A2UI renderer
|
|
24
|
+
(v0.9 + v1.0), gateway live (/serve + /publish + MCP)
|
|
25
|
+
backends/ JS side of the applicators: web/ (DOM) + native/
|
|
26
|
+
(marshaling to the ElurBridge host object)
|
|
27
|
+
native/ Native module contract: def/manifest, wire registry,
|
|
26
28
|
codegen (TS/Kotlin/mock), sharedMemory (CESM facade +
|
|
27
29
|
ring), binaryCodec, platformView, trace, tck, webModule
|
|
28
|
-
animations/ Worklets:
|
|
29
|
-
scroll, binds
|
|
30
|
-
app/ mountApp/mountEmbeddedApp, host
|
|
30
|
+
animations/ Worklets: main-thread + UIThreadRunner, gestures,
|
|
31
|
+
scroll, compositor binds, capture check
|
|
32
|
+
app/ mountApp/mountEmbeddedApp, embedded host, state snapshot
|
|
31
33
|
platform.ts Escape hatch: platform({ web, native, default })
|
|
32
|
-
layout/
|
|
34
|
+
layout/ Reserved (the Yoga instance lives in the target)
|
|
33
35
|
|
|
34
36
|
cli/ Toolchain: elur build/dev/doctor/create/debug/engines,
|
|
35
|
-
plugin manifest|check|sync|codegen|
|
|
36
|
-
(Babel ie11), gen-hbc (hermesc HBC 99),
|
|
37
|
-
gen-host-integration, layout-oracle,
|
|
37
|
+
sdui (gateway/mcp/sign), plugin manifest|check|sync|codegen|
|
|
38
|
+
create|add, gen-es5 (Babel ie11), gen-hbc (hermesc HBC 99),
|
|
39
|
+
gen-qjsc, gen-bundle, gen-host-integration, layout-oracle,
|
|
40
|
+
run-tck/run-parity
|
|
38
41
|
|
|
39
42
|
targets/
|
|
40
|
-
android/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
android/ Kotlin shell + JNI/C++ (QuickJS/Hermes bridges, Platform
|
|
44
|
+
Views renderers, vendored Yoga 3.2.1, CESM glue)
|
|
45
|
+
linux/ Native GTK4 host (GtkFixed applicator, Pango measure,
|
|
46
|
+
AT-SPI a11y, platform views, packaging appimage/deb/rpm)
|
|
47
|
+
windows/ Native WinUI 3 host (C++/WinRT, UIA a11y, unpackaged
|
|
48
|
+
self-contained)
|
|
49
|
+
ios/ Future — spec ready (ADR-0010, requires Mac)
|
|
50
|
+
web/ Reference Vite/SSR server
|
|
51
|
+
|
|
52
|
+
native/ Shared host C++, platform+engine agnostic:
|
|
53
|
+
cesm/ (core + qjs/hermes adapters, host tests) and
|
|
54
|
+
layout-oracle/ (binary against vendored Yoga)
|
|
55
|
+
|
|
56
|
+
packages/ Domain libraries on the module contract:
|
|
50
57
|
@elurjs/i18n, @elurjs/kv, @elurjs/location
|
|
51
58
|
|
|
52
|
-
tests/ unit (vitest+jsdom) · parity (
|
|
53
|
-
Hermes
|
|
59
|
+
tests/ unit (vitest+jsdom) · parity (same tests on QuickJS-ng and
|
|
60
|
+
real Hermes) · stress · e2e (Playwright) · tck ·
|
|
54
61
|
wire corpus · layout corpus · i18n corpus · bench
|
|
55
62
|
|
|
56
|
-
docs/adr/ ADR-0013 … ADR-
|
|
63
|
+
docs/adr/ ADR-0013 … ADR-0222 (index in docs/adr/README.md)
|
|
57
64
|
```
|
|
58
65
|
|
|
59
|
-
##
|
|
66
|
+
## Golden rules (from the ADRs / A.7)
|
|
60
67
|
|
|
61
|
-
- `src/reconciler`, `src/router`, `src/ir`, `src/transport`: **
|
|
62
|
-
|
|
63
|
-
QuickJS-ng
|
|
64
|
-
- No `TextEncoder`/`TextDecoder`/`SharedArrayBuffer`/class fields
|
|
65
|
-
|
|
68
|
+
- `src/reconciler`, `src/router`, `src/ir`, `src/transport`: **zero
|
|
69
|
+
DOM/platform imports**. They must transpile to ES5 and run identically on
|
|
70
|
+
V8, QuickJS-ng and Hermes — enforced by the parity lanes.
|
|
71
|
+
- No `TextEncoder`/`TextDecoder`/`SharedArrayBuffer`/class fields in embedded
|
|
72
|
+
code → binary encoding lives in `src/transport/` with a native encoder in
|
|
66
73
|
targets.
|
|
67
|
-
- `effect()`
|
|
68
|
-
flush
|
|
69
|
-
- `remove-child` = detach (
|
|
70
|
-
(
|
|
71
|
-
-
|
|
72
|
-
-
|
|
74
|
+
- `effect()` runs synchronously on registration: render pass ≠ update pass;
|
|
75
|
+
the flush belongs to the reconciler/backend, never to the effect.
|
|
76
|
+
- `remove-child` = detach (keeps node/state); `delete-node` = destroy
|
|
77
|
+
(frees resources and auxiliary indexes).
|
|
78
|
+
- The reconciler's tree is the single source of truth for child order.
|
|
79
|
+
- Per-frame logging is forbidden in benchmarks.
|
|
73
80
|
|
|
74
|
-
##
|
|
81
|
+
## Build your app
|
|
75
82
|
|
|
76
83
|
```bash
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
84
|
+
bunx @elurjs/universal create mi-app # consumer scaffold
|
|
85
|
+
elur build --target android --app src/entry.ts [--apk|--aab]
|
|
86
|
+
elur build --target web --app src/entry.ts
|
|
87
|
+
elur build --target linux --app src/entry.ts # JS + elur-linux (cmake)
|
|
88
|
+
elur build --target windows --app src/entry.ts # JS + elur-windows.exe (msbuild, on Windows)
|
|
89
|
+
elur dev --target <web|android|linux|windows> # watch → rebuild → relaunch/push
|
|
90
|
+
elur doctor # environment check (all targets)
|
|
82
91
|
```
|
|
83
92
|
|
|
84
|
-
`--app`
|
|
85
|
-
`mount.<
|
|
86
|
-
`bun add @elurjs/x` + `import { createX }` —
|
|
87
|
-
|
|
88
|
-
|
|
93
|
+
`--app` is the composition root: `mountApp()` resolves to
|
|
94
|
+
`mount.<platform>.ts` at build time (ADR-0101). Native plugins:
|
|
95
|
+
`bun add @elurjs/x` + `import { createX }` — the import auto-declares the
|
|
96
|
+
module (ADR-0099/0100); `elur build` generates `ElurModuleRegistrar.kt`,
|
|
97
|
+
the permission merge and the sourceSets (ADR-0102/0103).
|
|
89
98
|
|
|
90
|
-
##
|
|
99
|
+
## License
|
|
91
100
|
|
|
92
|
-
|
|
93
|
-
|
|
101
|
+
Code (framework, hosts, CLI, packages and TCK): **Apache-2.0** —
|
|
102
|
+
see `LICENSE`, `NOTICE` and `THIRD_PARTY_NOTICES.md` (ADR-0173).
|
|
94
103
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
`OWFA-1.0-Elur-Universal.md`.
|
|
104
|
+
The **specification** (Master Architecture Document) is published under
|
|
105
|
+
**CC-BY-4.0**, with the owner's **OWFa 1.0** for host implementers —
|
|
106
|
+
see `LICENSE-SPEC.md` and `OWFA-1.0-Elur-Universal.md`.
|
|
99
107
|
|
|
100
|
-
"Elur"
|
|
101
|
-
"compatible
|
|
108
|
+
"Elur" is not licensed: trademark usage in `TRADEMARKS.md` — claiming to
|
|
109
|
+
be "Elur compatible" requires a public green `run-tck` report.
|
|
102
110
|
|
|
103
|
-
|
|
111
|
+
Contributions: `CONTRIBUTING.md` (DCO 1.1 — `git commit -s`).
|
package/cli/dev.mjs
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
// — el refresh del navegador es del usuario.
|
|
18
18
|
|
|
19
19
|
import { execFileSync, spawn } from "node:child_process";
|
|
20
|
+
import { createServer as netCreateServer } from "node:net";
|
|
20
21
|
import {
|
|
21
22
|
existsSync, readdirSync, readFileSync, statSync, watch,
|
|
22
23
|
} from "node:fs";
|
|
@@ -44,11 +45,26 @@ const devFast = args.includes("--dev-fast");
|
|
|
44
45
|
// ADR-0142: --ssr en web sirve el SSR real en dev — rebuild del bundle
|
|
45
46
|
// server+client y restart del proceso bun por cambio.
|
|
46
47
|
const ssr = target === "web" && args.includes("--ssr");
|
|
48
|
+
// Puerto fijo solo con --strict-port; si no, se avanza hasta uno libre.
|
|
49
|
+
const strictPort = args.includes("--strict-port");
|
|
47
50
|
const ssrPort = opt("--port") ?? "3418";
|
|
51
|
+
let ssrPortResolved = Number(ssrPort);
|
|
48
52
|
// ADR-0214 — servidor estático dev con SSE de reload (SPA). `--no-serve`
|
|
49
53
|
// conserva el comportamiento anterior (solo rebuild de dist/).
|
|
50
54
|
const noServe = args.includes("--no-serve");
|
|
51
55
|
const webPort = opt("--port") ?? "3419";
|
|
56
|
+
const webEncoder = new TextEncoder();
|
|
57
|
+
function pickFreePort(start, span = 20) {
|
|
58
|
+
return new Promise((done) => {
|
|
59
|
+
const probe = (p) => {
|
|
60
|
+
if (p >= start + span) return done(null);
|
|
61
|
+
const s = netCreateServer();
|
|
62
|
+
s.once("error", () => probe(p + 1));
|
|
63
|
+
s.listen(p, () => s.close(() => done(p)));
|
|
64
|
+
};
|
|
65
|
+
probe(start);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
52
68
|
let webServer = null;
|
|
53
69
|
const webClients = new Set();
|
|
54
70
|
let ssrProc = null;
|
|
@@ -61,7 +77,7 @@ function restartSsrServer() {
|
|
|
61
77
|
const serverJs = join(ssrOutDir(), "server.js");
|
|
62
78
|
ssrProc = spawn("bun", [serverJs], {
|
|
63
79
|
cwd: process.cwd(),
|
|
64
|
-
env: { ...process.env, PORT:
|
|
80
|
+
env: { ...process.env, PORT: String(ssrPortResolved) },
|
|
65
81
|
stdio: jsonLogs ? ["ignore", 2, 2] : "inherit",
|
|
66
82
|
});
|
|
67
83
|
ssrProc.on("exit", () => { /* el restart del próximo rebuild cubre */ });
|
|
@@ -185,90 +201,101 @@ const WEB_MIME = {
|
|
|
185
201
|
};
|
|
186
202
|
function withReloadScript(html) {
|
|
187
203
|
const script = `<script>(()=>{const es=new EventSource("/__elur_dev");` +
|
|
188
|
-
`es.onmessage=e=>{if(e.data==="reload")location.reload();}
|
|
204
|
+
`es.onmessage=e=>{if(e.data==="reload")location.reload();};` +
|
|
205
|
+
`addEventListener("beforeunload",()=>es.close());})();</script>`;
|
|
189
206
|
return html.includes("</body>")
|
|
190
207
|
? html.replace("</body>", script + "</body>")
|
|
191
208
|
: html + script;
|
|
192
209
|
}
|
|
193
|
-
function
|
|
194
|
-
if (ssr || target !== "web" || noServe || webServer) return;
|
|
210
|
+
async function webFetch(req) {
|
|
195
211
|
const dist = WEB_DIST();
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
controller.enqueue(
|
|
211
|
-
encoder.encode(`data: ${msg}\n\n`));
|
|
212
|
-
} catch { /* cliente cerrado */ }
|
|
213
|
-
},
|
|
214
|
-
close() {
|
|
215
|
-
try { controller.close(); } catch { }
|
|
216
|
-
},
|
|
217
|
-
};
|
|
218
|
-
webClients.add(entry);
|
|
219
|
-
entry.send("connected");
|
|
220
|
-
req.signal?.addEventListener("abort", () => {
|
|
221
|
-
if (entry) webClients.delete(entry);
|
|
222
|
-
entry?.close();
|
|
223
|
-
});
|
|
224
|
-
},
|
|
225
|
-
cancel() {
|
|
226
|
-
if (entry) webClients.delete(entry);
|
|
227
|
-
},
|
|
228
|
-
});
|
|
229
|
-
return new Response(stream, {
|
|
230
|
-
headers: {
|
|
231
|
-
"content-type": "text/event-stream",
|
|
232
|
-
"cache-control": "no-cache",
|
|
233
|
-
"connection": "keep-alive",
|
|
234
|
-
},
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
let pathname = decodeURIComponent(url.pathname);
|
|
238
|
-
if (pathname === "/" || pathname.endsWith("/")) {
|
|
239
|
-
pathname += "index.html";
|
|
240
|
-
}
|
|
241
|
-
const targetFile = resolve(dist, "." + pathname);
|
|
242
|
-
if (targetFile !== dist &&
|
|
243
|
-
!targetFile.startsWith(dist + sep)) {
|
|
244
|
-
return new Response("forbidden", { status: 403 });
|
|
245
|
-
}
|
|
246
|
-
const fallback = join(dist, "index.html");
|
|
247
|
-
const file = existsSync(targetFile) ? targetFile : fallback;
|
|
248
|
-
if (!existsSync(file)) {
|
|
249
|
-
return new Response("not found", { status: 404 });
|
|
250
|
-
}
|
|
251
|
-
if (file.endsWith(".html")) {
|
|
252
|
-
return new Response(
|
|
253
|
-
withReloadScript(readFileSync(file, "utf8")),
|
|
254
|
-
{ headers: { "content-type": WEB_MIME[".html"] } });
|
|
255
|
-
}
|
|
256
|
-
const ext = file.slice(file.lastIndexOf("."));
|
|
257
|
-
return new Response(Bun.file(file), {
|
|
258
|
-
headers: {
|
|
259
|
-
"content-type": WEB_MIME[ext] ?? "application/octet-stream",
|
|
212
|
+
const url = new URL(req.url);
|
|
213
|
+
if (url.pathname === "/__elur_dev") {
|
|
214
|
+
let entry = null;
|
|
215
|
+
const stream = new ReadableStream({
|
|
216
|
+
start(controller) {
|
|
217
|
+
entry = {
|
|
218
|
+
send(msg) {
|
|
219
|
+
try {
|
|
220
|
+
controller.enqueue(
|
|
221
|
+
webEncoder.encode(`data: ${msg}\n\n`));
|
|
222
|
+
} catch { /* cliente cerrado */ }
|
|
223
|
+
},
|
|
224
|
+
close() {
|
|
225
|
+
try { controller.close(); } catch { }
|
|
260
226
|
},
|
|
227
|
+
};
|
|
228
|
+
webClients.add(entry);
|
|
229
|
+
entry.send("connected");
|
|
230
|
+
req.signal?.addEventListener("abort", () => {
|
|
231
|
+
if (entry) webClients.delete(entry);
|
|
232
|
+
entry?.close();
|
|
261
233
|
});
|
|
262
234
|
},
|
|
235
|
+
cancel() {
|
|
236
|
+
if (entry) webClients.delete(entry);
|
|
237
|
+
},
|
|
238
|
+
});
|
|
239
|
+
return new Response(stream, {
|
|
240
|
+
headers: {
|
|
241
|
+
"content-type": "text/event-stream",
|
|
242
|
+
"cache-control": "no-cache",
|
|
243
|
+
"connection": "keep-alive",
|
|
244
|
+
},
|
|
263
245
|
});
|
|
246
|
+
}
|
|
247
|
+
let pathname = decodeURIComponent(url.pathname);
|
|
248
|
+
if (pathname === "/" || pathname.endsWith("/")) {
|
|
249
|
+
pathname += "index.html";
|
|
250
|
+
}
|
|
251
|
+
const targetFile = resolve(dist, "." + pathname);
|
|
252
|
+
if (targetFile !== dist &&
|
|
253
|
+
!targetFile.startsWith(dist + sep)) {
|
|
254
|
+
return new Response("forbidden", { status: 403 });
|
|
255
|
+
}
|
|
256
|
+
const fallback = join(dist, "index.html");
|
|
257
|
+
const file = existsSync(targetFile) ? targetFile : fallback;
|
|
258
|
+
if (!existsSync(file)) {
|
|
259
|
+
return new Response("not found", { status: 404 });
|
|
260
|
+
}
|
|
261
|
+
if (file.endsWith(".html")) {
|
|
262
|
+
return new Response(
|
|
263
|
+
withReloadScript(readFileSync(file, "utf8")),
|
|
264
|
+
{ headers: { "content-type": WEB_MIME[".html"] } });
|
|
265
|
+
}
|
|
266
|
+
const ext = file.slice(file.lastIndexOf("."));
|
|
267
|
+
return new Response(Bun.file(file), {
|
|
268
|
+
headers: {
|
|
269
|
+
"content-type": WEB_MIME[ext] ?? "application/octet-stream",
|
|
270
|
+
},
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
let webPortResolved = Number(webPort);
|
|
274
|
+
function startWebServer() {
|
|
275
|
+
if (ssr || target !== "web" || noServe || webServer) return;
|
|
276
|
+
const dist = WEB_DIST();
|
|
277
|
+
if (!existsSync(dist)) return;
|
|
278
|
+
const base = Number(webPort);
|
|
279
|
+
const span = strictPort ? 1 : 20;
|
|
280
|
+
let lastErr = null;
|
|
281
|
+
for (let p = base; p < base + span; p++) {
|
|
282
|
+
try {
|
|
283
|
+
webServer = Bun.serve({ port: p, fetch: webFetch });
|
|
284
|
+
webPortResolved = p;
|
|
285
|
+
break;
|
|
286
|
+
} catch (e) { lastErr = e; }
|
|
287
|
+
}
|
|
288
|
+
if (webServer) {
|
|
264
289
|
log("dev.web", {
|
|
265
|
-
url: `http://localhost:${
|
|
266
|
-
msg: `sirviendo dist/ con reload en :${
|
|
290
|
+
url: `http://localhost:${webPortResolved}`,
|
|
291
|
+
msg: `sirviendo dist/ con reload en :${webPortResolved}` +
|
|
292
|
+
(webPortResolved !== base ? ` (:${base} ocupado)` : ""),
|
|
267
293
|
});
|
|
268
|
-
}
|
|
294
|
+
} else {
|
|
269
295
|
log("dev.web", {
|
|
270
|
-
ok: false, error: String(
|
|
271
|
-
msg: `
|
|
296
|
+
ok: false, error: String(lastErr?.message ?? lastErr),
|
|
297
|
+
msg: `ningún puerto libre en ${base}..${base + span - 1}` +
|
|
298
|
+
` — sigue el rebuild`,
|
|
272
299
|
});
|
|
273
300
|
}
|
|
274
301
|
}
|
|
@@ -387,8 +414,8 @@ function rebuild() {
|
|
|
387
414
|
restartSsrServer();
|
|
388
415
|
log("dev.build.end", {
|
|
389
416
|
ok: true, ms: Date.now() - t0,
|
|
390
|
-
port:
|
|
391
|
-
msg: `SSR rebuild + server reiniciado (:${
|
|
417
|
+
port: ssrPortResolved,
|
|
418
|
+
msg: `SSR rebuild + server reiniciado (:${ssrPortResolved})`
|
|
392
419
|
});
|
|
393
420
|
return;
|
|
394
421
|
}
|
|
@@ -398,9 +425,9 @@ function rebuild() {
|
|
|
398
425
|
broadcastReload();
|
|
399
426
|
log("dev.build.end", {
|
|
400
427
|
ok: true, ms: Date.now() - t0,
|
|
401
|
-
port: webServer ?
|
|
428
|
+
port: webServer ? webPortResolved : null,
|
|
402
429
|
msg: webServer
|
|
403
|
-
? `dist/ actualizado + reload (:${
|
|
430
|
+
? `dist/ actualizado + reload (:${webPortResolved})`
|
|
404
431
|
: "dist/ actualizado — refresca el navegador",
|
|
405
432
|
});
|
|
406
433
|
return;
|
|
@@ -543,6 +570,10 @@ log("dev.start", {
|
|
|
543
570
|
msg: `target=${target} app=${appEntry}${full ? " (full)" : ""}` +
|
|
544
571
|
`${devFast ? " (fast)" : ""}`
|
|
545
572
|
});
|
|
573
|
+
if (ssr && !strictPort) {
|
|
574
|
+
const free = await pickFreePort(Number(ssrPort));
|
|
575
|
+
if (free != null) ssrPortResolved = free;
|
|
576
|
+
}
|
|
546
577
|
rebuild();
|
|
547
578
|
|
|
548
579
|
let timer = null;
|
package/cli/inspect.mjs
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// elur inspect — overlay de inspección en dev (docs §3.16): cajas con
|
|
3
3
|
// el id del Display List sobre cada nodo + avisos strict.
|
|
4
4
|
//
|
|
5
|
-
// bun cli/elur.mjs inspect --target web --url http://localhost:
|
|
5
|
+
// bun cli/elur.mjs inspect --target web [--url http://localhost:3419/]
|
|
6
|
+
// (3419 = dev SPA; para el servidor SSR pasa --url …:3418)
|
|
6
7
|
// → imprime la URL con ?__inspect=1 (con --open la abre en Chrome)
|
|
7
8
|
// bun cli/elur.mjs inspect --target android [--serial id] \
|
|
8
9
|
// [--config examples/mareas/elur.app.json | --package <id.dev>] \
|
|
@@ -17,7 +18,7 @@ const opt = (n, d) => { const i = args.indexOf(`--${n}`); return i >= 0 && i + 1
|
|
|
17
18
|
const flag = (n) => args.includes(`--${n}`);
|
|
18
19
|
|
|
19
20
|
const target = opt("target", "web");
|
|
20
|
-
const url = opt("url", "http://localhost:
|
|
21
|
+
const url = opt("url", "http://localhost:3419/");
|
|
21
22
|
const serial = opt("serial", null);
|
|
22
23
|
// Mismo convenio que visual-parity: el dev host instala con
|
|
23
24
|
// <applicationId>.dev — --config evita lanzar el paquete de otra app.
|
package/cli/sdui.mjs
CHANGED
|
@@ -549,6 +549,8 @@ if (sub === "gateway") {
|
|
|
549
549
|
// POST /action → registra acciones de vuelta desde la app (a2ui.action / intents)
|
|
550
550
|
// GET /actions → devuelve cola reciente de acciones para inspección del agente
|
|
551
551
|
const port = Number(flag("port") ?? "8471");
|
|
552
|
+
// --strict-port fija el puerto; si no, se avanza hasta uno libre.
|
|
553
|
+
const strictPort = args.includes("--strict-port");
|
|
552
554
|
const docsDir = flag("dir");
|
|
553
555
|
const keyFile = flag("key");
|
|
554
556
|
const defaultKid = flag("kid") ?? "app";
|
|
@@ -633,6 +635,15 @@ if (sub === "gateway") {
|
|
|
633
635
|
const urlObj = new URL(req.url ?? "/", "http://127.0.0.1");
|
|
634
636
|
const pathname = urlObj.pathname;
|
|
635
637
|
|
|
638
|
+
if (req.method === "GET" &&
|
|
639
|
+
(pathname === "/" || pathname === "/favicon.ico")) {
|
|
640
|
+
return send(200, {
|
|
641
|
+
ok: true, rev,
|
|
642
|
+
rutas: "POST /serve | POST /publish | GET /poll | " +
|
|
643
|
+
"GET /stream | POST /action | GET /actions",
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
|
|
636
647
|
if (req.method === "GET" && pathname === "/poll") {
|
|
637
648
|
const since = Number(urlObj.searchParams.get("since") ?? "0");
|
|
638
649
|
if (rev > since && liveItem) {
|
|
@@ -886,11 +897,23 @@ if (sub === "gateway") {
|
|
|
886
897
|
});
|
|
887
898
|
}
|
|
888
899
|
});
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
900
|
+
const tryListen = (p, left) => {
|
|
901
|
+
srv.once("error", (e) => {
|
|
902
|
+
if (e?.code === "EADDRINUSE" && left > 0) {
|
|
903
|
+
console.error(`[sdui] :${p} ocupado — probando :${p + 1}`);
|
|
904
|
+
tryListen(p + 1, left - 1);
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
throw e;
|
|
908
|
+
});
|
|
909
|
+
srv.listen(p, () => {
|
|
910
|
+
console.error(`[sdui] gateway :${p} — POST /serve + /publish + GET /stream + /poll ` +
|
|
911
|
+
`${requireSig ? "(firma exigida)" : "(sin firma)"}` +
|
|
912
|
+
(docsDir ? ` almacén=${resolve(docsDir)}` : " (sin --dir: memoria/inline)") +
|
|
913
|
+
(p !== port ? ` (auto — :${port} ocupado)` : ""));
|
|
914
|
+
});
|
|
915
|
+
};
|
|
916
|
+
tryListen(port, strictPort ? 0 : 20);
|
|
894
917
|
}
|
|
895
918
|
|
|
896
919
|
if (sub === "mcp") {
|
|
@@ -87,7 +87,9 @@ Scripts del scaffold (`create-app.mjs`):
|
|
|
87
87
|
`http://localhost:3419` con SSE de auto-reload (ADR-0214) — cada
|
|
88
88
|
rebuild empuja `reload` a los navegadores conectados. `--ssr` cambia
|
|
89
89
|
al servidor SSR real en `:3418` (rebuild server+client y restart del
|
|
90
|
-
proceso bun).
|
|
90
|
+
proceso bun). Si el puerto está ocupado el dev busca el siguiente
|
|
91
|
+
libre (`3419→3420…`, hasta +20) — `--strict-port` lo fija y falla.
|
|
92
|
+
Igual en el gateway SDUI (`8471→8472…`).
|
|
91
93
|
- `bun run dev:android` → `elur dev --target android --app src/entry.ts`
|
|
92
94
|
(sin `--dev-fast`: cada ciclo genera además HBC/QJSC y los bundles de
|
|
93
95
|
verificación). Path caliente: `elur build --target android` →
|
|
@@ -147,7 +149,7 @@ Scripts del scaffold (`create-app.mjs`):
|
|
|
147
149
|
`targets/linux/generated/` (registrar/sources de módulos) **+ el
|
|
148
150
|
binario del host**: en Linux `build:linux` corre `cmake -B
|
|
149
151
|
node_modules/@elurjs/universal/targets/linux/build -S …/targets/linux`
|
|
150
|
-
|
|
152
|
+
`+` `cmake --build … -j4` → `node_modules/@elurjs/universal/targets/
|
|
151
153
|
linux/build/elur-linux`.
|
|
152
154
|
Distribución (ADR-0186): `bun cli/package-linux.mjs --format
|
|
153
155
|
appimage|deb|rpm|flatpak|all --app <bundle.js> --name n --title T
|