@johnhenry/mallory-cli 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -2
- package/bin/mallory.mjs +51 -0
- package/package.json +51 -4
- package/src/a2a/client.js +511 -0
- package/src/a2a/demo-agent.js +396 -0
- package/src/a2a/hub.js +578 -0
- package/src/a2a/settings.js +88 -0
- package/src/a2a/task.js +358 -0
- package/src/acp/client.js +573 -0
- package/src/acp/demo-agent.js +332 -0
- package/src/acp/hub.js +632 -0
- package/src/acp/settings.js +78 -0
- package/src/actions/map.js +524 -0
- package/src/agent/cloud.js +77 -0
- package/src/agent/compact.js +84 -0
- package/src/agent/constants.js +39 -0
- package/src/agent/diff.js +101 -0
- package/src/agent/fork.js +159 -0
- package/src/agent/grounding.js +73 -0
- package/src/agent/guards.js +129 -0
- package/src/agent/local-transport.js +152 -0
- package/src/agent/loop.js +479 -0
- package/src/agent/park-store.js +77 -0
- package/src/agent/park.js +76 -0
- package/src/agent/ports.js +28 -0
- package/src/agent/providers.js +591 -0
- package/src/agent/restart.js +51 -0
- package/src/agent/router.js +380 -0
- package/src/agent/run.js +861 -0
- package/src/agent/tools.js +247 -0
- package/src/agent-library/engine.js +43 -0
- package/src/ai/bridge.js +155 -0
- package/src/ai/policy.js +131 -0
- package/src/aimatey/vendor.js +18 -0
- package/src/audio/container-duration.js +35 -0
- package/src/audio/instruments.js +776 -0
- package/src/audio/lanes.js +230 -0
- package/src/audio/patch.js +1410 -0
- package/src/audio/plan.js +276 -0
- package/src/audio/rack.js +1006 -0
- package/src/audio/sample-trim.js +293 -0
- package/src/audio/soundfont.js +243 -0
- package/src/audio/take-store.js +87 -0
- package/src/audio/takes.js +129 -0
- package/src/audio/wav.js +170 -0
- package/src/audio/zzfx.js +333 -0
- package/src/autonomy/bundle.js +207 -0
- package/src/autonomy/confine.js +61 -0
- package/src/autonomy/enforce.js +155 -0
- package/src/autonomy/file-kv.js +88 -0
- package/src/autonomy/ledger.js +203 -0
- package/src/autonomy/pins.js +50 -0
- package/src/autonomy/psl/index.js +32 -0
- package/src/autonomy/psl/suffixes.json +1 -0
- package/src/autonomy/record.js +28 -0
- package/src/autonomy/routines.js +107 -0
- package/src/autonomy/server.js +175 -0
- package/src/autonomy/signer-node.js +167 -0
- package/src/autonomy/store.js +43 -0
- package/src/autonomy/unattended.js +13 -0
- package/src/bytes/bytes.js +378 -0
- package/src/calc/syntax.js +125 -0
- package/src/calc/tex.js +28 -0
- package/src/calendar/vendor.js +2 -0
- package/src/clipboard.js +130 -0
- package/src/clsh/clsh.js +3417 -0
- package/src/codec/capnp.js +1804 -0
- package/src/codec/core.js +2043 -0
- package/src/codec/vendor/avro.js +136 -0
- package/src/codec/vendor/cbor.js +25 -0
- package/src/codec/vendor/flatbuffers.js +206 -0
- package/src/codec/vendor/msgpack.js +9 -0
- package/src/codec/vendor/protobuf.js +53 -0
- package/src/delegation/caps.js +60 -0
- package/src/delegation/config.js +32 -0
- package/src/device/model.js +246 -0
- package/src/device/recording.js +198 -0
- package/src/device/stream-model.js +151 -0
- package/src/documents/documents.js +1224 -0
- package/src/effects/catalog.js +63 -0
- package/src/effects/extras.js +133 -0
- package/src/effects/parse.js +339 -0
- package/src/embed/protocol.js +131 -0
- package/src/env/env.js +159 -0
- package/src/exact/vendor.js +45 -0
- package/src/example-meta.js +164 -0
- package/src/examples.js +94 -0
- package/src/export/canvas-image.js +217 -0
- package/src/export/expr-latex-lazy.js +8 -0
- package/src/export/formats.js +322 -0
- package/src/export/latex.js +183 -0
- package/src/export/pane.js +184 -0
- package/src/export/value.js +452 -0
- package/src/export/zip.js +214 -0
- package/src/ext/access.js +58 -0
- package/src/ext/btasks.js +225 -0
- package/src/ext/client.js +209 -0
- package/src/ext/tools.js +69 -0
- package/src/ext/view.js +105 -0
- package/src/ext/webmcp-tabs.js +299 -0
- package/src/files/archive.js +232 -0
- package/src/files/files.js +317 -0
- package/src/formats/json.js +24 -0
- package/src/formats/jupyter.js +188 -0
- package/src/formats/markdown.js +254 -0
- package/src/formats/n8n.js +276 -0
- package/src/formats/node-red.js +363 -0
- package/src/formats/registry.js +177 -0
- package/src/formats/rivet.js +259 -0
- package/src/formats/shared.js +98 -0
- package/src/formats/structure.js +182 -0
- package/src/formats/yaml.js +127 -0
- package/src/frame/frame.js +962 -0
- package/src/frame/vendor.js +1484 -0
- package/src/gate/audit.js +116 -0
- package/src/gate/gate.js +365 -0
- package/src/gate/policy.js +295 -0
- package/src/gate/scripted.js +110 -0
- package/src/gate/seams.js +32 -0
- package/src/gate/store.js +66 -0
- package/src/geometry/model.js +533 -0
- package/src/grant-key.js +149 -0
- package/src/graph/model.js +381 -0
- package/src/headless/a2a-push.js +123 -0
- package/src/headless/channels/config.js +142 -0
- package/src/headless/channels/connectors.js +283 -0
- package/src/headless/channels/index.js +257 -0
- package/src/headless/channels/mail.js +197 -0
- package/src/headless/channels/mailnet.js +223 -0
- package/src/headless/channels/platforms.js +194 -0
- package/src/headless/channels/replay.js +49 -0
- package/src/headless/cli.js +1397 -0
- package/src/headless/companion-client.js +182 -0
- package/src/headless/cost-cli.js +177 -0
- package/src/headless/deprecations-cli.js +102 -0
- package/src/headless/examples.js +48 -0
- package/src/headless/ffmpeg-exec.js +217 -0
- package/src/headless/gateways/config.js +213 -0
- package/src/headless/gateways/homeassistant.js +159 -0
- package/src/headless/gateways/index.js +121 -0
- package/src/headless/gateways/matter.js +150 -0
- package/src/headless/gateways/mqtt-client.js +177 -0
- package/src/headless/gateways/mqtt.js +70 -0
- package/src/headless/gateways/netway.js +226 -0
- package/src/headless/gateways/serverpod-worker.mjs +16 -0
- package/src/headless/gateways/serverpod.js +71 -0
- package/src/headless/gateways/util.js +27 -0
- package/src/headless/grant-cli.js +208 -0
- package/src/headless/guard.js +125 -0
- package/src/headless/guards.js +124 -0
- package/src/headless/machine-cli.js +853 -0
- package/src/headless/mcp-endpoint.js +287 -0
- package/src/headless/mcp-roots.js +38 -0
- package/src/headless/model-endpoint.js +88 -0
- package/src/headless/net.js +151 -0
- package/src/headless/node.js +263 -0
- package/src/headless/npm-tarball.js +29 -0
- package/src/headless/operator-page.js +112 -0
- package/src/headless/operator.js +242 -0
- package/src/headless/people.js +34 -0
- package/src/headless/pkg-cli.js +1103 -0
- package/src/headless/pkg-serve.js +138 -0
- package/src/headless/process-worker.js +88 -0
- package/src/headless/runner-remote.js +477 -0
- package/src/headless/sandbox-child.mjs +21 -0
- package/src/headless/scheduled.js +557 -0
- package/src/headless/serve-stream.js +97 -0
- package/src/headless/serve.js +2238 -0
- package/src/headless/short-links.js +158 -0
- package/src/headless/static-dirs.js +207 -0
- package/src/headless/trust-file.js +51 -0
- package/src/headless/watch.js +291 -0
- package/src/headless/ws-connect.js +65 -0
- package/src/headless/ws-connections.js +44 -0
- package/src/headless/ws-echo.js +150 -0
- package/src/headless/ws-proxy.js +354 -0
- package/src/headless/ws-ticket.js +48 -0
- package/src/hooks/config.js +50 -0
- package/src/hooks/engine.js +189 -0
- package/src/input/log.js +613 -0
- package/src/input/player.js +217 -0
- package/src/input/replay.js +209 -0
- package/src/jth/vendor.js +28 -0
- package/src/ledger/tx.js +94 -0
- package/src/machine/apply.js +193 -0
- package/src/machine/diff.js +168 -0
- package/src/machine/drive.js +296 -0
- package/src/machine/engine.js +478 -0
- package/src/machine/files-tool.js +76 -0
- package/src/machine/lint.js +139 -0
- package/src/machine/llmtm-trace.js +117 -0
- package/src/machine/llmtm.js +475 -0
- package/src/machine/otel.js +80 -0
- package/src/machine/pane-provider.js +51 -0
- package/src/machine/propose.js +159 -0
- package/src/machine/random.js +52 -0
- package/src/machine/risk.js +107 -0
- package/src/machine/session.js +1017 -0
- package/src/machine/shell-tool.js +45 -0
- package/src/machine/tape.js +349 -0
- package/src/machine/templates.js +104 -0
- package/src/machine/trace.js +664 -0
- package/src/machine/view.js +73 -0
- package/src/machine/vm-tool.js +47 -0
- package/src/machine/watchdog.js +46 -0
- package/src/mcp/app-args.js +51 -0
- package/src/mcp/app-run.js +56 -0
- package/src/mcp/apps.js +468 -0
- package/src/mcp/cache.js +232 -0
- package/src/mcp/client.js +507 -0
- package/src/mcp/demo-app.js +183 -0
- package/src/mcp/demo-server.js +602 -0
- package/src/mcp/elicitation.js +116 -0
- package/src/mcp/hub.js +1326 -0
- package/src/mcp/roots.js +139 -0
- package/src/mcp/sampling.js +105 -0
- package/src/mcp/settings.js +125 -0
- package/src/mcp/tape.js +292 -0
- package/src/mcp/uri-template.js +156 -0
- package/src/mcp/wsh-client.js +164 -0
- package/src/media/animated-codec.js +7 -0
- package/src/media/animated.js +623 -0
- package/src/media/compare-agent.js +70 -0
- package/src/media/compare-job.js +63 -0
- package/src/media/compare-page.js +296 -0
- package/src/media/compare-worker.js +14 -0
- package/src/media/compare.js +600 -0
- package/src/media/contract.js +62 -0
- package/src/media/decode-frame.js +57 -0
- package/src/media/decode-pool.js +188 -0
- package/src/media/ffmpeg-edit.js +344 -0
- package/src/media/ffmpeg-wasm-client.js +121 -0
- package/src/media/ffmpeg-wasm-session.js +79 -0
- package/src/media/ffmpeg-wasm.js +139 -0
- package/src/media/ffmpeg-worker.js +23 -0
- package/src/media/ffmpeg.js +903 -0
- package/src/media/helpers.js +419 -0
- package/src/media/keep.js +108 -0
- package/src/media/metadata-worker.js +16 -0
- package/src/media/metadata.js +2518 -0
- package/src/media/mime.js +102 -0
- package/src/media/page-decode.js +74 -0
- package/src/media/persist.js +114 -0
- package/src/media/png.js +226 -0
- package/src/media/sample-input.js +67 -0
- package/src/media/store.js +86 -0
- package/src/media/wav.js +109 -0
- package/src/midi/mappings.js +250 -0
- package/src/midi/message.js +125 -0
- package/src/model/action-hub.js +143 -0
- package/src/model/adapters.js +284 -0
- package/src/model/agent-runs.js +12 -0
- package/src/model/arrange.js +308 -0
- package/src/model/automation-clock.js +494 -0
- package/src/model/automation.js +653 -0
- package/src/model/batches.js +78 -0
- package/src/model/binary-view.js +195 -0
- package/src/model/breakpoints.js +392 -0
- package/src/model/calc-settings.js +65 -0
- package/src/model/calendar.js +254 -0
- package/src/model/canvas-id.js +5 -0
- package/src/model/canvas.js +5048 -0
- package/src/model/channel-names.js +29 -0
- package/src/model/channels.js +692 -0
- package/src/model/chart-clock.js +631 -0
- package/src/model/chart-code.js +69 -0
- package/src/model/codecs.js +60 -0
- package/src/model/companion-access.js +271 -0
- package/src/model/companion-pane.js +50 -0
- package/src/model/composite.js +324 -0
- package/src/model/context.js +380 -0
- package/src/model/controls.js +231 -0
- package/src/model/converter-presets.js +368 -0
- package/src/model/cost.js +580 -0
- package/src/model/curve-transform.js +122 -0
- package/src/model/cycles.js +176 -0
- package/src/model/debug-log.js +168 -0
- package/src/model/decision-clock.js +100 -0
- package/src/model/decisions.js +265 -0
- package/src/model/desk.js +87 -0
- package/src/model/device-hub.js +400 -0
- package/src/model/diff.js +445 -0
- package/src/model/emit-events.js +179 -0
- package/src/model/errors.js +238 -0
- package/src/model/event-presets.js +297 -0
- package/src/model/events.js +1303 -0
- package/src/model/explicit-setters.js +139 -0
- package/src/model/field-mapping.js +623 -0
- package/src/model/files-pane.js +263 -0
- package/src/model/flow-idle.js +89 -0
- package/src/model/foreach.js +549 -0
- package/src/model/frame-loop.js +71 -0
- package/src/model/frame-pressure.js +180 -0
- package/src/model/function-scaffold.js +1000 -0
- package/src/model/geometry-settings.js +54 -0
- package/src/model/goals.js +176 -0
- package/src/model/graph-settings.js +76 -0
- package/src/model/grid-widget.js +175 -0
- package/src/model/groups.js +332 -0
- package/src/model/hash.js +21 -0
- package/src/model/history.js +259 -0
- package/src/model/http-copy.js +88 -0
- package/src/model/http-send-companion.js +110 -0
- package/src/model/http-send.js +163 -0
- package/src/model/http-tap.js +521 -0
- package/src/model/http-tools.js +1138 -0
- package/src/model/import-lock.js +78 -0
- package/src/model/imports.js +258 -0
- package/src/model/infer-outputs.js +822 -0
- package/src/model/ink-connect.js +150 -0
- package/src/model/ink-diff.js +75 -0
- package/src/model/ink-gone.js +71 -0
- package/src/model/ink-route.js +120 -0
- package/src/model/ink-svg.js +206 -0
- package/src/model/ink.js +739 -0
- package/src/model/input-log-hub.js +456 -0
- package/src/model/input-split.js +69 -0
- package/src/model/json-schema-host.js +9 -0
- package/src/model/json-schema.js +368 -0
- package/src/model/jth.js +78 -0
- package/src/model/latex-expr.js +528 -0
- package/src/model/layout-history.js +120 -0
- package/src/model/lazy-map.js +88 -0
- package/src/model/ledger-pane.js +101 -0
- package/src/model/legacy-viaframe.js +90 -0
- package/src/model/lessons.js +448 -0
- package/src/model/links.js +981 -0
- package/src/model/live.js +411 -0
- package/src/model/math-widget.js +53 -0
- package/src/model/memory-settings.js +33 -0
- package/src/model/midi-controls.js +350 -0
- package/src/model/nl-time.js +408 -0
- package/src/model/notebook.js +137 -0
- package/src/model/pane-view-store.js +15 -0
- package/src/model/partial.js +115 -0
- package/src/model/pause-clock.js +53 -0
- package/src/model/peer-pane.js +32 -0
- package/src/model/persist-state.js +290 -0
- package/src/model/person-only.js +122 -0
- package/src/model/pin.js +209 -0
- package/src/model/plot-3d.js +213 -0
- package/src/model/plot-series.js +157 -0
- package/src/model/plot-settings.js +531 -0
- package/src/model/ports.js +312 -0
- package/src/model/presentation.js +222 -0
- package/src/model/preset-apply.js +316 -0
- package/src/model/preset-banks.js +335 -0
- package/src/model/preset-morph.js +263 -0
- package/src/model/preset-ops.js +205 -0
- package/src/model/preset-player.js +283 -0
- package/src/model/preset-states.js +172 -0
- package/src/model/profile-settings.js +109 -0
- package/src/model/promote.js +103 -0
- package/src/model/protected.js +10 -0
- package/src/model/proxy-log.js +230 -0
- package/src/model/proxy.js +367 -0
- package/src/model/quantity-widget.js +61 -0
- package/src/model/queue-book.js +359 -0
- package/src/model/quick-add.js +224 -0
- package/src/model/rate-limit.js +313 -0
- package/src/model/rate.js +95 -0
- package/src/model/recovery.js +216 -0
- package/src/model/rename-follow.js +113 -0
- package/src/model/repeater.js +1126 -0
- package/src/model/retention.js +664 -0
- package/src/model/route-edit.js +132 -0
- package/src/model/router.js +155 -0
- package/src/model/runaway.js +232 -0
- package/src/model/runlog.js +1033 -0
- package/src/model/runners/a2a.js +2 -0
- package/src/model/runners/acp.js +2 -0
- package/src/model/runners/actions.js +4 -0
- package/src/model/runners/agent.js +4 -0
- package/src/model/runners/audio.js +21 -0
- package/src/model/runners/automation.js +2 -0
- package/src/model/runners/calc.js +23 -0
- package/src/model/runners/catch.js +10 -0
- package/src/model/runners/codec.js +24 -0
- package/src/model/runners/companion-run.js +2 -0
- package/src/model/runners/device.js +7 -0
- package/src/model/runners/dom.js +13 -0
- package/src/model/runners/effects.js +2 -0
- package/src/model/runners/embed.js +11 -0
- package/src/model/runners/eval.js +2 -0
- package/src/model/runners/files.js +19 -0
- package/src/model/runners/geometry.js +23 -0
- package/src/model/runners/goals.js +18 -0
- package/src/model/runners/graph.js +23 -0
- package/src/model/runners/html.js +2 -0
- package/src/model/runners/http-proxy.js +185 -0
- package/src/model/runners/http-send.js +61 -0
- package/src/model/runners/http-static.js +83 -0
- package/src/model/runners/http-tap.js +26 -0
- package/src/model/runners/http.js +40 -0
- package/src/model/runners/import.js +2 -0
- package/src/model/runners/index.js +74 -0
- package/src/model/runners/input.js +14 -0
- package/src/model/runners/inputlog.js +7 -0
- package/src/model/runners/ledger.js +15 -0
- package/src/model/runners/machine.js +4 -0
- package/src/model/runners/mcp.js +2 -0
- package/src/model/runners/mcpapp.js +2 -0
- package/src/model/runners/media.js +18 -0
- package/src/model/runners/memory.js +28 -0
- package/src/model/runners/mesh-inspect.js +13 -0
- package/src/model/runners/peer.js +14 -0
- package/src/model/runners/plot.js +22 -0
- package/src/model/runners/render.js +14 -0
- package/src/model/runners/respond.js +2 -0
- package/src/model/runners/sample-soundfont.js +85 -0
- package/src/model/runners/sample.js +159 -0
- package/src/model/runners/scene.js +8 -0
- package/src/model/runners/score.js +24 -0
- package/src/model/runners/secret.js +10 -0
- package/src/model/runners/select.js +2 -0
- package/src/model/runners/shared.js +4 -0
- package/src/model/runners/shares.js +15 -0
- package/src/model/runners/shell.js +7 -0
- package/src/model/runners/skill.js +26 -0
- package/src/model/runners/state.js +2 -0
- package/src/model/runners/statechart.js +4 -0
- package/src/model/runners/subgraph.js +9 -0
- package/src/model/runners/tabs.js +25 -0
- package/src/model/runners/terminal.js +5 -0
- package/src/model/runners/text.js +4 -0
- package/src/model/runners/timer.js +7 -0
- package/src/model/runners/traffic.js +65 -0
- package/src/model/runners/trigger.js +2 -0
- package/src/model/runners/verdict.js +29 -0
- package/src/model/runners/vm.js +7 -0
- package/src/model/runners/wait.js +4 -0
- package/src/model/runners/ws-client.js +57 -0
- package/src/model/safe-regex.js +719 -0
- package/src/model/sample-settings.js +43 -0
- package/src/model/sample-source.js +47 -0
- package/src/model/saved-mapping.js +153 -0
- package/src/model/score-controllers.js +87 -0
- package/src/model/score-edit.js +399 -0
- package/src/model/score-instruments.js +300 -0
- package/src/model/score-library.js +407 -0
- package/src/model/score-markup.js +235 -0
- package/src/model/score-mix.js +248 -0
- package/src/model/score-patterns.js +276 -0
- package/src/model/score-selection.js +34 -0
- package/src/model/score-time.js +139 -0
- package/src/model/score-transforms.js +336 -0
- package/src/model/score-transport.js +192 -0
- package/src/model/selection.js +351 -0
- package/src/model/serial-controls.js +328 -0
- package/src/model/shares-pane.js +17 -0
- package/src/model/shell-pane.js +106 -0
- package/src/model/signature.js +1122 -0
- package/src/model/size-hints.js +106 -0
- package/src/model/size-ratio.js +12 -0
- package/src/model/skill-settings.js +23 -0
- package/src/model/snapping.js +466 -0
- package/src/model/split.js +375 -0
- package/src/model/spring-player.js +222 -0
- package/src/model/statecharts.js +1369 -0
- package/src/model/states-preset.js +208 -0
- package/src/model/static-route.js +100 -0
- package/src/model/step-words.js +45 -0
- package/src/model/subgraph.js +1042 -0
- package/src/model/switch.js +98 -0
- package/src/model/tabs-store.js +10 -0
- package/src/model/tensor-view.js +146 -0
- package/src/model/timer-clock.js +361 -0
- package/src/model/timers.js +422 -0
- package/src/model/timing.js +212 -0
- package/src/model/traffic-agent.js +111 -0
- package/src/model/traffic-store.js +20 -0
- package/src/model/traffic.js +665 -0
- package/src/model/transport.js +364 -0
- package/src/model/turns.js +86 -0
- package/src/model/types.js +425 -0
- package/src/model/value-path.js +138 -0
- package/src/model/versions.js +535 -0
- package/src/model/view-outputs.js +144 -0
- package/src/model/viewport-bookmarks.js +194 -0
- package/src/model/virtual-clock.js +85 -0
- package/src/model/vm-pane.js +258 -0
- package/src/model/wait-clock.js +715 -0
- package/src/model/wait-persist.js +248 -0
- package/src/model/waits.js +431 -0
- package/src/model/watch.js +80 -0
- package/src/model/webhook.js +496 -0
- package/src/model/when.js +48 -0
- package/src/model/widget-values.js +392 -0
- package/src/model/window-commands.js +278 -0
- package/src/model/windows.js +348 -0
- package/src/model/wire-inspect.js +343 -0
- package/src/model/wire-ops.js +324 -0
- package/src/model/wire-pipeline.js +378 -0
- package/src/model/wire-route.js +637 -0
- package/src/model/workspaces.js +122 -0
- package/src/model/ws-client.js +155 -0
- package/src/model/ws-demo.js +31 -0
- package/src/model/ws-frames.js +141 -0
- package/src/model/ws-hub.js +219 -0
- package/src/model/ws-served.js +13 -0
- package/src/model/xstate.js +374 -0
- package/src/narrative/narrative.js +1557 -0
- package/src/network/auth.js +224 -0
- package/src/network/csp-frame.js +197 -0
- package/src/network/declarative-shadow.js +27 -0
- package/src/network/frame-net-shim.js +962 -0
- package/src/network/hosts.js +157 -0
- package/src/network/policy.js +520 -0
- package/src/network/rtc-shim.js +418 -0
- package/src/network/secret-gate.js +78 -0
- package/src/network/secrets.js +261 -0
- package/src/network/sockets.js +287 -0
- package/src/network/store.js +186 -0
- package/src/network/streams.js +99 -0
- package/src/packages/asset-values.js +50 -0
- package/src/packages/assets.js +99 -0
- package/src/packages/deprecation.js +203 -0
- package/src/packages/fetch.js +152 -0
- package/src/packages/function-canvas.js +73 -0
- package/src/packages/module.js +120 -0
- package/src/packages/package.js +474 -0
- package/src/packages/published.js +27 -0
- package/src/packages/requires.js +83 -0
- package/src/packages/signing.js +145 -0
- package/src/packages/trust.js +107 -0
- package/src/panes/a2a.js +51 -0
- package/src/panes/acp.js +60 -0
- package/src/panes/actions.js +54 -0
- package/src/panes/agent.js +83 -0
- package/src/panes/audio.js +103 -0
- package/src/panes/automation.js +112 -0
- package/src/panes/calc.js +67 -0
- package/src/panes/catch.js +52 -0
- package/src/panes/codec.js +59 -0
- package/src/panes/colors.js +12 -0
- package/src/panes/companion.js +54 -0
- package/src/panes/decision.js +65 -0
- package/src/panes/device.js +56 -0
- package/src/panes/dom.js +37 -0
- package/src/panes/effects.js +118 -0
- package/src/panes/embed.js +30 -0
- package/src/panes/eval.js +186 -0
- package/src/panes/fields.js +299 -0
- package/src/panes/files.js +45 -0
- package/src/panes/gate.js +70 -0
- package/src/panes/geometry.js +64 -0
- package/src/panes/goals.js +75 -0
- package/src/panes/graph.js +66 -0
- package/src/panes/html.js +54 -0
- package/src/panes/http.js +82 -0
- package/src/panes/import.js +38 -0
- package/src/panes/input.js +124 -0
- package/src/panes/inputlog.js +66 -0
- package/src/panes/ledger.js +56 -0
- package/src/panes/machine.js +138 -0
- package/src/panes/mcp.js +85 -0
- package/src/panes/mcpapp.js +64 -0
- package/src/panes/media.js +38 -0
- package/src/panes/memory.js +46 -0
- package/src/panes/mesh-inspect.js +49 -0
- package/src/panes/note.js +38 -0
- package/src/panes/peer.js +44 -0
- package/src/panes/plot.js +196 -0
- package/src/panes/registry.js +475 -0
- package/src/panes/render.js +87 -0
- package/src/panes/respond.js +44 -0
- package/src/panes/router.js +84 -0
- package/src/panes/sample.js +75 -0
- package/src/panes/scene.js +55 -0
- package/src/panes/score.js +87 -0
- package/src/panes/secret.js +38 -0
- package/src/panes/select.js +67 -0
- package/src/panes/shader.js +166 -0
- package/src/panes/shared.js +33 -0
- package/src/panes/shares.js +43 -0
- package/src/panes/shell.js +47 -0
- package/src/panes/skill.js +44 -0
- package/src/panes/state.js +91 -0
- package/src/panes/statechart.js +63 -0
- package/src/panes/story.js +33 -0
- package/src/panes/subgraph.js +94 -0
- package/src/panes/tabs.js +52 -0
- package/src/panes/terminal.js +57 -0
- package/src/panes/text.js +36 -0
- package/src/panes/timer.js +55 -0
- package/src/panes/traffic.js +59 -0
- package/src/panes/verdict.js +62 -0
- package/src/panes/vm.js +46 -0
- package/src/panes/wait.js +61 -0
- package/src/panes/watch.js +57 -0
- package/src/panes/webhook.js +67 -0
- package/src/panes/ws-client.js +67 -0
- package/src/persist.js +281 -0
- package/src/plot/tex.js +19 -0
- package/src/plot/vendor.js +59 -0
- package/src/plot/view-vendor.js +5 -0
- package/src/privacy/levels.js +108 -0
- package/src/protocol/devtools.js +116 -0
- package/src/protocol/inspector.js +368 -0
- package/src/render/time.js +381 -0
- package/src/rooms/mesh-metrics.js +162 -0
- package/src/run/companion.js +355 -0
- package/src/run/describe.js +114 -0
- package/src/run/local-model.js +150 -0
- package/src/run/monitor.js +208 -0
- package/src/run/publish.js +360 -0
- package/src/run/respond-outcome.js +12 -0
- package/src/run/run.js +820 -0
- package/src/run/runner-pairing.js +243 -0
- package/src/run/values.js +122 -0
- package/src/runtime/compile.js +122 -0
- package/src/runtime/console-tag.js +64 -0
- package/src/runtime/frame-signals.js +126 -0
- package/src/runtime/iteration-push.js +19 -0
- package/src/runtime/keys.js +474 -0
- package/src/runtime/midi-input.js +170 -0
- package/src/runtime/person-waits.js +140 -0
- package/src/runtime/resource-timing.js +56 -0
- package/src/runtime/runtime.js +2150 -0
- package/src/runtime/sandbox-modules.js +163 -0
- package/src/runtime/spring.js +246 -0
- package/src/runtime/strict.js +215 -0
- package/src/runtime/transfer.js +75 -0
- package/src/runtime/tween.js +158 -0
- package/src/runtime/wasm-fuel.js +596 -0
- package/src/runtime/worker/00-prelude.js +88 -0
- package/src/runtime/worker/10-helpers.js +295 -0
- package/src/runtime/worker/20-io.js +645 -0
- package/src/runtime/worker/30-previews.js +210 -0
- package/src/runtime/worker/40-profile-lineage.js +278 -0
- package/src/runtime/worker/50-own-worker.js +233 -0
- package/src/runtime/worker/60-timers.js +172 -0
- package/src/runtime/worker/70-state-keyed.js +193 -0
- package/src/runtime/worker/80-each-compile-generators.js +619 -0
- package/src/runtime/worker/90-events-operators.js +655 -0
- package/src/runtime/worker/95-agents-batches.js +1820 -0
- package/src/runtime/worker/96-plot.js +47 -0
- package/src/runtime/worker/97-calc.js +28 -0
- package/src/runtime/worker/98-geometry.js +24 -0
- package/src/runtime/worker/99-graph.js +30 -0
- package/src/runtime/worker/99-shell.js +30 -0
- package/src/safety/config.js +57 -0
- package/src/safety/engine.js +324 -0
- package/src/scene/pixi-scene.js +806 -0
- package/src/scene/scene-assets.js +241 -0
- package/src/scene/scene-edit.js +319 -0
- package/src/secret/settings.js +41 -0
- package/src/security/multipart.js +257 -0
- package/src/security/redact.js +261 -0
- package/src/serial/broker.js +473 -0
- package/src/serial/config.js +185 -0
- package/src/serial/framers.js +389 -0
- package/src/serial/packets.js +64 -0
- package/src/shader/audio-texture.js +87 -0
- package/src/shader/channels.js +496 -0
- package/src/shader/common.js +90 -0
- package/src/shader/model.js +867 -0
- package/src/shader/passes.js +150 -0
- package/src/shader/shadertoy.js +198 -0
- package/src/shell/hub.js +287 -0
- package/src/sim/checkpoints.js +850 -0
- package/src/sim/compile.js +37 -0
- package/src/sim/fixed.js +377 -0
- package/src/sim/headless.js +205 -0
- package/src/sim/physics.js +399 -0
- package/src/smf-helper/vendor.js +2 -0
- package/src/sources/config.js +435 -0
- package/src/storage.js +153 -0
- package/src/table/table-geo.js +2344 -0
- package/src/table/table-lineage.js +808 -0
- package/src/table/table-quality.js +355 -0
- package/src/table/table-schema.js +392 -0
- package/src/table/table-sql.js +1650 -0
- package/src/table/table-stats.js +480 -0
- package/src/table/table.js +2102 -0
- package/src/tensor/tensor.js +1153 -0
- package/src/terminal/hub.js +715 -0
- package/src/terminal/screen.js +516 -0
- package/src/tests/capture.js +88 -0
- package/src/tests/compare.js +480 -0
- package/src/tests/dataset.js +170 -0
- package/src/tests/evaluate.js +286 -0
- package/src/tests/from-runs.js +99 -0
- package/src/tests/judge.js +134 -0
- package/src/tests/matchers.js +263 -0
- package/src/tests/matrix-spec.js +87 -0
- package/src/tests/matrix.js +397 -0
- package/src/tests/metrics.js +369 -0
- package/src/tests/no-value.js +42 -0
- package/src/tests/pane-check.js +45 -0
- package/src/tests/report.js +124 -0
- package/src/tests/reporters.js +140 -0
- package/src/tests/run.js +155 -0
- package/src/tilemap/tilemap.js +1122 -0
- package/src/units/units.js +3 -0
- package/src/util/bytes-text.js +21 -0
- package/src/util/num.js +10 -0
- package/src/util/regexp.js +2 -0
- package/src/util/text.js +38 -0
- package/src/verdict/engine.js +154 -0
- package/src/vm/guest-wsh.js +108 -0
- package/src/vm/hub.js +457 -0
- package/src/vm/image-files.js +4 -0
- package/src/vm/image.js +33 -0
- package/src/vm/image.lock.json +13 -0
- package/src/vm/link.js +266 -0
- package/src/vm/mount.js +212 -0
- package/src/vm/net.js +85 -0
- package/src/vm/pipe-ws.js +187 -0
- package/src/vm/v86-loader.js +11 -0
- package/src/webmcp/args.js +212 -0
- package/src/webmcp/hidden.js +218 -0
- package/src/webmcp/text.js +250 -0
- package/src/webmcp/tools/bookmark-tools.js +106 -0
- package/src/webmcp/tools/breakpoint-tools.js +48 -0
- package/src/webmcp/tools/canvases.js +208 -0
- package/src/webmcp/tools/context-tools.js +84 -0
- package/src/webmcp/tools/core.js +170 -0
- package/src/webmcp/tools/devices.js +41 -0
- package/src/webmcp/tools/edit.js +357 -0
- package/src/webmcp/tools/event-tools.js +145 -0
- package/src/webmcp/tools/image-tools.js +173 -0
- package/src/webmcp/tools/ink-tools.js +247 -0
- package/src/webmcp/tools/input-log-tools.js +163 -0
- package/src/webmcp/tools/live.js +166 -0
- package/src/webmcp/tools/machine-tools.js +74 -0
- package/src/webmcp/tools/media.js +161 -0
- package/src/webmcp/tools/midi-tools.js +32 -0
- package/src/webmcp/tools/preset-tools.js +184 -0
- package/src/webmcp/tools/quick-add-tools.js +95 -0
- package/src/webmcp/tools/reshape.js +152 -0
- package/src/webmcp/tools/run-tools.js +309 -0
- package/src/webmcp/tools/runs.js +101 -0
- package/src/webmcp/tools/scaffold-tools.js +161 -0
- package/src/webmcp/tools/serial-tools.js +36 -0
- package/src/webmcp/tools/shared.js +338 -0
- package/src/webmcp/tools/subgraphs.js +360 -0
- package/src/webmcp/tools/tests.js +170 -0
- package/src/webmcp/tools/traffic-tools.js +70 -0
- package/src/webmcp/tools/transport-tools.js +65 -0
- package/src/webmcp/tools/version-tools.js +126 -0
- package/src/webmcp/tools/versions.js +11 -0
- package/src/webmcp/tools/wire-tools.js +90 -0
- package/src/webmcp/tools/workspace-tools.js +93 -0
- package/src/webmcp/tools.js +1323 -0
- package/src/wsh/connect.js +347 -0
- package/src/wsh/demo-host.js +361 -0
- package/src/wsh/e2e.js +27 -0
- package/src/wsh/keys.js +154 -0
- package/src/wsh/known-hosts.js +39 -0
- package/src/wsh/private-key.js +95 -0
- package/src/wsh/reverse.js +34 -0
- package/src/wsh/settings.js +118 -0
- package/src/wsh/transfer.js +62 -0
- package/src/wsh/vendor.js +5 -0
- package/src/x402/challenge.js +171 -0
- package/src/x402/demo-server.js +127 -0
- package/src/x402/pay.js +125 -0
- package/src/x402/retry.js +95 -0
- package/src/x402/store.js +76 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
// shader: a GLSL fragment shader with typed uniforms, drawn in its own sandboxed frame
|
|
2
|
+
// (src/ui/shader-pane.js, src/ui/shader-body.js, src/shader/).
|
|
3
|
+
import { FRAME } from "./shared.js";
|
|
4
|
+
import { ratioOf } from "../model/size-ratio.js";
|
|
5
|
+
import { UNIFORM_TYPES, LIMITS, DEFAULT_SHADER, checkUniforms, checkShaderSettings, lintPasses, shaderConfig } from "../shader/model.js";
|
|
6
|
+
import { CHANNEL_FILTERS, CHANNEL_WRAPS, CHANNEL_AS, checkChannels, normalizeChannels } from "../shader/channels.js";
|
|
7
|
+
import { BUFFER_NAMES, BUFFER_FORMATS, OUTPUTS, PASS_LIMITS, checkCommon, checkBuffers, checkImageBuffers, checkOutput, passLabel } from "../shader/passes.js";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
presentation: "body",
|
|
11
|
+
type: "shader",
|
|
12
|
+
// The line the Markdown format writes for it (src/formats/markdown.js).
|
|
13
|
+
describe: (pane) => `Shader: GLSL, ${(pane.uniforms ?? []).length} uniform${(pane.uniforms ?? []).length === 1 ? "" : "s"}${(pane.channels ?? []).length ? `, ${pane.channels.length} channel${pane.channels.length === 1 ? "" : "s"}` : ""}${(pane.buffers ?? []).length ? `, ${pane.buffers.length} buffer${pane.buffers.length === 1 ? "" : "s"}` : ""}.`,
|
|
14
|
+
// Settings whose edit reruns a pane of this type (src/panes/registry.js, reruns).
|
|
15
|
+
reruns: ["uniforms", "channels", "common", "buffers", "shader"],
|
|
16
|
+
title: "shader",
|
|
17
|
+
description: "A GLSL fragment shader with typed uniforms, drawn on the GPU",
|
|
18
|
+
icon: "▨",
|
|
19
|
+
// A gradient square (two tones) with a sparkle, over a code line.
|
|
20
|
+
art: `${FRAME}<rect class="f" x="9" y="13.5" width="18" height="11" rx="1.5"/><path class="a" d="M9 24.5l6-5 4 3 4-6 4 8"/><path class="a" d="M35 15.5v8M31 19.5h8M32.4 16.9l5.2 5.2M37.6 16.9l-5.2 5.2"/><path d="M9 29h18"/>`,
|
|
21
|
+
namePrefix: "shader",
|
|
22
|
+
defaults: () => ({ ...structuredClone(DEFAULT_SHADER), width: 400 }),
|
|
23
|
+
sizeHint: (pane) => ({ aspectRatio: ratioOf(pane.shader ?? DEFAULT_SHADER.shader), chromeHeight: 120, minHeight: 160, maxWidth: 2000 }), // the outer rect keeps the shader's ratio
|
|
24
|
+
minimap: ["#d6e6ee", "#2f4650"],
|
|
25
|
+
exports: "its PNG, the frame on screen as PNG, the shader as GLSL, a uniform manifest, and a Shadertoy variant (source or JSON)",
|
|
26
|
+
offlineFrames: "clock",
|
|
27
|
+
headless: { skip: "shader panes need a browser (WebGL2 draws in a page)" },
|
|
28
|
+
readsEnv: false,
|
|
29
|
+
needsScreen: true,
|
|
30
|
+
frame: true,
|
|
31
|
+
subgraphOutput: true,
|
|
32
|
+
// Its value is an image media value (the PNG at the pane's t and frame): the menus never need the
|
|
33
|
+
// sandbox's description of it (src/export/formats.js formatsFor, case "shader").
|
|
34
|
+
exportValue: false, // run-time traits (src/panes/registry.js)
|
|
35
|
+
menu: ["shader.edit", "shader.frame", "shader.clear-checkpoints", "shader.export-glsl", "shader.export-manifest", "shader.export-shadertoy", "shader.export-shadertoy-json", "shader.import", "shader.paste"],
|
|
36
|
+
// What would stop it compiling, found without a GPU: uniform declarations, settings, the loop check; the channels as declared,
|
|
37
|
+
// and (once it has drawn) what each input became, how many texture units are used of the GPU's, and the buffers.
|
|
38
|
+
agentStatus: (pane, canvas, { host }) => {
|
|
39
|
+
const out = {};
|
|
40
|
+
const state = canvas.stateOf(pane.id).value;
|
|
41
|
+
const uniformNames = (Array.isArray(pane.uniforms) ? pane.uniforms : []).map((u) => u?.name);
|
|
42
|
+
const where = (p) => `${p.pass === "image" ? "" : `${passLabel(p.pass)}, `}${p.line ? `line ${p.line}: ` : p.pass === "image" ? "" : ": "}${p.message}`;
|
|
43
|
+
const problems = [
|
|
44
|
+
...checkUniforms(pane.uniforms).map((p) => p.message),
|
|
45
|
+
...checkChannels(pane.channels, { uniforms: uniformNames }).map((p) => p.message),
|
|
46
|
+
...checkCommon(pane.common).map((p) => p.message),
|
|
47
|
+
...checkBuffers(pane.buffers, { uniforms: uniformNames }).map((p) => p.message),
|
|
48
|
+
...checkImageBuffers(pane.channels, pane.buffers).map((p) => p.message),
|
|
49
|
+
...checkOutput(pane.shader?.output, pane.buffers).map((p) => p.message),
|
|
50
|
+
...checkShaderSettings(pane.shader),
|
|
51
|
+
...lintPasses(pane, { pixels: shaderConfig(pane).width * shaderConfig(pane).height }).map(where),
|
|
52
|
+
];
|
|
53
|
+
if (problems.length) out.shaderProblems = problems;
|
|
54
|
+
if (Array.isArray(pane.channels) && pane.channels.length) out.channels = normalizeChannels(pane.channels, { uniforms: (Array.isArray(pane.uniforms) ? pane.uniforms : []).map((u) => u?.name) });
|
|
55
|
+
const shown = host.shader?.status?.(pane.id);
|
|
56
|
+
if (shown?.channels) out.channelStatus = { inputs: shown.channels.map(({ name, from, kind, glsl, summary }) => ({ name, from, kind, glsl, summary })), units: shown.channelUnits };
|
|
57
|
+
// Buffer A-D once it has drawn: size, the format each got (float, or bytes where the GPU can't draw to floats), its channels and units.
|
|
58
|
+
if (shown?.buffers) out.bufferStatus = { output: shown.output, floatBuffers: shown.floatBuffers, bytes: shown.bufferBytes, buffers: shown.buffers };
|
|
59
|
+
if (state.status === "done" && state.result?.media) out.media = state.result.media;
|
|
60
|
+
return out;
|
|
61
|
+
},
|
|
62
|
+
agent: {
|
|
63
|
+
summary:
|
|
64
|
+
"a GLSL ES 3.00 fragment shader, drawn on the GPU in its own frame: `code` defines void mainImage(out vec4 fragColor, in vec2 fragCoord) (Shadertoy's entry point) and reads u_resolution, u_time, u_frame (and Shadertoy's iResolution, iTime, iTimeDelta, iFrame, iFrameRate, iMouse, iDate, iSampleRate, iChannelResolution, iChannelTime, iChannel0…3) and the typed `uniforms` you declare; an input named like a uniform replaces its value (a range input for a float, an image pane for a sampler), inputs named time and frame set the clock, an input named mouse sets iMouse; `channels` are named texture inputs (an image, a list of images as one sampler2DArray, pixels or numbers, a video, audio as Shadertoy's FFT and waveform texture, a keyboard or gamepad device's state, or a render, effects or shader pane's frames read live) with filter, wrap and vflip, as many as the GPU has texture units; \`common\` is GLSL put in front of every pass and \`buffers\` are up to four more passes (Shadertoy's Buffer A to D, drawn in order before the Image, each into a texture its channels or the Image's can read as { buffer }), float where the GPU allows, with frames stepped from checkpoints that hold every buffer; its value is the PNG at that t and frame as an image media value",
|
|
65
|
+
fields: {
|
|
66
|
+
code: "GLSL ES 3.00 fragment shader source, without #version: define void mainImage(out vec4 fragColor, in vec2 fragCoord), or void main() writing outColor. u_resolution (vec2 pixels), u_time (float seconds), u_frame (int), u_prev (sampler2D, with shader.feedback) and each declared uniform are declared for you. Loops must be for (int i = 0; i < N; i++) with a literal or const int N of at most 1024 (while and do are refused); an error leaves the last valid picture and fails the pane with the line.",
|
|
67
|
+
uniforms: {
|
|
68
|
+
schema: {
|
|
69
|
+
type: "array",
|
|
70
|
+
description: `typed uniforms, as data: [{ name, type, value?, min?, max?, step?, label?, description? }]. type is ${UNIFORM_TYPES.join(", ")}: float and int take value, min, max, step (default range 0…1, int 0…100); vec2, vec3 and vec4 take a list of numbers (min and max apply to each); bool takes true or false; color takes "#rrggbb" or "#rrggbbaa" (a vec4 in the shader); sampler is an image (sampler2D), set by an input of that name (an image pane, a Blob or an image URL), reading opaque black until one is wired. At most ${LIMITS.maxUniforms} uniforms and ${LIMITS.maxSamplers} images. Names are GLSL identifiers, not time, frame or u_…. An input of the same name replaces the value (clamped to the range); an input of the wrong type fails the run. Pass [] to remove them all.`,
|
|
71
|
+
items: {
|
|
72
|
+
type: "object",
|
|
73
|
+
properties: {
|
|
74
|
+
name: { type: "string" },
|
|
75
|
+
type: { type: "string", enum: UNIFORM_TYPES },
|
|
76
|
+
value: {},
|
|
77
|
+
min: { type: "number" },
|
|
78
|
+
max: { type: "number" },
|
|
79
|
+
step: { type: "number", exclusiveMinimum: 0 },
|
|
80
|
+
label: { type: "string" },
|
|
81
|
+
description: { type: "string" },
|
|
82
|
+
},
|
|
83
|
+
required: ["name", "type"],
|
|
84
|
+
additionalProperties: false,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
refuse: "have uniforms",
|
|
88
|
+
},
|
|
89
|
+
channels: {
|
|
90
|
+
schema: {
|
|
91
|
+
type: "array",
|
|
92
|
+
description: `named texture inputs, as data: [{ name, from?, filter?, wrap?, vflip?, as? }]. The input named \`from\` (the channel's own name when left out) is its source, and its value decides what the channel is: an image (a media value or Blob) is a sampler2D; a list of images of one size is one sampler2DArray (texture(name, vec3(uv, layer)), with an int \`<name>Count\` uniform); pixels { width, height, data } (RGBA bytes) and numbers (a list, a typed array or a table: a float texture read exactly, texelFetch(name, ivec2(i, row), 0)) are a sampler2D; a keyboard device's state is Shadertoy's 256×3 keyboard texture (rows down, pressed, toggled at the legacy key code), a gamepad's a 32×2 float texture (axes, button values); a video is a sampler2D of its frame at the shader's time; audio (an audio pane's WAV, a recording) is Shadertoy's 512×2 music texture (FFT row at y 0.25, waveform at y 0.75) at the shader's time. A render pane wired in is read at the shader's frame number (its frame n). \`live\`: true reads the frames of the pane wired in (a render, effects or shader pane) as it draws them, the shader drawing frame n with that pane's frame n (its value stays the picture at its own t and frame). filter is ${CHANNEL_FILTERS.join(", ")} (default linear), wrap ${CHANNEL_WRAPS.join(", ")} (default clamp), vflip puts the first row at the top (default true, not for numbers). \`as\` forces ${CHANNEL_AS.join(", ")}. \`buffer\` ("A"…"D") reads one of the shader's buffers instead of an input (no from, as or vflip; see buffers). Not capped at four: the limit is the GPU's texture units (shown in the pane; get_pane lists the channels and units). iChannel0…iChannel3 are names for the first four, and a channel called iChannel0…3 takes that slot. Names are GLSL identifiers, not time, frame, u_… or Shadertoy's i… names. A sampler uniform is a channel with the defaults. Pass [] to remove them all.`,
|
|
93
|
+
items: {
|
|
94
|
+
type: "object",
|
|
95
|
+
properties: {
|
|
96
|
+
name: { type: "string" },
|
|
97
|
+
from: { type: "string" },
|
|
98
|
+
buffer: { type: "string", enum: BUFFER_NAMES },
|
|
99
|
+
filter: { type: "string", enum: CHANNEL_FILTERS },
|
|
100
|
+
wrap: { type: "string", enum: CHANNEL_WRAPS },
|
|
101
|
+
vflip: { type: "boolean" },
|
|
102
|
+
as: { type: "string", enum: CHANNEL_AS },
|
|
103
|
+
live: { type: "boolean" },
|
|
104
|
+
},
|
|
105
|
+
required: ["name"],
|
|
106
|
+
additionalProperties: false,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
refuse: "have channels",
|
|
110
|
+
},
|
|
111
|
+
common: {
|
|
112
|
+
schema: {
|
|
113
|
+
type: "string",
|
|
114
|
+
description: "GLSL put in front of every pass (Shadertoy's Common tab): constants, structs and functions the passes share; no mainImage. Compile errors in it show on its own lines. Pass an empty string to remove it.",
|
|
115
|
+
},
|
|
116
|
+
refuse: "have a Common tab",
|
|
117
|
+
},
|
|
118
|
+
buffers: {
|
|
119
|
+
schema: {
|
|
120
|
+
type: "array",
|
|
121
|
+
description: `more passes beside the Image (\`code\`), as data: [{ name, code, channels?, format? }]. name is ${BUFFER_NAMES.join(", ")} (Shadertoy's Buffer A to D), at most ${PASS_LIMITS.maxBuffers}; they are drawn in that order each frame, then the Image. Each is a full pass of its own: \`code\` defines mainImage as the Image does (Common is in front of it), its \`channels\` are the same declarations as the pane's (name, from?, filter?, wrap?, vflip?, as?) plus buffer: "A"…"D" instead of from/as/vflip to read one of the buffers: a pass reads a buffer as it stands when it is drawn, so the Image and later buffers see this frame's, and earlier buffers (and the buffer itself) see the previous frame's, which is how a buffer keeps state. The Image's channels (the pane's \`channels\`) can read buffers the same way. format is ${BUFFER_FORMATS.join(" or ")} (default float: RGBA16F where the GPU can draw to floats, with RGBA8 and a note where it can't; float32 is RGBA32F, exact but filtered only where the GPU filters 32-bit floats, else read nearest with a note; byte is RGBA8). Frame n is reached by stepping from the nearest checkpoint when a buffer reads itself or a later one (checkpoints hold every buffer and the byte quota counts them all); the loop check and the per-frame time budget cover all passes together, and the buffers may take ${PASS_LIMITS.maxBufferBytes / 1048576} MB of texture memory between them. A bad buffer or channel fails the run with its name. Pass [] to remove them all.`,
|
|
122
|
+
items: {
|
|
123
|
+
type: "object",
|
|
124
|
+
properties: {
|
|
125
|
+
name: { type: "string", enum: BUFFER_NAMES },
|
|
126
|
+
code: { type: "string" },
|
|
127
|
+
channels: { type: "array", items: { type: "object", properties: { name: { type: "string" }, from: { type: "string" }, buffer: { type: "string", enum: BUFFER_NAMES }, filter: { type: "string", enum: CHANNEL_FILTERS }, wrap: { type: "string", enum: CHANNEL_WRAPS }, vflip: { type: "boolean" }, as: { type: "string", enum: CHANNEL_AS }, live: { type: "boolean" } }, required: ["name"], additionalProperties: false } },
|
|
128
|
+
format: { type: "string", enum: BUFFER_FORMATS },
|
|
129
|
+
},
|
|
130
|
+
required: ["name", "code"],
|
|
131
|
+
additionalProperties: false,
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
refuse: "have buffers",
|
|
135
|
+
},
|
|
136
|
+
shader: {
|
|
137
|
+
schema: {
|
|
138
|
+
type: "object",
|
|
139
|
+
description: `size, clock and options. width and height (16…${LIMITS.maxSide} pixels each, at most ${LIMITS.maxPixels} pixels in all), fps (1…120: frame n is at t = n / fps), t (seconds, u_time) and frame (u_frame; round(t × fps) unless given), play (animate the preview from t and frame; the value stays the picture at them), output (${OUTPUTS.join(", ")}: the pass whose picture is the pane's preview and value; default image, a buffer exposes it as the pane's image), feedback (u_prev is the previous frame's output; frame n is made by stepping from the nearest checkpoint of the buffer at or before it, or from frame 0), checkpoint ({ every, max, maxBytes }: feedback keeps the buffer's pixels every "every" frames, at most "max" and "maxBytes" bytes; a changed shader, uniform, input, size or fps drops them and the pane says so; mallory_render_effects action clear-checkpoints drops them too), budget (${LIMITS.drawBudget.min}…${LIMITS.drawBudget.max} seconds one draw may take, every pass and feedback step included, default ${LIMITS.drawBudget.default}; a draw over it fails the pane, keeping the steps it made as checkpoints). Inputs named time and frame replace t and frame. Only the fields you pass change.`,
|
|
140
|
+
properties: {
|
|
141
|
+
width: { type: "integer", minimum: 16, maximum: LIMITS.maxSide },
|
|
142
|
+
height: { type: "integer", minimum: 16, maximum: LIMITS.maxSide },
|
|
143
|
+
fps: { type: "integer", minimum: 1, maximum: 120 },
|
|
144
|
+
t: { type: "number", minimum: 0 },
|
|
145
|
+
frame: { type: "integer", minimum: 0 },
|
|
146
|
+
play: { type: "boolean" },
|
|
147
|
+
feedback: { type: "boolean" },
|
|
148
|
+
output: { type: "string", enum: OUTPUTS },
|
|
149
|
+
budget: { type: "number", minimum: LIMITS.drawBudget.min, maximum: LIMITS.drawBudget.max },
|
|
150
|
+
checkpoint: {
|
|
151
|
+
type: "object",
|
|
152
|
+
properties: {
|
|
153
|
+
every: { type: "integer", minimum: 1, maximum: 100000 },
|
|
154
|
+
max: { type: "integer", minimum: 1, maximum: 1024 },
|
|
155
|
+
maxBytes: { type: "integer", minimum: 1024, maximum: 1073741824 },
|
|
156
|
+
},
|
|
157
|
+
additionalProperties: false,
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
additionalProperties: false,
|
|
161
|
+
},
|
|
162
|
+
refuse: "have shader settings",
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Pieces several pane type records share (src/panes/<type>.js): the add
|
|
2
|
+
// menu's picture frame, the value views, and context-menu items.
|
|
3
|
+
import { cutoffOn, RATE_PRESETS, sameRate } from "../model/rate.js";
|
|
4
|
+
|
|
5
|
+
/** Each add-menu picture sits in a 48×36 box: a pane outline (frame + header rule), then what makes the type recognizable. `a` marks accent strokes, `f` soft fills. */
|
|
6
|
+
export const FRAME = '<rect x="3.5" y="3.5" width="41" height="29" rx="3"/><path d="M3.5 10.5h41"/><circle class="a" cx="7.5" cy="7" r="1"/>';
|
|
7
|
+
|
|
8
|
+
/** How a value can be shown (eval and import panes; the pane.view.* commands). */
|
|
9
|
+
export const VIEWS = ["auto", "inspect", "table", "plot", "profile", "lineage", "html", "interactive", "math"];
|
|
10
|
+
|
|
11
|
+
/** The Auto-run checkbox item (eval and dom panes). */
|
|
12
|
+
export const AUTORUN_ITEM = { id: "pane.autorun", label: "Auto-run", checked: (pane) => pane.autorun !== false };
|
|
13
|
+
|
|
14
|
+
/** The "Only pass changes" checkbox item (the equality cut-off, src/model/rate.js). */
|
|
15
|
+
export const CUTOFF_ITEM = { id: "pane.cutoff", label: "Only pass changes", checked: (pane) => cutoffOn(pane) };
|
|
16
|
+
|
|
17
|
+
/** The Rate submenu (debounce/throttle presets, src/model/rate.js): the types with a `rate` setting. */
|
|
18
|
+
export const RATE_MENU = { submenu: "Rate", radio: RATE_PRESETS.map((p) => ({ id: `pane.rate.${p.id}`, label: p.label, checked: (pane) => sameRate(pane.rate, p.rate) })) };
|
|
19
|
+
|
|
20
|
+
/** The View submenu: one radio item per view. */
|
|
21
|
+
export const VIEW_MENU = { submenu: "View", radio: VIEWS.map((view) => ({ id: `pane.view.${view}`, label: view, checked: (pane) => (pane.view ?? "auto") === view })) };
|
|
22
|
+
|
|
23
|
+
/** The Live submenu: what a live pane (yield or emit) does when an input changes. */
|
|
24
|
+
export const LIVE_MENU = {
|
|
25
|
+
submenu: "Live: on input change",
|
|
26
|
+
radio: [
|
|
27
|
+
{ id: "pane.live.restart", label: "restart the run", checked: (pane) => pane.live !== "resume" },
|
|
28
|
+
{ id: "pane.live.resume", label: "resume with the new inputs", checked: (pane) => pane.live === "resume" },
|
|
29
|
+
],
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** A value as an inline code span in a one-line description (backticks in it become quotes). */
|
|
33
|
+
export const codeSpan = (s) => `\`${String(s).replace(/`/g, "'")}\``;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// shares: files kept in this browser by their content address (CIDv1), with grants, reads from IPFS gateways and CAR export (CLW-SHR-01, -03, CLW-SET-22; docs/guide/collaboration-and-sharing.md
|
|
2
|
+
// "Shares"). It is a window onto the page's share store (src/ui/shares-ui.js): the body reads the store while it is on screen, every action in it (add a file, import a CAR, read a CID, grant,
|
|
3
|
+
// revoke, export, remove) is the person's click, and none of it is saved with the canvas. Its value is only counts (shares this canvas may read or offer, files and bytes in the store), never a CID,
|
|
4
|
+
// a name or a byte. Agents have no way to add, fetch, grant, revoke, export or read a share.
|
|
5
|
+
import { FRAME } from "./shared.js";
|
|
6
|
+
import { SHARE_VIEWS, defaultShares, describeSharesPane, sharesProblem } from "../model/shares-pane.js";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
type: "shares",
|
|
10
|
+
validate(pane, where) {
|
|
11
|
+
const problem = sharesProblem(pane.shares);
|
|
12
|
+
if (problem) throw new Error(`Shares pane "${pane.name || pane.id}"${where}: ${problem}.`);
|
|
13
|
+
},
|
|
14
|
+
describe: (pane) => describeSharesPane(pane.shares),
|
|
15
|
+
reruns: ["shares"],
|
|
16
|
+
title: "shares",
|
|
17
|
+
description: "Files kept in this browser by content address (CIDv1), with grants; read a file from IPFS by CID through your gateways; export a CAR",
|
|
18
|
+
icon: "⬣",
|
|
19
|
+
art: `${FRAME}<path class="a f" d="M16 12l8 4v8l-8 4-8-4v-8z"/><path d="M32 22l8 4v8l-8 4-8-4v-8z"/>`,
|
|
20
|
+
namePrefix: "shares",
|
|
21
|
+
defaults: () => ({ shares: defaultShares(), width: 460 }),
|
|
22
|
+
minimap: ["#e4e0f0", "#3a3070"],
|
|
23
|
+
exports: "counts (JSON: readable, offered, files, bytes, limitBytes), never a CID, a name or a byte",
|
|
24
|
+
headless: "run", // its runner skips without a page (the store belongs to the mallory page)
|
|
25
|
+
readsEnv: false,
|
|
26
|
+
needsScreen: false,
|
|
27
|
+
frame: false,
|
|
28
|
+
subgraphOutput: false,
|
|
29
|
+
presentation: "body",
|
|
30
|
+
takesSkips: true,
|
|
31
|
+
menu: [],
|
|
32
|
+
mcpServes: false,
|
|
33
|
+
agentStatus: () => ({ shares: "shows the person's share store; adding, reading from a gateway, granting and exporting are the person's clicks" }),
|
|
34
|
+
agent: {
|
|
35
|
+
summary: "a person's window onto the files they keep in this browser by content address (CIDv1) and the grants this canvas holds for them: read (the canvas lists a share) and serve (the canvas may offer it to peers). The person can add a file, import a CAR, read a file from IPFS by CID through gateways they set (every block checked against its CID), export a CAR and revoke a grant. Its value is only counts. An agent cannot add, fetch, grant, revoke, export or read a share, and no executable is ever stored",
|
|
36
|
+
fields: {
|
|
37
|
+
shares: {
|
|
38
|
+
schema: { type: "object", description: `the settings: { view: ${SHARE_VIEWS.map((v) => `"${v}"`).join(" | ")} }. Only the keys passed change.`, properties: { view: { type: "string", enum: [...SHARE_VIEWS] } }, additionalProperties: false },
|
|
39
|
+
refuse: "show the person's shares (shares)",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// shell: a person's command line over this canvas's folder (CLW-SH-01, CLW-SH-02, CLW-SH-03, CLW-TERM-01, CLW-TERM-02, CLW-APP-09, CLW-LTM-02; docs/guide/settings-and-storage.md "Shell pane").
|
|
2
|
+
// The language is clsh (src/clsh/clsh.js), written clean-room from clawser's documented behaviour, and every line runs in the SANDBOX WORKER (src/runtime/worker/99-shell.js), never on the page,
|
|
3
|
+
// over the canvas's own folder through the page broker and the person's grant (the files pane's pattern, src/model/files-pane.js), with the network only through the canvas's network rules.
|
|
4
|
+
// It runs no program: there is no exec, no eval and no host shell, and the companion stays no-exec. Its value is only where the shell stands (session, folder, last exit code, how many lines ran), never what a
|
|
5
|
+
// line printed. Only the person types into it; a run, a wire, a share link and an agent never run a line. A machine's tool state can run a command in it, behind the gate and, for a line that writes, the person's approval.
|
|
6
|
+
import { FRAME } from "./shared.js";
|
|
7
|
+
import { defaultShell, describeShell, shellProblem } from "../model/shell-pane.js";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
type: "shell",
|
|
11
|
+
validate(pane, where) {
|
|
12
|
+
const problem = shellProblem(pane.shell);
|
|
13
|
+
if (problem) throw new Error(`Shell pane "${pane.name || pane.id}"${where}: ${problem}.`);
|
|
14
|
+
},
|
|
15
|
+
describe: (pane) => describeShell(pane.shell),
|
|
16
|
+
reruns: ["shell"],
|
|
17
|
+
// How a shell draws its screen is the person's: a renderer a share link, a paste or an agent names is reset to "auto" (src/model/person-only.js).
|
|
18
|
+
personOnly: ["shell.renderer"],
|
|
19
|
+
title: "shell",
|
|
20
|
+
description: "A clsh command line over this canvas's folder, run in the sandbox: pipes, redirects, globs, jq, snapshots; no programs",
|
|
21
|
+
icon: "$",
|
|
22
|
+
art: `${FRAME}<rect class="f" x="8" y="9" width="32" height="20" rx="2"/><path d="M13 16l4 3-4 3"/><path class="a" d="M20 24h10"/>`,
|
|
23
|
+
namePrefix: "shell",
|
|
24
|
+
defaults: () => ({ shell: defaultShell(), width: 560 }),
|
|
25
|
+
minimap: ["#d6dfe0", "#273336"],
|
|
26
|
+
exports: "where the shell stands (JSON: session, cwd, exit, commands), never what a line printed",
|
|
27
|
+
headless: "run", // its run only reports where the shell stands; a line is run only by a person on the page (src/shell/hub.js)
|
|
28
|
+
readsEnv: false,
|
|
29
|
+
needsScreen: false,
|
|
30
|
+
frame: false,
|
|
31
|
+
subgraphOutput: true,
|
|
32
|
+
presentation: "body",
|
|
33
|
+
takesSkips: true,
|
|
34
|
+
menu: ["shell.clear", "shell.newSession", "shell.fork", "shell.export"],
|
|
35
|
+
mcpServes: false, // never served by `mallory serve --mcp`: it runs commands
|
|
36
|
+
machineTool: true, // a machine's tool state can call it: `run` a command line in a fresh shell (src/machine/shell-tool.js)
|
|
37
|
+
machineShell: true,
|
|
38
|
+
// What an agent learns about it: its settings, never a line, an output or whether the person allowed the folder.
|
|
39
|
+
agentStatus: (pane) => {
|
|
40
|
+
const problem = shellProblem(pane.shell);
|
|
41
|
+
return problem ? { problem } : { renderer: pane.shell?.renderer ?? "auto" };
|
|
42
|
+
},
|
|
43
|
+
agent: {
|
|
44
|
+
summary: "a person's command line (clsh) over this canvas's own folder, run in the sandbox Worker: pipes, redirects, globs, about 60 builtins, jq, snapshots and a few clawser subcommands, and no program of any kind. It reaches only what the person allows in the permission bar, and its network only through the canvas's network rules. Its value is only { session, cwd, exit, commands }, never what a line printed. An agent cannot type into it, run a line, see its output or allow its folder; a machine's tool state can run a command in it, and a line that writes asks the person first.",
|
|
45
|
+
fields: {},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// skill: a canvas's read of ONE skill from the person's own library (CLW-SKL-01, CLW-APP-07; decisions D26 and D30 part 3, docs/guide/agents-and-machines.md "Skills"). The
|
|
2
|
+
// library lives in this browser, for the person only (src/skills/, off by default, scanned, bounded, never in a canvas document). A skill pane ASKS to read one skill by
|
|
3
|
+
// name and reads nothing until the person allows THAT pane, in the pane itself, and only an ACTIVE skill (one the person scanned and switched on) can be read. Its value is the
|
|
4
|
+
// skill's instructions, to wire into an agent pane's system or prompt: reading a skill never adds a tool. Agents cannot read, list, add, activate or grant skills.
|
|
5
|
+
import { FRAME } from "./shared.js";
|
|
6
|
+
import { defaultSkill, describeSkill, skillProblem } from "../model/skill-settings.js";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
type: "skill",
|
|
10
|
+
validate(pane, where) {
|
|
11
|
+
const problem = skillProblem(pane.skill);
|
|
12
|
+
if (problem) throw new Error(`Skill pane "${pane.name || pane.id}"${where}: ${problem}.`);
|
|
13
|
+
},
|
|
14
|
+
describe: (pane) => describeSkill(pane.skill),
|
|
15
|
+
reruns: ["skill"],
|
|
16
|
+
// Which skill a pane asks for is the person's: a name a share link, a paste or an agent brings is reset (src/model/person-only.js).
|
|
17
|
+
personOnly: ["skill.name"],
|
|
18
|
+
title: "skill",
|
|
19
|
+
description: "Read one skill from your own library, once you allow this pane",
|
|
20
|
+
icon: "✪",
|
|
21
|
+
art: `${FRAME}<path d="M24 8l4.2 9.8L38 19l-7.4 6.6L33 36l-9-5.4L15 36l2.4-10.4L10 19l9.8-1.2z" opacity=".6"/><path class="a" d="M24 14l2.4 5.6 5.6.7-4.2 3.8 1.4 5.9L24 27l-5.2 3 1.4-5.9L16 20.3l5.6-.7z"/>`,
|
|
22
|
+
namePrefix: "skill",
|
|
23
|
+
defaults: () => ({ skill: defaultSkill(), width: 380 }),
|
|
24
|
+
minimap: ["#e6e0f0", "#43365f"],
|
|
25
|
+
exports: "its instructions (JSON)",
|
|
26
|
+
headless: "run",
|
|
27
|
+
readsEnv: false,
|
|
28
|
+
needsScreen: false,
|
|
29
|
+
frame: false,
|
|
30
|
+
subgraphOutput: true,
|
|
31
|
+
presentation: "body",
|
|
32
|
+
takesSkips: true,
|
|
33
|
+
menu: [],
|
|
34
|
+
mcpServes: false,
|
|
35
|
+
// What an agent learns about it: the request, never the instructions, and never whether the library is on or the pane allowed.
|
|
36
|
+
agentStatus: (pane) => {
|
|
37
|
+
const problem = skillProblem(pane.skill);
|
|
38
|
+
return problem ? { problem } : { asks: pane.skill?.name ?? "" };
|
|
39
|
+
},
|
|
40
|
+
agent: {
|
|
41
|
+
summary: "reads ONE skill (instructions the person keeps in their own library, in their browser) once the person allows this pane. Which skill it asks for is the person's setting, so an agent cannot ask for one. Its value is that skill's instructions, to wire into an agent pane; reading a skill adds no tool. Nothing is in the canvas file.",
|
|
42
|
+
fields: {},
|
|
43
|
+
},
|
|
44
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// state: a value other panes can set through its ✎ setter output ("set",
|
|
2
|
+
// a pane wired to it gets `setCount`, write-only); ▶ resets it to its
|
|
3
|
+
// initial value.
|
|
4
|
+
import { FRAME, CUTOFF_ITEM } from "./shared.js";
|
|
5
|
+
import { stateKeyOf } from "../runtime/keys.js";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
type: "state",
|
|
9
|
+
// Settings whose edit reruns a pane of this type (src/panes/registry.js, reruns).
|
|
10
|
+
reruns: ["persist"],
|
|
11
|
+
// A new key: the panes that read this one have keyed setters that use it, so they run again. An edit that reruns it tries again (its loop guard clears).
|
|
12
|
+
onPatch(canvas, id, patch, step) {
|
|
13
|
+
if (step === "late" && "key" in patch && canvas.attached.has(id)) canvas.readersRerun(id, `edit ${canvas.panes.get(id).name || id}`);
|
|
14
|
+
if (step === "rerun") canvas.clearStateLoop(id);
|
|
15
|
+
},
|
|
16
|
+
title: "state",
|
|
17
|
+
description: "A value that other panes can set",
|
|
18
|
+
icon: "◉",
|
|
19
|
+
art: `${FRAME}<circle class="a" cx="24" cy="21.5" r="6.5"/><circle class="a f" cx="24" cy="21.5" r="2.4"/><path d="M11 18v7M37 18v7"/>`,
|
|
20
|
+
namePrefix: "state",
|
|
21
|
+
defaults: () => ({ code: "0", width: 240 }),
|
|
22
|
+
minimap: ["#efd3b9", "#5a412b"],
|
|
23
|
+
exports: "its value, its code",
|
|
24
|
+
headless: "run",
|
|
25
|
+
readsEnv: false,
|
|
26
|
+
needsScreen: false,
|
|
27
|
+
frame: false,
|
|
28
|
+
subgraphOutput: true,
|
|
29
|
+
readsInputs: false, freshRun: true, cutoff: true, pinnable: true, retypable: true, runInput: true, restorable: true, popOut: true, // run-time traits (src/panes/registry.js)
|
|
30
|
+
toolbar: ["persist", "key", "context", "outputs"],
|
|
31
|
+
// Where its value is kept (src/model/persist-state.js, src/ui/stores-ui.js).
|
|
32
|
+
menu: [
|
|
33
|
+
CUTOFF_ITEM,
|
|
34
|
+
{ separator: true },
|
|
35
|
+
{
|
|
36
|
+
submenu: "Keep value",
|
|
37
|
+
radio: [
|
|
38
|
+
{ id: "state.persist.session", label: "this session only", checked: (pane) => !pane.persist || pane.persist === "session" },
|
|
39
|
+
{ id: "state.persist.canvas", label: "in this canvas (this browser)", checked: (pane) => pane.persist === "canvas" },
|
|
40
|
+
{ id: "state.persist.browser", label: "in a browser store…", checked: (pane) => Boolean(pane.persist?.browser) },
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
"presets.add-states", // put it in a preset bank, opt-in (src/model/preset-states.js)
|
|
44
|
+
"state.context", // share it with the panes inside subgraphs below (src/ui/context-ui.js)
|
|
45
|
+
],
|
|
46
|
+
// Where its value is kept, and whether the last one was (never the stored value itself beyond the pane's own); and the panes
|
|
47
|
+
// whose setter wires write to it (not in usedBy: they don't read it).
|
|
48
|
+
agentStatus: (pane, canvas, { nameOf }) => {
|
|
49
|
+
const stored = canvas.stateOf(pane.id).value.result?.stored;
|
|
50
|
+
const writers = canvas.order().filter((other) => canvas.panes.get(other)?.inputs?.some((input, index) => input.source === pane.id && canvas.isSetterWire(other, index)));
|
|
51
|
+
return {
|
|
52
|
+
persist: pane.persist ?? "session",
|
|
53
|
+
key: stateKeyOf(pane.key), // what its keyed setters name items by
|
|
54
|
+
...(stored ? { stored } : {}),
|
|
55
|
+
...(writers.length ? { writtenBy: writers.map((w) => nameOf(canvas, w)) } : {}),
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
agent: {
|
|
59
|
+
summary: "a value other panes can set: its setter is its output \"set\" (✎ setCount): wire it with mallory_connect { from: <state>, to: <pane>, output: \"set\" } and the pane's code gets `setCount` (or the `as` name), write-only (it never waits for the state or reruns when it changes; a pane that reads and writes takes a value wire and a setter wire). A value wire carries only the value, never a setter. A list also gets keyed setters (setTodos.update(key, patch), .insert(item, at?), .remove(key), .move(key, to)) that change one item by its `key`; with `persist` it keeps its value between visits; with `context` it is shared with the panes inside subgraphs below it, which opt in by name (mallory_use_context) and get its setter too",
|
|
60
|
+
fields: {
|
|
61
|
+
onError: true,
|
|
62
|
+
cutoff: "on by default (setting it to an equal value doesn't rerun its readers).",
|
|
63
|
+
code: "the initial value expression.",
|
|
64
|
+
key: {
|
|
65
|
+
schema: {
|
|
66
|
+
type: "string",
|
|
67
|
+
description:
|
|
68
|
+
'what names an item of its list, for the keyed setters setTodos.update(key, patch), .insert(item, at?), .remove(key), .move(key, to) and mallory_set_state\'s `op`: a field or dotted path (id, user.id) or an expression with item (item for a list of strings, item.lang + "/" + item.id), the rule each.key uses. Empty or left out: "id".',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
context: {
|
|
72
|
+
schema: {
|
|
73
|
+
type: "string",
|
|
74
|
+
description:
|
|
75
|
+
'share its value as a named context, like Noodl\'s Component Object: a pane inside a subgraph below this canvas (at any depth: in a subgraph pane here, a linked subgraph, a repeater instance, or a subgraph inside those) that takes the input "context:<name>" (mallory_use_context) reads it, from the nearest canvas above it that shares that name; one that takes its setter (mallory_use_context setter: true, setTab; keyed ones for a list) writes it back. Panes on this same canvas wire it directly. An identifier, like "tabs"; "" stops sharing it.',
|
|
76
|
+
},
|
|
77
|
+
refuse: "share a context (context)",
|
|
78
|
+
},
|
|
79
|
+
persist: {
|
|
80
|
+
schema: {
|
|
81
|
+
type: ["string", "object"],
|
|
82
|
+
description:
|
|
83
|
+
'where the value is kept: "session" (the default: until the page reloads), "canvas" (in this browser, for this canvas), or { "browser": "<store name>" } (a named store shared by the canvases the person allows: its first use on a canvas asks them). Only plain JSON values are kept; the canvas, its file and its link never carry them. A persisted pane starts from its stored value, and keeps it when its code changes; mallory_run_pane resets it to its initial value (overwriting what is stored).',
|
|
84
|
+
properties: { browser: { type: "string" } },
|
|
85
|
+
additionalProperties: false,
|
|
86
|
+
},
|
|
87
|
+
refuse: "keep their value (persist)",
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// statechart: a hierarchical state machine as plain JSON (nested and parallel states, initial and history
|
|
2
|
+
// states, guarded transitions on named events, entry/exit actions that emit named events, `after` delays), run
|
|
3
|
+
// deterministically on events from its wires and the canvas clock. The machine, its strict validation and
|
|
4
|
+
// its runtime are src/model/statecharts.js (pure); keeping it in step with the canvas (delays on the canvas
|
|
5
|
+
// clock and the transport, the transition log, the events it emits) is src/model/chart-clock.js; its body and
|
|
6
|
+
// commands are src/ui/chart-pane.js. Guards and actions are declarative JSON, never code (docs/guide/canvas-basics.md, "Statecharts").
|
|
7
|
+
import { FRAME } from "./shared.js";
|
|
8
|
+
import { chartEvents } from "../model/chart-clock.js";
|
|
9
|
+
import { DEFAULT_CHART, MAX_STATES, MAX_DEPTH, MAX_AFTER_MS, MAX_ACTIONS, MAX_TESTS } from "../model/statecharts.js";
|
|
10
|
+
import { describeChart } from "../model/statecharts.js";
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
type: "statechart",
|
|
14
|
+
// Code in a chart's guards runs only when the person allows it (the chart.code-guards command).
|
|
15
|
+
personOnly: ["codeGuards"],
|
|
16
|
+
// The line the Markdown format writes for it (src/formats/markdown.js).
|
|
17
|
+
describe: (pane) => `Statechart: ${describeChart(pane.chart)}.`,
|
|
18
|
+
// Settings whose edit reruns a pane of this type (src/panes/registry.js, reruns).
|
|
19
|
+
reruns: ["chart", "codeGuards"],
|
|
20
|
+
// The machine is another machine now: it starts again.
|
|
21
|
+
onPatch(canvas, id, patch, step) {
|
|
22
|
+
if (step === "early" && ("chart" in patch || "codeGuards" in patch) && canvas.attached.has(id)) canvas.charts.edited(id);
|
|
23
|
+
},
|
|
24
|
+
title: "statechart",
|
|
25
|
+
description: "Runs a hierarchical state machine (nested and parallel states, guards, delays, history) on events",
|
|
26
|
+
icon: "⬡",
|
|
27
|
+
art: `${FRAME}<rect x="12" y="12" width="24" height="24" rx="3"/><rect class="a" x="16" y="17" width="7" height="6" rx="1.5"/><rect x="25" y="26" width="7" height="6" rx="1.5"/><path d="M23 20h4.5v6"/><circle class="a f" cx="19.5" cy="20" r="1"/>`,
|
|
28
|
+
namePrefix: "chart",
|
|
29
|
+
defaults: () => ({ chart: structuredClone(DEFAULT_CHART), outputs: [{ name: "configuration", type: "array<string>" }, { name: "context", type: "object" }], runsWithoutEvent: true, width: 420 }),
|
|
30
|
+
minimap: ["#d8e6d3", "#33503a"],
|
|
31
|
+
exports: "its value (the innermost active states as configuration, the nested value, the context and the last transition, as JSON)",
|
|
32
|
+
headless: "run",
|
|
33
|
+
readsEnv: false,
|
|
34
|
+
needsScreen: false,
|
|
35
|
+
frame: false,
|
|
36
|
+
subgraphOutput: false,
|
|
37
|
+
events: chartEvents, // one output per event the machine emits, then "transition" (a function of its settings)
|
|
38
|
+
menu: ["chart.reset", "chart.step", "chart.test", "chart.xstate-export", "chart.xstate-import", "chart.code-guards"],
|
|
39
|
+
// Where it stands, the delays pending, the transition log, its saved tests.
|
|
40
|
+
agentStatus: (pane, canvas) => (canvas.charts ? { statechart: canvas.charts.status(pane.id) } : {}),
|
|
41
|
+
agent: {
|
|
42
|
+
summary:
|
|
43
|
+
'runs a hierarchical state machine on events: nested (compound) and parallel states, initial and history states, guarded transitions on named events, entry/exit actions that emit named events, and "after" delays. Wire an event output into any input: an event on input NAME is the chart\'s event NAME (on an input called "event", its payload\'s "type" names it). Its value is { configuration (the innermost active states, like "work.editing"), value (nested), active, context, done, last }; every event it emits (an emit action) is an event output of that name, and "transition" fires on every transition. Delays run on the canvas clock and are held by the transport (pause, play, step). Guards and actions are declarative JSON, never code; for logic, compute it in an eval pane and send the chart an event. The state is runtime only: the canvas, its file and its share link hold the machine (and saved tests), never where it is. Send it events by hand with mallory_send_event { chart: "send" }; mallory_get_pane shows the configuration, the delays pending and the transition log',
|
|
44
|
+
fields: {
|
|
45
|
+
chart: {
|
|
46
|
+
schema: {
|
|
47
|
+
type: "object",
|
|
48
|
+
description: `the machine: { initial (a compound chart names its first child), states, context?, on?, tests? }. A state is { type?: "atomic" | "compound" | "parallel" | "final" | "history", initial? (compound), states?, on?, always?, after?, entry?, exit?, history? ("shallow" | "deep") and target? (history: the default), description? }; at most ${MAX_STATES} states, ${MAX_DEPTH} deep. on: { EVENT: transition(s), "*": … }; always: eventless; after: { "<ms 1..${MAX_AFTER_MS}>": transition(s) } (a timer from entering the state until it exits). A transition is a target name, { target?, guard?, actions?, reenter? }, or a list tried in order (all but the last need a guard). Targets: "sibling" ("a.b" below a sibling), ".child" (inside this state), "#a.b" (from the top); target may be a list of 2 to 8 (one state in each of several regions of a parallel state, entered together); a move from one region of a parallel state into another leaves and re-enters the parallel state; no target runs only the actions; the move to your own descendant doesn't leave you unless reenter: true. A guard is a condition or a list (all hold): { path: "event.amount" | "context.n", op (eq ne gt gte lt lte in contains exists missing), value | startPath } or { in: "#state.path" }. Actions (at most ${MAX_ACTIONS} per list, run in order, entry/exit/transition): { emit: "name", payload? } (an event output; no payload forwards the causing event's), { assign: { key: value } } (the context), { raise: "EVENT" }, { spawn: "machine", id, input? }, { stop: "id" }, { sendTo: "id", event, payload? } and, in child machines, { sendParent: "EVENT", payload? }. Child machines: the chart's machines: { name: chart } (up to 16, 3 deep) can be run by a state (invoke: { src, id?, input?, onDone? }: started on entry, stopped on exit) or spawned by an action; a child cannot emit (it sends events up with sendParent); a final state's output (a value) rides on done.<state>, on done.invoke.<id> (as event.output) and is the chart's own output. A value: JSON, { value }, { event: "path" }, { context: "path" } or { add: n } (assign only). Done events: "done.<state>" when a compound state enters a final child (a parallel one: every region). tests: up to ${MAX_TESTS} saved event sequences on virtual time: { name, steps: [{ send, payload? } | { advance: ms }], expect: { configuration?: [innermost states], context?: {subset}, emitted?: [names in order], output?: value, actors?: { id: [innermost states] } } }. Strict: unknown keys, targets and unreachable states, shadowed or duplicate transitions and ill-formed target lists are refused, each named by where it is. Only the keys passed change. Editing the machine restarts it (the state is never saved).`,
|
|
49
|
+
properties: {
|
|
50
|
+
initial: { type: "string" },
|
|
51
|
+
states: { type: "object" },
|
|
52
|
+
context: { type: "object" },
|
|
53
|
+
machines: { type: "object" },
|
|
54
|
+
on: { type: "object" },
|
|
55
|
+
tests: { type: "array", maxItems: MAX_TESTS },
|
|
56
|
+
},
|
|
57
|
+
additionalProperties: true,
|
|
58
|
+
},
|
|
59
|
+
refuse: "run a state machine (chart)",
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// story: a branching story as text whose value is that text, with its reader and map in its own body.
|
|
2
|
+
// The story is the pane's `text` (`@passage Name` sections with [[links]], src/narrative/narrative.js);
|
|
3
|
+
// the body (src/ui/story-pane.js) plays it, draws its navigation graph and jumps to a passage on a
|
|
4
|
+
// click. The reader's place is the person's, in this browser, never in the canvas file.
|
|
5
|
+
import { FRAME, CUTOFF_ITEM } from "./shared.js";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
presentation: "body",
|
|
9
|
+
type: "story",
|
|
10
|
+
title: "story",
|
|
11
|
+
description: "A branching story: read it, see its map, click to jump",
|
|
12
|
+
icon: "❡",
|
|
13
|
+
art: `${FRAME}<rect class="f" x="8" y="14" width="13" height="5" rx="1"/><rect x="27" y="14" width="13" height="5" rx="1"/><rect x="17" y="23" width="14" height="5" rx="1"/><path class="a" d="M21 16.5h6M14 19v2.5h10M34 19v2.5H24"/>`,
|
|
14
|
+
namePrefix: "story",
|
|
15
|
+
defaults: () => ({ text: "@passage Start\nYou stand at a crossroads. Go [[left->Forest]] or [[right->Village]].\n\n@passage Forest\nTrees, and a path back. [[Start<-back]]\n\n@passage Village\nA quiet village. **The end.**", width: 420 }),
|
|
16
|
+
minimap: ["#d6e9ec", "#2c4a50"],
|
|
17
|
+
exports: "its story text",
|
|
18
|
+
headless: "run",
|
|
19
|
+
readsEnv: false,
|
|
20
|
+
needsScreen: false,
|
|
21
|
+
frame: false,
|
|
22
|
+
subgraphOutput: false,
|
|
23
|
+
readsInputs: false, cutoff: true, runInput: true, catchable: false, restorable: true, textValue: true, // run-time traits (src/panes/registry.js)
|
|
24
|
+
menu: [CUTOFF_ITEM],
|
|
25
|
+
agent: {
|
|
26
|
+
summary: "a branching story: text of @passage sections and [[links]] whose value is that text; its body plays the story and draws its map, and a click on a passage jumps there",
|
|
27
|
+
fields: {
|
|
28
|
+
cutoff: "on by default.",
|
|
29
|
+
text: "the story (also its value): `@passage Name` starts a passage, [[Text]], [[Text->Target]] and [[Target<-Text]] are links, <<set $x to 1>>, <<if $x>>…<</if>> and <<print $x>> use variables, an `@asset name` section holds an image's data URI.",
|
|
30
|
+
view: true,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|