[118] Kern: Neustart nach Panic, Projekt aus der Leseansicht wiederhergestellt

core() hüllt alle Kern-Exporte; ein WASM-Trap baut sofort eine frische Instanz
(__dossier_reinit, ergänzt von scripts/build-core.mjs), alle ProjectDocuments
öffnen sich aus ihrer Leseansicht neu, Kern-Handles gelten über coreEpoch() als
ungültig. Der Aufruf wirft CoreTrapError (keine Wiederholung); die Hülle legt
eine Autosave-Kopie an und meldet (Verlauf geleert). Test über verstecktes
__debug_panic.
This commit is contained in:
Claude committed 2026-11-03 17:44:12 +00:00
1 parent bb3d9ede38
commit d9ee776618
17 files changed
+383 -13

No files matched your search

+6 -3
View File
@@ -11,7 +11,7 @@ import type { Vec2 } from "../../model/types";
import type { Plan, Primitive } from "../generatePlan";
import { heldSegs, planParts } from "../planParts";
import { planPrimAt } from "../planLazy";
import { core } from "../../engine/coreWasm";
import { core, coreEpoch } from "../../engine/coreWasm";
import type { ModelRect } from "./geometry";
/** Pick-Felder eines Primitivs (Besitzer-Ids). */
@@ -77,6 +77,8 @@ const splitIds = (s: string): string[] => (s ? s.split("\0").slice(1) : []);
export class PlanPickIndex {
private id = 0;
/** Kern-Epoche des Index (nach einem Kern-Neustart neu bauen, [118]). */
private epoch = 0;
constructor(readonly plan: Plan) {}
@@ -87,7 +89,8 @@ export class PlanPickIndex {
/** Kern-Index (lazy beim ersten Abfragen gebaut). Texte/Bilder mit JSON (Rahmen-Treffer). */
private ix(): number {
if (this.id) return this.id;
if (this.id && this.epoch === coreEpoch()) return this.id;
this.epoch = coreEpoch();
const c = core();
const parts = planParts(this.plan, true);
this.id = c.pick_index_build(heldSegs(parts, false));
@@ -97,7 +100,7 @@ export class PlanPickIndex {
/** Kern-Index freigeben (danach baut eine Abfrage ihn neu). */
release(): void {
if (this.id) core().pick_index_release(this.id);
if (this.id && this.epoch === coreEpoch()) core().pick_index_release(this.id);
this.id = 0;
}