@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,299 @@
|
|
|
1
|
+
// A pane's settings as agents set them (WebMCP add_pane and update_pane).
|
|
2
|
+
// The settings several types have are defined here; a type's own settings,
|
|
3
|
+
// and its part of a shared setting's description, are in its record
|
|
4
|
+
// (src/panes/<type>.js, `agent.fields`). paneFields() turns the records into
|
|
5
|
+
// one argument schema per setting, its description, the types that have it
|
|
6
|
+
// and the error for a type that doesn't, so a new type or setting is
|
|
7
|
+
// described once.
|
|
8
|
+
|
|
9
|
+
import { VIEWS } from "./shared.js";
|
|
10
|
+
import { MAX_RATE_MS } from "../model/rate.js";
|
|
11
|
+
import { PLOT_KINDS } from "../model/plot-series.js";
|
|
12
|
+
import { MAX_QUEUE_BYTES, MAX_QUEUE_EXPIRE_MS, POLICIES } from "../model/queue-book.js";
|
|
13
|
+
import { SIGNAL_SOURCES } from "../runtime/frame-signals.js";
|
|
14
|
+
|
|
15
|
+
/** A port type as an argument (src/model/types.js): a name, or a JSON Schema object. */
|
|
16
|
+
export const TYPE_ARG = {
|
|
17
|
+
description: 'A type: "any", "string", "number", "boolean", "null", "array", "object", "array<T>" (e.g. "array<number>"), "media", "media:image" (audio, video, file), or a JSON Schema object (checked by its top-level type).',
|
|
18
|
+
type: ["string", "object"],
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const PLOT_KIND_HELP =
|
|
22
|
+
"how the table is drawn (default line: a line through the points, with the points; the first column is x, or each row's label). marks: the points alone. bar: bars from zero, side by side for several series. heatmap: a cell per x and series, colored by its value. range: a bar from a low to a high at each x (the first two series), or with a third, the value between them (value, low, high: error bars). gantt: a bar from a start to an end per row (the first two series). dumbbell: two dots joined by a line per row (the first two series). sparkline: one small line per series, each on its own scale. faces: a Chernoff face per row, each series driving one feature. fit: a scatter with its fit over it: the first series is the data (dots), every later series a line through its own points, and a column called outlier (1 or true) draws that row's dot as an outlier. Range, gantt, dumbbell and fit need two numeric columns. The table stays the same, and its text (get_pane) too.";
|
|
23
|
+
|
|
24
|
+
/** "a", "a and b", "a, b and c". */
|
|
25
|
+
export const listWords = (words) => (words.length < 2 ? words.join("") : `${words.slice(0, -1).join(", ")} and ${words.at(-1)}`);
|
|
26
|
+
/** "a", "a or b", "a, b or c". */
|
|
27
|
+
const orWords = (words) => (words.length < 2 ? words.join("") : `${words.slice(0, -1).join(", ")} or ${words.at(-1)}`);
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The hints a field's `ui` may give the generic "Pane settings…" popover (src/ui/chrome/pane-settings.js), on a SHARED_FIELDS
|
|
31
|
+
* entry (or a function of the type, for a hint that depends on it) or on a record's own `agent.fields.<key>` declaration:
|
|
32
|
+
* inline the pane's body edits it (its code editor, its URL box): the popover leaves it out
|
|
33
|
+
* hidden not for the popover
|
|
34
|
+
* textarea a long text
|
|
35
|
+
* secret | host a masked input: a key's name, an endpoint: never drawn in plain text
|
|
36
|
+
* dialog:<id> its editor is the command <id> (a dialog or popover of its own): the popover links to it
|
|
37
|
+
* With no hint, the popover draws the field its schema describes (a switch, a list of choices, a number, a text); an object or
|
|
38
|
+
* an array has no generic editor, so it appears only with a `dialog:` hint. `group` puts a shared field under a heading.
|
|
39
|
+
*/
|
|
40
|
+
export const UI_HINT = /^(inline|hidden|textarea|secret|host|dialog:[a-z][a-z0-9.-]*)$/;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Settings shared by several types. A record lists the ones it has in
|
|
44
|
+
* `agent.fields`: `true`, or (`fragment`) its own part of the description.
|
|
45
|
+
* `every`: every type has it, without listing it.
|
|
46
|
+
*/
|
|
47
|
+
export const SHARED_FIELDS = {
|
|
48
|
+
name: {
|
|
49
|
+
ui: "inline",
|
|
50
|
+
every: true,
|
|
51
|
+
schema: { type: "string" },
|
|
52
|
+
describe: () => "The pane's name. Other panes see its value under this name when they take it as an input.",
|
|
53
|
+
},
|
|
54
|
+
description: {
|
|
55
|
+
ui: "textarea",
|
|
56
|
+
every: true,
|
|
57
|
+
schema: { type: "string" },
|
|
58
|
+
describe: () => "A short Markdown description of the pane: shown on hover (and under its name with showDescription), searched by the palette.",
|
|
59
|
+
},
|
|
60
|
+
showDescription: {
|
|
61
|
+
every: true,
|
|
62
|
+
schema: { type: "boolean" },
|
|
63
|
+
describe: () => "Show the description under the pane's name (default false).",
|
|
64
|
+
},
|
|
65
|
+
disabled: {
|
|
66
|
+
every: true,
|
|
67
|
+
schema: { type: "boolean" },
|
|
68
|
+
describe: () => 'Deactivate the pane (true): it skips with reason "deactivated" without running, and so do the panes that use it, until it is reactivated (false). A note has nothing to deactivate.',
|
|
69
|
+
},
|
|
70
|
+
code: {
|
|
71
|
+
ui: "inline",
|
|
72
|
+
fragment: true,
|
|
73
|
+
schema: { type: "string" },
|
|
74
|
+
describe: (parts) => parts.map(([type, text]) => `${type}: ${text}`).join(" "),
|
|
75
|
+
refuse: (type) => `A ${type} pane has no code.`,
|
|
76
|
+
},
|
|
77
|
+
text: {
|
|
78
|
+
ui: "inline",
|
|
79
|
+
fragment: true,
|
|
80
|
+
schema: { type: "string" },
|
|
81
|
+
describe: (parts) => parts.map(([type, text]) => `${type} panes: ${text}`).join(" "),
|
|
82
|
+
refuse: (type, types) => `Only ${listWords(types)} panes have text (this is a ${type} pane).`,
|
|
83
|
+
},
|
|
84
|
+
url: {
|
|
85
|
+
ui: (type) => (type === "media" ? "inline" : undefined),
|
|
86
|
+
fragment: true,
|
|
87
|
+
schema: { type: "string" },
|
|
88
|
+
describe: (parts) => parts.map(([type, text]) => `${type} panes: ${text}`).join(" "),
|
|
89
|
+
refuse: (type, types) => `Only ${listWords(types)} panes have a url.`,
|
|
90
|
+
},
|
|
91
|
+
prompt: {
|
|
92
|
+
ui: "textarea",
|
|
93
|
+
fragment: true,
|
|
94
|
+
schema: { type: "string" },
|
|
95
|
+
describe: (parts) => parts.map(([type, text]) => `${type} panes: ${text}`).join(" "),
|
|
96
|
+
refuse: (type, types) => `Only ${listWords(types)} panes have a prompt.`,
|
|
97
|
+
},
|
|
98
|
+
outputs: {
|
|
99
|
+
ui: "dialog:pane.outputs",
|
|
100
|
+
every: true,
|
|
101
|
+
schema: {
|
|
102
|
+
type: "array",
|
|
103
|
+
items: {
|
|
104
|
+
oneOf: [
|
|
105
|
+
{ type: "string", minLength: 1 },
|
|
106
|
+
{ type: "object", properties: { name: { type: "string", minLength: 1 }, type: { ...TYPE_ARG, description: `${TYPE_ARG.description} Or "event": an event output.` }, description: { type: "string" } }, required: ["name"], additionalProperties: false },
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
describe: () =>
|
|
111
|
+
'Named outputs (a port each, on the pane\'s right edge): ["small", "large"], or { name, type?, description? }. The pane\'s value is then an object keyed by output name: { small: n } sends n on "small", and an output whose key is missing (or undefined) this time is skipped, so the panes wired to it skip (reason: not "large" this time). A "*" key goes on every output (outputs.all(value) in code). Wire one with mallory_connect `output`. [] removes them. { name, type: "event" } is an event output: its events are delivered once each, in order, never superseded (any pane sends one with emit.event("name", payload) (eval, DOM, render and audio panes, an html page\'s scripts), and an eval pane also by returning or yielding a value with that key; `event` is only the event a reader received), and a pane that reads one runs once per event, sampling its other inputs. Timer, webhook, watch and html panes have their own: tick, request, change, submit (an html pane\'s fires once its page has a <form>).',
|
|
112
|
+
},
|
|
113
|
+
queueLimit: {
|
|
114
|
+
group: "Event queue",
|
|
115
|
+
every: true,
|
|
116
|
+
schema: { type: "integer", minimum: 1, maximum: 100000 },
|
|
117
|
+
describe: () => "For a pane that reads events (an event output wired in): how many events may wait while it runs (default 1000); past it the oldest is dropped and the pane warns.",
|
|
118
|
+
},
|
|
119
|
+
queueBytes: {
|
|
120
|
+
group: "Event queue",
|
|
121
|
+
every: true,
|
|
122
|
+
schema: { type: ["integer", "null"], minimum: 1, maximum: MAX_QUEUE_BYTES },
|
|
123
|
+
describe: () => "An event reader's byte budget for the events waiting for it (approximate JSON size; none by default). An event bigger than the whole budget is refused; queuePolicy decides what a full queue does.",
|
|
124
|
+
},
|
|
125
|
+
queueExpireMs: {
|
|
126
|
+
group: "Event queue",
|
|
127
|
+
every: true,
|
|
128
|
+
schema: { type: ["integer", "null"], minimum: 1, maximum: MAX_QUEUE_EXPIRE_MS },
|
|
129
|
+
describe: () => "An event reader's expiry for waiting events, in ms (never by default). Events that waited this long expire unread, counted. Checked whenever the queue is looked at, not by a timer.",
|
|
130
|
+
},
|
|
131
|
+
queuePolicy: {
|
|
132
|
+
group: "Event queue",
|
|
133
|
+
every: true,
|
|
134
|
+
schema: { type: ["string", "null"], enum: [...POLICIES, null] },
|
|
135
|
+
describe: () => "An event reader's policy for a full queue (queueLimit events or queueBytes). drop-oldest (default) drops the oldest waiting events, drop-newest drops the new one, reject refuses it and a sender that asked to be told (emit.event(name, payload, { ack: true }), mallory_send_event) hears why. Every loss is counted; none is reliable delivery.",
|
|
136
|
+
},
|
|
137
|
+
view: {
|
|
138
|
+
schema: { type: "string", enum: VIEWS },
|
|
139
|
+
describe: () => `How the value is shown: ${orWords(VIEWS)}.`,
|
|
140
|
+
refuse: (type) => `A ${type} pane has no view setting.`,
|
|
141
|
+
},
|
|
142
|
+
profile: {
|
|
143
|
+
ui: "dialog:pane.profile-settings",
|
|
144
|
+
schema: {
|
|
145
|
+
type: ["object", "null"],
|
|
146
|
+
properties: {
|
|
147
|
+
sample: { type: "integer", minimum: 1, maximum: 100000, description: "rows read, spread evenly over the table (default 10000)" },
|
|
148
|
+
types: { type: "object", description: 'what a column is meant to hold, { column: type } with type string, number, integer, boolean, date, datetime or json, or { type, from?, timeZone?, decimal?, group? } (the specs table.convert takes: { type: "datetime", from: "epoch-ms" })' },
|
|
149
|
+
units: { type: "object", description: 'the unit of a number column, { price: "USD" } (a profile never converts)' },
|
|
150
|
+
numberFormat: { type: "object", properties: { decimal: { type: "string" }, group: { type: "string" } }, additionalProperties: false, description: 'how number text is written (the locale): { decimal: ",", group: "." } reads 1.200,50' },
|
|
151
|
+
timeZone: { type: "string", description: 'the IANA zone date-times written without an offset were written in ("America/Los_Angeles"; default UTC)' },
|
|
152
|
+
},
|
|
153
|
+
additionalProperties: false,
|
|
154
|
+
},
|
|
155
|
+
describe: (parts) => `${listWords(parts.map(([type]) => type))} panes: what the "profile" view reads (set view to "profile"): sample size, declared column types, units, the number locale and the time zone; the statistics say what they were read with. null or {} goes back to the defaults.`,
|
|
156
|
+
refuse: (type, types) => `Only ${listWords(types)} panes have profile settings.`,
|
|
157
|
+
},
|
|
158
|
+
plot: {
|
|
159
|
+
ui: "dialog:pane.plot-settings",
|
|
160
|
+
schema: {
|
|
161
|
+
type: ["object", "null"],
|
|
162
|
+
properties: {
|
|
163
|
+
kind: { type: ["string", "null"], enum: [...PLOT_KINDS, null], description: PLOT_KIND_HELP },
|
|
164
|
+
series: { type: "array", items: { type: "string" }, maxItems: 40, description: "the columns to draw as series, in order (default: every column that holds a number, up to 8)" },
|
|
165
|
+
secondary: { type: "array", items: { type: "string" }, maxItems: 40, description: "series (named in series, or by default) drawn on a second y axis on the right, with its own ticks; the table keeps their true values" },
|
|
166
|
+
marks: { type: "boolean", description: "false draws the line alone, without a dot at each point (a spectrum or a dense recording); the default draws both. Only a line (a number x column in order) can go without dots" },
|
|
167
|
+
},
|
|
168
|
+
additionalProperties: false,
|
|
169
|
+
},
|
|
170
|
+
describe: (parts) => `${listWords(parts.map(([type]) => type))} panes: what the "plot" view draws (set view to "plot"; the first column is x): its kind (the same table as a line, bars, a heatmap, …), which numeric columns are series, which of them go on a secondary y axis, and whether a line has a dot at each point (marks). The whole setting is replaced by what is passed (pass kind, series, secondary and marks to keep them); null or {} goes back to a line of every numeric column on one axis.`,
|
|
171
|
+
refuse: (type, types) => `Only ${listWords(types)} panes have plot settings.`,
|
|
172
|
+
},
|
|
173
|
+
cutoff: {
|
|
174
|
+
fragment: true,
|
|
175
|
+
schema: { type: "boolean" },
|
|
176
|
+
describe: (parts) =>
|
|
177
|
+
`Only pass changes (an equality cut-off): when a run's value equals the last run's (by content for JSON-like values, by identity for anything else), the panes that read it don't rerun. ▶▶ run all still runs everything. ${parts.map(([type, text]) => `${type}: ${text}`).join(" ")}`,
|
|
178
|
+
refuse: (type, types) => `Only ${listWords(types)} panes have cutoff.`,
|
|
179
|
+
},
|
|
180
|
+
rate: {
|
|
181
|
+
schema: {
|
|
182
|
+
type: ["object", "null"],
|
|
183
|
+
properties: { debounceMs: { type: "integer", minimum: 0, maximum: MAX_RATE_MS }, throttleMs: { type: "integer", minimum: 0, maximum: MAX_RATE_MS } },
|
|
184
|
+
additionalProperties: false,
|
|
185
|
+
},
|
|
186
|
+
describe: (parts) =>
|
|
187
|
+
`${listWords(parts.map(([type]) => type))} panes: debounce or throttle the pane's runs caused by an input or an edit (▶, run all and partial runs always run at once): { debounceMs } waits that long after the last change, then runs once; { throttleMs } runs at most once per that long (the last change runs at the end of the window). Up to ${MAX_RATE_MS} ms; null or {} runs on every change.`,
|
|
188
|
+
refuse: (type, types) => `Only ${listWords(types)} panes have a rate.`,
|
|
189
|
+
},
|
|
190
|
+
onError: {
|
|
191
|
+
ui: "dialog:pane.error-handling",
|
|
192
|
+
schema: {
|
|
193
|
+
type: "object",
|
|
194
|
+
properties: {
|
|
195
|
+
retry: {
|
|
196
|
+
type: "object",
|
|
197
|
+
description: "Try again when a run fails: tries (1-10 in all, default 3), delayMs between them (0-60000, default 1000), backoff \"fixed\" or \"exponential\" (the delay doubles each time), jitter \"equal\" (each wait keeps its second half) or \"full\" (anywhere from nothing to the whole wait; seeded by the pane, so it is the same every time), on \"any\" failure (default) or only \"network\" ones (no response, 408, 429 or 5xx from the pane's fetch; a 429/503 Retry-After is honoured). Refusals by the network rules and missing API keys are never retried. All waits together stop at 5 minutes; a newer run cancels pending retries. For-each panes retry each item.",
|
|
198
|
+
properties: { tries: { type: "integer", minimum: 1, maximum: 10 }, delayMs: { type: "integer", minimum: 0, maximum: 60000 }, backoff: { type: "string", enum: ["fixed", "exponential"] }, jitter: { type: "string", enum: ["none", "equal", "full"] }, on: { type: "string", enum: ["any", "network"] } },
|
|
199
|
+
additionalProperties: false,
|
|
200
|
+
},
|
|
201
|
+
then: { type: "string", enum: ["error", "skip", "fallback", "output"], description: 'After the last failure: "error" (default: the pane errors and the panes that use it wait), "skip" (the pane skips with reason "failed: <message>", so takes-skips panes with firstOf can use another branch), "fallback" (the pane\'s value is `fallback`, marked "fallback") or "output" (the pane gets an "error" output: on a failure its value and other outputs skip and the error event, { message, name, paneName, inputs, at, attempt }, goes out on "error"; wire it with mallory_connect output "error").' },
|
|
202
|
+
fallback: { description: 'The value (any JSON) used with then: "fallback".' },
|
|
203
|
+
timeoutMs: { type: "integer", minimum: 1000, maximum: 600000, description: "This pane's own timeout instead of the global one. A timeout still restarts the sandbox, so every pane reruns." },
|
|
204
|
+
},
|
|
205
|
+
additionalProperties: false,
|
|
206
|
+
},
|
|
207
|
+
describe: (parts) => `${listWords(parts.map(([type]) => type))} panes: the error policy, what happens when a run fails. Pass {} to go back to the default (one try, the error stays an error).`,
|
|
208
|
+
refuse: (type, types) => `Only ${listWords(types)} panes have an error policy.`,
|
|
209
|
+
},
|
|
210
|
+
each: {
|
|
211
|
+
fragment: true,
|
|
212
|
+
schema: {
|
|
213
|
+
type: "object",
|
|
214
|
+
properties: {
|
|
215
|
+
on: { type: "boolean" },
|
|
216
|
+
input: { type: "string" },
|
|
217
|
+
parallel: { type: "boolean" },
|
|
218
|
+
max: { type: "integer", minimum: 0 },
|
|
219
|
+
batch: { type: "object", properties: { size: { type: "integer", minimum: 0 }, delayMs: { type: "integer", minimum: 0 } }, additionalProperties: false },
|
|
220
|
+
ratePerMinute: { type: "number", minimum: 0 },
|
|
221
|
+
key: { type: "string" },
|
|
222
|
+
recover: { type: "boolean" },
|
|
223
|
+
match: { type: "string", enum: ["cycle", "shortest", "last", "cross", "key"] },
|
|
224
|
+
inputs: { type: "array", items: { type: "string" } },
|
|
225
|
+
matchKey: { type: "string" },
|
|
226
|
+
unmatched: { type: "string", enum: ["fill", "drop", "error"] },
|
|
227
|
+
crossMax: { type: "integer", minimum: 1, maximum: 100000 },
|
|
228
|
+
shape: { type: "string", enum: ["flat", "nested"] },
|
|
229
|
+
templateBy: { type: "string" },
|
|
230
|
+
templates: { type: "object", additionalProperties: { type: ["string", "null"] } },
|
|
231
|
+
removal: { oneOf: [{ type: "string", enum: ["drop"] }, { type: "object", properties: { keepMinutes: { type: "number", exclusiveMinimum: 0 } }, required: ["keepMinutes"], additionalProperties: false }] },
|
|
232
|
+
graceMs: { type: "integer", minimum: 0 },
|
|
233
|
+
collect: { type: "string", enum: ["array", "keyed"] },
|
|
234
|
+
expose: { type: "array", items: { type: "object", properties: { name: { type: "string" }, pane: { type: "string" }, output: { type: "string" }, description: { type: "string" } }, required: ["name", "pane"], additionalProperties: false } },
|
|
235
|
+
},
|
|
236
|
+
additionalProperties: false,
|
|
237
|
+
},
|
|
238
|
+
describe: (parts) => `for-each mode. ${parts.map(([type, text]) => `${type} panes: ${text}`).join(" ")}`,
|
|
239
|
+
refuse: (type, types) => `Only ${listWords(types)} panes have for-each.`,
|
|
240
|
+
},
|
|
241
|
+
signals: {
|
|
242
|
+
schema: { type: ["array", "null"], items: { type: "string", enum: SIGNAL_SOURCES } },
|
|
243
|
+
describe: (parts) =>
|
|
244
|
+
`${listWords(parts.map(([type]) => type))} panes: which live browser signals the frame publishes as CSS custom properties, bundled with no network prompt: any of ${SIGNAL_SOURCES.join(", ")}. The page's CSS reads them with var() and calc() and no script (\`--sig-pointer-x\`, \`--sig-pointer-x-progress\`, \`--sig-key-KeyW\`, \`--sig-scroll-y-progress\`, \`--sig-viewport-width\`, \`--sig-date-second\`, \`--sig-audio-level\`, …; docs/guide/frames-and-code.md, "CSS signals"). Replaces the list; null or [] publishes none. audio needs an audio pane (signalsAudio); gamepad reads only a pad the person has touched.`,
|
|
245
|
+
refuse: (type, types) => `Only ${listWords(types)} panes have signals.`,
|
|
246
|
+
},
|
|
247
|
+
signalsAudio: {
|
|
248
|
+
schema: { type: ["string", "null"] },
|
|
249
|
+
describe: (parts) => `${listWords(parts.map(([type]) => type))} panes: the audio pane (name or id) whose output the \`audio\` signal reads (--sig-audio-level, -bass, -mid, -treble and -bin-0 to -bin-15). Left out: the canvas's first audio pane. null goes back to that. The audio pane is asked for its spectrum only while a pane reads it; no microphone is opened.`,
|
|
250
|
+
refuse: (type, types) => `Only ${listWords(types)} panes have signalsAudio.`,
|
|
251
|
+
},
|
|
252
|
+
exact: {
|
|
253
|
+
fragment: true,
|
|
254
|
+
schema: { type: "boolean" },
|
|
255
|
+
describe: (parts) => parts.map(([type, text]) => `${type} panes: ${text}`).join(" "),
|
|
256
|
+
refuse: (type, types) => `Only ${listWords(types)} panes have an exact mode (exact).`,
|
|
257
|
+
},
|
|
258
|
+
angle: {
|
|
259
|
+
fragment: true,
|
|
260
|
+
schema: { type: "string", enum: ["rad", "deg"] },
|
|
261
|
+
describe: (parts) => parts.map(([type, text]) => `${type} panes: ${text}`).join(" "),
|
|
262
|
+
refuse: (type, types) => `Only ${listWords(types)} panes have an angle unit (angle).`,
|
|
263
|
+
},
|
|
264
|
+
autorun: {
|
|
265
|
+
schema: { type: "boolean" },
|
|
266
|
+
describe: (parts) => `${listWords(parts.map(([type]) => type))} panes: rerun on every change (default true). false makes a click-to-run pane.`,
|
|
267
|
+
refuse: (type, types) => `Only ${listWords(types)} panes have autorun.`,
|
|
268
|
+
},
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Every setting the records declare, in order (name first, then as the
|
|
273
|
+
* records list them): { key, types, schema (with its description), refuse(type) }.
|
|
274
|
+
* A type's own setting is `{ schema, refuse? }` in its record: described as
|
|
275
|
+
* "<type> panes: <schema.description>", refused with "Only <types> panes
|
|
276
|
+
* <refuse>." (default "have <key>").
|
|
277
|
+
*/
|
|
278
|
+
export function paneFields(records) {
|
|
279
|
+
const fields = new Map();
|
|
280
|
+
const field = (key) => fields.get(key) ?? fields.set(key, { key, types: [], parts: [] }).get(key);
|
|
281
|
+
for (const [key, shared] of Object.entries(SHARED_FIELDS)) if (shared.every) field(key); // name first, then description, …, outputs
|
|
282
|
+
for (const record of records) {
|
|
283
|
+
for (const [key, decl] of Object.entries(record.agent?.fields ?? {})) {
|
|
284
|
+
const f = field(key);
|
|
285
|
+
f.types.push(record.type);
|
|
286
|
+
f.parts.push([record.type, decl]);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return [...fields.values()].map(({ key, types, parts }) => {
|
|
290
|
+
const shared = SHARED_FIELDS[key];
|
|
291
|
+
if (shared) {
|
|
292
|
+
const all = shared.every ? records.map((r) => r.type) : types;
|
|
293
|
+
return { key, types: all, schema: { ...shared.schema, description: shared.describe(parts) }, refuse: (type) => shared.refuse?.(type, all) ?? `A ${type} pane has no ${key}.` };
|
|
294
|
+
}
|
|
295
|
+
const [[type, own]] = parts;
|
|
296
|
+
const { description, ...schema } = own.schema;
|
|
297
|
+
return { key, types, schema: { ...schema, description: `${type} panes: ${description}` }, refuse: () => `Only ${listWords(types)} panes ${own.refuse ?? `have ${key}`}.` };
|
|
298
|
+
});
|
|
299
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// files: a person's window onto the browser's file system (CLW-APP-03, CLW-APP-18, CLW-LTM-03; docs/guide/settings-and-storage.md "Files pane", docs/design/vfs.md "Files pane").
|
|
2
|
+
// It browses and edits ONE folder: this canvas's own (/canvases/<id>/) or one mounted folder, through the page broker (src/vfs-access.js), so it reads or writes only what the
|
|
3
|
+
// person's own grant for this canvas allows. It grants nothing itself: the first call that has no grant raises the permission bar's card like pane code's `vfs.own()`. Its value
|
|
4
|
+
// is only which folder it browses ("own" or the mount's name), never file names, paths, contents or handles. Agents do not see, list or change files through it.
|
|
5
|
+
import { FRAME } from "./shared.js";
|
|
6
|
+
import { defaultFiles, describeFiles, filesProblem } from "../model/files-pane.js";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
type: "files",
|
|
10
|
+
validate(pane, where) {
|
|
11
|
+
const problem = filesProblem(pane.files);
|
|
12
|
+
if (problem) throw new Error(`Files pane "${pane.name || pane.id}"${where}: ${problem}.`);
|
|
13
|
+
},
|
|
14
|
+
describe: (pane) => describeFiles(pane.files),
|
|
15
|
+
reruns: ["files"],
|
|
16
|
+
// Which folder a pane browses is the person's: a mount a share link, a paste or an agent names is reset to this canvas's own folder (src/model/person-only.js).
|
|
17
|
+
personOnly: ["files.scope", "files.history"],
|
|
18
|
+
title: "files",
|
|
19
|
+
description: "Browse and edit this canvas's folder of the browser's file system, once you allow it",
|
|
20
|
+
icon: "🗂",
|
|
21
|
+
art: `${FRAME}<path d="M9 14h11l3 4h16v18H9z" opacity=".6"/><path class="a" d="M9 22h30v14H9z"/>`,
|
|
22
|
+
namePrefix: "files",
|
|
23
|
+
defaults: () => ({ files: defaultFiles(), width: 520 }),
|
|
24
|
+
minimap: ["#e8e4d6", "#4a4331"],
|
|
25
|
+
exports: "which folder it browses (JSON: scope)",
|
|
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
|
+
machineTool: true, // a machine tool state can call it: list, read, write, mkdir, remove in this canvas's own folder (src/machine/files-tool.js)
|
|
36
|
+
// What an agent learns about it: which folder it asks for, never a file name, its contents, or whether the person has allowed it.
|
|
37
|
+
agentStatus: (pane) => {
|
|
38
|
+
const problem = filesProblem(pane.files);
|
|
39
|
+
return problem ? { problem } : { folder: pane.files?.scope ?? "own" }; // never whether it records edits or what the history holds
|
|
40
|
+
},
|
|
41
|
+
agent: {
|
|
42
|
+
summary: "a person's file browser over this canvas's own folder of the browser's file system (or one mounted folder the person chose): list, preview, rename, move, delete with undo, new file and folder, upload and download. It reads and writes only through the permission the person gives in the bar, and its value is only which folder it browses, never a file's name or contents. An agent cannot allow it, list it or read through it; a machine's tool state can read and write this canvas's own folder through it, and every write asks the person first.",
|
|
43
|
+
fields: {},
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// gate: holds each item until a business-clock window is open, then releases it,
|
|
2
|
+
// spreading a crowd that waited for the opening over a bounded, seeded jitter
|
|
3
|
+
// . It is a wait (src/panes/wait.js, src/model/wait-clock.js) with no event
|
|
4
|
+
// paths: an item's deadline is the instant its window releases it, and it ends
|
|
5
|
+
// once on "released", "expired" (its maxWaitMs ran out first) or "cancelled". The window arithmetic (zone, weekdays,
|
|
6
|
+
// daylight saving, holidays, jitter) is src/model/windows.js; its body and commands are
|
|
7
|
+
// src/ui/gate-pane.js.
|
|
8
|
+
import { FRAME } from "./shared.js";
|
|
9
|
+
import { HOLIDAY_PRESETS, MAX_HOLIDAYS } from "../model/calendar.js";
|
|
10
|
+
import { MAX_GATE_WAIT_MS, gateAsWait, gateProblem, describeGate, describeWindow, gatePrint, DAY_NAMES, GATE_EVENTS, MAX_JITTER_MS, MAX_SEED } from "../model/windows.js";
|
|
11
|
+
|
|
12
|
+
const TEXT = {
|
|
13
|
+
scheduled: "an item is being held: the event says when it will be released (releaseAt); nothing is sent for one that passes at once",
|
|
14
|
+
released: "the window let the item through (reason: the window was open, or it opened and the item's turn in the spread came)",
|
|
15
|
+
cancelled: "the item was cancelled (a cancel event, a person, or a newer start with the same key)",
|
|
16
|
+
expired: "the item waited longer than the gate's maxWaitMs without its window releasing it (it is never released outside its window)",
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
type: "gate",
|
|
21
|
+
// The line the Markdown format writes for it (src/formats/markdown.js).
|
|
22
|
+
describe: (pane) => `Time window: ${describeGate(pane.gate)}.`,
|
|
23
|
+
title: "gate",
|
|
24
|
+
description: "Holds each item until a business-hours window is open in a time zone, then releases it, spread by seeded jitter",
|
|
25
|
+
icon: "◴",
|
|
26
|
+
art: `${FRAME}<circle cx="24" cy="21" r="7.5"/><path d="M24 16.5V21l3 2"/><path d="M13 29.5h22"/><circle class="a f" cx="24" cy="29.5" r="1.4"/>`,
|
|
27
|
+
namePrefix: "gate",
|
|
28
|
+
defaults: () => ({ gate: { zone: "UTC", days: [1, 2, 3, 4, 5], start: "09:00", end: "17:00", jitterMs: 0 }, runsWithoutEvent: true, width: 340 }),
|
|
29
|
+
minimap: ["#e8dfc9", "#5a4a2a"],
|
|
30
|
+
exports: "its value (how many items are held, which and when each is released, and how the others ended, as JSON)",
|
|
31
|
+
headless: "run",
|
|
32
|
+
readsEnv: false,
|
|
33
|
+
needsScreen: false,
|
|
34
|
+
frame: false,
|
|
35
|
+
subgraphOutput: false,
|
|
36
|
+
waiting: { field: "gate", settings: gateAsWait, problem: gateProblem, describe: describeGate, print: gatePrint, replan: true, extra: (raw, now) => ({ window: describeWindow(raw, now) }) }, // the pane type's part of src/model/wait-clock.js
|
|
37
|
+
events: () => GATE_EVENTS.map((name) => ({ name, description: TEXT[name] })),
|
|
38
|
+
menu: ["gate.cancel"],
|
|
39
|
+
agent: {
|
|
40
|
+
summary:
|
|
41
|
+
'holds each item (an event on its "start" input) until a business-hours window is open in an explicit IANA time zone, then releases it on the "released" output with the item inside the event; an item that arrives in an open window is released at once (or, with jitterOpen "spread", spread over jitterMs from its arrival). While a window is closed the item waits in the page: nothing downstream of "released" runs for it, and the "scheduled" output says when it will go (releaseAt). Jitter spreads items that waited for an opening over the first part of the window, from a seed (never random) and never outside the window. Wire an event output into "start" (the payload carries the item\'s key), optionally a "cancel" input, and "released" on to the panes that do the work. Its value is { waiting, instances (each with deadlineAt: when it will be released), started, ended, last }; mallory_get_pane shows where the window stands now',
|
|
42
|
+
fields: {
|
|
43
|
+
gate: {
|
|
44
|
+
schema: {
|
|
45
|
+
type: "object",
|
|
46
|
+
description: `the window: zone (an IANA name like "America/New_York", required: the window is in that zone's wall clock, not this computer's), days (the weekdays it OPENS on, 0 (Sunday) to 6, or names like "${DAY_NAMES.slice(1, 3).join('", "')}"), start and end (24-hour "HH:MM", or a time of day in words such as "9am", "5:30pm", "noon" or "midnight", read once and stored as HH:MM; an end at or before the start crosses midnight, "24:00" is midnight; they can't be equal); holidays (up to ${MAX_HOLIDAYS} entries on which the window doesn't open, whole days: a preset (${Object.keys(HOLIDAY_PRESETS).join(", ")}), a date such as "2026-12-24" (that year) or a month and day such as "12-31" (every year); a window past midnight belongs to the day it opens; the next listed weekday takes its place); jitterMs (0 to ${MAX_JITTER_MS}: the first part of a window over which items that waited for its opening are spread, cut to the window's length); jitterOpen ("now": an item that arrives in an open window goes at once, the default; "spread": it is also spread, over jitterMs from its arrival and never past the window's end); seed (text up to ${MAX_SEED} characters that makes the spread reproducible; unset, the canvas and pane decide it); atPath (a property path in the start payload holding an ISO time, ms or words such as "tomorrow 9am" or "in 3 hours", read in the gate's zone from when the item started: the window is looked up from then, never before now); by (a property path that gives the item its key; a newer start with the same key replaces the old, or restart: "ignore"); limit; maxWaitMs (0 = none, up to ${MAX_GATE_WAIT_MS}: an item still held that long after it started ends on "expired" instead of waiting for the window; a release at the same instant wins); startInput and cancelInput. Daylight saving: a wall time the clock reads twice is its first instant; one it skips is the instant of the jump; a window inside the skipped hour doesn't open that day. Only the keys passed change; editing it plans waiting items again (the pane shows which moved) and never releases one outside the window.`,
|
|
47
|
+
properties: {
|
|
48
|
+
zone: { type: "string" },
|
|
49
|
+
days: { type: "array", maxItems: 7, items: { type: ["integer", "string"] } },
|
|
50
|
+
start: { type: "string" },
|
|
51
|
+
end: { type: "string" },
|
|
52
|
+
holidays: { type: "array", maxItems: MAX_HOLIDAYS, items: { type: "string" } },
|
|
53
|
+
jitterMs: { type: "integer", minimum: 0, maximum: MAX_JITTER_MS },
|
|
54
|
+
jitterOpen: { type: "string", enum: ["now", "spread"] },
|
|
55
|
+
seed: { type: "string", maxLength: MAX_SEED },
|
|
56
|
+
atPath: { type: "string" },
|
|
57
|
+
by: { type: "string" },
|
|
58
|
+
limit: { type: "integer", minimum: 1, maximum: 10000 },
|
|
59
|
+
maxWaitMs: { type: "integer", minimum: 0, maximum: MAX_GATE_WAIT_MS },
|
|
60
|
+
restart: { type: "string", enum: ["replace", "ignore"] },
|
|
61
|
+
startInput: { type: "string" },
|
|
62
|
+
cancelInput: { type: "string" },
|
|
63
|
+
},
|
|
64
|
+
additionalProperties: false,
|
|
65
|
+
},
|
|
66
|
+
refuse: "hold items for a time window (gate)",
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// geometry: a construction canvas. Points you drag, lines and segments, circles, polygons (with their area, centroid and whether they cross
|
|
2
|
+
// themselves) and angles, and reflections, rotations, translations and scalings of them with parameters you edit or wire. Objects name the
|
|
3
|
+
// objects they are made from, a dependency graph: move a point and everything built on it follows; delete one and everything built on it
|
|
4
|
+
// goes too. The maths is pure and cheap (src/geometry/model.js), and runs in two places: in the sandbox Worker, for the pane's value (the
|
|
5
|
+
// scene and the measurements, with wired numbers as named parameters; src/runtime/worker/98-geometry.js), and on the page, to draw and
|
|
6
|
+
// hit-test while a point is dragged (src/ui/geometry-pane.js). Its value is { scene, <id>_length | _radius | _area | _perimeter | _angle }.
|
|
7
|
+
import { FRAME } from "./shared.js";
|
|
8
|
+
import { LIMITS, defaultSettings, geometryLine, geometryPorts, geometrySettingsProblem } from "../model/geometry-settings.js";
|
|
9
|
+
import { TYPES, ANGLE_MODES, COLORS } from "../geometry/model.js";
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
type: "geometry",
|
|
13
|
+
angleSetting: (unit) => ({ geometry: { ...defaultSettings().geometry, unit } }), // a new pane under the person's default angle unit
|
|
14
|
+
// A saved construction must be sound (known types, ids that exist, no cycle): refused with the reason (src/persist.js).
|
|
15
|
+
validate(pane, where) {
|
|
16
|
+
const problem = geometrySettingsProblem(pane);
|
|
17
|
+
if (problem) throw new Error(`Geometry pane "${pane.name || pane.id}"${where}: ${problem}.`);
|
|
18
|
+
},
|
|
19
|
+
// The line the Markdown format writes for it (src/formats/markdown.js).
|
|
20
|
+
describe: geometryLine,
|
|
21
|
+
// Settings whose edit reruns a pane of this type (src/panes/registry.js, reruns).
|
|
22
|
+
reruns: ["geometry"],
|
|
23
|
+
title: "geometry",
|
|
24
|
+
description: "Points, lines, circles, polygons and angles you drag, with reflect, rotate, translate and scale",
|
|
25
|
+
icon: "△",
|
|
26
|
+
art: `${FRAME}<path d="M11 31 24 13l13 18z" opacity=".5"/><path class="a" d="M11 31h26"/><circle class="a" cx="24" cy="13" r="2.5"/>`,
|
|
27
|
+
namePrefix: "geometry",
|
|
28
|
+
defaults: () => ({ ...defaultSettings(), width: 440 }),
|
|
29
|
+
minimap: ["#e4dccb", "#4a4030"],
|
|
30
|
+
exports: "its value (scene: every object with its coordinates; and a number for each length, radius, area, perimeter and angle), as JSON",
|
|
31
|
+
headless: "run",
|
|
32
|
+
readsEnv: false,
|
|
33
|
+
needsScreen: false,
|
|
34
|
+
frame: false,
|
|
35
|
+
subgraphOutput: true,
|
|
36
|
+
presentation: "body",
|
|
37
|
+
// One output for the scene and one per measurement, in the order of the objects: keys of its value. They follow the construction, so
|
|
38
|
+
// adding a polygon adds its area and perimeter. (src/model/ports.js builtinPorts, like calc's names.)
|
|
39
|
+
ports: geometryPorts,
|
|
40
|
+
menu: ["pane.record-gif"],
|
|
41
|
+
// The parameters in use and the objects that could not be worked out.
|
|
42
|
+
agentStatus: (pane, canvas) => {
|
|
43
|
+
const g = canvas.stateValue?.(pane.id)?.result?.geometry;
|
|
44
|
+
return g ? { parameters: g.params, wired: g.wired, errors: g.errors } : {};
|
|
45
|
+
},
|
|
46
|
+
agent: {
|
|
47
|
+
summary: `a construction canvas of points, lines and segments, circles, polygons and angles you drag, and reflections, rotations, translations and scalings of them. Objects name the objects they are made from (a dependency graph): moving a point recomputes everything built on it, and deleting an object deletes everything built on it. Its value is { scene (every object with plain coordinates; a polygon has area, perimeter, centroid and selfIntersecting) } plus a number per measurement: <id>_length (segments), <id>_radius, <id>_area and <id>_perimeter (polygons), <id>_angle (in the angle's unit); each is an output. A rotation's angle, a translation's dx and dy, a scale's factor and a circle's radius may be a parameter name; a wired input of that name sets it (else geometry.params). Set geometry (the whole construction)`,
|
|
48
|
+
fields: {
|
|
49
|
+
geometry: {
|
|
50
|
+
schema: {
|
|
51
|
+
type: "object",
|
|
52
|
+
description: `the construction, replaced whole: { objects: [...], params?: { name: number }, unit?: deg | rad (the unit of every angle and rotation that doesn't set its own) }. At most ${LIMITS.objects} objects, each { id (letters, digits, _), type: ${TYPES.join(" | ")}, ... } naming the objects it is made from by id, in any order, with no cycle: point { x, y } or anchored { on: a line or circle id, t: 0..1 along a line, degrees round a circle }; line { from, to, segment? } through two points; circle { center, through } or { center, radius }; polygon { points: [ids] } (3 to ${LIMITS.polygonPoints}); angle { points: [a, vertex, c], unit?: deg | rad, mode?: ${ANGLE_MODES.join(" | ")} (shorter under 180, clickOrder counterclockwise from a to c, reflex over 180) }; reflect { of, in: a line }; rotate { of, about: a point, angle, unit?: deg | rad }; translate { of, dx, dy }; scale { of, about, factor }. A number field (radius, angle, dx, dy, factor) is a number or a parameter name; params gives names a value and a wired input of the same name beats it. A line, circle, polygon or transform may have color: ${COLORS.join(" | ")}. An object that can't be worked out shows its error; one that depends on it says so.`,
|
|
53
|
+
properties: {
|
|
54
|
+
objects: { type: "array", maxItems: LIMITS.objects, items: { type: "object", properties: { id: { type: "string" }, type: { type: "string", enum: TYPES } }, required: ["id", "type"] } },
|
|
55
|
+
params: { type: "object", additionalProperties: { type: "number" } },
|
|
56
|
+
unit: { type: "string", enum: ["deg", "rad"] },
|
|
57
|
+
},
|
|
58
|
+
required: ["objects"],
|
|
59
|
+
},
|
|
60
|
+
refuse: "the geometry construction (geometry)",
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// goals: a list of goals, each with a status and artifacts (links to a pane's output or a file in the canvas's VFS) (CLW-AGT-08, CLW-APP-05;
|
|
2
|
+
// docs/guide/agents-and-machines.md "Goals panes"). The goals are the person's: only the person adds, edits and finishes one (`goals.items` is a person-only
|
|
3
|
+
// setting). An agent may PROPOSE changes (`goals.proposals`: set a status or note, add an artifact, add a goal), and a proposal waits in the pane until a person
|
|
4
|
+
// accepts or drops it. The model is src/model/goals.js, the run src/model/runners/goals.js, the body src/ui/goals-pane.js.
|
|
5
|
+
import { FRAME } from "./shared.js";
|
|
6
|
+
import { GOAL_LIMITS, GOAL_STATUSES, ARTIFACT_KINDS, describeGoals, goalsProblem } from "../model/goals.js";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
type: "goals",
|
|
10
|
+
validate(pane, where) {
|
|
11
|
+
const problem = goalsProblem(pane.goals);
|
|
12
|
+
if (problem) throw new Error(`Goals pane "${pane.name || pane.id}"${where}: ${problem}.`);
|
|
13
|
+
},
|
|
14
|
+
describe: (pane) => `Goals: ${describeGoals(pane.goals)}`,
|
|
15
|
+
reruns: ["goals"],
|
|
16
|
+
// The goals themselves are the person's: an agent proposes (goals.proposals), a person accepts. A pasted, shared or merged pane has them reset (src/model/person-only.js).
|
|
17
|
+
personOnly: ["goals.items"],
|
|
18
|
+
title: "goals",
|
|
19
|
+
description: "Goals with a status and artifacts; agents propose changes, you accept them",
|
|
20
|
+
icon: "⌾",
|
|
21
|
+
art: `${FRAME}<circle cx="24" cy="24" r="11"/><circle cx="24" cy="24" r="5.5" opacity=".6"/><circle class="a f" cx="24" cy="24" r="1.8"/><path class="a" d="M24 7v6M24 35v6M7 24h6M35 24h6"/>`,
|
|
22
|
+
namePrefix: "goals",
|
|
23
|
+
defaults: () => ({ goals: { items: [], proposals: [] }, width: 420 }),
|
|
24
|
+
minimap: ["#efe3c9", "#5a4720"],
|
|
25
|
+
exports: "its value (the goals, each with its artifacts' state, counts by status and how many proposals wait, as JSON)",
|
|
26
|
+
headless: "run",
|
|
27
|
+
readsEnv: false,
|
|
28
|
+
needsScreen: false,
|
|
29
|
+
frame: false,
|
|
30
|
+
subgraphOutput: true,
|
|
31
|
+
presentation: "body",
|
|
32
|
+
menu: [],
|
|
33
|
+
agentStatus: (pane) => {
|
|
34
|
+
const problem = goalsProblem(pane.goals);
|
|
35
|
+
return problem ? { problem } : { goals: (pane.goals?.items ?? []).map((g) => ({ id: g.id, title: g.title, status: g.status })), proposalsWaiting: (pane.goals?.proposals ?? []).length };
|
|
36
|
+
},
|
|
37
|
+
agent: {
|
|
38
|
+
summary: `a list of goals, each with a status (${GOAL_STATUSES.join(", ")}), a note and artifacts: links to a pane's output (kind "pane", its id or name) or a file in the canvas's VFS (kind "file", an absolute path). The goals are the PERSON's: an agent cannot add, edit or finish one. It can PROPOSE a change with \`goals.proposals\` (replacing the pending list): each names a goal id (or "" for a new goal that needs a title) and a \`set\` of title, status, note or addArtifact, with a short reason; a proposal changes nothing until a person accepts it in the pane. Its value is { goals: [{ id, title, status, note, artifacts: [{ kind, ref, label, state }] }], counts, proposals }.`,
|
|
39
|
+
fields: {
|
|
40
|
+
goals: {
|
|
41
|
+
schema: {
|
|
42
|
+
type: "object",
|
|
43
|
+
description: `a PROPOSAL, never a change: { proposals: [{ goal (a goal id, or "" for a new goal), set: { title, status ("${GOAL_STATUSES.join('" | "')}"), note (up to ${GOAL_LIMITS.note}), addArtifact: { kind ("${ARTIFACT_KINDS.join('" | "')}"), ref, label } }, reason (up to ${GOAL_LIMITS.reason}) }] } replaces the list of pending proposals (up to ${GOAL_LIMITS.proposals}). A person accepts or drops each in the pane. Giving \`items\` is refused.`,
|
|
44
|
+
properties: {
|
|
45
|
+
proposals: {
|
|
46
|
+
type: "array",
|
|
47
|
+
maxItems: GOAL_LIMITS.proposals,
|
|
48
|
+
items: {
|
|
49
|
+
type: "object",
|
|
50
|
+
properties: {
|
|
51
|
+
goal: { type: "string" },
|
|
52
|
+
set: {
|
|
53
|
+
type: "object",
|
|
54
|
+
properties: {
|
|
55
|
+
title: { type: "string", maxLength: GOAL_LIMITS.title },
|
|
56
|
+
status: { type: "string", enum: [...GOAL_STATUSES] },
|
|
57
|
+
note: { type: "string", maxLength: GOAL_LIMITS.note },
|
|
58
|
+
addArtifact: { type: "object", properties: { kind: { type: "string", enum: [...ARTIFACT_KINDS] }, ref: { type: "string", maxLength: GOAL_LIMITS.ref }, label: { type: "string", maxLength: GOAL_LIMITS.label } }, required: ["kind", "ref"], additionalProperties: false },
|
|
59
|
+
},
|
|
60
|
+
additionalProperties: false,
|
|
61
|
+
},
|
|
62
|
+
reason: { type: "string", maxLength: GOAL_LIMITS.reason },
|
|
63
|
+
},
|
|
64
|
+
required: ["goal", "set"],
|
|
65
|
+
additionalProperties: false,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
additionalProperties: false,
|
|
70
|
+
},
|
|
71
|
+
refuse: "propose a goal change (goals)",
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// graph: a graph you draw. Vertices you drag (their places are saved), edges you add by clicking two vertices, an edge list that is the
|
|
2
|
+
// graph's text, and the standard algorithms over it: breadth and depth first, Dijkstra and a shortest path, a minimum spanning tree, strongly
|
|
3
|
+
// connected components (colour each vertex by its component), the condensation and the adjacency matrix as a heatmap, each played back a step
|
|
4
|
+
// at a time. The maths is pure and dependency-free (src/graph/model.js) and runs in the sandbox Worker for the pane's value (wired `edges`,
|
|
5
|
+
// `directed`, `start` and `end` beat the settings; src/runtime/worker/99-graph.js) and on the page to draw (src/ui/graph-pane.js).
|
|
6
|
+
import { FRAME } from "./shared.js";
|
|
7
|
+
import { defaultSettings, graphLine, graphPorts, graphSettingsProblem } from "../model/graph-settings.js";
|
|
8
|
+
import { ALGORITHMS, COLORINGS, VIEWS, LIMITS } from "../graph/model.js";
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
type: "graph",
|
|
12
|
+
// A saved graph setting must be well formed (an edge list as text, positions as pairs of numbers): refused with the reason (src/persist.js).
|
|
13
|
+
validate(pane, where) {
|
|
14
|
+
const problem = graphSettingsProblem(pane);
|
|
15
|
+
if (problem) throw new Error(`Graph pane "${pane.name || pane.id}"${where}: ${problem}.`);
|
|
16
|
+
},
|
|
17
|
+
// The line the Markdown format writes for it (src/formats/markdown.js).
|
|
18
|
+
describe: graphLine,
|
|
19
|
+
// Settings whose edit reruns a pane of this type (src/panes/registry.js, reruns).
|
|
20
|
+
reruns: ["graph"],
|
|
21
|
+
title: "graph",
|
|
22
|
+
description: "Draw a graph, run BFS, DFS, Dijkstra, spanning tree and components over it, and play each back a step at a time",
|
|
23
|
+
icon: "⚇",
|
|
24
|
+
art: `${FRAME}<path d="M14 32 24 14l10 18z" opacity=".5"/><circle class="a" cx="14" cy="32" r="3"/><circle class="a" cx="24" cy="14" r="3"/><circle class="a" cx="34" cy="32" r="3"/>`,
|
|
25
|
+
namePrefix: "graph",
|
|
26
|
+
defaults: () => ({ ...defaultSettings(), width: 440 }),
|
|
27
|
+
minimap: ["#d9e4d2", "#34452e"],
|
|
28
|
+
exports: "its value (vertices, edges, order, distances, path, minimum spanning tree, components, condensation, adjacency matrix, playback steps), as JSON",
|
|
29
|
+
headless: "run",
|
|
30
|
+
readsEnv: false,
|
|
31
|
+
needsScreen: false,
|
|
32
|
+
frame: false,
|
|
33
|
+
subgraphOutput: true,
|
|
34
|
+
presentation: "body",
|
|
35
|
+
// The outputs: keys of its value (src/graph/model.js run).
|
|
36
|
+
ports: graphPorts,
|
|
37
|
+
menu: ["pane.record-gif"],
|
|
38
|
+
// Which settings the wires took.
|
|
39
|
+
agentStatus: (pane, canvas) => {
|
|
40
|
+
const g = canvas.stateValue?.(pane.id)?.result?.graph;
|
|
41
|
+
return g ? { wired: g.wired } : {};
|
|
42
|
+
},
|
|
43
|
+
agent: {
|
|
44
|
+
summary: `a graph you draw and run algorithms on. Its edge list is text, one edge per line \`from to\` or \`from to weight\` (a name alone is a vertex; # lines are skipped); the drawing, the dragging and the editor change that text and the saved vertex positions. Its value is { vertices, edges, order (bfs or dfs from start), distances (dijkstra), path (shortest path from start to end), mst (minimum spanning tree), components and componentOf (strong components of a directed graph, connected components of an undirected one), condensation (a directed graph's DAG of components), adjacency (the matrix, null where there is no edge), steps (the algorithm played back a step at a time), hasCycle, error }; each is an output. A wired input called edges, directed, start or end beats the setting of that name. Set graph (the whole setting)`,
|
|
45
|
+
fields: {
|
|
46
|
+
graph: {
|
|
47
|
+
schema: {
|
|
48
|
+
type: "object",
|
|
49
|
+
description: `the graph, replaced whole: { edges (text: one \`from to [weight]\` per line, at most ${LIMITS.vertices} vertices and ${LIMITS.edges} edges), directed (true or false), positions ({ vertex: [x, y] }, around the unit circle by default), algorithm (${ALGORITHMS.join(" | ")}), start, end (vertex names; empty means the first and the last), color (${COLORINGS.join(" | ")}: scc colours each vertex by its strong component), view (${VIEWS.join(" | ")}) }. A bad edge list is the pane's error value, not a refused setting.`,
|
|
50
|
+
properties: {
|
|
51
|
+
edges: { type: "string" },
|
|
52
|
+
directed: { type: "boolean" },
|
|
53
|
+
positions: { type: "object", additionalProperties: { type: "array", items: { type: "number" }, minItems: 2, maxItems: 2 } },
|
|
54
|
+
algorithm: { type: "string", enum: ALGORITHMS },
|
|
55
|
+
start: { type: "string" },
|
|
56
|
+
end: { type: "string" },
|
|
57
|
+
color: { type: "string", enum: COLORINGS },
|
|
58
|
+
view: { type: "string", enum: VIEWS },
|
|
59
|
+
},
|
|
60
|
+
required: ["edges", "directed", "positions", "algorithm", "start", "end", "color", "view"],
|
|
61
|
+
},
|
|
62
|
+
refuse: "the graph (graph)",
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
};
|