@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
package/src/panes/mcp.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// mcp: an MCP server pane (#529). It connects to a Streamable HTTP MCP server
|
|
2
|
+
// (src/mcp/client.js) through the canvas's network policy, or to the in-page
|
|
3
|
+
// demo server at mallory:demo-mcp (src/mcp/demo-server.js), and its value is
|
|
4
|
+
// the server's capability snapshot: { server, tools, resources, prompts }.
|
|
5
|
+
// Pane code calls its tools with mcp.call("<its name>", tool, args) and reads
|
|
6
|
+
// its resources with mcp.read(…); its body has a form per tool, and what a form
|
|
7
|
+
// returns goes out on its "result" event. Agent panes take its tools with
|
|
8
|
+
// their `mcpServers` setting (src/agent/run.js). Every tool call goes through
|
|
9
|
+
// the person's tool gate (src/gate/). The auth key is a name only; its value
|
|
10
|
+
// stays in this browser (src/mcp/settings.js), and agents can't set it.
|
|
11
|
+
// Live (#533): resources it keeps live (`subscribe`) go out on its "resource"
|
|
12
|
+
// event as they change, read-only tools it watches (`watch`) on "watch". A
|
|
13
|
+
// tape (#537, `tape`, `replay`) records a session and replays it offline.
|
|
14
|
+
// Agents set none of these: they would read resources or call tools.
|
|
15
|
+
// Via wsh (#529): a ws(s):// URL (or mallory:demo-wsh) reaches a wsh server
|
|
16
|
+
// the person runs, whose MCP bridge exposes the tools of the stdio MCP servers
|
|
17
|
+
// it runs (src/mcp/wsh-client.js): tools only, logged in like a terminal pane
|
|
18
|
+
// (`user`, `keyPane`: this browser's key or a secret pane's).
|
|
19
|
+
// Sampling (#545, src/mcp/sampling.js): with `sampling` set ({ agent: "<an
|
|
20
|
+
// agent pane's name>" }, or { agent: "" } to answer yourself), the server may
|
|
21
|
+
// ask for a completion; each request waits for the person's approval through
|
|
22
|
+
// the gate, and agents can't set it or approve one. Composer (#545): a form's
|
|
23
|
+
// answer can be attached to an agent pane's next message (its `attach`).
|
|
24
|
+
// Elicitation (#545, src/mcp/elicitation.js): with `elicitation: true` the
|
|
25
|
+
// server may ask the person a question (a form from its schema); each one
|
|
26
|
+
// waits for their answer through the gate, and agents can't set it or answer.
|
|
27
|
+
// Roots (#545, src/mcp/roots.js): with `roots: true` the server may ask which
|
|
28
|
+
// folders the person works in; it gets only folders they picked (kept in this
|
|
29
|
+
// browser, never in the canvas) and approved for it, once, through the gate.
|
|
30
|
+
// Agents can't set it, pick a folder or approve one.
|
|
31
|
+
// Resource templates (#545): the value lists them (`resourceTemplates`), the
|
|
32
|
+
// body fills one in and reads it, and code does with mcp.read(name, template, { params }).
|
|
33
|
+
import { FRAME } from "./shared.js";
|
|
34
|
+
import { DEMO_URL } from "../mcp/demo-server.js";
|
|
35
|
+
|
|
36
|
+
export default {
|
|
37
|
+
type: "mcp",
|
|
38
|
+
// Sampling, elicitation and roots are questions to the person that the server may only ask once they turned them on (agents can't set them).
|
|
39
|
+
//
|
|
40
|
+
// The rest of an MCP pane's settings that agents can't set (everything but `url`), one by one (test/person-only.test.mjs NOT_PERSON_ONLY):
|
|
41
|
+
// keyPane (via wsh, the secret pane whose private key logs in): person-only. A pasted pane could name a secret pane that is already
|
|
42
|
+
// on the target canvas and sign in to the pasted pane's server with its key, with nothing for the person to click.
|
|
43
|
+
// authKey: the NAME of an API key; the page fills the secret in only for that key's own hosts (src/network/secrets.js), so a pasted name
|
|
44
|
+
// reaches no other host. Left as it is, so a copied pane keeps working.
|
|
45
|
+
// user: a login name, of no use without the key. subscribe, watch: calls to the pane's own server through the tool gate and the
|
|
46
|
+
// network policy, like a read. tape, replay: recorded data and answering from it (offline). All inert without a grant the person gives.
|
|
47
|
+
personOnly: ["sampling", "elicitation", "roots", "keyPane"],
|
|
48
|
+
// Settings whose edit reruns a pane of this type (src/panes/registry.js, reruns).
|
|
49
|
+
reruns: ["authKey"],
|
|
50
|
+
// Its live sources follow its settings: nothing reruns.
|
|
51
|
+
onPatch(canvas, id, patch, step) {
|
|
52
|
+
if (step === "after" && ["subscribe", "watch"].some((k) => k in patch)) canvas.mcpHub?.syncLive(id);
|
|
53
|
+
},
|
|
54
|
+
title: "mcp",
|
|
55
|
+
description: "An MCP server: its tools, resources and prompts as a value, with a form per tool",
|
|
56
|
+
icon: "⌬",
|
|
57
|
+
art: `${FRAME}<circle class="a" cx="14" cy="21.5" r="4"/><path d="M18 21.5h6"/><rect class="f" x="24" y="14.5" width="15" height="4" rx="1.2"/><rect class="f" x="24" y="20" width="15" height="4" rx="1.2"/><rect class="f" x="24" y="25.5" width="15" height="4" rx="1.2"/><path d="M24 16.5h-2v11h2"/>`,
|
|
58
|
+
namePrefix: "mcp",
|
|
59
|
+
defaults: () => ({ url: DEMO_URL, authKey: "", width: 380 }),
|
|
60
|
+
minimap: ["#d4e3ea", "#33505c"],
|
|
61
|
+
exports: "its value (the server's tools, resources and prompts, as JSON)",
|
|
62
|
+
headless: "run",
|
|
63
|
+
readsEnv: false,
|
|
64
|
+
needsScreen: false,
|
|
65
|
+
frame: false,
|
|
66
|
+
subgraphOutput: true,
|
|
67
|
+
readsInputs: false, // run-time trait (src/panes/registry.js): it connects; nothing is wired into it
|
|
68
|
+
events: [
|
|
69
|
+
{ name: "result", description: "what its own forms return: { kind (tool, resource or prompt), name, args, value } or { …, error }, once per Call, Read or Get" },
|
|
70
|
+
{ name: "resource", description: "a live resource (its keep-live list): { uri, value, at } when it is first read and on each update the server sends" },
|
|
71
|
+
{ name: "watch", description: "a watched read-only tool's answers: { tool, args, value, at } or { …, error }, every few seconds" },
|
|
72
|
+
{ name: "sampling", description: "each sampling request the server sent (with its sampling setting on) and its answer: { request, text, model, at }, or { request, error, at } when it wasn't answered" },
|
|
73
|
+
{ name: "task", description: "each change of a long-running call's MCP task (CLW-MCP-02): { taskId, tool, status (working, input_required, completed, failed or cancelled), statusMessage?, at }" },
|
|
74
|
+
{ name: "elicitation", description: "each question the server asked you (with its elicitation setting on) and your answer: { request, action (accept, decline or cancel), content?, at }, or { request, error, at } when it was refused" },
|
|
75
|
+
],
|
|
76
|
+
// Its own commands (src/ui/mcp-pane.js), and the tool gate its calls go through (src/ui/tool-gate-ui.js).
|
|
77
|
+
menu: ["mcp.reconnect", "mcp.call", "mcp.openApp", "mcp.live", "mcp.attach", "mcp.sampling", "mcp.elicitation", "mcp.roots", "mcp.readTemplate", "mcp.auth", "mcp.acceptHostKey", { submenu: "Tape", items: ["mcp.record", "mcp.stopRecording", "mcp.replay", "mcp.downloadTape"] }, { separator: true }, "runs.protocol-pane", "gate.policy", "gate.inbox", "gate.audit"],
|
|
78
|
+
agent: {
|
|
79
|
+
summary:
|
|
80
|
+
'an MCP server (Model Context Protocol, Streamable HTTP): its value is { server, tools, resources, resourceTemplates, prompts }, what the server offers. Other panes call a tool with mcp.call("<this pane\'s name>", tool, args) and read a resource with mcp.read(name, uri) (a resource template with mcp.read(name, uriTemplate, { params })); a person can hand its tools to an agent pane (the agent pane\'s MCP servers list). Every tool call goes through the person\'s tool gate. url "mallory:demo-mcp" is a demo server inside the page (made-up data, no network). Its auth key is the person\'s to set',
|
|
81
|
+
fields: {
|
|
82
|
+
url: 'the server\'s Streamable HTTP endpoint (https://…/mcp; the network policy applies and the person is asked about a new host), a wsh server\'s ws:// or wss:// URL (its tools only, through wsh\'s MCP bridge, logged in with the person\'s key), "mallory:demo-mcp" for the demo server inside the page, or "mallory:demo-wsh" for the demo wsh host\'s tools.',
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// mcpapp: an MCP app pane. It shows an MCP server's app, the ui:// page a
|
|
2
|
+
// tool names for its results (MCP Apps, src/mcp/apps.js), in a sandboxed
|
|
3
|
+
// frame (src/ui/mcp-app-pane.js): the app's page runs in a frame inside the
|
|
4
|
+
// pane's own frame, with the canvas's network CSP and the CSP its resource
|
|
5
|
+
// declares, and talks to mallory only by the MCP Apps messages. It reaches
|
|
6
|
+
// the server through an MCP server pane on the canvas (its `server`, by
|
|
7
|
+
// name), never on its own: its run calls the tool (what is wired into it, else
|
|
8
|
+
// its `args`, are the arguments) through that pane's connection and the
|
|
9
|
+
// person's tool gate, reads the page, and hands the app the arguments and the
|
|
10
|
+
// result; a tool the app calls goes through the same gate, audited as asked
|
|
11
|
+
// for by this app. What the app sends (ui/message, ui/update-model-context,
|
|
12
|
+
// its lifecycle, its own calls) goes out on its event outputs. Agents can add
|
|
13
|
+
// one, never point it at a server, a tool or a resource: that would read a
|
|
14
|
+
// server's resources and call its tools (WHY_NOT.MCP).
|
|
15
|
+
//
|
|
16
|
+
// When the typed `args` setting is edited (#771): a tool that declares
|
|
17
|
+
// annotations.readOnlyHint: true is called again; any other tool is held. The
|
|
18
|
+
// edit is saved, the value stays the last call's { args, result } (never new
|
|
19
|
+
// arguments next to an old result) and the pane is marked out of date
|
|
20
|
+
// ("arguments changed: ▶ to call"; Canvas#callStale, tab-only, not in the
|
|
21
|
+
// document) until it is run. Undo and redo follow the same rule, and an
|
|
22
|
+
// unresolvable tool or server never calls (src/mcp/app-args.js, the rule in
|
|
23
|
+
// Canvas#update). The gate decides every call either way.
|
|
24
|
+
import { FRAME } from "./shared.js";
|
|
25
|
+
import { mcpAppArgsEdit } from "../mcp/app-args.js";
|
|
26
|
+
|
|
27
|
+
export default {
|
|
28
|
+
presentation: "body",
|
|
29
|
+
type: "mcpapp",
|
|
30
|
+
// Editing `args` (#771): a read-only tool calls again as a rerun does ("call"); any other tool is held: its last call's value stands and
|
|
31
|
+
// the pane is out of date until run ("hold", src/mcp/app-args.js). Every other setting is the person's pick, applied by the view.
|
|
32
|
+
onPatch(canvas, id, patch, step) {
|
|
33
|
+
if (step !== "edited" || !("args" in patch) || !canvas.attached.has(id)) return undefined;
|
|
34
|
+
return mcpAppArgsEdit(canvas, canvas.panes.get(id));
|
|
35
|
+
},
|
|
36
|
+
title: "mcpapp",
|
|
37
|
+
description: "An MCP server's app: the ui:// page a tool shows its results in, in a sandboxed frame",
|
|
38
|
+
icon: "⧇",
|
|
39
|
+
art: `${FRAME}<circle class="a" cx="10" cy="21.5" r="3"/><path d="M13 21.5h4"/><rect class="f" x="17" y="13.5" width="23" height="16" rx="1.5"/><path class="a" d="M20 18h10M20 22h14M20 26h7"/><rect class="a f" x="32" y="24.5" width="6" height="3" rx="1.5"/>`,
|
|
40
|
+
namePrefix: "app",
|
|
41
|
+
defaults: () => ({ server: "", tool: "", resource: "", args: {}, width: 400 }),
|
|
42
|
+
minimap: ["#d9e1ef", "#344260"],
|
|
43
|
+
exports: "its value (the tool, its arguments and its result, as JSON)",
|
|
44
|
+
headless: { skip: "MCP app panes show a server's page in a frame, which needs a browser" },
|
|
45
|
+
readsEnv: false,
|
|
46
|
+
needsScreen: true,
|
|
47
|
+
frame: true,
|
|
48
|
+
subgraphOutput: true,
|
|
49
|
+
// A restart of the sandbox puts its value back: rerunning it would call the tool again.
|
|
50
|
+
restorable: true,
|
|
51
|
+
events: [
|
|
52
|
+
{ name: "message", description: "each message the app sends for the conversation (ui/message): { role, content, text }" },
|
|
53
|
+
{ name: "context", description: "what the app tells the model it shows (ui/update-model-context): { content, text, structuredContent? }" },
|
|
54
|
+
{ name: "call", description: "each tool call the app makes (through the tool gate): { tool, args, result } or { tool, args, error }" },
|
|
55
|
+
{ name: "lifecycle", description: "the app's lifecycle: { phase } with phase initialize (its appInfo), initialized, teardown (with its reason), link (a link it asked to open, for you to open) or display-mode (the mode it requested, or the mode it is now in after the person pressed Fullscreen or left it)" },
|
|
56
|
+
],
|
|
57
|
+
// Its own commands (src/ui/mcp-app-pane.js), and the tool gate its calls go through (src/ui/tool-gate-ui.js).
|
|
58
|
+
menu: ["mcpapp.reload", "mcpapp.pick", { separator: true }, "gate.policy", "gate.inbox", "gate.audit"],
|
|
59
|
+
agent: {
|
|
60
|
+
summary:
|
|
61
|
+
"an MCP app: an MCP server pane's app (the ui:// page one of its tools shows its results in, MCP Apps) in a sandboxed frame. Its value is { server, tool, args, resource, result }; the app's messages, model-context updates, tool calls and lifecycle go out on its message, context, call and lifecycle event outputs. Which server, tool and resource it shows are the person's to pick (they read a server's resources and call its tools); every tool call, the app's own too, goes through the person's tool gate",
|
|
62
|
+
fields: {},
|
|
63
|
+
},
|
|
64
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// media: an image, sound, video or file a person adds (a file, the camera,
|
|
2
|
+
// the microphone) or a URL fetches (src/ui/media-pane.js, src/media/).
|
|
3
|
+
import { FRAME } from "./shared.js";
|
|
4
|
+
import { ratioOf } from "../model/size-ratio.js";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
type: "media",
|
|
8
|
+
// Settings whose edit reruns a pane of this type (src/panes/registry.js, reruns).
|
|
9
|
+
reruns: ["media"],
|
|
10
|
+
title: "media",
|
|
11
|
+
description: "An image, sound, video or file: drop, camera or mic",
|
|
12
|
+
icon: "◩",
|
|
13
|
+
art: `${FRAME}<rect class="f" x="9" y="14" width="17" height="14" rx="1.5"/><circle class="a" cx="13.5" cy="18" r="1.6"/><path d="M9.5 27l5-5 3.5 3.5 2.5-2.5 5 4.5"/><path class="a" d="M30 25.5v-8M33 27.5v-12M36 25v-7M39 23v-3"/>`,
|
|
14
|
+
namePrefix: "media",
|
|
15
|
+
defaults: () => ({ media: null, accept: "", width: 300 }), // see src/media/persist.js
|
|
16
|
+
sizeHint: (pane) => ({ aspectRatio: ["image", "video"].includes(pane.media?.kind) ? ratioOf(pane.media) : undefined, chromeHeight: 80, minHeight: 120, maxWidth: 2000 }), // an image or video keeps its own ratio
|
|
17
|
+
minimap: ["#e6cfd8", "#4d3340"],
|
|
18
|
+
exports: "its media file, an image as PNG, its description",
|
|
19
|
+
headless: "run",
|
|
20
|
+
readsEnv: false,
|
|
21
|
+
needsScreen: false,
|
|
22
|
+
frame: false,
|
|
23
|
+
subgraphOutput: true,
|
|
24
|
+
readsInputs: false, pinnable: true, runInput: true, // run-time traits (src/panes/registry.js)
|
|
25
|
+
menu: [{ submenu: "Media", items: ["media.choose", "media.camera", "media.record", "media.url", "media.table", "media.tilemap", "media.clear"] }],
|
|
26
|
+
// What the media pane holds and where its bytes are kept; never the bytes.
|
|
27
|
+
agentStatus: (pane) => {
|
|
28
|
+
const { data, ...held } = pane.media ?? {};
|
|
29
|
+
return { holds: pane.media ? held : null };
|
|
30
|
+
},
|
|
31
|
+
agent: {
|
|
32
|
+
summary: "an image, sound, video or file: a person drops or records one; an agent can give it a URL with `url` or mallory_set_media; pane code gets image(), audio(), video(), file(), decodeImage(), decodeAudio(), imageMetadata(), editImageMetadata(), routeImage(), normalizeImageOrientation() and carryImageMetadata() to make, read and clean media values, and ffmpegGraph() and ffmpegCommand() to turn a filtergraph into an exact ffmpeg command (nothing is run); a Tiled, LDtk, Aseprite or TexturePacker file in a media pane is read into a tilemap or atlas value with tilemap.read(file, { images })",
|
|
33
|
+
fields: {
|
|
34
|
+
url: "an image, sound, video or file to fetch (through the canvas's network permissions) as the pane's value.",
|
|
35
|
+
onError: true,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// memory: a canvas's read of the person's own memory (CLW-AGT-07, CLW-APP-04; decisions D26 and D30 part 3, docs/guide/agents-and-machines.md "Memory"). The store lives
|
|
2
|
+
// in this browser, for the person only (src/memory/, off by default, bounded, never in a canvas document). A memory pane ASKS to read one store ("canvas": this
|
|
3
|
+
// canvas's own entries, "shared": the browser-wide ones) and recalls entries by a query (BM25); it reads nothing until the person allows THAT pane, in the pane
|
|
4
|
+
// itself. Its value holds only what recall returned for it. Agents cannot read, list, write or grant memory: they see a pane's value as they see any other, and only when
|
|
5
|
+
// the person allowed the pane. The run is src/model/runners/memory.js, the body src/ui/memory-pane.js.
|
|
6
|
+
import { FRAME } from "./shared.js";
|
|
7
|
+
import { defaultMemory, describeMemory, memoryProblem } from "../model/memory-settings.js";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
type: "memory",
|
|
11
|
+
// A saved memory pane must have sound settings: refused with the reason (src/persist.js).
|
|
12
|
+
validate(pane, where) {
|
|
13
|
+
const problem = memoryProblem(pane.memory);
|
|
14
|
+
if (problem) throw new Error(`Memory pane "${pane.name || pane.id}"${where}: ${problem}.`);
|
|
15
|
+
},
|
|
16
|
+
describe: (pane) => describeMemory(pane.memory),
|
|
17
|
+
reruns: ["memory"],
|
|
18
|
+
// Which store a pane asks for is the person's: an id a share link, a paste or an agent brings is reset (src/model/person-only.js), so a file cannot ask for the shared store.
|
|
19
|
+
personOnly: ["memory.store", "memory.query", "memory.limit"],
|
|
20
|
+
title: "memory",
|
|
21
|
+
description: "Recall entries from your own memory store, once you allow this pane to read it",
|
|
22
|
+
icon: "⛁",
|
|
23
|
+
art: `${FRAME}<ellipse cx="24" cy="15" rx="11" ry="4"/><path d="M13 15v9c0 2.2 4.9 4 11 4s11-1.8 11-4v-9" opacity=".6"/><path class="a" d="M13 24v9c0 2.2 4.9 4 11 4s11-1.8 11-4v-9"/>`,
|
|
24
|
+
namePrefix: "memory",
|
|
25
|
+
defaults: () => ({ memory: defaultMemory(), width: 380 }),
|
|
26
|
+
minimap: ["#d9e6df", "#2f4a3d"],
|
|
27
|
+
exports: "its recalled entries (JSON)",
|
|
28
|
+
headless: "run",
|
|
29
|
+
readsEnv: false,
|
|
30
|
+
needsScreen: false,
|
|
31
|
+
frame: false,
|
|
32
|
+
subgraphOutput: true,
|
|
33
|
+
presentation: "body",
|
|
34
|
+
takesSkips: true,
|
|
35
|
+
menu: [],
|
|
36
|
+
mcpServes: false,
|
|
37
|
+
// What an agent learns about it: the request, never an entry, and never whether memory is on or the pane allowed.
|
|
38
|
+
agentStatus: (pane) => {
|
|
39
|
+
const problem = memoryProblem(pane.memory);
|
|
40
|
+
return problem ? { problem } : { asks: pane.memory?.store ?? "canvas", query: pane.memory?.query ?? "" };
|
|
41
|
+
},
|
|
42
|
+
agent: {
|
|
43
|
+
summary: `recalls entries from the PERSON's own memory store, in their browser. It asks to read one store (\`store\`: "canvas", this canvas's own entries, or "shared", the browser-wide ones; the person sets it, an agent cannot), looks for \`query\` (or a text wired into its input) with BM25 and takes up to \`limit\` entries; its value is { store, query, count, entries: [{ title, text, tags, score }], text }. It reads NOTHING until the person allows this pane in the pane itself: until then, and while memory is off, its value is empty. An agent cannot read, list, write or erase memory, switch it on or allow a pane; it sees this pane's value as it sees any pane's, and only when the person allowed it for the query the person set. Wire its value (or its \`text\`) to an agent pane's context to give that agent the entries.`,
|
|
44
|
+
fields: {}, // none: what a memory pane reads is the person's setting; an agent cannot edit it
|
|
45
|
+
},
|
|
46
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// mesh-inspect: connectivity of the room a person is in, as numbers (CLW-P2P-26, CLW-APP-20; docs/guide/collaboration-and-sharing.md "The mesh-inspect pane"): members, direct channels versus
|
|
2
|
+
// relay, who has gone quiet, the drop rate, alert rules a person edits, and a bounded trace of room events (names, short fingerprints and counts; never a message). The
|
|
3
|
+
// body reads the page's room while it is on screen; nothing is saved with the canvas but the pane's view and its rules (thresholds and labels). Its value is counts and
|
|
4
|
+
// the ids of the rules that are firing, so a canvas can wire an alert somewhere; it holds no name, key or fingerprint.
|
|
5
|
+
import { FRAME } from "./shared.js";
|
|
6
|
+
import { MESH_VIEWS, defaultMeshInspect, describeMeshInspect, meshInspectProblem } from "../model/peer-pane.js";
|
|
7
|
+
import { METRICS } from "../rooms/mesh-metrics.js";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
type: "mesh-inspect",
|
|
11
|
+
validate(pane, where) {
|
|
12
|
+
const problem = meshInspectProblem(pane.meshInspect);
|
|
13
|
+
if (problem) throw new Error(`Mesh-inspect pane "${pane.name || pane.id}"${where}: ${problem}.`);
|
|
14
|
+
},
|
|
15
|
+
describe: (pane) => describeMeshInspect(pane.meshInspect),
|
|
16
|
+
reruns: ["meshInspect"],
|
|
17
|
+
title: "mesh-inspect",
|
|
18
|
+
description: "Connectivity of your room: members, direct channels, quiet members, alert rules and a trace",
|
|
19
|
+
icon: "⟁",
|
|
20
|
+
art: `${FRAME}<path class="a" d="M10 26l6-6 5 4 7-9 6 5"/><path d="M10 28h28" opacity=".5"/>`,
|
|
21
|
+
namePrefix: "mesh",
|
|
22
|
+
defaults: () => ({ meshInspect: defaultMeshInspect(), width: 480 }),
|
|
23
|
+
minimap: ["#e4dcec", "#3d2d58"],
|
|
24
|
+
exports: "counts and the ids of the alert rules firing (JSON: state, members, channels, silent, alerts)",
|
|
25
|
+
headless: "run", // its runner skips without a page (a room belongs to the mallory page)
|
|
26
|
+
readsEnv: false,
|
|
27
|
+
needsScreen: false,
|
|
28
|
+
frame: false,
|
|
29
|
+
subgraphOutput: true,
|
|
30
|
+
presentation: "body",
|
|
31
|
+
takesSkips: true,
|
|
32
|
+
menu: [],
|
|
33
|
+
mcpServes: false,
|
|
34
|
+
agentStatus: () => ({ meshInspect: "reads connectivity of the person's room; its value is counts only" }),
|
|
35
|
+
agent: {
|
|
36
|
+
summary: `connectivity of the room the person is in: members, direct channels, silent members, a drop rate, alert rules (metrics: ${METRICS.join(", ")}) and a bounded trace of room events with no message bodies. Its value is counts and the ids of the rules firing. It reads and changes nothing in the room`,
|
|
37
|
+
fields: {
|
|
38
|
+
meshInspect: {
|
|
39
|
+
schema: {
|
|
40
|
+
type: "object",
|
|
41
|
+
description: `the settings: { view: ${MESH_VIEWS.map((v) => `"${v}"`).join(" | ")}, rules: a list of { id, label, metric, op, value, forMs, severity } }. Only the keys passed change.`,
|
|
42
|
+
properties: { view: { type: "string", enum: [...MESH_VIEWS] }, rules: { type: "array", items: { type: "object" } } },
|
|
43
|
+
additionalProperties: false,
|
|
44
|
+
},
|
|
45
|
+
refuse: "show the room's connectivity (mesh-inspect)",
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// note: a sticky note in Markdown. It holds no value and takes no part in
|
|
2
|
+
// the dataflow (`dataflow: false`): no ports, never an input, a leaf, a test
|
|
3
|
+
// output or a subgraph's output. Its body renders the Markdown through
|
|
4
|
+
// safe-fragment, with remote images kept to the canvas's network rules
|
|
5
|
+
// (src/ui/note-pane.js, src/notes/).
|
|
6
|
+
import { FRAME } from "./shared.js";
|
|
7
|
+
import { COLORS } from "./colors.js";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
// The LaTeX article (src/export/latex.js): the note's Markdown as prose.
|
|
11
|
+
latex: (pane, tex) => [tex.markdown(pane.text), ""],
|
|
12
|
+
presentation: "body",
|
|
13
|
+
type: "note",
|
|
14
|
+
title: "note",
|
|
15
|
+
description: "A sticky note in Markdown; no value, no wires",
|
|
16
|
+
icon: "✎",
|
|
17
|
+
art: `${FRAME}<rect class="f" x="8" y="14" width="32" height="15" rx="1.5"/><path d="M11 18h20M11 22h24M11 26h14"/><path class="a" d="M33 29l7-7"/>`,
|
|
18
|
+
namePrefix: "note",
|
|
19
|
+
defaults: () => ({ text: "", color: "yellow", width: 260 }),
|
|
20
|
+
minimap: ["#f3e3a0", "#5a5130"],
|
|
21
|
+
exports: "its Markdown",
|
|
22
|
+
headless: "run",
|
|
23
|
+
readsEnv: false,
|
|
24
|
+
needsScreen: false,
|
|
25
|
+
frame: false,
|
|
26
|
+
subgraphOutput: false,
|
|
27
|
+
dataflow: false,
|
|
28
|
+
popOut: true, // run-time trait (src/panes/registry.js)
|
|
29
|
+
menu: ["note.edit", { submenu: "Color", radio: COLORS.map((color) => ({ id: `note.color.${color}`, label: color, checked: (pane) => (pane.color ?? "yellow") === color })) }],
|
|
30
|
+
agentStatus: () => ({ note: "A note: Markdown documentation. It has no value and takes no part in the dataflow." }),
|
|
31
|
+
agent: {
|
|
32
|
+
summary: "a sticky note in Markdown that documents the canvas; it has no value and takes no part in the dataflow (no inputs, never an output)",
|
|
33
|
+
fields: {
|
|
34
|
+
text: "its Markdown (no value: other panes can't read a note).",
|
|
35
|
+
color: { schema: { type: "string", description: `its color: ${COLORS.join(", ")}, or "#rrggbb".` }, refuse: "have a color" },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// peer: the members of the room a person is in, with a type and badges each, pairing of their own devices by a six-digit code, first contact by QR, and sending a file
|
|
2
|
+
// to one member (CLW-P2P-14, CLW-APP-21, CLW-ID-06, CLW-ID-07, CLW-APP-18; docs/guide/collaboration-and-sharing.md "The peer pane"). It is a window onto the page's room (src/ui/peers-ui.js):
|
|
3
|
+
// the body reads the room while it is on screen, every action in it is the person's click, and none of it is saved with the canvas. Its value is only counts
|
|
4
|
+
// (members, how many showed an identity, how many are the person's own devices, how many were revoked), never a name, a key or a fingerprint. Agents have no way to
|
|
5
|
+
// pair, accept, send, revoke or read who is in the room: a peer's claims are data, shown, and never an authority.
|
|
6
|
+
import { FRAME } from "./shared.js";
|
|
7
|
+
import { PEER_VIEWS, defaultPeer, describePeerPane, peerProblem } from "../model/peer-pane.js";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
type: "peer",
|
|
11
|
+
validate(pane, where) {
|
|
12
|
+
const problem = peerProblem(pane.peer);
|
|
13
|
+
if (problem) throw new Error(`Peer pane "${pane.name || pane.id}"${where}: ${problem}.`);
|
|
14
|
+
},
|
|
15
|
+
describe: (pane) => describePeerPane(pane.peer),
|
|
16
|
+
reruns: ["peer"],
|
|
17
|
+
title: "peer",
|
|
18
|
+
description: "The members of your room with their types and badges; pair your own devices by code; send a file to one member",
|
|
19
|
+
icon: "⚆",
|
|
20
|
+
art: `${FRAME}<circle class="a f" cx="16" cy="22" r="4"/><circle cx="32" cy="22" r="4"/><path d="M20 22h8"/>`,
|
|
21
|
+
namePrefix: "peers",
|
|
22
|
+
defaults: () => ({ peer: defaultPeer(), width: 460 }),
|
|
23
|
+
minimap: ["#d9e8e2", "#254a3e"],
|
|
24
|
+
exports: "counts (JSON: state, members, withIdentity, paired, revoked), never who",
|
|
25
|
+
headless: "run", // its runner skips without a page (a room belongs to the mallory page)
|
|
26
|
+
readsEnv: false,
|
|
27
|
+
needsScreen: false,
|
|
28
|
+
frame: false,
|
|
29
|
+
subgraphOutput: false,
|
|
30
|
+
presentation: "body",
|
|
31
|
+
takesSkips: true,
|
|
32
|
+
menu: [],
|
|
33
|
+
mcpServes: false,
|
|
34
|
+
agentStatus: () => ({ peer: "shows the person's room; pairing, files and first contact are the person's clicks" }),
|
|
35
|
+
agent: {
|
|
36
|
+
summary: "a person's window onto the room they are in: its members with a type (owner, member, your own device) and badges (identity shown, revoked, silent, direct or relay), pairing of the person's own devices by a six-digit code, first contact by QR, and sending a file to one member who must accept. Its value is only counts. An agent cannot pair, accept a file, send one, confirm a contact or revoke anything, and a peer's claims are shown as data and never decide a grant",
|
|
37
|
+
fields: {
|
|
38
|
+
peer: {
|
|
39
|
+
schema: { type: "object", description: `the settings: { view: ${PEER_VIEWS.map((v) => `"${v}"`).join(" | ")} }. Only the keys passed change.`, properties: { view: { type: "string", enum: [...PEER_VIEWS] } }, additionalProperties: false },
|
|
40
|
+
refuse: "show the person's room members (peer)",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
};
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
// plot: a function plotter. Curves y = f(x), parametric x(t), y(t) and polar r(theta), drawn on a canvas you can pan, zoom and
|
|
2
|
+
// pinch. The formulas are @johnhenry/math expressions; their free variables bind to the wired inputs of the same NAME, and a
|
|
3
|
+
// variable no wire gives a value to gets a slider in the pane. Sampling runs in the sandbox Worker (src/plot/source.js, bundled
|
|
4
|
+
// with @johnhenry/math-sample; src/runtime/worker/96-plot.js), never on the page; the body (src/ui/plot-pane.js) only draws.
|
|
5
|
+
// Its value is { samples, features, viewport, overlays, points, annotations, meshes } and each is an output (docs/guide/graphics.md, "Plots").
|
|
6
|
+
import { FRAME } from "./shared.js";
|
|
7
|
+
import { summarize3D, complexStatus } from "../model/plot-3d.js";
|
|
8
|
+
import { plotTex } from "../plot/tex.js";
|
|
9
|
+
import { COMPLEX_PARTS, ENGINES, CURVE_KINDS, LIMITS, OP_KINDS, OVERLAY_KINDS, PALETTE, defaultPlot, plotProblem, plotLine, rangeOf, rangeProblem } from "../model/plot-settings.js";
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
type: "plot",
|
|
13
|
+
angleSetting: (unit) => ({ angle: unit }), // a new pane under the person's default angle unit (src/model/angle-default.js)
|
|
14
|
+
// A saved plot must be sound (formulas as text, a window with xMin < xMax, sliders that are numbers): refused with the reason (src/persist.js).
|
|
15
|
+
validate(pane, where) {
|
|
16
|
+
const problem = plotProblem(pane);
|
|
17
|
+
if (problem) throw new Error(`Plot pane "${pane.name || pane.id}"${where}: ${problem}.`);
|
|
18
|
+
},
|
|
19
|
+
// A link to this pane carries the window it shows (src/model/pane-link.js): view parameters only, never a curve, a formula or a slider.
|
|
20
|
+
linkView: {
|
|
21
|
+
read: (pane) => ({ range: rangeOf(pane.range) }),
|
|
22
|
+
accept: (raw) => {
|
|
23
|
+
const r = raw?.range;
|
|
24
|
+
if (!r || rangeProblem(r)) return null;
|
|
25
|
+
return { range: { xMin: r.xMin, xMax: r.xMax, yMin: r.yMin, yMax: r.yMax } };
|
|
26
|
+
},
|
|
27
|
+
patch: (view) => ({ range: view.range }),
|
|
28
|
+
},
|
|
29
|
+
// The line the Markdown format writes for it (src/formats/markdown.js).
|
|
30
|
+
describe: plotLine,
|
|
31
|
+
// The LaTeX article (src/export/latex.js): a display-math line per curve.
|
|
32
|
+
latex: plotTex,
|
|
33
|
+
// Settings whose edit reruns a pane of this type (src/panes/registry.js, reruns).
|
|
34
|
+
reruns: ["curves", "range", "sliders", "overlays", "points", "annotations", "exact", "angle", "slice"],
|
|
35
|
+
title: "plot",
|
|
36
|
+
description: "Graph functions, parametric and polar curves you can pan, zoom and pinch",
|
|
37
|
+
icon: "∽",
|
|
38
|
+
art: `${FRAME}<path d="M9 28h30M12 14v16" opacity=".5"/><path class="a" d="M10 26c4 0 5-10 9-10s5 10 9 10 5-10 9-10 1 4 2 6"/>`,
|
|
39
|
+
namePrefix: "plot",
|
|
40
|
+
defaults: () => ({ ...defaultPlot(), width: 520 }),
|
|
41
|
+
minimap: ["#cbdcee", "#2b4258"],
|
|
42
|
+
exports: "its value (samples: one { id, kind, x, y } per curve, features: roots, extrema and intersections, and the viewport), as JSON; the picture as a PNG at 2x or an SVG, the samples as CSV, a recording as WebM",
|
|
43
|
+
offlineFrames: "timeline",
|
|
44
|
+
headless: "run",
|
|
45
|
+
readsEnv: false,
|
|
46
|
+
needsScreen: false,
|
|
47
|
+
frame: false,
|
|
48
|
+
subgraphOutput: true,
|
|
49
|
+
presentation: "body",
|
|
50
|
+
// The outputs: keys of its value.
|
|
51
|
+
ports: () => [
|
|
52
|
+
{ name: "samples", description: "one { id, kind, x, y } per visible curve: x and y are Float64Arrays, a NaN in y is a gap (the curve is not drawn between its neighbours); a curve that can't be drawn has an `error` and empty arrays. An implicit curve or contour is a polyline of segments (NaN between them; a contour adds z, the level of each vertex, and levels), a gradient is arrows at x, y along u, v (and max, the longest), a finite structure is the points (k, f(k) mod n) with modulus (and skipped); a grid curve cut short has a `limit` saying where and why. A complex curve has empty x and y and a `complex`: { viewport, raster: { width, height, abs, arg (Float32Arrays, row 0 is the smallest imaginary part), progress }, zeros?: [{ re, im, kind: 'zero' | 'pole', order, refined }], unity?: [{ k, re, im }], conformal?: [{ kind: 're' | 'im', value, x, y }], shaderReason? }; a complex surface (complex3) has a mesh with arg and mag per vertex." },
|
|
53
|
+
{ name: "features", description: "[{ item, kind: root | min | max | intersection, x, y }]: where y = f(x) curves cross the x-axis, turn, or cross each other (an intersection's item is the two curve ids, comma separated)" },
|
|
54
|
+
{ name: "viewport", description: "the window being shown: { xMin, xMax, yMin, yMax }" },
|
|
55
|
+
{ name: "meshes", description: "[{ id, kind: 'surface' | 'psurface', positions, normals, indices, valid, vertexCount, columns, rows, bounds, progress, flipped? }]: the triangle meshes of the visible surface (z = f(x, y)) and parametric-surface curves, typed arrays ready for a GPU buffer: positions and normals are Float32Arrays of x, y, z per vertex, indices a Uint32Array of triangles (counter-clockwise seen from the side the normals point to; a parametric surface is turned outward when its normals pointed into the solid, flipped: true), valid a Uint8Array (0 = a hole: NaN position, no triangle uses it), vertex (i, j) is j * columns + i. progress says whether the budget stopped it early. A 3D plot's space curves and vector fields are in samples (curve3, field3)." },
|
|
56
|
+
{ name: "slice", description: "[{ id, axis, at, x, y }]: with a slice plane set (the slice setting, { axis: x, y or z, at }), the cross-section of each visible 3D surface z = f(x, y): axis y is f(x, at) over x, axis x is f(at, y) over y, as Float64Arrays of 257 samples (a gap is NaN); axis z is the level set where the surface is at height at (the contour z = at, found by marching squares over the mesh): x and y are the polylines one after another with NaN between them, at most 20,000 points; [] with no plane. Wire it to a 2D plot or an eval pane." },
|
|
57
|
+
{ name: "points", description: "[{ id, curve, x, y, slope }]: the points on y = f(x) curves (the points setting; drag them in the pane), y and f'(x) at each x; in exact mode also exact: { y, slope } as fractions (or exactError); a point that can't be read has an `error`" },
|
|
58
|
+
{ name: "annotations", description: "[{ id, text, x, y, curve? | point? }]: the annotations setting as plain data, in order: x and y are where each note's anchor is on the plane in this run (a curve anchor reads the sampled curve at x, a point anchor the handle); a note whose anchor is gone has x and y null and an `error`. Text only, never HTML. [] with no notes" },
|
|
59
|
+
{ name: "overlays", description: "one entry per visible overlay: an area { id, kind: 'area', curve, curve2?, from, to, area (signed), absolute, x, top, bottom, exact?: { area, from, to } as fractions in exact mode, or exactError }, an inequality { id, kind: 'inequality', curve, op }, a derivative { id, kind: 'derivative', curve, expr (f' as text), latex, x, y, steps?: [{ rule, input, output, inputLatex, outputLatex }] }, roots / extrema / intersections { id, kind, curve, curve2?, points: [{ x, y, kind }] }; an overlay that can't be drawn has an `error`" },
|
|
60
|
+
],
|
|
61
|
+
// What its 3D view publishes without rerunning the pane (src/model/view-outputs.js): the slice plane's cross-section, live while it is dragged.
|
|
62
|
+
viewOutputs: [
|
|
63
|
+
{ name: "liveSlice", description: "[{ id, axis, at, x, y, live }]: the `slice` output's cross-section kept up to date while the slice plane is dragged in the 3D view (set by the view, so a drag reruns what reads it, not the pane): the meshes the view holds are cut at the plane's position now (at most ten a second, the last position always goes out), x and y are plain arrays (a gap is null; a z plane's level set has at most 1000 segments; a value too big to publish is downsampled and says `downsampled: n`, keeping every n-th point), live is true while the plane moves and false once the run's exact cut replaces it (the same numbers as `slice`, for the plane the setting holds). Not saved and not undoable: only the release writes the setting, as one undo step; an Escape or a cancelled pointer puts the last exact cut back. [] with no plane", initial: [] },
|
|
64
|
+
],
|
|
65
|
+
// The click-to-pin event: each pin or unpin on the plot, once, in order (docs/guide/graphics.md, "Plots").
|
|
66
|
+
events: [{ name: "pick", description: "a point of a curve was pinned (or unpinned) by a click, a tap or Enter while tracing: { id, curve, x, y, pinned }; the pins themselves are not saved" }],
|
|
67
|
+
menu: ["plot.reset", "plot.export-png", "plot.export-svg", "plot.export-csv", "plot.record", "plot.sonify", "plot.trace", "plot.sliders-to-inputs", "plot.add-timeline", "plot.import-desmos"],
|
|
68
|
+
// The free variables and which are wired or on sliders, and the values in use (what the last run bound).
|
|
69
|
+
agentStatus: (pane, canvas) => {
|
|
70
|
+
const plot = canvas.stateValue?.(pane.id)?.result?.plot;
|
|
71
|
+
return plot ? { variables: { free: plot.free, wired: plot.bound, sliders: plot.unbound, values: plot.params }, errors: plot.items.filter((i) => i.error).map((i) => ({ curve: i.id, error: i.error })), ...(summarize3D(plot.items).length ? { view3d: summarize3D(plot.items) } : {}), ...(complexStatus(plot.items).length ? { complex: complexStatus(plot.items) } : {}) } : {};
|
|
72
|
+
},
|
|
73
|
+
agent: {
|
|
74
|
+
summary: `a plot of formulas you can pan, zoom and pinch: y = f(x), parametric x(t), y(t) and polar r(theta), implicit F(x, y) = 0 curves, contours and gradient fields of f(x, y), and scatters of f(k) mod n over Z/nZ, written in @johnhenry/math syntax (implicit multiplication works: 2x, 3sin(x); a multi-letter name is read as letters multiplied unless an input or the polar theta has it; sin, cos, sqrt, ln, exp, abs, pi, e, ^). Every free variable (the a in a*sin(x)) binds to the wired input of the same name; a variable with no such input gets a slider in the pane. Its value is { samples, features, viewport, overlays, points, annotations, meshes } (all seven are outputs): samples hold Float64Arrays (NaN in y is a gap), features the roots, extrema and intersections of the y = f(x) curves. Sampling runs in the sandbox Worker. Set curves, range, sliders, overlays, points (draggable points on curves) and exact`,
|
|
75
|
+
fields: {
|
|
76
|
+
curves: {
|
|
77
|
+
schema: {
|
|
78
|
+
type: "array",
|
|
79
|
+
maxItems: LIMITS.curves,
|
|
80
|
+
description: `the curves, at most ${LIMITS.curves} (the list is replaced whole): { id, kind: ${CURVE_KINDS.join(" | ")} (default y), expr, expr2?, expr3?, min?, max?, min2?, max2?, zMin?, zMax?, levels?, robust?, modulus?, grid?, center?, order?, ivps?, source?, transform?, zeros?, unity?, conformal?, engine?, degrees?, part?, label?, color?, visible? }. y: expr is f(x). param: expr is x(t) and expr2 is y(t), over t from min to max (default 0 to 2*pi). polar: expr is r(theta), theta from min to max (default 0 to 2*pi). implicit: expr is F(x, y) and the curve is where F = 0 (write x^2+y^2=r^2 or just x^2+y^2-r^2; y = x^2 here is the equation y - x^2 = 0); robust: true splits the window with interval arithmetic so a thin or touching curve is not missed (reads + - * / and whole powers only). contour: expr is f(x, y); levels is how many level sets (default 9) or a list of values. gradient: arrows along the gradient of f(x, y). grid is the cells a side (implicit and contour default 160, gradient 18); a grid over the cell budget is cut down, and a curve stopped by the cell budget, the time limit or the evaluation limit says where in its \`limit\` (output samples). 3D kinds (a plot with a visible one is drawn in 3D, orbit with the pointer or the arrow keys): surface: expr is f(x, y) (a leading z = is fine) over x in [min, max] and y in [min2, max2] (default -3 to 3), zMin and zMax turn vertices outside them into holes (a pole), grid is the vertices a side (default 64, at most 256); psurface: a parametric surface, expr, expr2, expr3 are x, y, z of u and v over u in [min, max] and v in [min2, max2] (default 0 to 2*pi), turned outward for display; curve3: a space curve, expr, expr2, expr3 are x, y, z of t over [min, max], grid samples (default 512, at most 4000); field3: a 3D vector field, expr, expr2, expr3 are Fx, Fy, Fz of (x, y, z) over the box [min, max] x [min2, max2] x [zMin, zMax] (default -3 to 3), grid arrows an axis (default 6, at most 16). complex: expr is f(z) (z = x + iy; i, pi and e are numbers; + - * / powers and exp ln sqrt sin cos tan sinh cosh tanh abs), drawn behind the other curves as a domain-colouring picture of the window (hue is arg f, lightness is |f|, black at a zero, white at a pole) from a CPU raster of grid pixels across (8 to 400, default 160) or, when the formula compiles with Symbolic.toGLSL and WebGL2 is there, a shader (engine auto; cpu forces the raster); zeros: true marks the zeros and poles in the window with their orders, unity: n the n-th roots of unity, conformal: n draws the image of an n x n grid over [min, max] x [min2, max2] (default -2 to 2); degrees: true makes the probe read arg f in degrees; other variables (a, b) are real parameters with sliders, so a complex parameter is a + b*i. complex3: expr is f(z) as a 3D surface over [min, max] x [min2, max2] (default -2 to 2), part abs (default), re or im is the height and the colour is arg f (nearReal: true paints the vertices where f is nearly real, |Im f| under a tenth of |f|, white), zMin and zMax (default -10 to 10) turn vertices outside them into holes. Every 3D item has a cell budget and a time limit: the mesh stops at a row boundary and the item's limit says where. finite: expr is f(k) over Z/nZ, drawn as dots at (k, f(k) mod n) for k = 0 .. n-1; modulus is n (2 to 4096, default 7) or a constant expression that may name a variable ("n", then a slider or wire gives it); elements where f has no value are skipped. Calculus kinds: slope: expr is f(x, y) of y' = f(x, y), a field of segments (grid a side, default 22, at most 60) and a solution curve through each of ivps [{ x, y }] (at most 16; a person drags or clicks them), with a typeset closed form where the symbolic solver has one; ode2: expr is f(x, y, v) of y'' = f(x, y, y') (v is y'), ivps [{ x, y, v }], constant-coefficient linear equations get a closed form; phase: expr and expr2 are x' and y' of an autonomous system, arrows, both nullclines, fixed points classified from the Jacobian (saddle, node, spiral, center) and a trajectory through each ivp over t in [-max, max] (default 10); taylor: expr is f(x), center (default 0) and order 0 to 24: the polynomial over f with the error shaded; limit: expr is f(x) and center the point approached, one-sided values and the limit or why there is none; series: expr is a(n) for n from min (default 1) to max (default min + 49): partial sums, an Aitken estimate and a convergence verdict; fourier: expr is f(x) on the period [min, max] (default -pi to pi), order harmonics 1 to 100, the partial sum and the Gibbs overshoot at a jump. min and max are numbers or constant expressions such as "2*pi", and may name a free variable. color is a hex colour like #3b82d6 (default: one of ${PALETTE.length}). source: the name of a wired input that gives this curve its formula (an input pane's math widget { latex, expr }, or a text); expr is the fallback. transform: { of (a curve id), dx?, dy?, sx?, sy?, reflect? ('x-axis' | 'y-axis' | 'origin') }: this curve is another y, param or implicit curve moved, scaled or reflected (expr is then ignored). Formulas are parsed, never run as code, and are limited in length and in work; a formula that does not parse shows its error on that curve. Ids are unique.`,
|
|
81
|
+
items: {
|
|
82
|
+
type: "object",
|
|
83
|
+
properties: {
|
|
84
|
+
id: { type: "string" },
|
|
85
|
+
kind: { type: "string", enum: CURVE_KINDS },
|
|
86
|
+
expr: { type: "string" },
|
|
87
|
+
expr2: { type: "string" },
|
|
88
|
+
expr3: { type: "string" },
|
|
89
|
+
min: { type: ["string", "number"] },
|
|
90
|
+
max: { type: ["string", "number"] },
|
|
91
|
+
min2: { type: ["string", "number"] },
|
|
92
|
+
max2: { type: ["string", "number"] },
|
|
93
|
+
zMin: { type: ["string", "number"] },
|
|
94
|
+
zMax: { type: ["string", "number"] },
|
|
95
|
+
levels: { type: ["integer", "array"], items: { type: "number" } },
|
|
96
|
+
robust: { type: "boolean" },
|
|
97
|
+
modulus: { type: ["string", "number"] },
|
|
98
|
+
grid: { type: "integer" },
|
|
99
|
+
center: { type: ["string", "number"] },
|
|
100
|
+
order: { type: "integer" },
|
|
101
|
+
ivps: { type: "array", maxItems: 16, items: { type: "object", properties: { x: { type: "number" }, y: { type: "number" }, v: { type: "number" } }, required: ["x", "y"], additionalProperties: false } },
|
|
102
|
+
zeros: { type: "boolean" },
|
|
103
|
+
unity: { type: ["integer", "string"] },
|
|
104
|
+
conformal: { type: "integer" },
|
|
105
|
+
engine: { type: "string", enum: ENGINES },
|
|
106
|
+
degrees: { type: "boolean" },
|
|
107
|
+
part: { type: "string", enum: COMPLEX_PARTS },
|
|
108
|
+
nearReal: { type: "boolean" },
|
|
109
|
+
axes: { type: "object" },
|
|
110
|
+
source: { type: "string" },
|
|
111
|
+
transform: { type: "object", properties: { of: { type: "string" }, dx: { type: "number" }, dy: { type: "number" }, sx: { type: "number" }, sy: { type: "number" }, reflect: { type: "string", enum: ["x-axis", "y-axis", "origin"] } }, required: ["of"], additionalProperties: false },
|
|
112
|
+
label: { type: "string" },
|
|
113
|
+
color: { type: "string" },
|
|
114
|
+
visible: { type: "boolean" },
|
|
115
|
+
},
|
|
116
|
+
required: ["id", "expr"],
|
|
117
|
+
additionalProperties: false,
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
refuse: "graph formulas (curves)",
|
|
121
|
+
},
|
|
122
|
+
range: {
|
|
123
|
+
schema: {
|
|
124
|
+
type: "object",
|
|
125
|
+
description: "the window on the plane: { xMin, xMax, yMin, yMax }, finite, with xMin < xMax and yMin < yMax. Panning and zooming in the pane change it.",
|
|
126
|
+
properties: { xMin: { type: "number" }, xMax: { type: "number" }, yMin: { type: "number" }, yMax: { type: "number" } },
|
|
127
|
+
required: ["xMin", "xMax", "yMin", "yMax"],
|
|
128
|
+
additionalProperties: false,
|
|
129
|
+
},
|
|
130
|
+
refuse: "show a window (range)",
|
|
131
|
+
},
|
|
132
|
+
overlays: {
|
|
133
|
+
schema: {
|
|
134
|
+
type: "array",
|
|
135
|
+
maxItems: LIMITS.overlays,
|
|
136
|
+
description: `overlays on the y = f(x) curves, at most ${LIMITS.overlays} (the list is replaced whole): { id, kind: ${OVERLAY_KINDS.join(" | ")}, curve (a curve id), curve2?, from?, to?, op?, steps?, label?, color?, visible? }. area: the region between curve and curve2 (the x-axis when there is no curve2) from \`from\` to \`to\` (numbers or constant expressions like "2*pi"; without them: the first and last meeting of the two curves, or the window), shaded, with its signed \`area\` and \`absolute\` area in the overlays output. inequality: shade y op f(x) for op one of ${OP_KINDS.join(" ")} (a strict one has a dashed edge). derivative: f'(x) of the curve, worked out symbolically and drawn dashed; steps: true adds the rule-by-rule trace (power rule, chain rule, ...) as text and LaTeX in the overlays output and a disclosure under the row. integral: the running area under curve from the left edge of its samples (an antiderivative up to a constant), drawn dashed; difference: the finite difference of its samples (slope between neighbours), drawn dashed. roots, extrema: the zeros and the turning points of curve, marked on it (found for a hidden curve too), listed as points. intersections: where curve and curve2 meet. A curve an overlay sits on may be hidden.`,
|
|
137
|
+
items: {
|
|
138
|
+
type: "object",
|
|
139
|
+
properties: {
|
|
140
|
+
id: { type: "string" },
|
|
141
|
+
kind: { type: "string", enum: OVERLAY_KINDS },
|
|
142
|
+
curve: { type: "string" },
|
|
143
|
+
curve2: { type: "string" },
|
|
144
|
+
from: { type: ["string", "number"] },
|
|
145
|
+
to: { type: ["string", "number"] },
|
|
146
|
+
op: { type: "string", enum: OP_KINDS },
|
|
147
|
+
steps: { type: "boolean" },
|
|
148
|
+
label: { type: "string" },
|
|
149
|
+
color: { type: "string" },
|
|
150
|
+
visible: { type: "boolean" },
|
|
151
|
+
},
|
|
152
|
+
required: ["id", "kind", "curve"],
|
|
153
|
+
additionalProperties: false,
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
refuse: "show overlays (overlays)",
|
|
157
|
+
},
|
|
158
|
+
points: {
|
|
159
|
+
schema: {
|
|
160
|
+
type: "array",
|
|
161
|
+
maxItems: LIMITS.points,
|
|
162
|
+
description: `points on the y = f(x) curves, at most ${LIMITS.points} (the list is replaced whole): { id, curve (a curve id), x }. Each is drawn as a handle people drag along its curve (or nudge with the arrow keys), and the points output reads { id, curve, x, y, slope } for each. A hidden curve works too.`,
|
|
163
|
+
items: { type: "object", properties: { id: { type: "string" }, curve: { type: "string" }, x: { type: "number" } }, required: ["id", "curve", "x"], additionalProperties: false },
|
|
164
|
+
},
|
|
165
|
+
refuse: "put points on the curves (points)",
|
|
166
|
+
},
|
|
167
|
+
annotations: {
|
|
168
|
+
schema: {
|
|
169
|
+
type: "array",
|
|
170
|
+
maxItems: LIMITS.annotations,
|
|
171
|
+
description: `notes drawn on the graph, at most ${LIMITS.annotations} (the list is replaced whole), plain text only: { id, text (up to ${LIMITS.text} characters) } and one anchor: { x, y } a spot on the plane, { curve, x } a y = f(x) curve at x (follows the curve), or { point } the id of a points handle (follows it). Also an output (annotations): each note with its resolved position.`,
|
|
172
|
+
items: { type: "object", properties: { id: { type: "string" }, text: { type: "string" }, x: { type: "number" }, y: { type: "number" }, curve: { type: "string" }, point: { type: "string" } }, required: ["id", "text"], additionalProperties: false },
|
|
173
|
+
},
|
|
174
|
+
refuse: "annotate the graph (annotations)",
|
|
175
|
+
},
|
|
176
|
+
exact: "exact mode (default false): the points, and the area overlays with numeric or fractional bounds, are also worked out as fractions (Rational) with the exact helper's maths: the answers carry exact: { y, slope } or { area, from, to }, or exactError when the formula has no exact value (sin, pi, ...). Numbers are read as written (0.1 is 1/10).",
|
|
177
|
+
slice: {
|
|
178
|
+
schema: { type: ["object", "null"], properties: { axis: { type: "string", enum: ["x", "y", "z"] }, at: { type: "number" } }, description: "a slice plane through the 3D surfaces: { axis: x, y or z, at } (x and y cut vertically; z is a level set, the contour at that height); the cross-section is the slice output, and the plane is drawn in the 3D view. null removes it." },
|
|
179
|
+
refuse: "move the slice plane (slice)",
|
|
180
|
+
},
|
|
181
|
+
angle: "the angle unit of the formulas (default rad). deg reads sin, cos, tan, cot, sec and csc of a number of degrees and gives asin, acos, atan, acot, asec, acsc and atan2 in degrees; Copy LaTeX and the typeset row keep the formula as written.",
|
|
182
|
+
markers: {
|
|
183
|
+
schema: { type: "boolean", description: "draw the roots, extrema and intersections of every visible y = f(x) curve (default true). false leaves only the markers of roots, extrema and intersections overlays; the features output has them all either way." },
|
|
184
|
+
refuse: "show or hide the automatic markers (markers)",
|
|
185
|
+
},
|
|
186
|
+
sliders: {
|
|
187
|
+
schema: {
|
|
188
|
+
type: "object",
|
|
189
|
+
description: "the sliders of the free variables no wire gives a value to: { name: { value, min, max, step } } (value defaults to 1, min -10, max 10, step 0.1). A variable whose name matches a wired input uses that input's number instead.",
|
|
190
|
+
additionalProperties: { type: "object", properties: { value: { type: "number" }, min: { type: "number" }, max: { type: "number" }, step: { type: "number" } }, additionalProperties: false },
|
|
191
|
+
},
|
|
192
|
+
refuse: "set the sliders of the free variables (sliders)",
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
};
|