@despia-native/kernel 0.0.0-coming-soon.0 → 0.3.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/LICENSE +202 -0
- package/NOTICE +1414 -0
- package/README.md +16 -1
- package/dist/.dsx-build-stamp.json +7 -0
- package/dist/api-cohort.d.ts +27 -0
- package/dist/api-cohort.d.ts.map +1 -0
- package/dist/api-cohort.js +94 -0
- package/dist/api-cohort.js.map +1 -0
- package/dist/api.d.ts +454 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +2442 -0
- package/dist/api.js.map +1 -0
- package/dist/app-consts.d.ts +10 -0
- package/dist/app-consts.d.ts.map +1 -0
- package/dist/app-consts.js +39 -0
- package/dist/app-consts.js.map +1 -0
- package/dist/app-update.d.ts +12 -0
- package/dist/app-update.d.ts.map +1 -0
- package/dist/app-update.js +32 -0
- package/dist/app-update.js.map +1 -0
- package/dist/aria.d.ts +152 -0
- package/dist/aria.d.ts.map +1 -0
- package/dist/aria.js +524 -0
- package/dist/aria.js.map +1 -0
- package/dist/audio-core.d.ts +260 -0
- package/dist/audio-core.d.ts.map +1 -0
- package/dist/audio-core.js +1440 -0
- package/dist/audio-core.js.map +1 -0
- package/dist/audio-edit.d.ts +100 -0
- package/dist/audio-edit.d.ts.map +1 -0
- package/dist/audio-edit.js +489 -0
- package/dist/audio-edit.js.map +1 -0
- package/dist/audio-mix.d.ts +84 -0
- package/dist/audio-mix.d.ts.map +1 -0
- package/dist/audio-mix.js +393 -0
- package/dist/audio-mix.js.map +1 -0
- package/dist/auth-proof.d.ts +145 -0
- package/dist/auth-proof.d.ts.map +1 -0
- package/dist/auth-proof.js +644 -0
- package/dist/auth-proof.js.map +1 -0
- package/dist/availability-explain.d.ts +3 -0
- package/dist/availability-explain.d.ts.map +1 -0
- package/dist/availability-explain.js +322 -0
- package/dist/availability-explain.js.map +1 -0
- package/dist/availability.d.ts +246 -0
- package/dist/availability.d.ts.map +1 -0
- package/dist/availability.js +615 -0
- package/dist/availability.js.map +1 -0
- package/dist/background.d.ts +116 -0
- package/dist/background.d.ts.map +1 -0
- package/dist/background.js +235 -0
- package/dist/background.js.map +1 -0
- package/dist/boot-tables-flag.d.ts +2 -0
- package/dist/boot-tables-flag.d.ts.map +1 -0
- package/dist/boot-tables-flag.js +16 -0
- package/dist/boot-tables-flag.js.map +1 -0
- package/dist/boot-tables.d.ts +40 -0
- package/dist/boot-tables.d.ts.map +1 -0
- package/dist/boot-tables.js +102 -0
- package/dist/boot-tables.js.map +1 -0
- package/dist/border-edges.d.ts +5 -0
- package/dist/border-edges.d.ts.map +1 -0
- package/dist/border-edges.js +47 -0
- package/dist/border-edges.js.map +1 -0
- package/dist/bus.d.ts +1203 -0
- package/dist/bus.d.ts.map +1 -0
- package/dist/bus.js +2647 -0
- package/dist/bus.js.map +1 -0
- package/dist/calendar-core.d.ts +143 -0
- package/dist/calendar-core.d.ts.map +1 -0
- package/dist/calendar-core.js +372 -0
- package/dist/calendar-core.js.map +1 -0
- package/dist/call-value.d.ts +16 -0
- package/dist/call-value.d.ts.map +1 -0
- package/dist/call-value.js +54 -0
- package/dist/call-value.js.map +1 -0
- package/dist/camera-core.d.ts +222 -0
- package/dist/camera-core.d.ts.map +1 -0
- package/dist/camera-core.js +980 -0
- package/dist/camera-core.js.map +1 -0
- package/dist/canvas-core.d.ts +404 -0
- package/dist/canvas-core.d.ts.map +1 -0
- package/dist/canvas-core.js +2186 -0
- package/dist/canvas-core.js.map +1 -0
- package/dist/capture-core.d.ts +74 -0
- package/dist/capture-core.d.ts.map +1 -0
- package/dist/capture-core.js +158 -0
- package/dist/capture-core.js.map +1 -0
- package/dist/compile/codegen.d.ts +146 -0
- package/dist/compile/codegen.d.ts.map +1 -0
- package/dist/compile/codegen.js +1949 -0
- package/dist/compile/codegen.js.map +1 -0
- package/dist/compile/jstier.d.ts +44 -0
- package/dist/compile/jstier.d.ts.map +1 -0
- package/dist/compile/jstier.js +181 -0
- package/dist/compile/jstier.js.map +1 -0
- package/dist/compile/tier-door.d.ts +41 -0
- package/dist/compile/tier-door.d.ts.map +1 -0
- package/dist/compile/tier-door.js +167 -0
- package/dist/compile/tier-door.js.map +1 -0
- package/dist/compile/tier-realm.d.ts +49 -0
- package/dist/compile/tier-realm.d.ts.map +1 -0
- package/dist/compile/tier-realm.js +368 -0
- package/dist/compile/tier-realm.js.map +1 -0
- package/dist/compile/tier.d.ts +23 -0
- package/dist/compile/tier.d.ts.map +1 -0
- package/dist/compile/tier.js +157 -0
- package/dist/compile/tier.js.map +1 -0
- package/dist/compose-core.d.ts +86 -0
- package/dist/compose-core.d.ts.map +1 -0
- package/dist/compose-core.js +112 -0
- package/dist/compose-core.js.map +1 -0
- package/dist/config-validate.d.ts +31 -0
- package/dist/config-validate.d.ts.map +1 -0
- package/dist/config-validate.js +147 -0
- package/dist/config-validate.js.map +1 -0
- package/dist/config-values.d.ts +106 -0
- package/dist/config-values.d.ts.map +1 -0
- package/dist/config-values.js +340 -0
- package/dist/config-values.js.map +1 -0
- package/dist/contacts-core.d.ts +127 -0
- package/dist/contacts-core.d.ts.map +1 -0
- package/dist/contacts-core.js +211 -0
- package/dist/contacts-core.js.map +1 -0
- package/dist/content-transition.d.ts +58 -0
- package/dist/content-transition.d.ts.map +1 -0
- package/dist/content-transition.js +94 -0
- package/dist/content-transition.js.map +1 -0
- package/dist/controls-core.d.ts +227 -0
- package/dist/controls-core.d.ts.map +1 -0
- package/dist/controls-core.js +652 -0
- package/dist/controls-core.js.map +1 -0
- package/dist/cookies.d.ts +78 -0
- package/dist/cookies.d.ts.map +1 -0
- package/dist/cookies.js +265 -0
- package/dist/cookies.js.map +1 -0
- package/dist/corner-shape-core.d.ts +69 -0
- package/dist/corner-shape-core.d.ts.map +1 -0
- package/dist/corner-shape-core.js +261 -0
- package/dist/corner-shape-core.js.map +1 -0
- package/dist/crypto-core.d.ts +57 -0
- package/dist/crypto-core.d.ts.map +1 -0
- package/dist/crypto-core.js +128 -0
- package/dist/crypto-core.js.map +1 -0
- package/dist/dataviz.d.ts +436 -0
- package/dist/dataviz.d.ts.map +1 -0
- package/dist/dataviz.js +956 -0
- package/dist/dataviz.js.map +1 -0
- package/dist/debug.d.ts +293 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/debug.js +767 -0
- package/dist/debug.js.map +1 -0
- package/dist/device-ownership.d.ts +50 -0
- package/dist/device-ownership.d.ts.map +1 -0
- package/dist/device-ownership.js +105 -0
- package/dist/device-ownership.js.map +1 -0
- package/dist/effects.d.ts +86 -0
- package/dist/effects.d.ts.map +1 -0
- package/dist/effects.js +98 -0
- package/dist/effects.js.map +1 -0
- package/dist/element.d.ts +108 -0
- package/dist/element.d.ts.map +1 -0
- package/dist/element.js +63 -0
- package/dist/element.js.map +1 -0
- package/dist/file-watch.d.ts +16 -0
- package/dist/file-watch.d.ts.map +1 -0
- package/dist/file-watch.js +49 -0
- package/dist/file-watch.js.map +1 -0
- package/dist/filepaths.d.ts +72 -0
- package/dist/filepaths.d.ts.map +1 -0
- package/dist/filepaths.js +271 -0
- package/dist/filepaths.js.map +1 -0
- package/dist/film.d.ts +264 -0
- package/dist/film.d.ts.map +1 -0
- package/dist/film.js +313 -0
- package/dist/film.js.map +1 -0
- package/dist/fonts.d.ts +66 -0
- package/dist/fonts.d.ts.map +1 -0
- package/dist/fonts.js +135 -0
- package/dist/fonts.js.map +1 -0
- package/dist/forms.d.ts +191 -0
- package/dist/forms.d.ts.map +1 -0
- package/dist/forms.js +663 -0
- package/dist/forms.js.map +1 -0
- package/dist/geo.d.ts +289 -0
- package/dist/geo.d.ts.map +1 -0
- package/dist/geo.js +460 -0
- package/dist/geo.js.map +1 -0
- package/dist/handler-announce.d.ts +46 -0
- package/dist/handler-announce.d.ts.map +1 -0
- package/dist/handler-announce.js +96 -0
- package/dist/handler-announce.js.map +1 -0
- package/dist/handoff.d.ts +71 -0
- package/dist/handoff.d.ts.map +1 -0
- package/dist/handoff.js +250 -0
- package/dist/handoff.js.map +1 -0
- package/dist/identity-durability.d.ts +76 -0
- package/dist/identity-durability.d.ts.map +1 -0
- package/dist/identity-durability.js +150 -0
- package/dist/identity-durability.js.map +1 -0
- package/dist/image-core.d.ts +240 -0
- package/dist/image-core.d.ts.map +1 -0
- package/dist/image-core.js +618 -0
- package/dist/image-core.js.map +1 -0
- package/dist/image-schemes.d.ts +10 -0
- package/dist/image-schemes.d.ts.map +1 -0
- package/dist/image-schemes.js +28 -0
- package/dist/image-schemes.js.map +1 -0
- package/dist/index.d.ts +143 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +299 -0
- package/dist/index.js.map +1 -0
- package/dist/ink-core.d.ts +53 -0
- package/dist/ink-core.d.ts.map +1 -0
- package/dist/ink-core.js +119 -0
- package/dist/ink-core.js.map +1 -0
- package/dist/input.d.ts +148 -0
- package/dist/input.d.ts.map +1 -0
- package/dist/input.js +358 -0
- package/dist/input.js.map +1 -0
- package/dist/integrity.d.ts +63 -0
- package/dist/integrity.d.ts.map +1 -0
- package/dist/integrity.js +150 -0
- package/dist/integrity.js.map +1 -0
- package/dist/intents.d.ts +95 -0
- package/dist/intents.d.ts.map +1 -0
- package/dist/intents.js +282 -0
- package/dist/intents.js.map +1 -0
- package/dist/interpolate-core.d.ts +37 -0
- package/dist/interpolate-core.d.ts.map +1 -0
- package/dist/interpolate-core.js +443 -0
- package/dist/interpolate-core.js.map +1 -0
- package/dist/jse/color.d.ts +12 -0
- package/dist/jse/color.d.ts.map +1 -0
- package/dist/jse/color.js +196 -0
- package/dist/jse/color.js.map +1 -0
- package/dist/jse/core.d.ts +54 -0
- package/dist/jse/core.d.ts.map +1 -0
- package/dist/jse/core.js +1519 -0
- package/dist/jse/core.js.map +1 -0
- package/dist/jse/dispatch.d.ts +28 -0
- package/dist/jse/dispatch.d.ts.map +1 -0
- package/dist/jse/dispatch.js +116 -0
- package/dist/jse/dispatch.js.map +1 -0
- package/dist/jse/highlight-grammar.d.ts +15 -0
- package/dist/jse/highlight-grammar.d.ts.map +1 -0
- package/dist/jse/highlight-grammar.js +161 -0
- package/dist/jse/highlight-grammar.js.map +1 -0
- package/dist/jse/highlight-grammars.generated.d.ts +2 -0
- package/dist/jse/highlight-grammars.generated.d.ts.map +1 -0
- package/dist/jse/highlight-grammars.generated.js +4 -0
- package/dist/jse/highlight-grammars.generated.js.map +1 -0
- package/dist/jse/highlight.d.ts +37 -0
- package/dist/jse/highlight.d.ts.map +1 -0
- package/dist/jse/highlight.js +323 -0
- package/dist/jse/highlight.js.map +1 -0
- package/dist/jse/jse.d.ts +674 -0
- package/dist/jse/jse.d.ts.map +1 -0
- package/dist/jse/jse.js +5841 -0
- package/dist/jse/jse.js.map +1 -0
- package/dist/jse/pathmatch.d.ts +10 -0
- package/dist/jse/pathmatch.d.ts.map +1 -0
- package/dist/jse/pathmatch.js +73 -0
- package/dist/jse/pathmatch.js.map +1 -0
- package/dist/jse/regex.d.ts +33 -0
- package/dist/jse/regex.d.ts.map +1 -0
- package/dist/jse/regex.js +375 -0
- package/dist/jse/regex.js.map +1 -0
- package/dist/jse/stdlib.d.ts +8 -0
- package/dist/jse/stdlib.d.ts.map +1 -0
- package/dist/jse/stdlib.js +765 -0
- package/dist/jse/stdlib.js.map +1 -0
- package/dist/jse/tokens.d.ts +102 -0
- package/dist/jse/tokens.d.ts.map +1 -0
- package/dist/jse/tokens.js +982 -0
- package/dist/jse/tokens.js.map +1 -0
- package/dist/jse/values.d.ts +206 -0
- package/dist/jse/values.d.ts.map +1 -0
- package/dist/jse/values.js +846 -0
- package/dist/jse/values.js.map +1 -0
- package/dist/keyboard.d.ts +196 -0
- package/dist/keyboard.d.ts.map +1 -0
- package/dist/keyboard.js +186 -0
- package/dist/keyboard.js.map +1 -0
- package/dist/label-choices.d.ts +3 -0
- package/dist/label-choices.d.ts.map +1 -0
- package/dist/label-choices.js +168 -0
- package/dist/label-choices.js.map +1 -0
- package/dist/language.d.ts +33 -0
- package/dist/language.d.ts.map +1 -0
- package/dist/language.js +50 -0
- package/dist/language.js.map +1 -0
- package/dist/length-units.d.ts +30 -0
- package/dist/length-units.d.ts.map +1 -0
- package/dist/length-units.js +83 -0
- package/dist/length-units.js.map +1 -0
- package/dist/lightsensor.d.ts +48 -0
- package/dist/lightsensor.d.ts.map +1 -0
- package/dist/lightsensor.js +97 -0
- package/dist/lightsensor.js.map +1 -0
- package/dist/link-refresh.d.ts +27 -0
- package/dist/link-refresh.d.ts.map +1 -0
- package/dist/link-refresh.js +166 -0
- package/dist/link-refresh.js.map +1 -0
- package/dist/link.d.ts +57 -0
- package/dist/link.d.ts.map +1 -0
- package/dist/link.js +333 -0
- package/dist/link.js.map +1 -0
- package/dist/linkpreview.d.ts +114 -0
- package/dist/linkpreview.d.ts.map +1 -0
- package/dist/linkpreview.js +439 -0
- package/dist/linkpreview.js.map +1 -0
- package/dist/list-presence.d.ts +32 -0
- package/dist/list-presence.d.ts.map +1 -0
- package/dist/list-presence.js +48 -0
- package/dist/list-presence.js.map +1 -0
- package/dist/live-stream.d.ts +27 -0
- package/dist/live-stream.d.ts.map +1 -0
- package/dist/live-stream.js +274 -0
- package/dist/live-stream.js.map +1 -0
- package/dist/livelogs.d.ts +134 -0
- package/dist/livelogs.d.ts.map +1 -0
- package/dist/livelogs.js +409 -0
- package/dist/livelogs.js.map +1 -0
- package/dist/logs.d.ts +80 -0
- package/dist/logs.d.ts.map +1 -0
- package/dist/logs.js +206 -0
- package/dist/logs.js.map +1 -0
- package/dist/mcp/apps.d.ts +82 -0
- package/dist/mcp/apps.d.ts.map +1 -0
- package/dist/mcp/apps.js +219 -0
- package/dist/mcp/apps.js.map +1 -0
- package/dist/mcp/entities.d.ts +25 -0
- package/dist/mcp/entities.d.ts.map +1 -0
- package/dist/mcp/entities.js +71 -0
- package/dist/mcp/entities.js.map +1 -0
- package/dist/mcp/result.d.ts +73 -0
- package/dist/mcp/result.d.ts.map +1 -0
- package/dist/mcp/result.js +119 -0
- package/dist/mcp/result.js.map +1 -0
- package/dist/mcp/webmcp.d.ts +162 -0
- package/dist/mcp/webmcp.d.ts.map +1 -0
- package/dist/mcp/webmcp.js +214 -0
- package/dist/mcp/webmcp.js.map +1 -0
- package/dist/mcp.d.ts +5 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +14 -0
- package/dist/mcp.js.map +1 -0
- package/dist/media-core.d.ts +191 -0
- package/dist/media-core.d.ts.map +1 -0
- package/dist/media-core.js +446 -0
- package/dist/media-core.js.map +1 -0
- package/dist/media-timeline-core.d.ts +94 -0
- package/dist/media-timeline-core.d.ts.map +1 -0
- package/dist/media-timeline-core.js +620 -0
- package/dist/media-timeline-core.js.map +1 -0
- package/dist/message.d.ts +42 -0
- package/dist/message.d.ts.map +1 -0
- package/dist/message.js +582 -0
- package/dist/message.js.map +1 -0
- package/dist/missing-element.d.ts +29 -0
- package/dist/missing-element.d.ts.map +1 -0
- package/dist/missing-element.js +76 -0
- package/dist/missing-element.js.map +1 -0
- package/dist/motion-core.d.ts +160 -0
- package/dist/motion-core.d.ts.map +1 -0
- package/dist/motion-core.js +752 -0
- package/dist/motion-core.js.map +1 -0
- package/dist/motion-pose.d.ts +65 -0
- package/dist/motion-pose.d.ts.map +1 -0
- package/dist/motion-pose.js +143 -0
- package/dist/motion-pose.js.map +1 -0
- package/dist/motion.d.ts +132 -0
- package/dist/motion.d.ts.map +1 -0
- package/dist/motion.js +260 -0
- package/dist/motion.js.map +1 -0
- package/dist/mount-core.d.ts +203 -0
- package/dist/mount-core.d.ts.map +1 -0
- package/dist/mount-core.js +437 -0
- package/dist/mount-core.js.map +1 -0
- package/dist/net-core.d.ts +110 -0
- package/dist/net-core.d.ts.map +1 -0
- package/dist/net-core.js +225 -0
- package/dist/net-core.js.map +1 -0
- package/dist/notify.d.ts +399 -0
- package/dist/notify.d.ts.map +1 -0
- package/dist/notify.js +964 -0
- package/dist/notify.js.map +1 -0
- package/dist/orientation-binding.d.ts +39 -0
- package/dist/orientation-binding.d.ts.map +1 -0
- package/dist/orientation-binding.js +64 -0
- package/dist/orientation-binding.js.map +1 -0
- package/dist/orientation.d.ts +55 -0
- package/dist/orientation.d.ts.map +1 -0
- package/dist/orientation.js +89 -0
- package/dist/orientation.js.map +1 -0
- package/dist/ota.d.ts +52 -0
- package/dist/ota.d.ts.map +1 -0
- package/dist/ota.js +122 -0
- package/dist/ota.js.map +1 -0
- package/dist/passkeys.d.ts +91 -0
- package/dist/passkeys.d.ts.map +1 -0
- package/dist/passkeys.js +307 -0
- package/dist/passkeys.js.map +1 -0
- package/dist/payment.d.ts +85 -0
- package/dist/payment.d.ts.map +1 -0
- package/dist/payment.js +270 -0
- package/dist/payment.js.map +1 -0
- package/dist/pending-presenter.d.ts +31 -0
- package/dist/pending-presenter.d.ts.map +1 -0
- package/dist/pending-presenter.js +119 -0
- package/dist/pending-presenter.js.map +1 -0
- package/dist/permission-core.d.ts +59 -0
- package/dist/permission-core.d.ts.map +1 -0
- package/dist/permission-core.js +102 -0
- package/dist/permission-core.js.map +1 -0
- package/dist/persist.d.ts +169 -0
- package/dist/persist.d.ts.map +1 -0
- package/dist/persist.js +361 -0
- package/dist/persist.js.map +1 -0
- package/dist/phase-plan.d.ts +114 -0
- package/dist/phase-plan.d.ts.map +1 -0
- package/dist/phase-plan.js +837 -0
- package/dist/phase-plan.js.map +1 -0
- package/dist/playback-core.d.ts +64 -0
- package/dist/playback-core.d.ts.map +1 -0
- package/dist/playback-core.js +176 -0
- package/dist/playback-core.js.map +1 -0
- package/dist/player-sources.d.ts +12 -0
- package/dist/player-sources.d.ts.map +1 -0
- package/dist/player-sources.js +44 -0
- package/dist/player-sources.js.map +1 -0
- package/dist/proxy-denylist.d.ts +11 -0
- package/dist/proxy-denylist.d.ts.map +1 -0
- package/dist/proxy-denylist.js +44 -0
- package/dist/proxy-denylist.js.map +1 -0
- package/dist/public-config.d.ts +20 -0
- package/dist/public-config.d.ts.map +1 -0
- package/dist/public-config.js +109 -0
- package/dist/public-config.js.map +1 -0
- package/dist/qoe-core.d.ts +72 -0
- package/dist/qoe-core.d.ts.map +1 -0
- package/dist/qoe-core.js +113 -0
- package/dist/qoe-core.js.map +1 -0
- package/dist/reactive-request.d.ts +80 -0
- package/dist/reactive-request.d.ts.map +1 -0
- package/dist/reactive-request.js +192 -0
- package/dist/reactive-request.js.map +1 -0
- package/dist/read-cache.d.ts +129 -0
- package/dist/read-cache.d.ts.map +1 -0
- package/dist/read-cache.js +566 -0
- package/dist/read-cache.js.map +1 -0
- package/dist/recorder-core.d.ts +57 -0
- package/dist/recorder-core.d.ts.map +1 -0
- package/dist/recorder-core.js +136 -0
- package/dist/recorder-core.js.map +1 -0
- package/dist/ref.d.ts +41 -0
- package/dist/ref.d.ts.map +1 -0
- package/dist/ref.js +98 -0
- package/dist/ref.js.map +1 -0
- package/dist/refusal.d.ts +82 -0
- package/dist/refusal.d.ts.map +1 -0
- package/dist/refusal.js +218 -0
- package/dist/refusal.js.map +1 -0
- package/dist/region-insets.d.ts +61 -0
- package/dist/region-insets.d.ts.map +1 -0
- package/dist/region-insets.js +67 -0
- package/dist/region-insets.js.map +1 -0
- package/dist/rive-core.d.ts +323 -0
- package/dist/rive-core.d.ts.map +1 -0
- package/dist/rive-core.js +677 -0
- package/dist/rive-core.js.map +1 -0
- package/dist/runner.d.ts +595 -0
- package/dist/runner.d.ts.map +1 -0
- package/dist/runner.js +4094 -0
- package/dist/runner.js.map +1 -0
- package/dist/scene/a11y.d.ts +11 -0
- package/dist/scene/a11y.d.ts.map +1 -0
- package/dist/scene/a11y.js +67 -0
- package/dist/scene/a11y.js.map +1 -0
- package/dist/scene/anim.d.ts +149 -0
- package/dist/scene/anim.d.ts.map +1 -0
- package/dist/scene/anim.js +396 -0
- package/dist/scene/anim.js.map +1 -0
- package/dist/scene/bind.d.ts +33 -0
- package/dist/scene/bind.d.ts.map +1 -0
- package/dist/scene/bind.js +66 -0
- package/dist/scene/bind.js.map +1 -0
- package/dist/scene/collide.d.ts +56 -0
- package/dist/scene/collide.d.ts.map +1 -0
- package/dist/scene/collide.js +146 -0
- package/dist/scene/collide.js.map +1 -0
- package/dist/scene/frame.d.ts +22 -0
- package/dist/scene/frame.d.ts.map +1 -0
- package/dist/scene/frame.js +57 -0
- package/dist/scene/frame.js.map +1 -0
- package/dist/scene/gltf.d.ts +79 -0
- package/dist/scene/gltf.d.ts.map +1 -0
- package/dist/scene/gltf.js +409 -0
- package/dist/scene/gltf.js.map +1 -0
- package/dist/scene/ir.d.ts +293 -0
- package/dist/scene/ir.d.ts.map +1 -0
- package/dist/scene/ir.js +692 -0
- package/dist/scene/ir.js.map +1 -0
- package/dist/scene/math.d.ts +50 -0
- package/dist/scene/math.d.ts.map +1 -0
- package/dist/scene/math.js +180 -0
- package/dist/scene/math.js.map +1 -0
- package/dist/scene/orbit.d.ts +19 -0
- package/dist/scene/orbit.d.ts.map +1 -0
- package/dist/scene/orbit.js +60 -0
- package/dist/scene/orbit.js.map +1 -0
- package/dist/scene/physics.d.ts +228 -0
- package/dist/scene/physics.d.ts.map +1 -0
- package/dist/scene/physics.js +1500 -0
- package/dist/scene/physics.js.map +1 -0
- package/dist/scene/registry.d.ts +85 -0
- package/dist/scene/registry.d.ts.map +1 -0
- package/dist/scene/registry.js +75 -0
- package/dist/scene/registry.js.map +1 -0
- package/dist/scene/skin.d.ts +82 -0
- package/dist/scene/skin.d.ts.map +1 -0
- package/dist/scene/skin.js +351 -0
- package/dist/scene/skin.js.map +1 -0
- package/dist/scene/sprite.d.ts +36 -0
- package/dist/scene/sprite.d.ts.map +1 -0
- package/dist/scene/sprite.js +107 -0
- package/dist/scene/sprite.js.map +1 -0
- package/dist/scene/viewer.d.ts +96 -0
- package/dist/scene/viewer.d.ts.map +1 -0
- package/dist/scene/viewer.js +235 -0
- package/dist/scene/viewer.js.map +1 -0
- package/dist/scoped-slots.d.ts +9 -0
- package/dist/scoped-slots.d.ts.map +1 -0
- package/dist/scoped-slots.js +42 -0
- package/dist/scoped-slots.js.map +1 -0
- package/dist/screen.d.ts +109 -0
- package/dist/screen.d.ts.map +1 -0
- package/dist/screen.js +309 -0
- package/dist/screen.js.map +1 -0
- package/dist/scroll.d.ts +525 -0
- package/dist/scroll.d.ts.map +1 -0
- package/dist/scroll.js +1226 -0
- package/dist/scroll.js.map +1 -0
- package/dist/settings-plane.d.ts +58 -0
- package/dist/settings-plane.d.ts.map +1 -0
- package/dist/settings-plane.js +86 -0
- package/dist/settings-plane.js.map +1 -0
- package/dist/share-inbox.d.ts +56 -0
- package/dist/share-inbox.d.ts.map +1 -0
- package/dist/share-inbox.js +114 -0
- package/dist/share-inbox.js.map +1 -0
- package/dist/shared-transition.d.ts +152 -0
- package/dist/shared-transition.d.ts.map +1 -0
- package/dist/shared-transition.js +257 -0
- package/dist/shared-transition.js.map +1 -0
- package/dist/sheet-content-padding.d.ts +24 -0
- package/dist/sheet-content-padding.d.ts.map +1 -0
- package/dist/sheet-content-padding.js +32 -0
- package/dist/sheet-content-padding.js.map +1 -0
- package/dist/shot-devices.d.ts +36 -0
- package/dist/shot-devices.d.ts.map +1 -0
- package/dist/shot-devices.js +90 -0
- package/dist/shot-devices.js.map +1 -0
- package/dist/shot-guards.d.ts +100 -0
- package/dist/shot-guards.d.ts.map +1 -0
- package/dist/shot-guards.js +260 -0
- package/dist/shot-guards.js.map +1 -0
- package/dist/shot-scope.d.ts +140 -0
- package/dist/shot-scope.d.ts.map +1 -0
- package/dist/shot-scope.js +302 -0
- package/dist/shot-scope.js.map +1 -0
- package/dist/slot-partition.d.ts +9 -0
- package/dist/slot-partition.d.ts.map +1 -0
- package/dist/slot-partition.js +38 -0
- package/dist/slot-partition.js.map +1 -0
- package/dist/snackbar.d.ts +165 -0
- package/dist/snackbar.d.ts.map +1 -0
- package/dist/snackbar.js +220 -0
- package/dist/snackbar.js.map +1 -0
- package/dist/socket.d.ts +96 -0
- package/dist/socket.d.ts.map +1 -0
- package/dist/socket.js +370 -0
- package/dist/socket.js.map +1 -0
- package/dist/spotlight.d.ts +77 -0
- package/dist/spotlight.d.ts.map +1 -0
- package/dist/spotlight.js +174 -0
- package/dist/spotlight.js.map +1 -0
- package/dist/state-primitive.d.ts +37 -0
- package/dist/state-primitive.d.ts.map +1 -0
- package/dist/state-primitive.js +91 -0
- package/dist/state-primitive.js.map +1 -0
- package/dist/store-query.d.ts +25 -0
- package/dist/store-query.d.ts.map +1 -0
- package/dist/store-query.js +88 -0
- package/dist/store-query.js.map +1 -0
- package/dist/store-value.d.ts +48 -0
- package/dist/store-value.d.ts.map +1 -0
- package/dist/store-value.js +264 -0
- package/dist/store-value.js.map +1 -0
- package/dist/store-versioning.d.ts +70 -0
- package/dist/store-versioning.d.ts.map +1 -0
- package/dist/store-versioning.js +188 -0
- package/dist/store-versioning.js.map +1 -0
- package/dist/store.d.ts +282 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +1144 -0
- package/dist/store.js.map +1 -0
- package/dist/strings.d.ts +141 -0
- package/dist/strings.d.ts.map +1 -0
- package/dist/strings.js +581 -0
- package/dist/strings.js.map +1 -0
- package/dist/telemetry.d.ts +95 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +255 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/transform-core.d.ts +228 -0
- package/dist/transform-core.d.ts.map +1 -0
- package/dist/transform-core.js +921 -0
- package/dist/transform-core.js.map +1 -0
- package/dist/transition-core.d.ts +58 -0
- package/dist/transition-core.d.ts.map +1 -0
- package/dist/transition-core.js +352 -0
- package/dist/transition-core.js.map +1 -0
- package/dist/trim-trailing.d.ts +3 -0
- package/dist/trim-trailing.d.ts.map +1 -0
- package/dist/trim-trailing.js +14 -0
- package/dist/trim-trailing.js.map +1 -0
- package/dist/upload.d.ts +51 -0
- package/dist/upload.d.ts.map +1 -0
- package/dist/upload.js +68 -0
- package/dist/upload.js.map +1 -0
- package/dist/vendor-face.d.ts +44 -0
- package/dist/vendor-face.d.ts.map +1 -0
- package/dist/vendor-face.js +80 -0
- package/dist/vendor-face.js.map +1 -0
- package/dist/vendor-session.d.ts +166 -0
- package/dist/vendor-session.d.ts.map +1 -0
- package/dist/vendor-session.js +423 -0
- package/dist/vendor-session.js.map +1 -0
- package/dist/vendor-surface.d.ts +290 -0
- package/dist/vendor-surface.d.ts.map +1 -0
- package/dist/vendor-surface.js +439 -0
- package/dist/vendor-surface.js.map +1 -0
- package/dist/version-rules.generated.d.ts +17 -0
- package/dist/version-rules.generated.d.ts.map +1 -0
- package/dist/version-rules.generated.js +99 -0
- package/dist/version-rules.generated.js.map +1 -0
- package/dist/view-transition-core.d.ts +99 -0
- package/dist/view-transition-core.d.ts.map +1 -0
- package/dist/view-transition-core.js +127 -0
- package/dist/view-transition-core.js.map +1 -0
- package/dist/view-transition-door.d.ts +26 -0
- package/dist/view-transition-door.d.ts.map +1 -0
- package/dist/view-transition-door.js +88 -0
- package/dist/view-transition-door.js.map +1 -0
- package/dist/window-identity.d.ts +3 -0
- package/dist/window-identity.d.ts.map +1 -0
- package/dist/window-identity.js +27 -0
- package/dist/window-identity.js.map +1 -0
- package/package.json +141 -2
package/dist/debug.js
ADDED
|
@@ -0,0 +1,767 @@
|
|
|
1
|
+
//
|
|
2
|
+
// debug.ts - the debug facility: breakpoints, a pause, stepping, a frame and a read only
|
|
3
|
+
// evaluation, over the one choke point in runner.ts
|
|
4
|
+
// sections 1, 2, 3 and 6, ordered as G2 by section 8).
|
|
5
|
+
//
|
|
6
|
+
// THIS FILE IS THE FACILITY AND IT IS INSTALLED, NEVER IMPORTED BY THE RUNNER. `runner.ts`
|
|
7
|
+
// ships in every bundle including a self-contained embed and knows only that
|
|
8
|
+
// `RunnerDebugSeam.onStatement` may be null. A host that wants a debugger installs this; a
|
|
9
|
+
// production build installs nothing, so there is no code for a debug door to attach to. That
|
|
10
|
+
// is section 5.3's enforcement by absence, and it is the only half of the security rule that
|
|
11
|
+
// survives a misconfiguration.
|
|
12
|
+
//
|
|
13
|
+
// WHAT A BREAKPOINT IS. A document and a line, never a byte. The plan's section 1 argues it
|
|
14
|
+
// and `OpenSource/Engine/TypeScript/packages/cli/src/nodeflow.ts:14` argues the opposite for EDITS ("every
|
|
15
|
+
// node records a SPAN into the author's own source and nothing is ever re-printed"), which is
|
|
16
|
+
// the right rule for a splice and the wrong one for a stop: a line survives a reformat that
|
|
17
|
+
// moved every byte, and a line is the unit a person and an agent both name. Which STATEMENT a
|
|
18
|
+
// line binds is this file's answer, reported back on `breakpointbound`, and its absence is
|
|
19
|
+
// reported on `breakpointunbound` with a reason rather than by never firing.
|
|
20
|
+
//
|
|
21
|
+
// HOW A LINE IS FOUND, AND WHY IT IS NOT A SECOND TOKENIZER. `tokenizeSpans` (jse/tokens.ts)
|
|
22
|
+
// is the language's own answer to where a token began, and its header says why a tool must
|
|
23
|
+
// ask rather than lex again: "a second tokenizer is a second opinion about where a number
|
|
24
|
+
// ends, whether `===` is one token, whether a `/` opened a regex and whether `a.b` is one
|
|
25
|
+
// name". Its spans index the PREPROCESSED source, so `alignToRaw` below walks the two strings
|
|
26
|
+
// together and maps each preprocessed index back to the author's own, through the three edits
|
|
27
|
+
// the preprocessor makes and no others.
|
|
28
|
+
//
|
|
29
|
+
// STEPPING IS A PREDICATE OVER THE NEXT STOP, not a second interpreter. `over` declines to
|
|
30
|
+
// stop in a body deeper than this one, `into` stops at the very next statement whatever its
|
|
31
|
+
// depth, and `out` stops only once this body's frame is gone. Written that way, the three
|
|
32
|
+
// verbs cannot disagree with execution, because they never drive it: they only decide where to
|
|
33
|
+
// stop the execution the runner is already doing.
|
|
34
|
+
//
|
|
35
|
+
// THE CLOCK. `deadlineAt` is wall clock (`runner.ts:224`), and a person at a breakpoint takes
|
|
36
|
+
// minutes, so a naive pause makes every debugged run die of its own deadline the moment it
|
|
37
|
+
// resumes. While held, the deadline is pushed forward by the pause's own duration: the
|
|
38
|
+
// deadline exists to stop a body burning an isolate, and a held body is burning nothing.
|
|
39
|
+
//
|
|
40
|
+
import { RunnerDebugSeam, scopeLocals, } from "./runner.js";
|
|
41
|
+
import { tokenizeSpans, preprocessSource } from "./jse/tokens.js";
|
|
42
|
+
const ACTION_DEPTH_CAP = 32;
|
|
43
|
+
/**
|
|
44
|
+
* EACH PREPROCESSED INDEX, MAPPED BACK TO THE AUTHOR'S OWN.
|
|
45
|
+
*
|
|
46
|
+
* `preprocessSource` makes exactly three edits and this walk knows all three: an operator
|
|
47
|
+
* entity decodes to fewer characters, a comment is dropped (a line comment to nothing, a block
|
|
48
|
+
* comment to one space), and a statement boundary newline becomes `;`. Walking the two strings
|
|
49
|
+
* together with those three rules is exact where they hold and honest where they do not: a
|
|
50
|
+
* position the walk cannot align answers the last index it was sure of, which binds the
|
|
51
|
+
* breakpoint one statement early rather than silently somewhere else.
|
|
52
|
+
*
|
|
53
|
+
* The alternative was to teach the preprocessor to carry its own indices, which would put a
|
|
54
|
+
* second copy of "what a comment is" in this file the first time either changed.
|
|
55
|
+
*/
|
|
56
|
+
export function alignToRaw(raw, pre) {
|
|
57
|
+
const map = new Array(pre.length + 1).fill(0);
|
|
58
|
+
let i = 0;
|
|
59
|
+
let j = 0;
|
|
60
|
+
while (j < pre.length && i < raw.length) {
|
|
61
|
+
if (raw[i] === pre[j]) {
|
|
62
|
+
map[j] = i;
|
|
63
|
+
i += 1;
|
|
64
|
+
j += 1;
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
// The ASI pass: a statement boundary newline became `;` (tokens.ts asiSemicolons).
|
|
68
|
+
if (pre[j] === ";" && raw[i] === "\n") {
|
|
69
|
+
map[j] = i;
|
|
70
|
+
i += 1;
|
|
71
|
+
j += 1;
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
// An operator entity decoded: `<` and its family are longer in the author's source.
|
|
75
|
+
if (raw[i] === "&") {
|
|
76
|
+
const semi = raw.indexOf(";", i);
|
|
77
|
+
if (semi > i && semi - i <= 8) {
|
|
78
|
+
i = semi + 1;
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
// Anything else the two strings disagree about came out of the author's source and not
|
|
83
|
+
// out of the preprocessor: a comment, dropped whole or to one space.
|
|
84
|
+
i += 1;
|
|
85
|
+
}
|
|
86
|
+
for (let k = j; k <= pre.length; k += 1)
|
|
87
|
+
map[k] = raw.length;
|
|
88
|
+
return map;
|
|
89
|
+
}
|
|
90
|
+
/** The one based line of a raw offset. Newlines are counted and nothing is guessed. */
|
|
91
|
+
export function lineOfOffset(raw, offset) {
|
|
92
|
+
let line = 1;
|
|
93
|
+
for (let k = 0; k < offset && k < raw.length; k += 1)
|
|
94
|
+
if (raw[k] === "\n")
|
|
95
|
+
line += 1;
|
|
96
|
+
return line;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* THE LINE EACH STATEMENT OF A BODY BEGINS ON, indexed by the body's own token index.
|
|
100
|
+
*
|
|
101
|
+
* The runner reports a stop by the token index of the statement about to run, which is the one
|
|
102
|
+
* thing it can report without carrying a source map through the hot loop. This turns that index
|
|
103
|
+
* into a line, through the language's own span door and the alignment above.
|
|
104
|
+
*/
|
|
105
|
+
export function lineByToken(raw) {
|
|
106
|
+
const { source, tokens } = tokenizeSpans(raw);
|
|
107
|
+
const map = alignToRaw(raw, source);
|
|
108
|
+
return tokens.map((t) => lineOfOffset(raw, map[t.start] ?? 0));
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* THE LINES A STATEMENT BEGINS ON, which is not the same as the lines a token sits on.
|
|
112
|
+
*
|
|
113
|
+
* A breakpoint binds a STATEMENT, so a line carrying only a closing brace binds nothing and
|
|
114
|
+
* must say so. The rule is the runner's own, read off `runStatements`: it skips `;`, it returns
|
|
115
|
+
* at `}`, and everything else begins a statement. Reading the rule from the loop rather than
|
|
116
|
+
* inventing one is what keeps a bound line and a stop from disagreeing.
|
|
117
|
+
*/
|
|
118
|
+
export function statementStartLines(raw) {
|
|
119
|
+
const { source, tokens } = tokenizeSpans(raw);
|
|
120
|
+
const map = alignToRaw(raw, source);
|
|
121
|
+
const out = new Set();
|
|
122
|
+
const punctuation = new Set([";", "{", "}"]);
|
|
123
|
+
for (let k = 0; k < tokens.length; k += 1) {
|
|
124
|
+
const here = tokens[k].token;
|
|
125
|
+
if (here.kind === "op" && punctuation.has(here.v))
|
|
126
|
+
continue;
|
|
127
|
+
const before = k === 0 ? null : tokens[k - 1].token;
|
|
128
|
+
const starts = before === null || (before.kind === "op" && punctuation.has(before.v));
|
|
129
|
+
if (starts)
|
|
130
|
+
out.add(lineOfOffset(raw, map[tokens[k].start] ?? 0));
|
|
131
|
+
}
|
|
132
|
+
return [...out].sort((a, b) => a - b);
|
|
133
|
+
}
|
|
134
|
+
/** The statement text a bound line names, for the answer a `breakpoint set` gives back. */
|
|
135
|
+
export function statementAtLine(raw, line) {
|
|
136
|
+
const text = raw.split("\n")[line - 1] ?? "";
|
|
137
|
+
return text.trim();
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* THE SIX GRANT LEVELS, AS A VALUE, and the type derives from it.
|
|
141
|
+
*
|
|
142
|
+
* They are the Session Protocol's levels, declared once per reader that has to name them:
|
|
143
|
+
* `SESSION_CAPABILITIES` in the CLI's session.ts (the package that mints and revokes them, and
|
|
144
|
+
* which this package may not import), the `capabilities` rows of
|
|
145
|
+
* OpenSource/Conformance/cli/admission.json, and this list. The corpus is where the three meet:
|
|
146
|
+
* the CLI's suite already pins its list to it, and debug-locals.test.ts now pins this one, so a
|
|
147
|
+
* seventh level cannot reach the debug facility's door and miss the session that hands it out,
|
|
148
|
+
* or the other way round.
|
|
149
|
+
*/
|
|
150
|
+
export const DEBUG_GRANTS = ["page", "read", "write", "review", "agent", "debug"];
|
|
151
|
+
/**
|
|
152
|
+
* ONE DEBUG SESSION over one run environment.
|
|
153
|
+
*
|
|
154
|
+
* Every verb answers a status and a body rather than throwing, because a refusal is an answer
|
|
155
|
+
* and because a door over this must be a door rather than a translation. Events are collected
|
|
156
|
+
* in order and read by whatever is subscribed, which is what a feed subscriber does.
|
|
157
|
+
*/
|
|
158
|
+
export class DebugSession {
|
|
159
|
+
options;
|
|
160
|
+
events = [];
|
|
161
|
+
points = [];
|
|
162
|
+
apis = new Map();
|
|
163
|
+
ledger = [];
|
|
164
|
+
held = null;
|
|
165
|
+
pauseArmed = false;
|
|
166
|
+
stepping = null;
|
|
167
|
+
waiters = [];
|
|
168
|
+
nextPoint = 1;
|
|
169
|
+
pausedMs = 0;
|
|
170
|
+
startedAt = 0;
|
|
171
|
+
abandoned = new Set();
|
|
172
|
+
runId = "r-1";
|
|
173
|
+
installed = false;
|
|
174
|
+
lineCache = new Map();
|
|
175
|
+
constructor(options) {
|
|
176
|
+
this.options = options;
|
|
177
|
+
for (const name of options.env?.apis.keys() ?? [])
|
|
178
|
+
this.apis.set(name, "idle");
|
|
179
|
+
}
|
|
180
|
+
feed() { return this.events; }
|
|
181
|
+
breakpoints() { return this.points; }
|
|
182
|
+
/** Executed time only: a pause is not spent, which is section 6's rule and is what makes a
|
|
183
|
+
* held run safe to stop in. */
|
|
184
|
+
executed() { return this.now() - this.startedAt - this.pausedMs; }
|
|
185
|
+
paused() { return this.pausedMs; }
|
|
186
|
+
now() { return (this.options.now ?? Date.now)(); }
|
|
187
|
+
/**
|
|
188
|
+
* INSTALL THE FACILITY, which a production build never does.
|
|
189
|
+
*
|
|
190
|
+
* This is the one line section 5.3 is about. A host calls it because it is a development or
|
|
191
|
+
* Sandbox host; nothing else calls it; and a bundle where it was never called has a null
|
|
192
|
+
* seam, which is a debugger with nothing to attach to rather than a debugger that refuses.
|
|
193
|
+
*/
|
|
194
|
+
install() {
|
|
195
|
+
if (this.options.build !== "development")
|
|
196
|
+
return;
|
|
197
|
+
this.installed = true;
|
|
198
|
+
this.startedAt = this.now();
|
|
199
|
+
RunnerDebugSeam.onStatement = (stop) => this.offer(stop);
|
|
200
|
+
this.wrapApis();
|
|
201
|
+
}
|
|
202
|
+
/** Take it out again. A facility left installed is the same defect as one compiled into a
|
|
203
|
+
* production build, one process later. */
|
|
204
|
+
uninstall() {
|
|
205
|
+
this.installed = false;
|
|
206
|
+
RunnerDebugSeam.onStatement = null;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* THE HANDLES, OBSERVED RATHER THAN ASKED. The runner declares the `<api as>` set and each
|
|
210
|
+
* handle's two faces; it keeps no state for them, and it should not, because a state nobody
|
|
211
|
+
* reads is a cost every bundle pays. The debug host wraps the declared handles as it installs
|
|
212
|
+
* itself, so the three states exist exactly where a debugger exists.
|
|
213
|
+
*/
|
|
214
|
+
wrapApis() {
|
|
215
|
+
const apis = this.options.env?.apis;
|
|
216
|
+
if (apis === undefined)
|
|
217
|
+
return;
|
|
218
|
+
for (const [name, handle] of apis) {
|
|
219
|
+
const call = handle.call.bind(handle);
|
|
220
|
+
const cancel = handle.cancel.bind(handle);
|
|
221
|
+
apis.set(name, {
|
|
222
|
+
call: async (args) => {
|
|
223
|
+
this.apis.set(name, "in flight");
|
|
224
|
+
try {
|
|
225
|
+
return await call(args);
|
|
226
|
+
}
|
|
227
|
+
finally {
|
|
228
|
+
if (this.apis.get(name) !== "cancelled")
|
|
229
|
+
this.apis.set(name, "idle");
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
cancel: () => { this.apis.set(name, "cancelled"); cancel(); },
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
/** A refusal appended to this run's ledger, and dispatched as it happens. The envelope's own
|
|
237
|
+
* four members in their own order (`refusal.ts:44`), `where` included, because the same code
|
|
238
|
+
* at two funnels is two different facts (`refusal.ts:30`). */
|
|
239
|
+
refuse(refusal) {
|
|
240
|
+
const row = {
|
|
241
|
+
code: refusal.code, message: refusal.message, where: refusal.where,
|
|
242
|
+
...(refusal.detail === undefined ? {} : { detail: refusal.detail }),
|
|
243
|
+
};
|
|
244
|
+
this.ledger.push(row);
|
|
245
|
+
this.emit("refusal", row);
|
|
246
|
+
}
|
|
247
|
+
emit(event, payload) { this.events.push({ event, payload }); }
|
|
248
|
+
/** Which body of the document this stop is in, and therefore which first line to count from. */
|
|
249
|
+
bodyOf(stop) {
|
|
250
|
+
for (const body of this.options.document?.bodies ?? []) {
|
|
251
|
+
if (body.source.trim() === stop.body.trim())
|
|
252
|
+
return body;
|
|
253
|
+
}
|
|
254
|
+
return null;
|
|
255
|
+
}
|
|
256
|
+
lineOf(stop) {
|
|
257
|
+
const body = this.bodyOf(stop);
|
|
258
|
+
if (body === null)
|
|
259
|
+
return { line: 0, body: "" };
|
|
260
|
+
let lines = this.lineCache.get(body.name);
|
|
261
|
+
if (lines === undefined) {
|
|
262
|
+
lines = lineByToken(body.source);
|
|
263
|
+
this.lineCache.set(body.name, lines);
|
|
264
|
+
}
|
|
265
|
+
const within = lines[stop.token] ?? 1;
|
|
266
|
+
return { line: body.firstLine + within - 1, body: body.name };
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* ONE STATEMENT IS OFFERED. Decide whether to hold it, and hold it by not resolving.
|
|
270
|
+
*
|
|
271
|
+
* The order is the order the reasons rank in: a completed step first, because the person
|
|
272
|
+
* asked for it most recently; then an explicit pause, which is a one shot arm; then the
|
|
273
|
+
* breakpoints, which are standing. A statement that matches none of the three runs.
|
|
274
|
+
*/
|
|
275
|
+
offer(stop) {
|
|
276
|
+
const { line, body } = this.lineOf(stop);
|
|
277
|
+
const step = this.stepping;
|
|
278
|
+
if (step !== null && this.stepStopsHere(step, stop)) {
|
|
279
|
+
this.stepping = null;
|
|
280
|
+
return this.hold(stop, line, body, { reason: "step", step: step.mode });
|
|
281
|
+
}
|
|
282
|
+
if (this.pauseArmed) {
|
|
283
|
+
this.pauseArmed = false;
|
|
284
|
+
return this.hold(stop, line, body, { reason: "pause" });
|
|
285
|
+
}
|
|
286
|
+
const point = this.pointAt(body, line, stop);
|
|
287
|
+
if (point !== null)
|
|
288
|
+
return this.hold(stop, line, body, { reason: "breakpoint", breakpoint: point.id });
|
|
289
|
+
return undefined;
|
|
290
|
+
}
|
|
291
|
+
/** `over` never stops deeper than the body it was asked in; `into` stops at the very next
|
|
292
|
+
* statement, which is what makes it behave as `over` at a statement that calls nothing; and
|
|
293
|
+
* `out` stops only once this body's frame is gone. */
|
|
294
|
+
stepStopsHere(step, stop) {
|
|
295
|
+
if (step.mode === "into")
|
|
296
|
+
return true;
|
|
297
|
+
if (step.mode === "out")
|
|
298
|
+
return stop.actionDepth < step.actionDepth;
|
|
299
|
+
return stop.actionDepth <= step.actionDepth;
|
|
300
|
+
}
|
|
301
|
+
/** The breakpoint this stop fires, with its condition and its hit count honoured, or null.
|
|
302
|
+
* A condition is evaluated in the paused scope under the run's own budgets, and a hit count
|
|
303
|
+
* fires on neither before both: the condition decides whether a hit COUNTS. */
|
|
304
|
+
pointAt(bodyName, line, stop) {
|
|
305
|
+
for (const point of this.points) {
|
|
306
|
+
if (point.state !== "bound" || point.line !== line)
|
|
307
|
+
continue;
|
|
308
|
+
if (point.condition !== undefined && !this.truthyIn(point.condition, stop))
|
|
309
|
+
continue;
|
|
310
|
+
point.hitCount += 1;
|
|
311
|
+
if (point.hits !== undefined && point.hitCount < point.hits)
|
|
312
|
+
continue;
|
|
313
|
+
return point;
|
|
314
|
+
}
|
|
315
|
+
void bodyName;
|
|
316
|
+
return null;
|
|
317
|
+
}
|
|
318
|
+
truthyIn(expression, stop) {
|
|
319
|
+
const store = this.options.env?.store;
|
|
320
|
+
if (store === undefined)
|
|
321
|
+
return false;
|
|
322
|
+
try {
|
|
323
|
+
const value = store.eval(expression, stop.scope);
|
|
324
|
+
return value !== null && value !== undefined && value !== false && value !== 0 && value !== "";
|
|
325
|
+
}
|
|
326
|
+
catch {
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
/** Hold the statement. The promise is the pause: the body waits here, holding whatever it was
|
|
331
|
+
* holding, and the ceiling is what bounds that. */
|
|
332
|
+
hold(stop, line, bodyName, why) {
|
|
333
|
+
return new Promise((resolve) => {
|
|
334
|
+
const held = {
|
|
335
|
+
stop, line, bodyName, reason: why.reason, at: this.now(), release: resolve,
|
|
336
|
+
...(why.breakpoint === undefined ? {} : { breakpoint: why.breakpoint }),
|
|
337
|
+
...(why.step === undefined ? {} : { step: why.step }),
|
|
338
|
+
};
|
|
339
|
+
this.held = held;
|
|
340
|
+
this.emit("paused", {
|
|
341
|
+
reason: why.reason,
|
|
342
|
+
...(why.breakpoint === undefined ? {} : { breakpoint: why.breakpoint }),
|
|
343
|
+
...(why.step === undefined ? {} : { step: why.step }),
|
|
344
|
+
document: this.options.document?.path ?? "", line, run: this.runId,
|
|
345
|
+
...(this.options.pauseCeilingMs === undefined ? {} : { ceilingMs: this.options.pauseCeilingMs }),
|
|
346
|
+
});
|
|
347
|
+
const waiting = this.waiters;
|
|
348
|
+
this.waiters = [];
|
|
349
|
+
for (const w of waiting)
|
|
350
|
+
w(held);
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
/** Let a verb wait for the run to come to rest again, so its answer can carry the line it
|
|
354
|
+
* stopped on rather than a promise that it will. */
|
|
355
|
+
nextStop() {
|
|
356
|
+
return new Promise((resolve) => { this.waiters.push(resolve); });
|
|
357
|
+
}
|
|
358
|
+
/** The run finished without stopping again: wake every waiter with nothing. */
|
|
359
|
+
ended(reason = "finished") {
|
|
360
|
+
this.emit("ended", { reason, run: this.runId });
|
|
361
|
+
const waiting = this.waiters;
|
|
362
|
+
this.waiters = [];
|
|
363
|
+
for (const w of waiting)
|
|
364
|
+
w(null);
|
|
365
|
+
}
|
|
366
|
+
/** A run this session is about to observe. Naming it is what lets an event say which. */
|
|
367
|
+
run(id) { this.runId = id; }
|
|
368
|
+
/**
|
|
369
|
+
* THE GATE, and it is the same gate for every verb.
|
|
370
|
+
*
|
|
371
|
+
* 404 before 403, and the order is the argument: a production build compiled no choke point
|
|
372
|
+
* in, so the honest answer is that the door is not there rather than that it is closed to
|
|
373
|
+
* this caller. A correct debug grant changes nothing about a door that does not exist.
|
|
374
|
+
*/
|
|
375
|
+
gate() {
|
|
376
|
+
if (this.options.build !== "development" || !this.installed) {
|
|
377
|
+
return { status: 404, body: { reason: "debug_not_installed" } };
|
|
378
|
+
}
|
|
379
|
+
if (this.options.grant !== "debug")
|
|
380
|
+
return { status: 403, body: { reason: "capability_refused" } };
|
|
381
|
+
return null;
|
|
382
|
+
}
|
|
383
|
+
/** Every verb, through one dispatch, so a door over this session is a door. */
|
|
384
|
+
async call(verb, args = {}) {
|
|
385
|
+
switch (verb) {
|
|
386
|
+
case "breakpoint set": return this.breakpointSet(args);
|
|
387
|
+
case "breakpoint clear": return this.breakpointClear(args);
|
|
388
|
+
case "breakpoint list": return this.breakpointList();
|
|
389
|
+
case "pause": return this.pause(args);
|
|
390
|
+
case "resume": return await this.resume(args);
|
|
391
|
+
case "step over": return await this.step("over");
|
|
392
|
+
case "step into": return await this.step("into");
|
|
393
|
+
case "step out": return await this.step("out");
|
|
394
|
+
case "inspect": return this.inspect(args);
|
|
395
|
+
case "evaluate": return this.evaluate(args);
|
|
396
|
+
case "refusals": return this.refusals();
|
|
397
|
+
default: return { status: 404, body: { reason: "debug_not_installed" } };
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
breakpointSet(args) {
|
|
401
|
+
const refused = this.gate();
|
|
402
|
+
if (refused !== null)
|
|
403
|
+
return refused;
|
|
404
|
+
const document = String(args["document"] ?? this.options.document?.path ?? "");
|
|
405
|
+
const line = Number(args["line"] ?? 0);
|
|
406
|
+
const id = `bp-${String(this.nextPoint)}`;
|
|
407
|
+
this.nextPoint += 1;
|
|
408
|
+
const bound = this.bindsAt(document, line);
|
|
409
|
+
const point = {
|
|
410
|
+
id, document, line, hitCount: 0, state: bound.state,
|
|
411
|
+
...(bound.statement === undefined ? {} : { statement: bound.statement }),
|
|
412
|
+
...(bound.why === undefined ? {} : { why: bound.why }),
|
|
413
|
+
...(typeof args["condition"] === "string" ? { condition: args["condition"] } : {}),
|
|
414
|
+
...(typeof args["hits"] === "number" ? { hits: args["hits"] } : {}),
|
|
415
|
+
};
|
|
416
|
+
this.points.push(point);
|
|
417
|
+
return { status: 200, body: { ...point } };
|
|
418
|
+
}
|
|
419
|
+
/** Does this line bind a statement in this document, and if not, say which of the two
|
|
420
|
+
* reasons it is: the document is not mounted here at all, or the line binds nothing. */
|
|
421
|
+
bindsAt(document, line) {
|
|
422
|
+
const doc = this.options.document;
|
|
423
|
+
if (doc === undefined || doc.path !== document) {
|
|
424
|
+
return { state: "armed", why: "the document is not mounted, so no statement is bound yet" };
|
|
425
|
+
}
|
|
426
|
+
for (const body of doc.bodies) {
|
|
427
|
+
const lines = statementStartLines(body.source);
|
|
428
|
+
const within = line - body.firstLine + 1;
|
|
429
|
+
if (within < 1)
|
|
430
|
+
continue;
|
|
431
|
+
if (lines.includes(within)) {
|
|
432
|
+
return { state: "bound", statement: statementAtLine(body.source, within) };
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
return { state: "unbound", why: "the line no longer binds a statement" };
|
|
436
|
+
}
|
|
437
|
+
/** A document was rebuilt: rebind every breakpoint in it and say so, by name. A breakpoint
|
|
438
|
+
* that silently never fires and one on a line that never runs read identically to a person,
|
|
439
|
+
* and only one of them is a lie the tool told. */
|
|
440
|
+
rebuilt(document, moved = (line) => line) {
|
|
441
|
+
this.options.document = document;
|
|
442
|
+
this.lineCache.clear();
|
|
443
|
+
for (const point of this.points) {
|
|
444
|
+
if (point.document !== document.path)
|
|
445
|
+
continue;
|
|
446
|
+
const was = point.line;
|
|
447
|
+
point.line = moved(was);
|
|
448
|
+
const bound = this.bindsAt(point.document, point.line);
|
|
449
|
+
point.state = bound.state;
|
|
450
|
+
if (bound.statement !== undefined)
|
|
451
|
+
point.statement = bound.statement;
|
|
452
|
+
if (bound.state === "bound") {
|
|
453
|
+
this.emit("breakpointbound", {
|
|
454
|
+
id: point.id, document: point.document, line: point.line, was,
|
|
455
|
+
statement: point.statement ?? "",
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
this.emit("breakpointunbound", {
|
|
460
|
+
id: point.id, document: point.document, line: point.line,
|
|
461
|
+
why: bound.why ?? "the line no longer binds a statement",
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
/** A body escalated to the JS tier, where the interpreter is not executing at all, so a
|
|
467
|
+
* breakpoint inside it is unbound WITH THAT REASON rather than silently never firing. */
|
|
468
|
+
escalated(document) {
|
|
469
|
+
for (const point of this.points) {
|
|
470
|
+
if (point.document !== document)
|
|
471
|
+
continue;
|
|
472
|
+
point.state = "unbound";
|
|
473
|
+
point.why = "the body escalated to the JS tier, where the interpreter is not executing at all";
|
|
474
|
+
this.emit("breakpointunbound", {
|
|
475
|
+
id: point.id, document: point.document, line: point.line, why: point.why,
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
breakpointClear(args) {
|
|
480
|
+
const refused = this.gate();
|
|
481
|
+
if (refused !== null)
|
|
482
|
+
return refused;
|
|
483
|
+
const cleared = [];
|
|
484
|
+
const keep = [];
|
|
485
|
+
for (const point of this.points) {
|
|
486
|
+
const byId = args["id"] !== undefined && point.id === args["id"];
|
|
487
|
+
const byDocument = args["document"] !== undefined && point.document === args["document"];
|
|
488
|
+
const all = args["all"] === true;
|
|
489
|
+
if (byId || byDocument || all)
|
|
490
|
+
cleared.push(point.id);
|
|
491
|
+
else
|
|
492
|
+
keep.push(point);
|
|
493
|
+
}
|
|
494
|
+
this.points.length = 0;
|
|
495
|
+
this.points.push(...keep);
|
|
496
|
+
return { status: 200, body: { cleared } };
|
|
497
|
+
}
|
|
498
|
+
breakpointList() {
|
|
499
|
+
const refused = this.gate();
|
|
500
|
+
if (refused !== null)
|
|
501
|
+
return refused;
|
|
502
|
+
return {
|
|
503
|
+
status: 200,
|
|
504
|
+
body: { breakpoints: this.points.map((p) => ({ ...p })) },
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* `pause`: ask the next statement of the next entry to stop, with no breakpoint armed.
|
|
509
|
+
*
|
|
510
|
+
* A run with a caller waiting is never paused. The caller's timeout is not this session's to
|
|
511
|
+
* extend, so stopping the clock there could not be honest; the honest answer is the recorded
|
|
512
|
+
* run, which is what `debug-record.ts` is.
|
|
513
|
+
*/
|
|
514
|
+
pause(args) {
|
|
515
|
+
const refused = this.gate();
|
|
516
|
+
if (refused !== null)
|
|
517
|
+
return refused;
|
|
518
|
+
const kind = String(args["kind"] ?? "explicit_run");
|
|
519
|
+
if (kind === "http_request") {
|
|
520
|
+
return {
|
|
521
|
+
status: 409,
|
|
522
|
+
body: { reason: "request_scoped_run", offer: "record this run and replay it" },
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
this.pauseArmed = true;
|
|
526
|
+
return { status: 200, body: { armed: true } };
|
|
527
|
+
}
|
|
528
|
+
/** `resume`: continue the held run, and do not charge the pause to the deadline. */
|
|
529
|
+
async resume(args) {
|
|
530
|
+
const refused = this.gate();
|
|
531
|
+
if (refused !== null)
|
|
532
|
+
return refused;
|
|
533
|
+
const named = args["run"];
|
|
534
|
+
if (typeof named === "string" && this.abandoned.has(named)) {
|
|
535
|
+
return { status: 409, body: { reason: "run_abandoned" } };
|
|
536
|
+
}
|
|
537
|
+
const held = this.held;
|
|
538
|
+
if (held === null)
|
|
539
|
+
return { status: 409, body: { reason: "not_paused" } };
|
|
540
|
+
const pausedMs = this.now() - held.at;
|
|
541
|
+
const ceiling = this.options.pauseCeilingMs;
|
|
542
|
+
if (ceiling !== undefined && pausedMs > ceiling) {
|
|
543
|
+
this.abandon();
|
|
544
|
+
return { status: 409, body: { reason: "run_abandoned" } };
|
|
545
|
+
}
|
|
546
|
+
this.pausedMs += pausedMs;
|
|
547
|
+
const env = this.options.env;
|
|
548
|
+
if (env?.deadlineAt !== undefined)
|
|
549
|
+
env.deadlineAt += pausedMs;
|
|
550
|
+
this.held = null;
|
|
551
|
+
this.emit("resumed", { reason: "resume", run: this.runId });
|
|
552
|
+
held.release();
|
|
553
|
+
return {
|
|
554
|
+
status: 200,
|
|
555
|
+
body: {
|
|
556
|
+
resumed: true, pausedMs,
|
|
557
|
+
...(env?.deadlineAt === undefined ? {} : { deadlineAt: env.deadlineAt }),
|
|
558
|
+
},
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* THE PAUSE CEILING EXPIRED, so the run is ABANDONED rather than resumed.
|
|
563
|
+
*
|
|
564
|
+
* An abandoned debugger, a browser tab closed or an agent that died mid script, must not hold
|
|
565
|
+
* a run for ever, because a held run holds whatever it was holding: a transaction, a lease, a
|
|
566
|
+
* file handle. Resuming one silently is how a debugger corrupts state in development.
|
|
567
|
+
*/
|
|
568
|
+
abandon() {
|
|
569
|
+
const held = this.held;
|
|
570
|
+
if (held === null)
|
|
571
|
+
return;
|
|
572
|
+
this.held = null;
|
|
573
|
+
this.abandoned.add(this.runId);
|
|
574
|
+
this.emit("ended", { reason: "pause_ceiling", run: this.runId });
|
|
575
|
+
held.release();
|
|
576
|
+
}
|
|
577
|
+
/** `step over`, `step into`, `step out`. The answer carries the line it came to rest on, so
|
|
578
|
+
* a scripted session reads one answer rather than correlating an event. */
|
|
579
|
+
async step(mode) {
|
|
580
|
+
const refused = this.gate();
|
|
581
|
+
if (refused !== null)
|
|
582
|
+
return refused;
|
|
583
|
+
const held = this.held;
|
|
584
|
+
if (held === null)
|
|
585
|
+
return { status: 409, body: { reason: "not_paused" } };
|
|
586
|
+
this.stepping = {
|
|
587
|
+
mode, actionDepth: held.stop.actionDepth, depth: held.stop.depth, body: held.stop.body,
|
|
588
|
+
};
|
|
589
|
+
const pausedMs = this.now() - held.at;
|
|
590
|
+
this.pausedMs += pausedMs;
|
|
591
|
+
const env = this.options.env;
|
|
592
|
+
if (env?.deadlineAt !== undefined)
|
|
593
|
+
env.deadlineAt += pausedMs;
|
|
594
|
+
this.held = null;
|
|
595
|
+
const waiting = this.nextStop();
|
|
596
|
+
held.release();
|
|
597
|
+
const next = await waiting;
|
|
598
|
+
if (next === null)
|
|
599
|
+
return { status: 200, body: { line: 0, ended: true } };
|
|
600
|
+
const answer = { line: next.line };
|
|
601
|
+
// `into` at a statement that entered no authored body lands where `over` would have, and
|
|
602
|
+
// says so rather than leaving a person to wonder whether the step was swallowed. The two
|
|
603
|
+
// reasons it can happen are named apart, because they are different facts: the statement
|
|
604
|
+
// called nothing at all, or its callee is a module, whose body is a lane's implementation
|
|
605
|
+
// and not the author's document.
|
|
606
|
+
if (mode === "into" && next.stop.actionDepth <= held.stop.actionDepth) {
|
|
607
|
+
answer["behavedAs"] = "over";
|
|
608
|
+
const statement = this.statementOf(held);
|
|
609
|
+
if (statement.includes("dsx.module.")) {
|
|
610
|
+
answer["why"] = "the callee is a module, not an authored body";
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
return { status: 200, body: answer };
|
|
614
|
+
}
|
|
615
|
+
/** `inspect`: the paused frame, and it changes nothing about the run. */
|
|
616
|
+
inspect(args) {
|
|
617
|
+
const refused = this.gate();
|
|
618
|
+
if (refused !== null)
|
|
619
|
+
return refused;
|
|
620
|
+
const held = this.held;
|
|
621
|
+
if (held === null)
|
|
622
|
+
return { status: 409, body: { reason: "not_paused" } };
|
|
623
|
+
const store = this.storeSubtree(args["store"]);
|
|
624
|
+
const pausedMs = this.now() - held.at;
|
|
625
|
+
const chain = [{ kind: "entry", name: "on:click" }];
|
|
626
|
+
held.stop.chain.forEach((name, index) => chain.push({ kind: "action", name, depth: index + 1 }));
|
|
627
|
+
const route = this.options.route;
|
|
628
|
+
return {
|
|
629
|
+
status: 200,
|
|
630
|
+
body: {
|
|
631
|
+
document: this.options.document?.path ?? "",
|
|
632
|
+
line: held.line,
|
|
633
|
+
statement: held.stop.body.length === 0 ? "" : this.statementOf(held),
|
|
634
|
+
store,
|
|
635
|
+
locals: scopeLocals(held.stop.scope),
|
|
636
|
+
apis: [...this.apis].map(([as, state]) => ({ as, state })),
|
|
637
|
+
...(route === undefined ? {} : { route: route.params === undefined ? route.path : { path: route.path, params: route.params } }),
|
|
638
|
+
chain,
|
|
639
|
+
actionDepth: held.stop.actionDepth,
|
|
640
|
+
actionDepthCap: ACTION_DEPTH_CAP,
|
|
641
|
+
pausedMs,
|
|
642
|
+
// THE TWO DURATIONS, BOTH STATED. Elapsed is what a clock on the wall saw; executed is
|
|
643
|
+
// what is left when the pauses are taken out. Printing only the first would let a
|
|
644
|
+
// person read a debugged run's duration as a measurement, which section 6 says not to.
|
|
645
|
+
executedMs: this.now() - this.startedAt - this.pausedMs - pausedMs,
|
|
646
|
+
elapsedMs: this.now() - this.startedAt,
|
|
647
|
+
callBudget: this.callBudget(),
|
|
648
|
+
},
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
statementOf(held) {
|
|
652
|
+
const body = this.bodyOf(held.stop);
|
|
653
|
+
if (body === null)
|
|
654
|
+
return "";
|
|
655
|
+
return statementAtLine(body.source, held.line - body.firstLine + 1);
|
|
656
|
+
}
|
|
657
|
+
callBudget() {
|
|
658
|
+
const budget = this.options.env?.callBudget;
|
|
659
|
+
return { count: budget?.count ?? 0, cap: budget?.cap ?? 0 };
|
|
660
|
+
}
|
|
661
|
+
/** The store, or one named subtree of it. A frame asserted over three keys fails for a reason
|
|
662
|
+
* a reader can see; one asserted over a real application's store does not. */
|
|
663
|
+
storeSubtree(pick) {
|
|
664
|
+
const store = this.options.env?.store;
|
|
665
|
+
if (store === undefined)
|
|
666
|
+
return {};
|
|
667
|
+
const all = {};
|
|
668
|
+
for (const [key, value] of store.vars)
|
|
669
|
+
all[key] = value;
|
|
670
|
+
if (typeof pick !== "string" || pick.length === 0)
|
|
671
|
+
return all;
|
|
672
|
+
return Object.hasOwn(all, pick) ? { [pick]: all[pick] } : {};
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* `evaluate`: one expression in the paused scope, READ ONLY.
|
|
676
|
+
*
|
|
677
|
+
* Section 6's rule, and its price is stated rather than hidden: this costs the most useful
|
|
678
|
+
* debugger trick there is, changing a value and continuing, and it buys the property that
|
|
679
|
+
* inspecting a run cannot alter it, which is what makes a replay reproducible. The plan says
|
|
680
|
+
* to revisit it after the corpus exists, never before, so changing it means changing the
|
|
681
|
+
* corpus first, with the argument written down.
|
|
682
|
+
*
|
|
683
|
+
* The budgets are the RUN'S budgets and never new ones. An expression box outside them would
|
|
684
|
+
* be a hole straight through them, and a person debugging a budget exhaustion would be
|
|
685
|
+
* debugging it with the budgets off.
|
|
686
|
+
*/
|
|
687
|
+
evaluate(args) {
|
|
688
|
+
const refused = this.gate();
|
|
689
|
+
if (refused !== null)
|
|
690
|
+
return refused;
|
|
691
|
+
// THE SHAPE IS REFUSED BEFORE ANYTHING IS SCHEDULED, which is why this comes before the
|
|
692
|
+
// held frame is looked for: a write is refused because it is a write, not because there
|
|
693
|
+
// happened to be nowhere to run it.
|
|
694
|
+
const expression = String(args["expression"] ?? "");
|
|
695
|
+
const write = writeInExpression(expression, (scheme, action) => this.effectful(scheme, action));
|
|
696
|
+
if (write !== null)
|
|
697
|
+
return { status: 403, body: { reason: "evaluate_write_refused", why: write } };
|
|
698
|
+
const held = this.held;
|
|
699
|
+
if (held === null)
|
|
700
|
+
return { status: 409, body: { reason: "not_paused" } };
|
|
701
|
+
const env = this.options.env;
|
|
702
|
+
if (env !== undefined && env.loopWork.count >= (env.loopCap ?? Infinity)) {
|
|
703
|
+
const detail = { kind: "budget", limit: "loop", budget: env.loopCap ?? 0, units: "iterations" };
|
|
704
|
+
const row = {
|
|
705
|
+
code: "jse_budget_exhausted", message: "loop budget exceeded", where: "jse.eval", detail,
|
|
706
|
+
};
|
|
707
|
+
this.ledger.push(row);
|
|
708
|
+
return { status: 200, body: { refusal: row } };
|
|
709
|
+
}
|
|
710
|
+
// A MODULE CALL SPENDS THE RUN'S OWN CALL BUDGET, which is surprising and correct: the
|
|
711
|
+
// alternative is that inspecting a run changes what the run can then do.
|
|
712
|
+
const budget = env?.callBudget;
|
|
713
|
+
if (budget !== undefined && /\bdsx\s*\.\s*module\s*\./.test(expression))
|
|
714
|
+
budget.count += 1;
|
|
715
|
+
const store = this.options.env?.store;
|
|
716
|
+
if (store === undefined)
|
|
717
|
+
return { status: 200, body: { callBudget: this.callBudget() } };
|
|
718
|
+
if (/\bdsx\s*\.\s*module\s*\./.test(expression)) {
|
|
719
|
+
return { status: 200, body: { callBudget: this.callBudget() } };
|
|
720
|
+
}
|
|
721
|
+
// THE PAUSED SCOPE ITSELF, not a copy of it. The authored locals ledger rides the scope
|
|
722
|
+
// under a non enumerable symbol, so a spread drops it and every local then reads as an
|
|
723
|
+
// absence: the expression box would answer a different value from the statement beside it.
|
|
724
|
+
// An evaluation is refused if it would write, so handing over the live object costs
|
|
725
|
+
// nothing that the read only rule has not already taken away.
|
|
726
|
+
const value = store.eval(expression, held.stop.scope);
|
|
727
|
+
return { status: 200, body: { value, callBudget: this.callBudget() } };
|
|
728
|
+
}
|
|
729
|
+
/** Does this module action declare an effect. A module with no declaration is treated as
|
|
730
|
+
* effectful, for the reason an unknown markup door is treated as over the air: the safe
|
|
731
|
+
* answer to "what does this do" is "something". */
|
|
732
|
+
effectful(scheme, action) {
|
|
733
|
+
const declared = this.options.effects?.[`${scheme}.${action}`];
|
|
734
|
+
return declared !== false;
|
|
735
|
+
}
|
|
736
|
+
refusals() {
|
|
737
|
+
const refused = this.gate();
|
|
738
|
+
if (refused !== null)
|
|
739
|
+
return refused;
|
|
740
|
+
return { status: 200, body: { refusals: this.ledger.map((r) => ({ ...r })) } };
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* WOULD THIS EXPRESSION WRITE, and if so in which of the three ways.
|
|
745
|
+
*
|
|
746
|
+
* Three ways and the corpus names all three: it assigns, it calls an action, or it calls a
|
|
747
|
+
* module action that declares an effect. A declared READ is not a write and is answered.
|
|
748
|
+
*/
|
|
749
|
+
export function writeInExpression(expression, effectful) {
|
|
750
|
+
const pre = preprocessSource(expression);
|
|
751
|
+
const { tokens } = tokenizeSpans(expression);
|
|
752
|
+
// An assignment at any depth: `=` that is not part of `==`, `===`, `!=`, `<=`, `>=`, `=>`,
|
|
753
|
+
// and the compound forms, each of which the tokenizer already answers as one token.
|
|
754
|
+
const assigns = new Set(["=", "+=", "-=", "*=", "/=", "%=", "**=", "||=", "&&=", "??=", "++", "--"]);
|
|
755
|
+
for (const { token } of tokens) {
|
|
756
|
+
if (token.kind === "op" && assigns.has(token.v))
|
|
757
|
+
return "the expression assigns";
|
|
758
|
+
}
|
|
759
|
+
if (/\bdsx\s*\.\s*action\s*\./.test(pre))
|
|
760
|
+
return "the expression calls an action";
|
|
761
|
+
const module = /\bdsx\s*\.\s*module\s*\.\s*([A-Za-z_][A-Za-z0-9_]*)\s*\.\s*([A-Za-z_][A-Za-z0-9_]*)/.exec(pre);
|
|
762
|
+
if (module !== null && effectful(module[1], module[2])) {
|
|
763
|
+
return "the module action declares an effect";
|
|
764
|
+
}
|
|
765
|
+
return null;
|
|
766
|
+
}
|
|
767
|
+
//# sourceMappingURL=debug.js.map
|