@elurjs/universal 0.1.13 → 0.1.14
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 +106 -76
- package/cli/inspect.mjs +3 -2
- package/cli/sdui.mjs +19 -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 */ });
|
|
@@ -190,85 +206,95 @@ function withReloadScript(html) {
|
|
|
190
206
|
? html.replace("</body>", script + "</body>")
|
|
191
207
|
: html + script;
|
|
192
208
|
}
|
|
193
|
-
function
|
|
194
|
-
if (ssr || target !== "web" || noServe || webServer) return;
|
|
209
|
+
async function webFetch(req) {
|
|
195
210
|
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",
|
|
211
|
+
const url = new URL(req.url);
|
|
212
|
+
if (url.pathname === "/__elur_dev") {
|
|
213
|
+
let entry = null;
|
|
214
|
+
const stream = new ReadableStream({
|
|
215
|
+
start(controller) {
|
|
216
|
+
entry = {
|
|
217
|
+
send(msg) {
|
|
218
|
+
try {
|
|
219
|
+
controller.enqueue(
|
|
220
|
+
webEncoder.encode(`data: ${msg}\n\n`));
|
|
221
|
+
} catch { /* cliente cerrado */ }
|
|
222
|
+
},
|
|
223
|
+
close() {
|
|
224
|
+
try { controller.close(); } catch { }
|
|
260
225
|
},
|
|
226
|
+
};
|
|
227
|
+
webClients.add(entry);
|
|
228
|
+
entry.send("connected");
|
|
229
|
+
req.signal?.addEventListener("abort", () => {
|
|
230
|
+
if (entry) webClients.delete(entry);
|
|
231
|
+
entry?.close();
|
|
261
232
|
});
|
|
262
233
|
},
|
|
234
|
+
cancel() {
|
|
235
|
+
if (entry) webClients.delete(entry);
|
|
236
|
+
},
|
|
237
|
+
});
|
|
238
|
+
return new Response(stream, {
|
|
239
|
+
headers: {
|
|
240
|
+
"content-type": "text/event-stream",
|
|
241
|
+
"cache-control": "no-cache",
|
|
242
|
+
"connection": "keep-alive",
|
|
243
|
+
},
|
|
263
244
|
});
|
|
245
|
+
}
|
|
246
|
+
let pathname = decodeURIComponent(url.pathname);
|
|
247
|
+
if (pathname === "/" || pathname.endsWith("/")) {
|
|
248
|
+
pathname += "index.html";
|
|
249
|
+
}
|
|
250
|
+
const targetFile = resolve(dist, "." + pathname);
|
|
251
|
+
if (targetFile !== dist &&
|
|
252
|
+
!targetFile.startsWith(dist + sep)) {
|
|
253
|
+
return new Response("forbidden", { status: 403 });
|
|
254
|
+
}
|
|
255
|
+
const fallback = join(dist, "index.html");
|
|
256
|
+
const file = existsSync(targetFile) ? targetFile : fallback;
|
|
257
|
+
if (!existsSync(file)) {
|
|
258
|
+
return new Response("not found", { status: 404 });
|
|
259
|
+
}
|
|
260
|
+
if (file.endsWith(".html")) {
|
|
261
|
+
return new Response(
|
|
262
|
+
withReloadScript(readFileSync(file, "utf8")),
|
|
263
|
+
{ headers: { "content-type": WEB_MIME[".html"] } });
|
|
264
|
+
}
|
|
265
|
+
const ext = file.slice(file.lastIndexOf("."));
|
|
266
|
+
return new Response(Bun.file(file), {
|
|
267
|
+
headers: {
|
|
268
|
+
"content-type": WEB_MIME[ext] ?? "application/octet-stream",
|
|
269
|
+
},
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
let webPortResolved = Number(webPort);
|
|
273
|
+
function startWebServer() {
|
|
274
|
+
if (ssr || target !== "web" || noServe || webServer) return;
|
|
275
|
+
const dist = WEB_DIST();
|
|
276
|
+
if (!existsSync(dist)) return;
|
|
277
|
+
const base = Number(webPort);
|
|
278
|
+
const span = strictPort ? 1 : 20;
|
|
279
|
+
let lastErr = null;
|
|
280
|
+
for (let p = base; p < base + span; p++) {
|
|
281
|
+
try {
|
|
282
|
+
webServer = Bun.serve({ port: p, fetch: webFetch });
|
|
283
|
+
webPortResolved = p;
|
|
284
|
+
break;
|
|
285
|
+
} catch (e) { lastErr = e; }
|
|
286
|
+
}
|
|
287
|
+
if (webServer) {
|
|
264
288
|
log("dev.web", {
|
|
265
|
-
url: `http://localhost:${
|
|
266
|
-
msg: `sirviendo dist/ con reload en :${
|
|
289
|
+
url: `http://localhost:${webPortResolved}`,
|
|
290
|
+
msg: `sirviendo dist/ con reload en :${webPortResolved}` +
|
|
291
|
+
(webPortResolved !== base ? ` (:${base} ocupado)` : ""),
|
|
267
292
|
});
|
|
268
|
-
}
|
|
293
|
+
} else {
|
|
269
294
|
log("dev.web", {
|
|
270
|
-
ok: false, error: String(
|
|
271
|
-
msg: `
|
|
295
|
+
ok: false, error: String(lastErr?.message ?? lastErr),
|
|
296
|
+
msg: `ningún puerto libre en ${base}..${base + span - 1}` +
|
|
297
|
+
` — sigue el rebuild`,
|
|
272
298
|
});
|
|
273
299
|
}
|
|
274
300
|
}
|
|
@@ -387,8 +413,8 @@ function rebuild() {
|
|
|
387
413
|
restartSsrServer();
|
|
388
414
|
log("dev.build.end", {
|
|
389
415
|
ok: true, ms: Date.now() - t0,
|
|
390
|
-
port:
|
|
391
|
-
msg: `SSR rebuild + server reiniciado (:${
|
|
416
|
+
port: ssrPortResolved,
|
|
417
|
+
msg: `SSR rebuild + server reiniciado (:${ssrPortResolved})`
|
|
392
418
|
});
|
|
393
419
|
return;
|
|
394
420
|
}
|
|
@@ -398,9 +424,9 @@ function rebuild() {
|
|
|
398
424
|
broadcastReload();
|
|
399
425
|
log("dev.build.end", {
|
|
400
426
|
ok: true, ms: Date.now() - t0,
|
|
401
|
-
port: webServer ?
|
|
427
|
+
port: webServer ? webPortResolved : null,
|
|
402
428
|
msg: webServer
|
|
403
|
-
? `dist/ actualizado + reload (:${
|
|
429
|
+
? `dist/ actualizado + reload (:${webPortResolved})`
|
|
404
430
|
: "dist/ actualizado — refresca el navegador",
|
|
405
431
|
});
|
|
406
432
|
return;
|
|
@@ -543,6 +569,10 @@ log("dev.start", {
|
|
|
543
569
|
msg: `target=${target} app=${appEntry}${full ? " (full)" : ""}` +
|
|
544
570
|
`${devFast ? " (fast)" : ""}`
|
|
545
571
|
});
|
|
572
|
+
if (ssr && !strictPort) {
|
|
573
|
+
const free = await pickFreePort(Number(ssrPort));
|
|
574
|
+
if (free != null) ssrPortResolved = free;
|
|
575
|
+
}
|
|
546
576
|
rebuild();
|
|
547
577
|
|
|
548
578
|
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";
|
|
@@ -886,11 +888,23 @@ if (sub === "gateway") {
|
|
|
886
888
|
});
|
|
887
889
|
}
|
|
888
890
|
});
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
891
|
+
const tryListen = (p, left) => {
|
|
892
|
+
srv.once("error", (e) => {
|
|
893
|
+
if (e?.code === "EADDRINUSE" && left > 0) {
|
|
894
|
+
console.error(`[sdui] :${p} ocupado — probando :${p + 1}`);
|
|
895
|
+
tryListen(p + 1, left - 1);
|
|
896
|
+
return;
|
|
897
|
+
}
|
|
898
|
+
throw e;
|
|
899
|
+
});
|
|
900
|
+
srv.listen(p, () => {
|
|
901
|
+
console.error(`[sdui] gateway :${p} — POST /serve + /publish + GET /stream + /poll ` +
|
|
902
|
+
`${requireSig ? "(firma exigida)" : "(sin firma)"}` +
|
|
903
|
+
(docsDir ? ` almacén=${resolve(docsDir)}` : " (sin --dir: memoria/inline)") +
|
|
904
|
+
(p !== port ? ` (auto — :${port} ocupado)` : ""));
|
|
905
|
+
});
|
|
906
|
+
};
|
|
907
|
+
tryListen(port, strictPort ? 0 : 20);
|
|
894
908
|
}
|
|
895
909
|
|
|
896
910
|
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
|