@almadar/shell-web 1.0.0 → 1.1.0
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/dist/AvlGlyph-PIXU6QH5.js +5 -0
- package/dist/AvlStateMachine-CKGMECMG.js +8 -0
- package/dist/{AvlTransitionDetail-63SD6GZF.js → AvlTransitionDetail-QZX6G5KJ.js} +4 -5
- package/dist/AvlTransitionExplainer-26WLEIC6.js +11 -0
- package/dist/BehaviorView-JLZ4PKWY.js +10 -0
- package/dist/{FileTree-BCFnBEuQ.d.ts → FileTree-B3GDAjaQ.d.ts} +131 -4
- package/dist/{FlowCanvas-AUMTWMNG.js → FlowCanvas-RPII4V24.js} +10 -13
- package/dist/{FlowCanvas-3JRMNJLV.css → FlowCanvas-VWUPMBKB.css} +189 -191
- package/dist/{GameAudioProvider-ceM_n0ey.d.ts → GameAudioProvider-D7wo5ryN.d.ts} +1 -1
- package/dist/{KernelEngineContext-CcxGYtlr.d.ts → KernelEngineContext-CPeWQMAz.d.ts} +15 -2
- package/dist/ModuleCard-NJD6JQGD.js +6 -0
- package/dist/{OrbInspector-QCPEPUPH.js → OrbInspector-OWWKPOBF.js} +10 -13
- package/dist/{OrbInspector-MHLJ6OEE.css → OrbInspector-VMTMZHNQ.css} +189 -191
- package/dist/{Select-B-iDdnvE.d.ts → Select-C2Uq6t86.d.ts} +1 -1
- package/dist/{UISlotRenderer-KVFO6J7R.css → UISlotRenderer-BIS6KT7T.css} +189 -191
- package/dist/{UISlotRenderer-C7WWOK43.js → UISlotRenderer-PY7FIJXN.js} +10 -13
- package/dist/avl/index.css +189 -191
- package/dist/avl/index.d.ts +19 -7
- package/dist/avl/index.js +157 -26
- package/dist/{chunk-TUPZWTRE.js → chunk-2WGR4TDJ.js} +464 -35
- package/dist/{chunk-SP5CDJ6K.js → chunk-4YJ53G7S.js} +3 -3
- package/dist/{chunk-HH5KSMH5.js → chunk-7N6ZPHQ5.js} +1 -1
- package/dist/{chunk-CPLN6NBQ.js → chunk-AGVSO4WY.js} +2 -3
- package/dist/{chunk-UXLE3IPR.js → chunk-FAKU5F62.js} +205 -4
- package/dist/{chunk-TXAUOLWZ.js → chunk-M74BCDBQ.js} +1 -1
- package/dist/{chunk-LHP2TK7O.js → chunk-MS4K3K2R.js} +2908 -4574
- package/dist/{chunk-K4MOPSEL.js → chunk-OWNG4JZI.js} +3 -4
- package/dist/{chunk-AB3X7QTE.js → chunk-PRLHKBXG.js} +1 -2
- package/dist/{chunk-X3DMMX27.js → chunk-VHC2M26B.js} +1 -1
- package/dist/{chunk-E6KA4J6N.js → chunk-VUIACGDU.js} +3 -4
- package/dist/{chunk-ROICKAU7.js → chunk-YYIHRIDH.js} +1 -1
- package/dist/{chunk-3VZ36ZKO.js → chunk-ZDRDJKYB.js} +5 -2
- package/dist/components/index.css +189 -191
- package/dist/components/index.d.ts +417 -173
- package/dist/components/index.js +14 -17
- package/dist/core.d.ts +3 -3
- package/dist/{fx-CmQjnHmT.d.ts → fx-Br8zjvu9.d.ts} +6 -6
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2 -2
- package/dist/{kernel-client-TZKGHJRY.js → kernel-client-JW6OH5FX.js} +24 -3
- package/dist/{kernel-wire-wNdAPfhJ.d.ts → kernel-wire-DGAySGhX.d.ts} +7 -0
- package/dist/lib/index.d.ts +2 -3
- package/dist/lib/index.js +2 -3
- package/dist/providers/index.css +189 -191
- package/dist/providers/index.d.ts +6 -8
- package/dist/providers/index.js +10 -14
- package/dist/runtime/index.css +189 -191
- package/dist/runtime/index.d.ts +6 -1
- package/dist/runtime/index.js +10 -13
- package/dist/test-support.js +2 -2
- package/dist/{paintDispatch-CuJLsr9Y.d.ts → verificationRegistry-oopV1J1n.d.ts} +127 -15
- package/package.json +8 -36
- package/dist/AvlGlyph-EPJKFEO3.js +0 -6
- package/dist/AvlStateMachine-RKZIKNGC.js +0 -9
- package/dist/AvlTransitionExplainer-ZBTLOM3T.js +0 -12
- package/dist/BehaviorView-YS5G4GNB.js +0 -11
- package/dist/Canvas3DHost-BkZQB5l2.d.ts +0 -552
- package/dist/ModuleCard-QHDGK5XK.js +0 -7
- package/dist/avl-3d-context-BycmO6tG.d.ts +0 -201
- package/dist/avl-schema-parser-CtJxJ9KU.d.ts +0 -132
- package/dist/avl-zoom-state-CKMVuBFg.d.ts +0 -17
- package/dist/chunk-4T3P43NS.js +0 -1133
- package/dist/chunk-DZBQA2OW.js +0 -176
- package/dist/chunk-EOWMARUB.js +0 -16
- package/dist/chunk-GFXCPUMX.js +0 -1334
- package/dist/chunk-ILZ7ORX7.js +0 -432
- package/dist/three/index.css +0 -503
- package/dist/three/index.d.ts +0 -1185
- package/dist/three/index.js +0 -3908
- package/dist/verificationRegistry-CVrcxG1s.d.ts +0 -122
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { perfStore, pushPerfEntry } from './chunk-
|
|
1
|
+
import { perfStore, pushPerfEntry } from './chunk-ZDRDJKYB.js';
|
|
2
2
|
import { isMotionEnabled } from './chunk-4YXBKHHM.js';
|
|
3
3
|
import { useRef, useLayoutEffect, useSyncExternalStore } from 'react';
|
|
4
4
|
import { ENTER_DELAY_STEPS, ENTER_ANIMATIONS, isFileValue } from '@almadar/core';
|
|
@@ -514,17 +514,27 @@ function middleSnake(a, aLo, aHi, b, bLo, bHi) {
|
|
|
514
514
|
}
|
|
515
515
|
throw new Error("computeLineDiff: no middle snake \u2014 unreachable for differing texts");
|
|
516
516
|
}
|
|
517
|
-
|
|
518
|
-
|
|
517
|
+
|
|
518
|
+
// src/lib/keyMapEvent.ts
|
|
519
|
+
function isEditableTarget(target) {
|
|
520
|
+
if (!(target instanceof HTMLElement)) return false;
|
|
521
|
+
const tag = target.tagName;
|
|
522
|
+
if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT") return true;
|
|
523
|
+
if (target.isContentEditable || target.contentEditable === "true") return true;
|
|
524
|
+
const attr = target.getAttribute("contenteditable");
|
|
525
|
+
return attr === "" || attr === "true" || attr === "plaintext-only";
|
|
526
|
+
}
|
|
527
|
+
function keyMapCode(e) {
|
|
528
|
+
let code = e.code;
|
|
529
|
+
if (e.altKey) code = `Alt+${code}`;
|
|
530
|
+
if (e.shiftKey) code = `Shift+${code}`;
|
|
531
|
+
if (e.metaKey || e.ctrlKey) code = `Mod+${code}`;
|
|
532
|
+
return code;
|
|
533
|
+
}
|
|
534
|
+
function resolveKeyMapEvent(map, e) {
|
|
535
|
+
if (!map || isEditableTarget(e.target)) return void 0;
|
|
536
|
+
return map[keyMapCode(e)] ?? map[e.code];
|
|
519
537
|
}
|
|
520
|
-
var profilerOnRender = (id, phase, actualDuration, baseDuration, _startTime, commitTime) => {
|
|
521
|
-
pushPerfEntry({
|
|
522
|
-
name: `profiler:${id}:${phase}`,
|
|
523
|
-
durationMs: actualDuration,
|
|
524
|
-
ts: commitTime,
|
|
525
|
-
detail: { baseDuration }
|
|
526
|
-
});
|
|
527
|
-
};
|
|
528
538
|
|
|
529
539
|
// src/lib/lessonSegmentUtils.ts
|
|
530
540
|
function parseMarkdownWithCodeBlocks(content) {
|
|
@@ -560,6 +570,414 @@ function resolveImageUrl(value) {
|
|
|
560
570
|
}
|
|
561
571
|
return void 0;
|
|
562
572
|
}
|
|
573
|
+
var log = createLogger("almadar:bridge");
|
|
574
|
+
var MAX_TRANSITIONS = 500;
|
|
575
|
+
function getState() {
|
|
576
|
+
if (typeof window !== "undefined") {
|
|
577
|
+
const w = window;
|
|
578
|
+
if (!w.__verificationRegistryState) {
|
|
579
|
+
w.__verificationRegistryState = {
|
|
580
|
+
checks: /* @__PURE__ */ new Map(),
|
|
581
|
+
transitions: [],
|
|
582
|
+
bridgeHealth: null,
|
|
583
|
+
listeners: /* @__PURE__ */ new Set(),
|
|
584
|
+
traitSnapshots: /* @__PURE__ */ new Map()
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
return w.__verificationRegistryState;
|
|
588
|
+
}
|
|
589
|
+
return {
|
|
590
|
+
checks: /* @__PURE__ */ new Map(),
|
|
591
|
+
transitions: [],
|
|
592
|
+
bridgeHealth: null,
|
|
593
|
+
listeners: /* @__PURE__ */ new Set(),
|
|
594
|
+
traitSnapshots: /* @__PURE__ */ new Map()
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
function notifyListeners() {
|
|
598
|
+
getState().listeners.forEach((l) => l());
|
|
599
|
+
exposeOnWindow();
|
|
600
|
+
}
|
|
601
|
+
function registerCheck(id, label, status = "pending", details) {
|
|
602
|
+
getState().checks.set(id, { id, label, status, details, updatedAt: Date.now() });
|
|
603
|
+
notifyListeners();
|
|
604
|
+
}
|
|
605
|
+
function updateCheck(id, status, details) {
|
|
606
|
+
const check = getState().checks.get(id);
|
|
607
|
+
if (check) {
|
|
608
|
+
check.status = status;
|
|
609
|
+
if (details !== void 0) check.details = details;
|
|
610
|
+
check.updatedAt = Date.now();
|
|
611
|
+
} else {
|
|
612
|
+
getState().checks.set(id, { id, label: id, status, details, updatedAt: Date.now() });
|
|
613
|
+
}
|
|
614
|
+
notifyListeners();
|
|
615
|
+
}
|
|
616
|
+
function getAllChecks() {
|
|
617
|
+
return Array.from(getState().checks.values());
|
|
618
|
+
}
|
|
619
|
+
function recordTransition(trace) {
|
|
620
|
+
const entry = {
|
|
621
|
+
...trace,
|
|
622
|
+
id: `t-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
|
|
623
|
+
};
|
|
624
|
+
log.debug("transition:recorded", { trait: trace.traitName, from: trace.from, to: trace.to, event: trace.event, effectCount: trace.effects.length });
|
|
625
|
+
getState().transitions.push(entry);
|
|
626
|
+
if (getState().transitions.length > MAX_TRANSITIONS) {
|
|
627
|
+
getState().transitions.shift();
|
|
628
|
+
}
|
|
629
|
+
if (entry.event === "INIT") {
|
|
630
|
+
const hasFetch = entry.effects.some((e) => e.type === "fetch");
|
|
631
|
+
const hasEntitySeed = entry.effects.some(
|
|
632
|
+
(e) => e.type === "set" && typeof e.args[0] === "string" && e.args[0].startsWith("@entity.")
|
|
633
|
+
);
|
|
634
|
+
const checkId = `init-fetch-${entry.traitName}`;
|
|
635
|
+
if (hasFetch || hasEntitySeed) {
|
|
636
|
+
registerCheck(
|
|
637
|
+
checkId,
|
|
638
|
+
`INIT transition for "${entry.traitName}" has fetch or entity-seed effect`,
|
|
639
|
+
"pass"
|
|
640
|
+
);
|
|
641
|
+
} else {
|
|
642
|
+
const rendersEntityData = entry.effects.some(
|
|
643
|
+
(e) => e.type === "render-ui" && JSON.stringify(e.args).includes("@entity.")
|
|
644
|
+
);
|
|
645
|
+
if (rendersEntityData) {
|
|
646
|
+
const siblingSeeds = getState().transitions.some(
|
|
647
|
+
(t) => t.event === "INIT" && t.effects.some(
|
|
648
|
+
(e) => e.type === "fetch" || e.type === "set" && typeof e.args[0] === "string" && e.args[0].startsWith("@entity.")
|
|
649
|
+
)
|
|
650
|
+
);
|
|
651
|
+
if (siblingSeeds) {
|
|
652
|
+
registerCheck(
|
|
653
|
+
checkId,
|
|
654
|
+
`INIT transition for "${entry.traitName}" has sibling entity-seed (shared entity)`,
|
|
655
|
+
"pass"
|
|
656
|
+
);
|
|
657
|
+
} else {
|
|
658
|
+
registerCheck(
|
|
659
|
+
checkId,
|
|
660
|
+
`INIT transition for "${entry.traitName}" missing fetch effect`,
|
|
661
|
+
"fail",
|
|
662
|
+
"Entity-bound render-ui without a fetch effect will show empty data"
|
|
663
|
+
);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
const failedEffects = entry.effects.filter((e) => e.status === "failed");
|
|
669
|
+
if (failedEffects.length > 0) {
|
|
670
|
+
registerCheck(
|
|
671
|
+
`effects-${entry.id}`,
|
|
672
|
+
`Effects failed in ${entry.traitName}: ${entry.from} -> ${entry.to}`,
|
|
673
|
+
"fail",
|
|
674
|
+
failedEffects.map((e) => `${e.type}: ${e.error}`).join("; ")
|
|
675
|
+
);
|
|
676
|
+
}
|
|
677
|
+
notifyListeners();
|
|
678
|
+
}
|
|
679
|
+
function getTransitions() {
|
|
680
|
+
return [...getState().transitions];
|
|
681
|
+
}
|
|
682
|
+
function getTransitionsForTrait(traitName) {
|
|
683
|
+
return getState().transitions.filter((t) => t.traitName === traitName);
|
|
684
|
+
}
|
|
685
|
+
function recordServerResponse(orbitalName, event, response) {
|
|
686
|
+
const { effectResults, ...responseFields } = response;
|
|
687
|
+
const serverResponse = {
|
|
688
|
+
...responseFields,
|
|
689
|
+
orbitalName,
|
|
690
|
+
timestamp: Date.now()
|
|
691
|
+
};
|
|
692
|
+
const entry = {
|
|
693
|
+
id: `srv-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
|
|
694
|
+
traitName: `server:${orbitalName}`,
|
|
695
|
+
from: "server",
|
|
696
|
+
to: "server",
|
|
697
|
+
event,
|
|
698
|
+
effects: effectResults ?? [],
|
|
699
|
+
serverResponse,
|
|
700
|
+
timestamp: Date.now()
|
|
701
|
+
};
|
|
702
|
+
getState().transitions.push(entry);
|
|
703
|
+
if (getState().transitions.length > MAX_TRANSITIONS) {
|
|
704
|
+
getState().transitions.shift();
|
|
705
|
+
}
|
|
706
|
+
if (!response.success && response.error) {
|
|
707
|
+
registerCheck(
|
|
708
|
+
`server-error-${entry.id}`,
|
|
709
|
+
`Server error for ${orbitalName}:${event}`,
|
|
710
|
+
"fail",
|
|
711
|
+
response.error
|
|
712
|
+
);
|
|
713
|
+
}
|
|
714
|
+
notifyListeners();
|
|
715
|
+
}
|
|
716
|
+
function serverEffectTraces(results) {
|
|
717
|
+
if (!results) return [];
|
|
718
|
+
return results.map((r) => {
|
|
719
|
+
const resultId = typeof r.data === "object" && r.data !== null && !Array.isArray(r.data) && "id" in r.data && typeof r.data.id === "string" ? r.data.id : void 0;
|
|
720
|
+
const outcome = r.denied ? "denied" : r.success ? "success" : "failed";
|
|
721
|
+
return {
|
|
722
|
+
type: r.effect,
|
|
723
|
+
...r.entityType !== void 0 ? { entityName: r.entityType } : {},
|
|
724
|
+
...r.action === "create" || r.action === "update" || r.action === "delete" || r.action === "batch" ? { action: r.action } : {},
|
|
725
|
+
...resultId !== void 0 ? { resultId } : {},
|
|
726
|
+
outcome,
|
|
727
|
+
args: [],
|
|
728
|
+
status: outcome === "success" ? "executed" : "failed",
|
|
729
|
+
...r.error !== void 0 ? { error: r.error } : {},
|
|
730
|
+
...r.target !== void 0 ? { target: r.target } : {},
|
|
731
|
+
...r.routed !== void 0 ? { routed: r.routed } : {}
|
|
732
|
+
};
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
function recordOrbitalResponse(orbitalName, request, response) {
|
|
736
|
+
recordServerResponse(orbitalName, request.event, {
|
|
737
|
+
success: response.success,
|
|
738
|
+
transitioned: response.transitioned,
|
|
739
|
+
emitted: response.emittedEvents.map((e) => ({ event: e.event, ...e.payload !== void 0 ? { payload: e.payload } : {} })),
|
|
740
|
+
emittedEvents: response.emittedEvents.map((e) => e.event),
|
|
741
|
+
clientEffects: response.clientEffectsByTrait?.length ?? 0,
|
|
742
|
+
dataEntities: Object.fromEntries(Object.entries(response.data ?? {}).map(([name, rows]) => [name, rows.length])),
|
|
743
|
+
...response.error !== void 0 ? { error: response.error } : {},
|
|
744
|
+
effectResults: serverEffectTraces(response.effectResults)
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
function recordingTransport(transport) {
|
|
748
|
+
const subscribe = transport.subscribe?.bind(transport);
|
|
749
|
+
const subscribeHostDispatches = transport.subscribeHostDispatches?.bind(transport);
|
|
750
|
+
return {
|
|
751
|
+
...transport.hostsBrowserStore !== void 0 ? { hostsBrowserStore: transport.hostsBrowserStore } : {},
|
|
752
|
+
register: (schema) => transport.register(schema),
|
|
753
|
+
unregister: () => transport.unregister(),
|
|
754
|
+
send: async (orbitalName, request) => {
|
|
755
|
+
const response = await transport.send(orbitalName, request);
|
|
756
|
+
recordOrbitalResponse(orbitalName, request, response);
|
|
757
|
+
return response;
|
|
758
|
+
},
|
|
759
|
+
...subscribe !== void 0 ? { subscribe } : {},
|
|
760
|
+
...subscribeHostDispatches !== void 0 ? { subscribeHostDispatches } : {}
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
function updateBridgeHealth(health) {
|
|
764
|
+
getState().bridgeHealth = { ...health };
|
|
765
|
+
const checkId = "server-bridge";
|
|
766
|
+
if (health.connected) {
|
|
767
|
+
registerCheck(checkId, "Server bridge connected", "pass");
|
|
768
|
+
} else {
|
|
769
|
+
registerCheck(
|
|
770
|
+
checkId,
|
|
771
|
+
"Server bridge disconnected",
|
|
772
|
+
"fail",
|
|
773
|
+
health.lastError || "Bridge is not connected"
|
|
774
|
+
);
|
|
775
|
+
}
|
|
776
|
+
notifyListeners();
|
|
777
|
+
}
|
|
778
|
+
function getBridgeHealth() {
|
|
779
|
+
const bh = getState().bridgeHealth;
|
|
780
|
+
return bh ? { ...bh } : null;
|
|
781
|
+
}
|
|
782
|
+
function getSummary() {
|
|
783
|
+
const allChecks = getAllChecks();
|
|
784
|
+
return {
|
|
785
|
+
totalChecks: allChecks.length,
|
|
786
|
+
passed: allChecks.filter((c) => c.status === "pass").length,
|
|
787
|
+
failed: allChecks.filter((c) => c.status === "fail").length,
|
|
788
|
+
warnings: allChecks.filter((c) => c.status === "warn").length,
|
|
789
|
+
pending: allChecks.filter((c) => c.status === "pending").length
|
|
790
|
+
};
|
|
791
|
+
}
|
|
792
|
+
function getSnapshot() {
|
|
793
|
+
return {
|
|
794
|
+
checks: getAllChecks(),
|
|
795
|
+
transitions: getTransitions(),
|
|
796
|
+
bridge: getBridgeHealth(),
|
|
797
|
+
summary: getSummary(),
|
|
798
|
+
traits: getTraitSnapshots()
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
function getTraitSnapshots() {
|
|
802
|
+
const snapshots = [];
|
|
803
|
+
for (const [traitName, getter] of getState().traitSnapshots.entries()) {
|
|
804
|
+
try {
|
|
805
|
+
snapshots.push(getter());
|
|
806
|
+
} catch (err) {
|
|
807
|
+
log.error("traitSnapshot getter failed", { trait: traitName, err: String(err) });
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
return snapshots;
|
|
811
|
+
}
|
|
812
|
+
function subscribeToVerification(listener) {
|
|
813
|
+
getState().listeners.add(listener);
|
|
814
|
+
return () => getState().listeners.delete(listener);
|
|
815
|
+
}
|
|
816
|
+
function defaultGetTraitState(traitName) {
|
|
817
|
+
const getter = getState().traitSnapshots.get(traitName);
|
|
818
|
+
if (getter === void 0) return void 0;
|
|
819
|
+
try {
|
|
820
|
+
return getter().currentState;
|
|
821
|
+
} catch {
|
|
822
|
+
return void 0;
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
function verifierAttached() {
|
|
826
|
+
return typeof window !== "undefined" && window.__ALMADAR_VERIFY__ === true;
|
|
827
|
+
}
|
|
828
|
+
function exposeOnWindow() {
|
|
829
|
+
if (typeof window === "undefined") return;
|
|
830
|
+
if (!window.__orbitalVerification) {
|
|
831
|
+
window.__orbitalVerification = {
|
|
832
|
+
getSnapshot,
|
|
833
|
+
getChecks: getAllChecks,
|
|
834
|
+
getTransitions,
|
|
835
|
+
getBridge: getBridgeHealth,
|
|
836
|
+
getSummary,
|
|
837
|
+
waitForTransition,
|
|
838
|
+
getTraitSnapshots,
|
|
839
|
+
getTraitState: defaultGetTraitState
|
|
840
|
+
};
|
|
841
|
+
} else {
|
|
842
|
+
if (!window.__orbitalVerification.getTraitSnapshots) {
|
|
843
|
+
window.__orbitalVerification.getTraitSnapshots = getTraitSnapshots;
|
|
844
|
+
}
|
|
845
|
+
if (!window.__orbitalVerification.getTraitState) {
|
|
846
|
+
window.__orbitalVerification.getTraitState = defaultGetTraitState;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
function waitForTransition(event, timeoutMs = 1e4) {
|
|
851
|
+
return new Promise((resolve) => {
|
|
852
|
+
const existing = getState().transitions.find((t) => t.event === event);
|
|
853
|
+
if (existing) {
|
|
854
|
+
resolve(existing);
|
|
855
|
+
return;
|
|
856
|
+
}
|
|
857
|
+
const timeout = setTimeout(() => {
|
|
858
|
+
unsub();
|
|
859
|
+
resolve(null);
|
|
860
|
+
}, timeoutMs);
|
|
861
|
+
const unsub = subscribeToVerification(() => {
|
|
862
|
+
const found = getState().transitions.find((t) => t.event === event);
|
|
863
|
+
if (found) {
|
|
864
|
+
clearTimeout(timeout);
|
|
865
|
+
unsub();
|
|
866
|
+
resolve(found);
|
|
867
|
+
}
|
|
868
|
+
});
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
function bindEventBus(eventBus) {
|
|
872
|
+
if (typeof window === "undefined") return;
|
|
873
|
+
log.info("bindEventBus", { hasOnAny: !!eventBus.onAny });
|
|
874
|
+
exposeOnWindow();
|
|
875
|
+
if (window.__orbitalVerification) {
|
|
876
|
+
window.__orbitalVerification.sendEvent = (event, payload, traitScope) => {
|
|
877
|
+
const prefixed = event.startsWith("UI:") ? event : traitScope ? `UI:${traitScope}.${event}` : `UI:${event}`;
|
|
878
|
+
log.debug("sendEvent", { event: prefixed, traitScope, payloadKeys: payload ? Object.keys(payload) : [] });
|
|
879
|
+
eventBus.emit(prefixed, payload);
|
|
880
|
+
};
|
|
881
|
+
const MAX_EVENT_LOG = 5e3;
|
|
882
|
+
const eventLog = [];
|
|
883
|
+
let eventLogDropped = 0;
|
|
884
|
+
const bumpEpoch = () => {
|
|
885
|
+
window.__orbitalVerification.eventLogEpoch = `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
886
|
+
};
|
|
887
|
+
window.__orbitalVerification.eventLog = eventLog;
|
|
888
|
+
window.__orbitalVerification.eventLogDropped = 0;
|
|
889
|
+
bumpEpoch();
|
|
890
|
+
window.__orbitalVerification.clearEventLog = () => {
|
|
891
|
+
eventLog.length = 0;
|
|
892
|
+
eventLogDropped = 0;
|
|
893
|
+
window.__orbitalVerification.eventLogDropped = 0;
|
|
894
|
+
bumpEpoch();
|
|
895
|
+
};
|
|
896
|
+
if (eventBus.onAny) {
|
|
897
|
+
const verificationRegistryEventLogger = (event) => {
|
|
898
|
+
eventLog.push({
|
|
899
|
+
type: event.type,
|
|
900
|
+
payload: event.payload,
|
|
901
|
+
...event.source === void 0 ? {} : { source: event.source },
|
|
902
|
+
timestamp: Date.now()
|
|
903
|
+
});
|
|
904
|
+
if (eventLog.length > MAX_EVENT_LOG) {
|
|
905
|
+
eventLog.shift();
|
|
906
|
+
eventLogDropped += 1;
|
|
907
|
+
window.__orbitalVerification.eventLogDropped = eventLogDropped;
|
|
908
|
+
}
|
|
909
|
+
};
|
|
910
|
+
Object.defineProperty(verificationRegistryEventLogger, "name", {
|
|
911
|
+
value: "verificationRegistry:eventLog"
|
|
912
|
+
});
|
|
913
|
+
eventBus.onAny(verificationRegistryEventLogger);
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
function bindConfigApplier(applyConfig) {
|
|
918
|
+
if (typeof window === "undefined") return () => {
|
|
919
|
+
};
|
|
920
|
+
exposeOnWindow();
|
|
921
|
+
const bridge = window.__orbitalVerification;
|
|
922
|
+
if (!bridge) return () => {
|
|
923
|
+
};
|
|
924
|
+
bridge.applyConfig = applyConfig;
|
|
925
|
+
return () => {
|
|
926
|
+
if (bridge.applyConfig === applyConfig) delete bridge.applyConfig;
|
|
927
|
+
};
|
|
928
|
+
}
|
|
929
|
+
function bindTraitStateGetter(getter) {
|
|
930
|
+
if (typeof window === "undefined") return;
|
|
931
|
+
exposeOnWindow();
|
|
932
|
+
if (window.__orbitalVerification) {
|
|
933
|
+
window.__orbitalVerification.getTraitState = getter;
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
function registerTraitSnapshot(traitName, getter) {
|
|
937
|
+
if (typeof window === "undefined") return () => {
|
|
938
|
+
};
|
|
939
|
+
getState().traitSnapshots.set(traitName, getter);
|
|
940
|
+
exposeOnWindow();
|
|
941
|
+
notifyListeners();
|
|
942
|
+
return () => {
|
|
943
|
+
const s = getState();
|
|
944
|
+
if (s.traitSnapshots.get(traitName) === getter) {
|
|
945
|
+
s.traitSnapshots.delete(traitName);
|
|
946
|
+
notifyListeners();
|
|
947
|
+
}
|
|
948
|
+
};
|
|
949
|
+
}
|
|
950
|
+
function bindCanvasCapture(captureFn) {
|
|
951
|
+
if (typeof window === "undefined") return;
|
|
952
|
+
exposeOnWindow();
|
|
953
|
+
if (window.__orbitalVerification) {
|
|
954
|
+
window.__orbitalVerification.captureFrame = captureFn;
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
function bindLastDrawables(getDrawables) {
|
|
958
|
+
if (typeof window === "undefined") return;
|
|
959
|
+
exposeOnWindow();
|
|
960
|
+
if (window.__orbitalVerification) {
|
|
961
|
+
window.__orbitalVerification.getLastDrawables = getDrawables;
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
function updateAssetStatus(url, status) {
|
|
965
|
+
if (typeof window === "undefined") return;
|
|
966
|
+
exposeOnWindow();
|
|
967
|
+
if (window.__orbitalVerification) {
|
|
968
|
+
if (!window.__orbitalVerification.assetStatus) {
|
|
969
|
+
window.__orbitalVerification.assetStatus = {};
|
|
970
|
+
}
|
|
971
|
+
window.__orbitalVerification.assetStatus[url] = status;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
function clearVerification() {
|
|
975
|
+
getState().checks.clear();
|
|
976
|
+
getState().transitions.length = 0;
|
|
977
|
+
getState().bridgeHealth = null;
|
|
978
|
+
notifyListeners();
|
|
979
|
+
}
|
|
980
|
+
exposeOnWindow();
|
|
563
981
|
|
|
564
982
|
// src/lib/parseContentSegments.ts
|
|
565
983
|
function tryParseOrbitalSchema(code) {
|
|
@@ -628,7 +1046,7 @@ function parseContentSegments(content) {
|
|
|
628
1046
|
return segments;
|
|
629
1047
|
}
|
|
630
1048
|
var NAMESPACE = "almadar:ui:debug";
|
|
631
|
-
var
|
|
1049
|
+
var log2 = createLogger(NAMESPACE);
|
|
632
1050
|
var inputLog = createLogger("almadar:ui:debug:input");
|
|
633
1051
|
var collisionLog = createLogger("almadar:ui:debug:collision");
|
|
634
1052
|
var physicsLog = createLogger("almadar:ui:debug:physics");
|
|
@@ -644,9 +1062,9 @@ function debug(...args) {
|
|
|
644
1062
|
const [first, ...rest] = args;
|
|
645
1063
|
const message = typeof first === "string" ? first : "<debug>";
|
|
646
1064
|
if (rest.length === 0 && typeof first === "string") {
|
|
647
|
-
|
|
1065
|
+
log2.debug(message);
|
|
648
1066
|
} else {
|
|
649
|
-
|
|
1067
|
+
log2.debug(message, { args: rest.length > 0 ? formatArgs(rest) : formatArgs([first]) });
|
|
650
1068
|
}
|
|
651
1069
|
}
|
|
652
1070
|
function debugGroup(label) {
|
|
@@ -659,13 +1077,13 @@ function debugWarn(...args) {
|
|
|
659
1077
|
if (!gateEnabled("WARN")) return;
|
|
660
1078
|
const [first, ...rest] = args;
|
|
661
1079
|
const message = typeof first === "string" ? first : "<warn>";
|
|
662
|
-
|
|
1080
|
+
log2.warn(message, rest.length > 0 ? { args: formatArgs(rest) } : void 0);
|
|
663
1081
|
}
|
|
664
1082
|
function debugError(...args) {
|
|
665
1083
|
if (!gateEnabled("ERROR")) return;
|
|
666
1084
|
const [first, ...rest] = args;
|
|
667
1085
|
const message = typeof first === "string" ? first : "<error>";
|
|
668
|
-
|
|
1086
|
+
log2.error(message, rest.length > 0 ? { args: formatArgs(rest) } : void 0);
|
|
669
1087
|
}
|
|
670
1088
|
function debugTable(data) {
|
|
671
1089
|
if (gateEnabled("DEBUG")) console.table(data);
|
|
@@ -715,19 +1133,19 @@ function toLogMetaValue(v) {
|
|
|
715
1133
|
// src/lib/traitRegistry.ts
|
|
716
1134
|
var traits = /* @__PURE__ */ new Map();
|
|
717
1135
|
var listeners = /* @__PURE__ */ new Set();
|
|
718
|
-
function
|
|
1136
|
+
function notifyListeners2() {
|
|
719
1137
|
listeners.forEach((listener) => listener());
|
|
720
1138
|
}
|
|
721
1139
|
function registerTrait(info) {
|
|
722
1140
|
traits.set(info.id, info);
|
|
723
|
-
|
|
1141
|
+
notifyListeners2();
|
|
724
1142
|
}
|
|
725
1143
|
function updateTraitState(id, newState) {
|
|
726
1144
|
const trait = traits.get(id);
|
|
727
1145
|
if (trait) {
|
|
728
1146
|
trait.currentState = newState;
|
|
729
1147
|
trait.transitionCount++;
|
|
730
|
-
|
|
1148
|
+
notifyListeners2();
|
|
731
1149
|
}
|
|
732
1150
|
}
|
|
733
1151
|
function updateGuardResult(traitId, guardName, result) {
|
|
@@ -736,13 +1154,13 @@ function updateGuardResult(traitId, guardName, result) {
|
|
|
736
1154
|
const guard = trait.guards.find((g) => g.name === guardName);
|
|
737
1155
|
if (guard) {
|
|
738
1156
|
guard.lastResult = result;
|
|
739
|
-
|
|
1157
|
+
notifyListeners2();
|
|
740
1158
|
}
|
|
741
1159
|
}
|
|
742
1160
|
}
|
|
743
1161
|
function unregisterTrait(id) {
|
|
744
1162
|
traits.delete(id);
|
|
745
|
-
|
|
1163
|
+
notifyListeners2();
|
|
746
1164
|
}
|
|
747
1165
|
function getAllTraits() {
|
|
748
1166
|
return Array.from(traits.values());
|
|
@@ -756,18 +1174,29 @@ function subscribeToTraitChanges(listener) {
|
|
|
756
1174
|
}
|
|
757
1175
|
function clearTraits() {
|
|
758
1176
|
traits.clear();
|
|
759
|
-
|
|
1177
|
+
notifyListeners2();
|
|
760
1178
|
}
|
|
1179
|
+
function usePerfBuffer() {
|
|
1180
|
+
return useSyncExternalStore(perfStore.subscribe, perfStore.getSnapshot, perfStore.getSnapshot);
|
|
1181
|
+
}
|
|
1182
|
+
var profilerOnRender = (id, phase, actualDuration, baseDuration, _startTime, commitTime) => {
|
|
1183
|
+
pushPerfEntry({
|
|
1184
|
+
name: `profiler:${id}:${phase}`,
|
|
1185
|
+
durationMs: actualDuration,
|
|
1186
|
+
ts: commitTime,
|
|
1187
|
+
detail: { baseDuration }
|
|
1188
|
+
});
|
|
1189
|
+
};
|
|
761
1190
|
|
|
762
1191
|
// src/lib/tickRegistry.ts
|
|
763
1192
|
var ticks = /* @__PURE__ */ new Map();
|
|
764
1193
|
var listeners2 = /* @__PURE__ */ new Set();
|
|
765
|
-
function
|
|
1194
|
+
function notifyListeners3() {
|
|
766
1195
|
listeners2.forEach((listener) => listener());
|
|
767
1196
|
}
|
|
768
1197
|
function registerTick(tick) {
|
|
769
1198
|
ticks.set(tick.id, tick);
|
|
770
|
-
|
|
1199
|
+
notifyListeners3();
|
|
771
1200
|
}
|
|
772
1201
|
function updateTickExecution(id, timestamp) {
|
|
773
1202
|
const tick = ticks.get(id);
|
|
@@ -775,19 +1204,19 @@ function updateTickExecution(id, timestamp) {
|
|
|
775
1204
|
tick.lastExecuted = timestamp;
|
|
776
1205
|
tick.nextExecution = timestamp + tick.interval;
|
|
777
1206
|
tick.executionCount++;
|
|
778
|
-
|
|
1207
|
+
notifyListeners3();
|
|
779
1208
|
}
|
|
780
1209
|
}
|
|
781
1210
|
function setTickActive(id, isActive) {
|
|
782
1211
|
const tick = ticks.get(id);
|
|
783
1212
|
if (tick) {
|
|
784
1213
|
tick.isActive = isActive;
|
|
785
|
-
|
|
1214
|
+
notifyListeners3();
|
|
786
1215
|
}
|
|
787
1216
|
}
|
|
788
1217
|
function unregisterTick(id) {
|
|
789
1218
|
ticks.delete(id);
|
|
790
|
-
|
|
1219
|
+
notifyListeners3();
|
|
791
1220
|
}
|
|
792
1221
|
function getAllTicks() {
|
|
793
1222
|
return Array.from(ticks.values());
|
|
@@ -801,14 +1230,14 @@ function subscribeToTickChanges(listener) {
|
|
|
801
1230
|
}
|
|
802
1231
|
function clearTicks() {
|
|
803
1232
|
ticks.clear();
|
|
804
|
-
|
|
1233
|
+
notifyListeners3();
|
|
805
1234
|
}
|
|
806
1235
|
|
|
807
1236
|
// src/lib/guardRegistry.ts
|
|
808
1237
|
var guardHistory = [];
|
|
809
1238
|
var listeners3 = /* @__PURE__ */ new Set();
|
|
810
1239
|
var MAX_HISTORY = 100;
|
|
811
|
-
function
|
|
1240
|
+
function notifyListeners4() {
|
|
812
1241
|
listeners3.forEach((listener) => listener());
|
|
813
1242
|
}
|
|
814
1243
|
function recordGuardEvaluation(evaluation) {
|
|
@@ -821,7 +1250,7 @@ function recordGuardEvaluation(evaluation) {
|
|
|
821
1250
|
if (guardHistory.length > MAX_HISTORY) {
|
|
822
1251
|
guardHistory.pop();
|
|
823
1252
|
}
|
|
824
|
-
|
|
1253
|
+
notifyListeners4();
|
|
825
1254
|
}
|
|
826
1255
|
function getGuardHistory() {
|
|
827
1256
|
return [...guardHistory];
|
|
@@ -838,7 +1267,7 @@ function subscribeToGuardChanges(listener) {
|
|
|
838
1267
|
}
|
|
839
1268
|
function clearGuardHistory() {
|
|
840
1269
|
guardHistory.length = 0;
|
|
841
|
-
|
|
1270
|
+
notifyListeners4();
|
|
842
1271
|
}
|
|
843
1272
|
|
|
844
1273
|
// src/lib/entityDebug.ts
|
|
@@ -880,7 +1309,7 @@ function getEntitiesByType(type) {
|
|
|
880
1309
|
var events = [];
|
|
881
1310
|
var listeners4 = /* @__PURE__ */ new Set();
|
|
882
1311
|
var MAX_EVENTS = 500;
|
|
883
|
-
function
|
|
1312
|
+
function notifyListeners5() {
|
|
884
1313
|
listeners4.forEach((listener) => listener());
|
|
885
1314
|
}
|
|
886
1315
|
function logDebugEvent(type, source, message, data) {
|
|
@@ -896,7 +1325,7 @@ function logDebugEvent(type, source, message, data) {
|
|
|
896
1325
|
if (events.length > MAX_EVENTS) {
|
|
897
1326
|
events.pop();
|
|
898
1327
|
}
|
|
899
|
-
|
|
1328
|
+
notifyListeners5();
|
|
900
1329
|
}
|
|
901
1330
|
function logStateChange(source, from, to, event) {
|
|
902
1331
|
logDebugEvent("state-change", source, `${from} \u2192 ${to}`, { from, to, event: event ?? null });
|
|
@@ -934,7 +1363,7 @@ function subscribeToDebugEvents(listener) {
|
|
|
934
1363
|
}
|
|
935
1364
|
function clearDebugEvents() {
|
|
936
1365
|
events.length = 0;
|
|
937
|
-
|
|
1366
|
+
notifyListeners5();
|
|
938
1367
|
}
|
|
939
1368
|
|
|
940
1369
|
// src/lib/debugUtils.ts
|
|
@@ -1048,4 +1477,4 @@ function parseLessonSegments(lesson) {
|
|
|
1048
1477
|
return segments;
|
|
1049
1478
|
}
|
|
1050
1479
|
|
|
1051
|
-
export { EDITOR_MOTIONS, EDITOR_OPERATORS, ENTER_SLOT_CLASS, INDENT_UNIT, MAX_ENTER_DELAY, applyMotion, applyOperator, asEnterAnimation, clearDebugEvents, clearEntityProvider, clearGuardHistory, clearTicks, clearTraits, computeLineDiff, debug, debugCollision, debugError, debugGameState, debugGroup, debugGroupEnd, debugInput, debugPhysics, debugTable, debugTime, debugTimeEnd, debugWarn, enterClassName, getAllTicks, getAllTraits, getDebugEvents, getEntitiesByType, getEntityById, getEntitySnapshot, getEventsBySource, getEventsByType, getGuardEvaluationsForTrait, getGuardHistory, getRecentEvents, getRecentGuardEvaluations, getTick, getTrait, initDebugShortcut, isDebugEnabled, isDebugEnabled2, isEditorMotion, isEditorOperator, logDebugEvent, logEffectExecuted, logError, logEventFired, logInfo, logStateChange, logWarning, motionRange, onDebugToggle, parseContentSegments, parseLessonSegments, parseMarkdownWithCodeBlocks, parseMarkdownWithCodeBlocks2, profilerOnRender, recordGuardEvaluation, registerTick, registerTrait, resolveImageUrl, setDebugEnabled, setEntityProvider, setTickActive, slotPlaysDefaultEnter, subscribeToDebugEvents, subscribeToGuardChanges, subscribeToTickChanges, subscribeToTraitChanges, toggleDebug, unregisterTick, unregisterTrait, updateGuardResult, updateTickExecution, updateTraitState, usePerfBuffer, useSlotEnterRestart };
|
|
1480
|
+
export { EDITOR_MOTIONS, EDITOR_OPERATORS, ENTER_SLOT_CLASS, INDENT_UNIT, MAX_ENTER_DELAY, applyMotion, applyOperator, asEnterAnimation, bindCanvasCapture, bindConfigApplier, bindEventBus, bindLastDrawables, bindTraitStateGetter, clearDebugEvents, clearEntityProvider, clearGuardHistory, clearTicks, clearTraits, clearVerification, computeLineDiff, debug, debugCollision, debugError, debugGameState, debugGroup, debugGroupEnd, debugInput, debugPhysics, debugTable, debugTime, debugTimeEnd, debugWarn, enterClassName, getAllChecks, getAllTicks, getAllTraits, getBridgeHealth, getDebugEvents, getEntitiesByType, getEntityById, getEntitySnapshot, getEventsBySource, getEventsByType, getGuardEvaluationsForTrait, getGuardHistory, getRecentEvents, getRecentGuardEvaluations, getSnapshot, getSummary, getTick, getTrait, getTraitSnapshots, getTransitions, getTransitionsForTrait, initDebugShortcut, isDebugEnabled, isDebugEnabled2, isEditableTarget, isEditorMotion, isEditorOperator, keyMapCode, logDebugEvent, logEffectExecuted, logError, logEventFired, logInfo, logStateChange, logWarning, motionRange, onDebugToggle, parseContentSegments, parseLessonSegments, parseMarkdownWithCodeBlocks, parseMarkdownWithCodeBlocks2, profilerOnRender, recordGuardEvaluation, recordOrbitalResponse, recordServerResponse, recordTransition, recordingTransport, registerCheck, registerTick, registerTrait, registerTraitSnapshot, resolveImageUrl, resolveKeyMapEvent, serverEffectTraces, setDebugEnabled, setEntityProvider, setTickActive, slotPlaysDefaultEnter, subscribeToDebugEvents, subscribeToGuardChanges, subscribeToTickChanges, subscribeToTraitChanges, subscribeToVerification, toggleDebug, unregisterTick, unregisterTrait, updateAssetStatus, updateBridgeHealth, updateCheck, updateGuardResult, updateTickExecution, updateTraitState, usePerfBuffer, useSlotEnterRestart, verifierAttached, waitForTransition };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useContainerWidth, computeTraitLayout, roundedEdgePath } from './chunk-
|
|
2
|
-
import { AvlExplain, AvlEffectChip } from './chunk-
|
|
1
|
+
import { useContainerWidth, computeTraitLayout, roundedEdgePath } from './chunk-M74BCDBQ.js';
|
|
2
|
+
import { AvlExplain, AvlEffectChip } from './chunk-PRLHKBXG.js';
|
|
3
|
+
import { AVL_INK, AVL_FONT, AVL_STROKE, avlTint } from './chunk-FAKU5F62.js';
|
|
3
4
|
import { gearTeethPath } from './chunk-TZZBINQY.js';
|
|
4
|
-
import { AVL_INK, AVL_FONT, AVL_STROKE, avlTint } from './chunk-UXLE3IPR.js';
|
|
5
5
|
import { domPassthrough, useTranslate, useEventBus, useMediaQuery, Box, Typography, Button } from './chunk-4YXBKHHM.js';
|
|
6
6
|
import { useState, useRef, useMemo, useEffect } from 'react';
|
|
7
7
|
import { formatSExpr } from '@almadar/core';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { AvlFieldType, AvlState, AvlPage, AvlEntity } from './chunk-
|
|
2
|
-
import { AvlEffect } from './chunk-
|
|
3
|
-
import { OPERATOR_CATEGORY_COLORS } from './chunk-UXLE3IPR.js';
|
|
1
|
+
import { AvlFieldType, AvlState, AvlPage, AvlEntity } from './chunk-7N6ZPHQ5.js';
|
|
2
|
+
import { OPERATOR_CATEGORY_COLORS, AvlEffect } from './chunk-FAKU5F62.js';
|
|
4
3
|
import { useTranslate, Box, Typography, domPassthrough } from './chunk-4YXBKHHM.js';
|
|
5
4
|
import React, { useRef, useState, useLayoutEffect } from 'react';
|
|
6
5
|
import { jsxs, jsx } from 'react/jsx-runtime';
|