@descix/frqtl-web 0.6.0-p4.1 → 0.6.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/CLAUDE.md +15 -11
- package/README.md +26 -6
- package/dist/artifact/double-slit.html +2 -2
- package/dist/dist-manifest.json +61 -60
- package/dist/experiments/empty/index.html +22 -7
- package/dist/frqtl/compat/providers/wasm-engine.js +3 -4
- package/dist/frqtl/compat/renderer/providers/p5-provider.js +1 -1
- package/dist/frqtl/objects/FrqtlApp.js +5 -5
- package/dist/frqtl/objects/RecipeContext.js +106 -1
- package/dist/frqtl/objects/constants/WallBehaviors.js +1 -1
- package/dist/frqtl/objects/instruments/capture.js +1 -24
- package/dist/frqtl/objects/instruments/hosted-eyes.js +17 -1
- package/dist/frqtl/objects/objects/makeControlsForObject.js +5 -5
- package/dist/frqtl/objects/record/Record.js +25 -5
- package/dist/frqtl/objects/schema/engine-scopes.js +2 -2
- package/dist/frqtl/objects/schema/scopes.js +2 -2
- package/dist/frqtl/objects/setup/_worldInit.js +1 -2
- package/dist/frqtl/objects/setup/setupBlackbodySubstrate.js +1 -2
- package/dist/frqtl/parts/CameraControls.js +8 -0
- package/dist/frqtl/parts/DetectorWall.js +1 -1
- package/dist/frqtl/parts/GraphingDetectorWall.js +7 -7
- package/dist/frqtl/parts/LargeObject.js +2 -2
- package/dist/frqtl/parts/LiveChart.js +2 -2
- package/dist/frqtl/parts/LogicGate.js +3 -3
- package/dist/frqtl/parts/OvenBox.js +1 -1
- package/dist/frqtl/parts/PointSource.js +1 -1
- package/dist/frqtl/parts/SlitLightSource.js +1 -1
- package/dist/frqtl/parts/SlitScreen.js +1 -1
- package/dist/frqtl/parts/SphereEmitter.js +12 -12
- package/dist/frqtl/parts/Trace.js +1 -1
- package/dist/frqtl/parts/Tunnel.js +11 -11
- package/dist/frqtl/parts/Wall.js +20 -10
- package/dist/frqtl/scenes/circuit-sat.js +1 -0
- package/dist/frqtl/scenes/dse-one-emitter.js +32 -34
- package/dist/frqtl/scenes/dse-two-emitters.js +33 -34
- package/dist/frqtl/scenes/mirror-route.js +96 -79
- package/dist/frqtl-web.min.js +54 -54
- package/dist/sdk.html +2 -2
- package/dist/shim/bundle/index.js +6 -0
- package/dist/shim/controls/index.js +1 -1
- package/dist/shim/engine/artifact-shell.js +1 -1
- package/dist/shim/engine/router.js +3 -3
- package/dist/shim/host/host-view.js +228 -0
- package/dist/shim/host/index.js +18 -0
- package/dist/shim/index.js +2 -4
- package/dist/shim/notebook/kernel.js +1 -1
- package/dist/shim/notebook/setup-builder.js +2 -2
- package/dist/shim/package.json +1 -0
- package/dist/shim/page-params/index.js +2 -30
- package/dist/shim/project/fork.js +293 -0
- package/dist/shim/project/identity.js +3 -1
- package/dist/shim/project/link.js +43 -3
- package/dist/shim/project/parts-writer.js +62 -5
- package/dist/shim/project/read-text.js +43 -0
- package/dist/shim/project/specifiers.js +104 -15
- package/dist/shim/registry/exhibits.js +15 -34
- package/dist/shim/registry/index.js +2 -2
- package/dist/shim/registry/scene-roster.js +35 -0
- package/dist/shim/registry/scene-source.js +6 -36
- package/dist/shim/registry/walkthrough.js +2 -3
- package/dist/shim/render-state/apply.js +66 -31
- package/dist/shim/render-state/index.js +6 -2
- package/dist/shim/runtime/index.js +4 -4
- package/llms.txt +9 -7
- package/package.json +20 -2
- package/dist/frqtl/experiments/_shared/fx-experiment.js +0 -449
- package/dist/js/models/flamingo-draco.glb +0 -0
- package/dist/js/models/flamingo.glb +0 -0
- package/dist/shim/registry/experiments.js +0 -215
|
@@ -74,7 +74,10 @@ import { ObjectSchema } from './schema/index.js';
|
|
|
74
74
|
import { kindOf } from './kinds.js';
|
|
75
75
|
import { linkProject } from '../../shim/project/link.js';
|
|
76
76
|
import { patchParts, PARTS_EXPORT, entryKeys, entryLiteral } from '../../shim/project/parts-writer.js';
|
|
77
|
-
import { moduleOfKind } from '../../shim/project/parts-module.js';
|
|
77
|
+
import { moduleOfKind, PARTS_SPECIFIER } from '../../shim/project/parts-module.js';
|
|
78
|
+
import { forkPartText, FORK_REFUSED } from '../../shim/project/fork.js';
|
|
79
|
+
import { readText } from '../../shim/project/read-text.js';
|
|
80
|
+
import { packageRoot } from '../compat/package-root.js';
|
|
78
81
|
import { MANIFEST_FILE } from '../../shim/project/manifest.js';
|
|
79
82
|
import { Record, openRecordOf } from './record/Record.js';
|
|
80
83
|
|
|
@@ -463,6 +466,7 @@ import { Record, openRecordOf } from './record/Record.js';
|
|
|
463
466
|
_requireWorld(this);
|
|
464
467
|
_requireHeld(this, 'toSketch');
|
|
465
468
|
var by = this._record ? Record.requireBy(opts && opts.by, 'RecipeContext.toSketch') : null;
|
|
469
|
+
if (this._record) { this._record._admit('RecipeContext.toSketch'); }
|
|
466
470
|
var self = this;
|
|
467
471
|
var runner = this._runner;
|
|
468
472
|
var declared = runner.declared;
|
|
@@ -654,6 +658,7 @@ import { Record, openRecordOf } from './record/Record.js';
|
|
|
654
658
|
_requireWorld(this);
|
|
655
659
|
_requireHeld(this, 'setDeclared');
|
|
656
660
|
var by = this._record ? Record.requireBy(opts && opts.by, 'RecipeContext.setDeclared') : null;
|
|
661
|
+
if (this._record) { this._record._admit('RecipeContext.setDeclared'); }
|
|
657
662
|
var runner = this._runner;
|
|
658
663
|
var obj = null;
|
|
659
664
|
this._parts.forEach(function (row, o) { if (row.key === name) { obj = o; } });
|
|
@@ -724,6 +729,106 @@ import { Record, openRecordOf } from './record/Record.js';
|
|
|
724
729
|
return { set: name, from: from, to: to, tick: 0, kept: kept, files: Object.assign({}, files) };
|
|
725
730
|
};
|
|
726
731
|
|
|
732
|
+
/**
|
|
733
|
+
* exp.fork(name, NewKind[, { by }]) → Promise<{ fork, file, from, files }> — copy the part file of `inParts` object
|
|
734
|
+
* `name`'s kind into the project as `parts/<NewKind>.js` (lib/shim/project/fork.js forkPartText: the class renamed,
|
|
735
|
+
* its imports rewritten to package specifiers, every other byte the source's), point the entry at the fork (the
|
|
736
|
+
* parts writer's `kind` edit: the Kind identifier and one import line), and re-run the scene IN THIS DOCUMENT
|
|
737
|
+
* through the one restart door, as setDeclared does: the seed and the camera pose are kept, the loop's run state
|
|
738
|
+
* is kept. The source text is the exact bytes the kind's `from` names: a package part's file (read through
|
|
739
|
+
* read-text.js readText), or a project fork's held file. The held project is updated BEFORE the re-run, so an open
|
|
740
|
+
* Record stays open; with one open, `by` is required and its `fork` row ({ from: <kind>, to: { kind, file } }) is
|
|
741
|
+
* written after the re-run. REFUSES (throws, the held text unchanged): a name that is not an `inParts` object, a
|
|
742
|
+
* hand made since the last toSketch that is unwritten, a kind with no file a fork can copy, every forkPartText
|
|
743
|
+
* refusal, a writer refusal, and a re-run whose entry is not the fork.
|
|
744
|
+
*/
|
|
745
|
+
/**
|
|
746
|
+
* The fork's plan for `inParts` object `name`, before any read: { obj, from, row, module }. THROWS the refusal
|
|
747
|
+
* fork() and forkRefusal() both name: not an `inParts` object, an unwritten hand, a kind FORK_REFUSED names
|
|
748
|
+
* (lib/shim/project/fork.js, the census reason), a kind with no part file a fork can copy.
|
|
749
|
+
*/
|
|
750
|
+
function _forkPlan(self, name) {
|
|
751
|
+
var runner = self._runner;
|
|
752
|
+
var obj = null;
|
|
753
|
+
self._parts.forEach(function (row, o) { if (row.key === name) { obj = o; } });
|
|
754
|
+
if (!obj || runner.declared.indexOf(obj) === -1) {
|
|
755
|
+
throw new Error('[RecipeContext.fork] "' + name + '" is not an object of this sketch\'s `parts` block' +
|
|
756
|
+
(self._code.size ? ' (code declarations: ' + Array.from(self._code.keys()).map(function (o) { return o.name; }).join(', ') +
|
|
757
|
+
' — ' + OUTSIDE_PARTS + ')' : '') + '. (FAIL-LOUD.)');
|
|
758
|
+
}
|
|
759
|
+
var unwritten = _unwrittenHands(self);
|
|
760
|
+
if (unwritten.length) {
|
|
761
|
+
throw new Error('[RecipeContext.fork] "' + unwritten.join('", "') + '" carries a hand the sketch text does ' +
|
|
762
|
+
'not hold yet — write the hand first: await exp.toSketch(). (FAIL-LOUD.)');
|
|
763
|
+
}
|
|
764
|
+
var from = runner.kindOf(obj);
|
|
765
|
+
if (Object.prototype.hasOwnProperty.call(FORK_REFUSED, from)) {
|
|
766
|
+
throw new Error('[RecipeContext.fork] ' + from + ' (the kind of "' + name + '") is not forkable — ' + FORK_REFUSED[from] + '. (FAIL-LOUD.)');
|
|
767
|
+
}
|
|
768
|
+
var row = kindOf(from);
|
|
769
|
+
var module = row ? moduleOfKind(row.from, self._urls) : null;
|
|
770
|
+
if (module !== PARTS_SPECIFIER && !(module && Object.prototype.hasOwnProperty.call(self._project.files, module))) {
|
|
771
|
+
throw new Error('[RecipeContext.fork] ' + from + ' (the kind of "' + name + '") has no part file a fork can copy — a fork ' +
|
|
772
|
+
'copies a part of @descix/frqtl-web/parts or a part file of this project. (FAIL-LOUD.)');
|
|
773
|
+
}
|
|
774
|
+
return { obj: obj, from: from, row: row, module: module };
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
/**
|
|
778
|
+
* exp.forkRefusal(name) → null when exp.fork(name, …) may run, else the refusal it would throw (one sentence). A
|
|
779
|
+
* host's "Fork into project" control reads it for its disabled state and title; fork() runs the same plan.
|
|
780
|
+
*/
|
|
781
|
+
RecipeContext.prototype.forkRefusal = function (name) {
|
|
782
|
+
_requireWorld(this);
|
|
783
|
+
_requireHeld(this, 'forkRefusal');
|
|
784
|
+
try { _forkPlan(this, name); return null; }
|
|
785
|
+
catch (err) { return String(err && err.message).replace(/^\[RecipeContext\.fork\] /, '').replace(/ \(FAIL-LOUD\.\)$/, ''); }
|
|
786
|
+
};
|
|
787
|
+
|
|
788
|
+
RecipeContext.prototype.fork = async function (name, NewKind, opts) {
|
|
789
|
+
_requireWorld(this);
|
|
790
|
+
_requireHeld(this, 'fork');
|
|
791
|
+
var by = this._record ? Record.requireBy(opts && opts.by, 'RecipeContext.fork') : null;
|
|
792
|
+
if (this._record) { this._record._admit('RecipeContext.fork'); }
|
|
793
|
+
var runner = this._runner;
|
|
794
|
+
var plan = _forkPlan(this, name);
|
|
795
|
+
var from = plan.from, row = plan.row, module = plan.module;
|
|
796
|
+
var text, libPath;
|
|
797
|
+
if (module === PARTS_SPECIFIER) {
|
|
798
|
+
libPath = row.from.slice(packageRoot().length);
|
|
799
|
+
try { text = await readText(row.from); }
|
|
800
|
+
catch (err) { throw new Error('[RecipeContext.fork] the part file of ' + from + ': ' + ((err && err.message) || err) + '. (FAIL-LOUD.)'); }
|
|
801
|
+
} else {
|
|
802
|
+
libPath = module;
|
|
803
|
+
text = this._project.files[module];
|
|
804
|
+
}
|
|
805
|
+
var forked = forkPartText(text, { from: from, to: NewKind, libPath: libPath, files: this._project.files });
|
|
806
|
+
var file = 'parts/' + NewKind + '.js';
|
|
807
|
+
var entry = this._project.entry;
|
|
808
|
+
var r = patchParts(this._project.files[entry], [{ op: 'kind', name: name, Kind: NewKind, module: file }], { entry: entry });
|
|
809
|
+
if (r.refused.length) {
|
|
810
|
+
throw new Error('[RecipeContext.fork] the sketch text refused the fork: ' +
|
|
811
|
+
r.refused.map(function (x) { return x.reason; }).join('; ') + ' (FAIL-LOUD.)');
|
|
812
|
+
}
|
|
813
|
+
var files = Object.assign({}, this._project.files);
|
|
814
|
+
files[file] = forked.text;
|
|
815
|
+
files[entry] = r.text;
|
|
816
|
+
this._project = Object.assign({}, this._project, { files: files });
|
|
817
|
+
var pose = _cameraPose(runner);
|
|
818
|
+
var wasRunning = !!runner._isLooping;
|
|
819
|
+
await runner.restart();
|
|
820
|
+
if (!wasRunning) { runner.stop(); }
|
|
821
|
+
if (pose && runner.cameraControl && typeof runner.cameraControl.setOrbit === 'function') { runner.cameraControl.setOrbit(pose); }
|
|
822
|
+
var rebuilt = null;
|
|
823
|
+
this._parts.forEach(function (row2, o) { if (row2.key === name) { rebuilt = o; } });
|
|
824
|
+
if (!rebuilt || runner.kindOf(rebuilt) !== NewKind) {
|
|
825
|
+
throw new Error('[RecipeContext.fork] the re-run declared "' + name + '" as ' + (rebuilt ? runner.kindOf(rebuilt) : 'nothing') +
|
|
826
|
+
', not the fork ' + NewKind + '. (FAIL-LOUD.)');
|
|
827
|
+
}
|
|
828
|
+
if (this._record) { this._record._row({ name: name, op: 'fork', by: by, from: from, to: { kind: NewKind, file: file } }); }
|
|
829
|
+
return { fork: NewKind, file: file, from: from, files: Object.assign({}, files) };
|
|
830
|
+
};
|
|
831
|
+
|
|
727
832
|
RecipeContext.prototype.addTickFunction = function (fn) {
|
|
728
833
|
_requireWorld(this);
|
|
729
834
|
var fns = this._runner.universe.experimentTickFunctions;
|
|
@@ -128,7 +128,7 @@ import { compileWallV2 } from '../objects/actionCompiler.js';
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
// ── Presets (B6) — pure CONSTRUCTION sugar expanding to the v2 descriptor fields.
|
|
131
|
-
// The
|
|
131
|
+
// The parts writer captures the EXPANDED fields (never the preset name).
|
|
132
132
|
//
|
|
133
133
|
// THE NAMING RULE: a preset's NAME MUST ASSERT ITS BEHAVIOR.
|
|
134
134
|
// `collisionBehavior:'nothing'` (pass-through) belongs ONLY on a preset whose name SAYS
|
|
@@ -71,29 +71,6 @@ import { loadedWasmSha256 } from '../../compat/providers/wasm-load-browser.js';
|
|
|
71
71
|
import * as FrqtlDisplay from '../../compat/renderer/display-slot.js';
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
/**
|
|
75
|
-
* The experiment identity the page ALREADY carries, ferried — not a second authority.
|
|
76
|
-
*
|
|
77
|
-
* The experiments registry DEFINES an experiment id as "the directory name under
|
|
78
|
-
* experiments/" (`experimentById`), and a canonical page is served from
|
|
79
|
-
* `…/experiments/<id>/index.html`. So the path segment IS the registry id, and reading it
|
|
80
|
-
* ferries the existing identity rather than minting a parallel one. The registry module
|
|
81
|
-
* is a registry, not a page fact, which is why the id is taken from the URL the registry's
|
|
82
|
-
* own ids are defined by.
|
|
83
|
-
*
|
|
84
|
-
* Fails SOFT to null (no DOM, a notebook realm, an ad-hoc page): `sourceRef: null` is the
|
|
85
|
-
* honest "this scene has no authored identity" value, and the corpus row then carries the
|
|
86
|
-
* code itself. A caller with a better identity overrides via `setSourceRef()`.
|
|
87
|
-
* @private
|
|
88
|
-
*/
|
|
89
|
-
function _defaultSourceRef() {
|
|
90
|
-
try {
|
|
91
|
-
if (typeof location === 'undefined' || !location) { return null; }
|
|
92
|
-
var m = String(location.pathname).match(/\/experiments\/([^/]+)\//);
|
|
93
|
-
return (m && m[1]) ? m[1] : null;
|
|
94
|
-
} catch (e) { return null; }
|
|
95
|
-
}
|
|
96
|
-
|
|
97
74
|
/**
|
|
98
75
|
* The RASTER PATH pin — which GL backend this browser actually rasters with.
|
|
99
76
|
*
|
|
@@ -207,7 +184,7 @@ import * as FrqtlDisplay from '../../compat/renderer/display-slot.js';
|
|
|
207
184
|
// harness via setSourceRef(). null is HONEST (an ad-hoc universe); the corpus row then
|
|
208
185
|
// carries the code itself. Never per-capture caller-supplied provenance.
|
|
209
186
|
this._sourceRef = (identity.sourceRef === undefined || identity.sourceRef === null)
|
|
210
|
-
?
|
|
187
|
+
? null : String(identity.sourceRef);
|
|
211
188
|
// The code identity (setSourceSha256) — null until a door that linked a project registers it.
|
|
212
189
|
this._sourceSha256 = null;
|
|
213
190
|
// Memo for the content-addressed SceneRecord — see sceneRecord().
|
|
@@ -662,12 +662,21 @@ import { libPathOf } from '../../../shim/project/specifiers.js';
|
|
|
662
662
|
return { files: files, record: out.record, clips: out.clips };
|
|
663
663
|
};
|
|
664
664
|
|
|
665
|
-
/**
|
|
665
|
+
/** rec.changes (the page's own read: a deep-frozen copy per read) as plain JSON. */
|
|
666
|
+
var _IN_PAGE_RECORD_CHANGES = function () {
|
|
667
|
+
var p = window.__frqtlHostedRecord;
|
|
668
|
+
if (!p || !p.rec) { throw new Error('[FrqtlHostedEyes/in-page] no Record is open — eyes.record.start() first.'); }
|
|
669
|
+
return JSON.parse(JSON.stringify(p.rec.changes));
|
|
670
|
+
};
|
|
671
|
+
|
|
672
|
+
/** One act through the page's own doors: toSketch({by}), setDeclared(name, patch, {by}), fork(name, Kind, {by}),
|
|
673
|
+
* placeDeclaredAt(name, point). */
|
|
666
674
|
var _IN_PAGE_ACT = async function (args) {
|
|
667
675
|
var exp = window.FrqtlPage.experiment;
|
|
668
676
|
var r = window.FrqtlPage.runner;
|
|
669
677
|
if (args.door === 'toSketch') { return exp.toSketch(args.opts); }
|
|
670
678
|
if (args.door === 'setDeclared') { return exp.setDeclared(args.name, args.patch, args.opts); }
|
|
679
|
+
if (args.door === 'fork') { return exp.fork(args.name, args.Kind, args.opts); }
|
|
671
680
|
if (args.door === 'placeDeclaredAt') {
|
|
672
681
|
var d = r.declared.find(function (o) { return o.name === args.name; });
|
|
673
682
|
if (!d) { throw new Error('[FrqtlHostedEyes/in-page] no declared object is named ' + JSON.stringify(args.name) + '.'); }
|
|
@@ -1113,6 +1122,8 @@ import { libPathOf } from '../../../shim/project/specifiers.js';
|
|
|
1113
1122
|
* film(opts) rec.film(opts) → its clip spans. Drive the world while it films:
|
|
1114
1123
|
* `const f = eyes.record.film(o); await eyes.driveToTick(n); await f`
|
|
1115
1124
|
* stop() rec.stop() → { files: { path: string | Uint8Array }, record, clips } | { empty: true }
|
|
1125
|
+
* changes() rec.changes → the rows so far, plain JSON (the page's own read). REJECTS when no Record is
|
|
1126
|
+
* open (as stop() does). One act's rows: read the length before the act, slice after.
|
|
1116
1127
|
*/
|
|
1117
1128
|
record: {
|
|
1118
1129
|
start: function () {
|
|
@@ -1125,6 +1136,9 @@ import { libPathOf } from '../../../shim/project/specifiers.js';
|
|
|
1125
1136
|
},
|
|
1126
1137
|
stop: function () {
|
|
1127
1138
|
return page.evaluate(_IN_PAGE_RECORD_STOP, { modules: modules }).then(_rethrowRefused).then(_folderFromPage);
|
|
1139
|
+
},
|
|
1140
|
+
changes: function () {
|
|
1141
|
+
return page.evaluate(_IN_PAGE_RECORD_CHANGES);
|
|
1128
1142
|
}
|
|
1129
1143
|
},
|
|
1130
1144
|
|
|
@@ -1132,11 +1146,13 @@ import { libPathOf } from '../../../shim/project/specifiers.js';
|
|
|
1132
1146
|
* Acts through the page's own doors (the writer's rows come from these, never from node):
|
|
1133
1147
|
* toSketch({ by }) exp.toSketch
|
|
1134
1148
|
* setDeclared(name, patch, { by }) exp.setDeclared
|
|
1149
|
+
* fork(name, Kind, { by }) exp.fork → { fork, file, from, files } (the files as text)
|
|
1135
1150
|
* placeDeclaredAt(name, [x, y, z?]) runner.placeDeclaredAt on the declared object of that name
|
|
1136
1151
|
*/
|
|
1137
1152
|
act: {
|
|
1138
1153
|
toSketch: function (opts) { return page.evaluate(_IN_PAGE_ACT, { door: 'toSketch', opts: opts }); },
|
|
1139
1154
|
setDeclared: function (name, patch, opts) { return page.evaluate(_IN_PAGE_ACT, { door: 'setDeclared', name: name, patch: patch, opts: opts }); },
|
|
1155
|
+
fork: function (name, Kind, opts) { return page.evaluate(_IN_PAGE_ACT, { door: 'fork', name: name, Kind: Kind, opts: opts }); },
|
|
1140
1156
|
placeDeclaredAt: function (name, point) { return page.evaluate(_IN_PAGE_ACT, { door: 'placeDeclaredAt', name: name, point: point }); }
|
|
1141
1157
|
},
|
|
1142
1158
|
|
|
@@ -254,8 +254,8 @@ function _resolveBounds(field, value) {
|
|
|
254
254
|
|
|
255
255
|
function _label(field) {
|
|
256
256
|
// An optional display `label` overrides the field NAME for the
|
|
257
|
-
// control's shown label WITHOUT renaming the schema field (the
|
|
258
|
-
//
|
|
257
|
+
// control's shown label WITHOUT renaming the schema field (the capture key
|
|
258
|
+
// stays `field.name`). e.g. leafDimension → "Emit Dimension", the global
|
|
259
259
|
// shape capability → "Default Shape". Absent → the name, as before (byte-identical).
|
|
260
260
|
var base = (typeof field.label === 'string' && field.label) ? field.label : field.name;
|
|
261
261
|
return field.unit ? (base + ' (' + field.unit + ')') : base;
|
|
@@ -556,8 +556,8 @@ function _rectArrayHandler(field, env) {
|
|
|
556
556
|
value: r.slice(),
|
|
557
557
|
description: (field.description || '') +
|
|
558
558
|
' (DISPLAY ONLY — the bind contract {object,prop} has no array-index ' +
|
|
559
|
-
'addressing; a live per-entry write needs either bind.index
|
|
560
|
-
'extension
|
|
559
|
+
'addressing; a live per-entry write needs either bind.index or a shim-contract ' +
|
|
560
|
+
'extension (an onChange closure is not a bind). See ' +
|
|
561
561
|
'makeControlsForObject.js\'s module docstring, scope note #2.)'
|
|
562
562
|
});
|
|
563
563
|
}
|
|
@@ -730,7 +730,7 @@ function makeControlsForObject(wrapper, ctx, opts) {
|
|
|
730
730
|
// field-name list) marks an ENGINE INTERNAL that must never surface as a
|
|
731
731
|
// designer control/display (e.g. LargeObject.program's raw op-program AST,
|
|
732
732
|
// the derived op-program-scope geometry accessors). Skipped entirely here —
|
|
733
|
-
// no control, no display row. Still engineVisible + captured
|
|
733
|
+
// no control, no display row. Still engineVisible + captured by the parts writer.
|
|
734
734
|
if (field.internal === true) { continue; }
|
|
735
735
|
var handler = TYPE_DISPATCH[field.type];
|
|
736
736
|
if (!handler) {
|
|
@@ -22,12 +22,20 @@
|
|
|
22
22
|
* `closedBy: 'stop'`, or — when the facade's world is re-authored (a build of
|
|
23
23
|
* text that is not the held text) — the folder of the world before, with
|
|
24
24
|
* `closedBy: 'reauthor'` (rejected when that folder is refused, as stop() is).
|
|
25
|
+
* Both carry `droppedClips`: the clips still filming when the Record closed, which
|
|
26
|
+
* the close drops (0 on a stop, which refuses while a clip films); a refused
|
|
27
|
+
* re-author close carries it as err.droppedClips beside err.closedBy.
|
|
25
28
|
* A refused close nobody READ (the getter records the read) makes the facade's
|
|
26
29
|
* next exp.startRecord() reject, naming it.
|
|
27
30
|
* err.record every rejection of stop() and of `closed` carries { changes, clips } — the
|
|
28
31
|
* Record's rows and clip spans — so a host can name them unheld instead of losing them.
|
|
29
32
|
*
|
|
30
|
-
* `closedBy` and the clip spans are the host's (a lab's own `filmed` list); record.json never
|
|
33
|
+
* `closedBy`, `droppedClips` and the clip spans are the host's (a lab's own `filmed` list); record.json never
|
|
34
|
+
* carries them.
|
|
35
|
+
*
|
|
36
|
+
* An act (toSketch, setDeclared, fork) is ADMITTED only while the Record is open and not stopping (`_admit`, asked
|
|
37
|
+
* before the act changes the held text): an act during an async stop() is refused naming "stopping", and the
|
|
38
|
+
* held text is unchanged.
|
|
31
39
|
*
|
|
32
40
|
* WHERE ITS PARTS COME FROM — nothing here captures a second time:
|
|
33
41
|
* rows the writer's own edits at act end (RecipeContext.toSketch / setDeclared call `_row`); only what
|
|
@@ -152,10 +160,20 @@ Record.requireBy = function (by, where) {
|
|
|
152
160
|
return by;
|
|
153
161
|
};
|
|
154
162
|
|
|
163
|
+
/**
|
|
164
|
+
* THE admission check: an act may write into this Record only while it is open and not stopping. The facade asks
|
|
165
|
+
* it BEFORE an act changes the held text (toSketch, setDeclared, fork), and `_row` asks it again: one predicate.
|
|
166
|
+
* @private
|
|
167
|
+
*/
|
|
168
|
+
Record.prototype._admit = function (where) {
|
|
169
|
+
var at = where ? where + ': ' : '';
|
|
170
|
+
if (!this._open) { _fail(at + 'this Record is closed — no row is written into it.'); }
|
|
171
|
+
if (this._stopping) { _fail(at + 'this Record is stopping — an act during stop() belongs to the next Record.'); }
|
|
172
|
+
};
|
|
173
|
+
|
|
155
174
|
/** One change row, at the Record's current tick, in the order acted. @private */
|
|
156
175
|
Record.prototype._row = function (row) {
|
|
157
|
-
|
|
158
|
-
if (this._stopping) { _fail('this Record is stopping — an act during stop() belongs to the next Record.'); }
|
|
176
|
+
this._admit();
|
|
159
177
|
this._rows.push({ tick: this._tick, name: row.name, op: row.op, by: row.by, from: row.from, to: row.to });
|
|
160
178
|
};
|
|
161
179
|
|
|
@@ -302,7 +320,7 @@ Record.prototype.stop = async function () {
|
|
|
302
320
|
finally { this._stopping = false; }
|
|
303
321
|
this._closedBy = 'stop';
|
|
304
322
|
this._detach();
|
|
305
|
-
this._closedSettle.resolve(Object.assign({}, out, { closedBy: 'stop' }));
|
|
323
|
+
this._closedSettle.resolve(Object.assign({}, out, { closedBy: 'stop', droppedClips: 0 }));
|
|
306
324
|
return out;
|
|
307
325
|
};
|
|
308
326
|
|
|
@@ -312,13 +330,15 @@ Record.prototype.stop = async function () {
|
|
|
312
330
|
*/
|
|
313
331
|
Record.prototype._closeOnReauthor = function (held) {
|
|
314
332
|
var self = this;
|
|
333
|
+
var dropped = this._inflight; // clips still filming: detaching drops them (their end() finds the Record closed)
|
|
315
334
|
this._closedBy = 'reauthor';
|
|
316
335
|
this._detach();
|
|
317
336
|
this._folder(held).then(function (out) {
|
|
318
|
-
self._closedSettle.resolve(Object.assign({}, out, { closedBy: 'reauthor' }));
|
|
337
|
+
self._closedSettle.resolve(Object.assign({}, out, { closedBy: 'reauthor', droppedClips: dropped }));
|
|
319
338
|
}, function (e) {
|
|
320
339
|
self._refused = self._carry(e);
|
|
321
340
|
self._refused.closedBy = 'reauthor';
|
|
341
|
+
self._refused.droppedClips = dropped;
|
|
322
342
|
self._closedSettle.reject(self._refused);
|
|
323
343
|
});
|
|
324
344
|
};
|
|
@@ -94,7 +94,7 @@ import * as FrameDataSchema from '../../../shim/frame-data/index.js';
|
|
|
94
94
|
engineVisible: true,
|
|
95
95
|
description: 'Frame center Z position (depth, physics pixels). ' +
|
|
96
96
|
'Default 0.0 when active_axes.z is false (2D mode). ' +
|
|
97
|
-
'
|
|
97
|
+
'Set by the 3D emitter; moved by the ' +
|
|
98
98
|
'independent z yo-yo coin when active_axes.z is true. ' +
|
|
99
99
|
'Cube edge = w (spec §11 — no separate d field; cubes only).'
|
|
100
100
|
},
|
|
@@ -322,7 +322,7 @@ import * as FrameDataSchema from '../../../shim/frame-data/index.js';
|
|
|
322
322
|
engineVisible: true,
|
|
323
323
|
description: 'Derived (scope-read): frame CENTER Z before this tick\'s move() ' +
|
|
324
324
|
'(physics pixels). Default 0.0 when active_axes.z is false. ' +
|
|
325
|
-
'
|
|
325
|
+
'Saved by Frame::move_frame alongside prev_x/prev_y. ' +
|
|
326
326
|
'Read-only — write THROWS (engine-owned per-tick snapshot).'
|
|
327
327
|
},
|
|
328
328
|
// ── Forbidden: engine-owned topology ──────────────────────────────
|
|
@@ -273,7 +273,7 @@ export function shapeValuesMap() {
|
|
|
273
273
|
// existing scene is byte-identical. A live edit (updateObjectProperty) sets the
|
|
274
274
|
// per-instance override that _visibleLargeObjects reads.
|
|
275
275
|
description: 'When this object\'s visual shell renders (render-only): design = only ' +
|
|
276
|
-
'while authoring (
|
|
276
|
+
'while authoring (the marker default); run = always visible (the "red light ' +
|
|
277
277
|
'bulb" opt-in); never = hidden. Generalizes the design-only marker suppression ' +
|
|
278
278
|
'at the single _visibleLargeObjects authority; engine collision is unaffected.'
|
|
279
279
|
},
|
|
@@ -322,7 +322,7 @@ export function shapeValuesMap() {
|
|
|
322
322
|
// designer control — the raw JSON must never render in the STUDIO Inspector.
|
|
323
323
|
// `internal:true` is the ONE authority for "hide from the designer surface"
|
|
324
324
|
// (consumed by makeControlsForObject + AuthorView's renderInspector); the
|
|
325
|
-
// program is still engineVisible + captured
|
|
325
|
+
// program is still engineVisible + captured (the parts writer's round trip).
|
|
326
326
|
internal: true,
|
|
327
327
|
description: 'Op-program attached to this LO (§10.3 SLICE 3). ' +
|
|
328
328
|
'Shape: { on: "collision"|"tick", ops: [{ set: "<handle>.<prop>", to: ExprAST }] }. ' +
|
|
@@ -23,8 +23,7 @@
|
|
|
23
23
|
*
|
|
24
24
|
* The list is derived from what `initArgs()` below ACTUALLY reads. `interQuantumCollisions`
|
|
25
25
|
* is in it because it is still ACCEPTED (inert — it fed a removed positional slot) and
|
|
26
|
-
*
|
|
27
|
-
* would make every saved scene throw.
|
|
26
|
+
* saved scenes carry it: dropping it from the vocabulary would make them throw.
|
|
28
27
|
*
|
|
29
28
|
* @type {Array<{key:string, effect:string}>}
|
|
30
29
|
*/
|
|
@@ -34,8 +34,7 @@
|
|
|
34
34
|
* — as `lib/frqtl/scenes/blackbody.js` sets it. ENGINE physics; no new
|
|
35
35
|
* op-programs. Expected JS↔WASM divergence on parent-frame count (deferred §6).
|
|
36
36
|
*
|
|
37
|
-
* Set any flag to `false` only for progressive test isolation (L1/L2/L3 runs
|
|
38
|
-
* `experiments/blackbody-substrate/run.js`). The default (all true) runs the
|
|
37
|
+
* Set any flag to `false` only for progressive test isolation (L1/L2/L3 runs). The default (all true) runs the
|
|
39
38
|
* scene's flags (brownian on, inter-quantum collisions on).
|
|
40
39
|
*
|
|
41
40
|
* ## Thermostat control loop (as-intended §2.1, Dispatch C2)
|
|
@@ -177,6 +177,12 @@ import * as OrbitBag from '../compat/renderer/orbit-bag.js';
|
|
|
177
177
|
if (mountEl && mountEl.__frqtlCameraHandle && mountEl.__frqtlCameraHandle.mounted) {
|
|
178
178
|
return mountEl.__frqtlCameraHandle;
|
|
179
179
|
}
|
|
180
|
+
// ...and per RUNNER: one runner has one camera controller. A host that mounted the pads before the scene
|
|
181
|
+
// could (STUDIO: the sizeless page builds before its runner has a control host), then a re-run in the same
|
|
182
|
+
// document (a fork, setDeclared) that reaches the scene's own attach with another container, gets the live one.
|
|
183
|
+
if (runner.__frqtlCameraHandle && runner.__frqtlCameraHandle.mounted) {
|
|
184
|
+
return runner.__frqtlCameraHandle;
|
|
185
|
+
}
|
|
180
186
|
|
|
181
187
|
var doc = (mountEl && mountEl.ownerDocument) ? mountEl.ownerDocument
|
|
182
188
|
: (typeof document !== 'undefined' ? document : null);
|
|
@@ -581,6 +587,7 @@ import * as OrbitBag from '../compat/renderer/orbit-bag.js';
|
|
|
581
587
|
if (mountEl && mountEl.__frqtlCameraHandle === liveHandle) {
|
|
582
588
|
mountEl.__frqtlCameraHandle = null;
|
|
583
589
|
}
|
|
590
|
+
if (runner.__frqtlCameraHandle === liveHandle) { runner.__frqtlCameraHandle = null; }
|
|
584
591
|
if (rafId !== null) { cAF(rafId); rafId = null; }
|
|
585
592
|
// Force-release any in-flight joystick drag (detaches its doc listeners).
|
|
586
593
|
for (var i = 0; i < padCleanups.length; i++) {
|
|
@@ -617,6 +624,7 @@ import * as OrbitBag from '../compat/renderer/orbit-bag.js';
|
|
|
617
624
|
};
|
|
618
625
|
// F4: mark the container as owning this live instance (idempotency guard above).
|
|
619
626
|
if (mountEl) { mountEl.__frqtlCameraHandle = liveHandle; }
|
|
627
|
+
runner.__frqtlCameraHandle = liveHandle;
|
|
620
628
|
return liveHandle;
|
|
621
629
|
}
|
|
622
630
|
|
|
@@ -111,7 +111,7 @@ import { registerKind } from '../objects/kinds.js';
|
|
|
111
111
|
var depth = (opts.depth !== undefined && opts.depth !== null) ? opts.depth : null;
|
|
112
112
|
|
|
113
113
|
this.universe = universe;
|
|
114
|
-
this._schemaKind =
|
|
114
|
+
this._schemaKind = this.constructor.name;
|
|
115
115
|
|
|
116
116
|
// The world rect, through the ONE normalizer (a zero-high detector counts nothing
|
|
117
117
|
// and would report it as physics — so a missing dimension throws, never zeroes).
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
* so every Wall option, live method and property accessor applies verbatim.
|
|
25
25
|
* When neither `preset` nor `collisionBehavior` is supplied it defaults to the
|
|
26
26
|
* `detector-screen` preset (destroy + count) — the counting authority. Extra
|
|
27
|
-
* options, all DECLARED descriptor fields (so
|
|
28
|
-
* rebuilds the heatmap wall from
|
|
27
|
+
* options, all DECLARED descriptor fields (so the parts writer captures them and the
|
|
28
|
+
* sketch rebuilds the heatmap wall from that state — the W2 declared-field rule):
|
|
29
29
|
*
|
|
30
30
|
* @param {number} [opts.binPx=12] — face bin size in physics pixels. Bins
|
|
31
31
|
* are anchored at the FACE ORIGIN (its top / near-z corner), so the map runs
|
|
@@ -105,7 +105,7 @@ import { registerKind, kindOf } from '../objects/kinds.js';
|
|
|
105
105
|
* painting of the only spatial information a 2D scene carries.
|
|
106
106
|
*
|
|
107
107
|
* @param {Array|Object} rect — the LO rect ([l,t,w,h] / [l,t,z,w,h,d] /
|
|
108
|
-
* {left,top,w,h[,z,d]} — the shape a
|
|
108
|
+
* {left,top,w,h[,z,d]} — the shape a live LO's rect reads as).
|
|
109
109
|
* @param {number} binPx
|
|
110
110
|
* @returns {{top:number,height:number,z0:number,depth:number,binPx:number,
|
|
111
111
|
* canvasW:number,canvasH:number}}
|
|
@@ -248,9 +248,9 @@ import { registerKind, kindOf } from '../objects/kinds.js';
|
|
|
248
248
|
opts = merged;
|
|
249
249
|
}
|
|
250
250
|
WallCls.call(this, universe, opts);
|
|
251
|
-
this._schemaKind =
|
|
251
|
+
this._schemaKind = this.constructor.name;
|
|
252
252
|
|
|
253
|
-
// Declared heatmap fields (own props →
|
|
253
|
+
// Declared heatmap fields (own props → the parts writer's captureProps).
|
|
254
254
|
this.binPx = _num(opts.binPx, 12);
|
|
255
255
|
this.refreshMs = _num(opts.refreshMs, 100);
|
|
256
256
|
this.heatBase = _num(opts.heatBase, 0.35);
|
|
@@ -399,8 +399,8 @@ import { registerKind, kindOf } from '../objects/kinds.js';
|
|
|
399
399
|
*
|
|
400
400
|
* FIELDS ARE FERRIED FROM WallDescriptor (never re-listed — the
|
|
401
401
|
* schema-mirror-drift discipline): this descriptor is Wall's field table plus
|
|
402
|
-
* the three heatmap fields. Every one is a DECLARED field, so
|
|
403
|
-
*
|
|
402
|
+
* the three heatmap fields. Every one is a DECLARED field, so the parts writer
|
|
403
|
+
* captures it and the sketch rebuilds the heatmap wall from that state.
|
|
404
404
|
*/
|
|
405
405
|
var WallDescriptor = kindOf(WallCls).descriptor;
|
|
406
406
|
var GraphingDetectorWallDescriptor = {
|
|
@@ -35,7 +35,7 @@ import { SCOPE_DESCRIPTORS } from '../objects/schema/scopes.js';
|
|
|
35
35
|
* Build a LargeObject `.rect` for the 2D (4-element) case: a REAL Rectangle instance
|
|
36
36
|
* (is_centered=false) so a center write (`.x`/`.y`) auto-recomputes left/top and vice
|
|
37
37
|
* versa (PR-1 — audit item 3). A non-enumerable `toJSON` is attached so JSON-serializing
|
|
38
|
-
* consumers (
|
|
38
|
+
* consumers (bundle export, save-state, any JSON copy) still produce the SAME plain
|
|
39
39
|
* `{left,top,w,h}` shape they always did — the Rectangle's own enumerable fields are
|
|
40
40
|
* `_left/_x/...`, which WOULD drift; `toJSON` pins the wire shape. (`left/top/w/h` are read
|
|
41
41
|
* via getters by every direct consumer, so those are unaffected.) 6-element z/d rects are
|
|
@@ -128,7 +128,7 @@ import { SCOPE_DESCRIPTORS } from '../objects/schema/scopes.js';
|
|
|
128
128
|
collectCollided = collectCollided || false;
|
|
129
129
|
|
|
130
130
|
this.universe = universe;
|
|
131
|
-
this._schemaKind =
|
|
131
|
+
this._schemaKind = this.constructor.name;
|
|
132
132
|
// rect is [left, top, w, h] (legacy) or [left, top, z, w, h, d] (FRQTL-MAINT
|
|
133
133
|
// 2026-07-01, explicit z/depth) — is_centered=false convention either way.
|
|
134
134
|
var ra = rectToArray(rect);
|
|
@@ -267,8 +267,8 @@ import { registerKind } from '../objects/kinds.js';
|
|
|
267
267
|
};
|
|
268
268
|
// Mirror the SERIALIZABLE chartSpec fields onto the LO under their DESCRIPTOR
|
|
269
269
|
// names (restart-bug fix, 2026-07-25): captureProps(lo, LiveChartDescriptor)
|
|
270
|
-
// reads lo[field.name], so without these mirrors a
|
|
271
|
-
//
|
|
270
|
+
// reads lo[field.name], so without these mirrors a captured chart (the parts writer's
|
|
271
|
+
// capture of a declared chart) would rebuild UNBOUND
|
|
272
272
|
// with default projector/label ("detector"). The name string — never the live
|
|
273
273
|
// sourceHandle — is the captured source (re-resolved here on rebuild).
|
|
274
274
|
lo.source = sourceName;
|
|
@@ -219,7 +219,7 @@ import { registerKind } from '../objects/kinds.js';
|
|
|
219
219
|
function LogicGate(universe, opts) {
|
|
220
220
|
opts = opts || {};
|
|
221
221
|
this.universe = universe;
|
|
222
|
-
this._schemaKind =
|
|
222
|
+
this._schemaKind = this.constructor.name;
|
|
223
223
|
|
|
224
224
|
var TunnelCls = _Tunnel;
|
|
225
225
|
var WallCls = _Wall;
|
|
@@ -705,8 +705,8 @@ import { registerKind } from '../objects/kinds.js';
|
|
|
705
705
|
var gate = new GateCls(ctx.runner.universe, opts);
|
|
706
706
|
gate._schemaKind = Class.name;
|
|
707
707
|
// The comparator is a HOST tick-fn: subscribe it to the runner's per-tick
|
|
708
|
-
// fan-out here, off the DECLARED fields, so the switching
|
|
709
|
-
//
|
|
708
|
+
// fan-out here, off the DECLARED fields, so the switching belongs to the declared
|
|
709
|
+
// object: every build of it (a sketch entry, a Restart) re-wires it. Idempotent.
|
|
710
710
|
if (typeof gate.attachToRunner === 'function') { gate.attachToRunner(ctx.runner); }
|
|
711
711
|
return gate;
|
|
712
712
|
}
|
|
@@ -199,7 +199,7 @@ import { registerKind } from '../objects/kinds.js';
|
|
|
199
199
|
options = options || {};
|
|
200
200
|
|
|
201
201
|
this.universe = universe;
|
|
202
|
-
this._schemaKind =
|
|
202
|
+
this._schemaKind = this.constructor.name;
|
|
203
203
|
this.name = options.name || 'oven'; // its declared name (the Tunnel/LogicGate idiom)
|
|
204
204
|
this.temperature = options.temperature || 300;
|
|
205
205
|
|
|
@@ -169,7 +169,7 @@ import { declaredCount } from '../objects/ObjectFactory.js';
|
|
|
169
169
|
var zDepth = opts.zDepth !== undefined ? opts.zDepth : null;
|
|
170
170
|
|
|
171
171
|
this.universe = universe;
|
|
172
|
-
this._schemaKind =
|
|
172
|
+
this._schemaKind = this.constructor.name;
|
|
173
173
|
this.x = x;
|
|
174
174
|
this.y = y;
|
|
175
175
|
this.diameter = diameter;
|
|
@@ -82,7 +82,7 @@ import { V1_REPLACEMENTS } from '../objects/v1-replacements.js';
|
|
|
82
82
|
var zDepth = (depth !== null) ? depth : null;
|
|
83
83
|
|
|
84
84
|
this.universe = universe;
|
|
85
|
-
this._schemaKind =
|
|
85
|
+
this._schemaKind = this.constructor.name;
|
|
86
86
|
|
|
87
87
|
// Light source diameter: hardcoded to 16 matching devsdk's pointSOURCESIZE.
|
|
88
88
|
// (wavelength * 0.25 * 2 = 32 would double the emission radius and velocity)
|
|
@@ -137,7 +137,7 @@ import { ObjectSchema } from '../objects/schema/index.js';
|
|
|
137
137
|
*/
|
|
138
138
|
function SlitScreen(universe, wallLeft, wallWidth, canvasHeight, wavelength, absorbAtSlitWall, detectAtSlits, slitHeight, gapHeight, depth, holeDepth, linerScatter) {
|
|
139
139
|
this.universe = universe;
|
|
140
|
-
this._schemaKind =
|
|
140
|
+
this._schemaKind = this.constructor.name;
|
|
141
141
|
this.wavelength = wavelength;
|
|
142
142
|
this.depth = (depth !== undefined && depth !== null) ? depth : null;
|
|
143
143
|
// 'current' (default/omitted) = today's exact liner behavior, byte-identical.
|