@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,54 @@
|
|
|
1
|
+
// html: HTML with ${…} from its inputs, shown as a page in a sandboxed frame;
|
|
2
|
+
// a form in it makes the pane's value the form's object (src/ui/html-pane.js).
|
|
3
|
+
import { FRAME, CUTOFF_ITEM, RATE_MENU } from "./shared.js";
|
|
4
|
+
|
|
5
|
+
/** The "Patch in place" checkbox item: keep the page, change only what the ${…} changed. */
|
|
6
|
+
const PATCH_ITEM = { id: "pane.patch", label: "Patch in place", checked: (pane) => pane.patch === true };
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
// The LaTeX article (src/export/latex.js): its markup in a listing.
|
|
10
|
+
latex: (pane, tex) => tex.titled(pane, typeof pane.text === "string" && pane.text ? [tex.verbatim(pane.text)] : []),
|
|
11
|
+
presentation: "body",
|
|
12
|
+
type: "html",
|
|
13
|
+
// Settings whose edit reruns a pane of this type (src/panes/registry.js, reruns).
|
|
14
|
+
reruns: ["signals", "signalsAudio"],
|
|
15
|
+
title: "html",
|
|
16
|
+
description: "HTML with ${…}; a form in it is an input",
|
|
17
|
+
icon: "⌗",
|
|
18
|
+
art: `${FRAME}<path d="M9 15.5h6"/><rect class="f" x="18" y="13" width="21" height="5" rx="1"/><rect class="a" x="9" y="20.5" width="4" height="4" rx=".8"/><path class="a" d="M9.9 22.6l1.1 1 1.8-2.1"/><path d="M16 22.5h9"/><path class="a" d="M12 26.5l-2.2 2 2.2 2M15 26.5l2.2 2-2.2 2"/><rect class="a f" x="27" y="26.5" width="12" height="4" rx="2"/>`,
|
|
19
|
+
namePrefix: "html",
|
|
20
|
+
defaults: () => ({
|
|
21
|
+
text: '<form>\n <label>name <input name="name" value="Ada"></label>\n <label>age <input name="age" type="number" value="36"></label>\n</form>',
|
|
22
|
+
typed: null, // what was typed into its form (fields that differ from the rendered HTML); kept across renders
|
|
23
|
+
width: 320,
|
|
24
|
+
}),
|
|
25
|
+
minimap: ["#d6e2c6", "#3c4a30"],
|
|
26
|
+
exports: "the form's object, the page as shown, its template's HTML and text",
|
|
27
|
+
headless: { skip: "html panes need a browser" },
|
|
28
|
+
readsEnv: true,
|
|
29
|
+
needsScreen: true,
|
|
30
|
+
frame: true,
|
|
31
|
+
subgraphOutput: false,
|
|
32
|
+
framePage: true, cssSignals: true, cutoff: true, pinnable: true, retypable: true, restorable: true, slots: true, // run-time traits (src/panes/registry.js)
|
|
33
|
+
// Each submit of a <form> in its page (a submit button, Enter in a field) is an event with the form's object.
|
|
34
|
+
// The output is always there, so wires to it survive editing the HTML; without a form it never fires.
|
|
35
|
+
events: [{ name: "submit", description: "each form submit as an event, with the form's object", quiet: (pane) => (/<form[\s>]/i.test(String(pane?.text ?? "")) ? "" : "no <form> in its HTML: it fires once there is one") }],
|
|
36
|
+
toolbar: ["outputs"],
|
|
37
|
+
codeOutputs: { page: true }, // outputs found in its page's scripts: emit.event in <script> and on…="…"
|
|
38
|
+
menu: [CUTOFF_ITEM, PATCH_ITEM, RATE_MENU],
|
|
39
|
+
agent: {
|
|
40
|
+
summary: "HTML with ${…} from its inputs, shown as a page; a form in it makes the pane's value the form's object, so it works as an input",
|
|
41
|
+
fields: {
|
|
42
|
+
cutoff: "on by default (a form edit that leaves the form's object the same doesn't rerun what reads it).",
|
|
43
|
+
text: "HTML with ${…} interpolations (JavaScript expressions over the pane's inputs, escaped unless they are html`…` values), shown as a live page; when it contains form controls the pane's value is the form's object (typed by input type, read as the user edits), otherwise the HTML string.",
|
|
44
|
+
onError: true,
|
|
45
|
+
rate: true,
|
|
46
|
+
signals: true,
|
|
47
|
+
signalsAudio: true,
|
|
48
|
+
patch: {
|
|
49
|
+
schema: { type: "boolean", description: "patch in place (default false): when its inputs change, the page is kept and only the text and attributes whose ${…} changed are updated (focus, scroll, typed values and a <details> left open stay), instead of the page being rendered again. Lists aren't matched by key yet: a list that grows or shrinks changes at its end." },
|
|
50
|
+
refuse: "can patch in place",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// http: HTTP messages as values. One pane with eight modes (its `http.mode`): convert a curl command, a fetch() call,
|
|
2
|
+
// a raw HTTP request or a HAR file into any of those (and so export a HAR or a curl script); compose a request from fields; diff two
|
|
3
|
+
// requests; rewrite a request with rules; tap (#846) the canvas's own requests as they pass the network policy. The engine is src/model/http-tools.js (pure: it reaches no network, and a credential comes out
|
|
4
|
+
// of it as "[redacted]"); the body is src/ui/bodies/http.js. The fifth mode, send, is the only one that reaches the network, in files of its own (src/model/http-send.js, src/model/runners/http-send.js):
|
|
5
|
+
// the request goes through the canvas's network policy like any pane's fetch, and the response is the value.
|
|
6
|
+
import { FRAME } from "./shared.js";
|
|
7
|
+
import { HTTP_MODES, TARGETS, SEND_LIMITS, REWRITE_OPS, MAX_RULES, cleanHttp, defaultHttp, describeHttp, httpProblem } from "../model/http-tools.js";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
type: "http",
|
|
11
|
+
// In tap and proxy mode its value records the canvas's requests with the network policy's verdicts and reasons: agents never read it as a value (a traffic pane the person allowed, with mallory_traffic, is their way in).
|
|
12
|
+
// An OpenAPI spec's operations become panes of this type (send mode; src/model/openapi.js).
|
|
13
|
+
openApiTarget: true,
|
|
14
|
+
captureLogWhen: (pane) => pane?.http?.mode === "tap" || pane?.http?.mode === "proxy",
|
|
15
|
+
// Whether a send runs on every run, whether the tap keeps bodies (and how many bytes of each), and where a proxy route sends (its upstream, targets and
|
|
16
|
+
// credential headers) and whether it keeps bodies are the person's (httpPatch in src/webmcp/tools.js): an agent cannot point a proxy anywhere.
|
|
17
|
+
personOnly: ["http.send.auto", "http.tap.bodies", "http.tap.bodyBytes", "http.proxy.upstream", "http.proxy.targets", "http.proxy.headers", "http.proxy.bodies"],
|
|
18
|
+
// A saved pane's settings must not hold a credential (they are saved in the canvas): refused with the check's message (src/persist.js).
|
|
19
|
+
validate(pane, where) {
|
|
20
|
+
const problem = httpProblem(pane.http);
|
|
21
|
+
if (problem) throw new Error(`HTTP pane "${pane.name || pane.id}"${where}: ${problem}.`);
|
|
22
|
+
},
|
|
23
|
+
// The line the Markdown format writes for it (src/formats/markdown.js).
|
|
24
|
+
describe: (pane) => `HTTP: ${describeHttp(pane.http)}.`,
|
|
25
|
+
// Settings whose edit reruns a pane of this type (src/panes/registry.js, reruns).
|
|
26
|
+
reruns: ["http"],
|
|
27
|
+
// Choosing the proxy or static mode adds the outputs those modes make (`response` for a respond pane, `entries` for a traffic pane), so a wire can name them.
|
|
28
|
+
onPatch(canvas, id, patch, step) {
|
|
29
|
+
if (step !== "shape" || !patch.http || "outputs" in patch) return undefined;
|
|
30
|
+
const want = patch.http.mode === "proxy" ? ["response", "entries", "request", "changes"] : patch.http.mode === "static" ? ["response"] : null;
|
|
31
|
+
if (!want) return undefined;
|
|
32
|
+
const pane = canvas.panes.get(id);
|
|
33
|
+
const have = (pane.outputs ?? []).map((o) => (typeof o === "string" ? o : o.name));
|
|
34
|
+
const missing = want.filter((n) => !have.includes(n));
|
|
35
|
+
if (!missing.length) return undefined;
|
|
36
|
+
pane.outputs = [...(pane.outputs ?? []), ...missing.map((name) => ({ name }))];
|
|
37
|
+
return { ...patch, outputs: pane.outputs };
|
|
38
|
+
},
|
|
39
|
+
title: "http",
|
|
40
|
+
description: "HTTP requests as data: convert curl, fetch(), raw HTTP and HAR into each other, compose a request, diff two, rewrite one with rules; in send mode (off until chosen) send one, under the canvas permissions, and read the response. Credentials are redacted",
|
|
41
|
+
icon: "⇝",
|
|
42
|
+
art: `${FRAME}<path d="M10 17h20m-3-3 3 3-3 3"/><path class="a" d="M38 28H18m3-3-3 3 3 3"/><path d="M12 22h8M28 22h8" opacity=".35"/>`,
|
|
43
|
+
namePrefix: "http",
|
|
44
|
+
defaults: () => ({ http: defaultHttp(), outputs: [{ name: "request" }, { name: "text" }, { name: "changes" }], width: 440 }),
|
|
45
|
+
minimap: ["#d4e0ee", "#2d435e"],
|
|
46
|
+
exports: "its value (the request, its text as curl, fetch(), HAR or raw HTTP, what changed), as JSON; the text as a file",
|
|
47
|
+
headless: "run",
|
|
48
|
+
readsEnv: false,
|
|
49
|
+
needsScreen: false,
|
|
50
|
+
frame: false,
|
|
51
|
+
subgraphOutput: true,
|
|
52
|
+
menu: [],
|
|
53
|
+
agentStatus: (pane) => {
|
|
54
|
+
const problem = httpProblem(pane.http);
|
|
55
|
+
return problem ? { problem } : { summary: describeHttp(pane.http) };
|
|
56
|
+
},
|
|
57
|
+
agent: {
|
|
58
|
+
summary:
|
|
59
|
+
'HTTP requests as data; most of its eight modes (http.mode) send nothing: "convert" (the first input is a curl command, a fetch(…) call, a raw HTTP request, a HAR file or a request object; the value is { kind, request, requests, text, formats: { curl, fetch, har, raw }, redacted }, text in the http.to form: a HAR input with several entries gives every request, and to "har" or "curl" exports them all), "compose" (http.compose has method, url, headers, query and body; inputs named url, method, body, headers or query override them), "diff" (inputs a and b, or the first two: { identical, text, changes: { requestLine, headers: { added, removed, changed }, body } }; a JSON body is compared by path) and "rewrite" (the input request, changed by http.rules in order, plus an optional input named rules: { request, before, text, changes }; an input named response is rewritten by the response rules too, giving { response, responseBefore, responseText, responseChanges }, with or without a request). A diff of two responses (raw HTTP or objects with a status) gives the same shape with kind "response"; a diff also has form: { form, identical, lines, text }, the two requests written in http.to and compared line by line, and a form body is compared by field. The fifth, "send", sends the request (a wired request, with http.rules applied, else the compose fields) through the canvas\'s network policy like any pane\'s fetch: a host the person hasn\'t allowed is refused and they are asked, and an agent can\'t allow it; it sends only when run on purpose (▶, run all) unless the person turned on send.auto; the value is { sent, ok, request, response fields: status, statusText, url, headers, rateLimit, body: { text, json?, bytes, truncated }, timing: { ms } } or error: { kind: "refused" | "secret" | "request" | "timeout" | "network" | "companion", message }; send.via "companion" has the person\'s paired companion\'s http-tap module make it instead, on their machine, with timing: { dns, connect, tls, ttfb, total } (only to hosts the person listed in the companion\'s config, which nothing here can change; never with a secret placeholder); a credential header comes back "[redacted]", and a request that holds a literal credential is not sent (use a secret pane\'s placeholder, which the page fills in only where the request goes). The sixth, "tap", only reads (its value holds the verdicts and reasons of the network rules, so you get it withheld, as for a proxy-mode pane: read the requests through a traffic pane the person allowed, with mallory_traffic): { entries: [{ at, method, url, paneName, allowed, result: "response" | "refused" | "failed", reason?, status?, ms, requestBytes, responseBytes? }], total, allowed, refused, failed, dropped, text } for this canvas\'s own requests as they pass the network policy (bodies kept only if the person turns on http.tap.bodies). The seventh, "proxy", is for a served canvas: the input is a webhook with capture "raw", and the request goes to a FIXED upstream the person set (http.proxy; you cannot set or change it, nor its headers or body-keeping), through the network policy (headless: only --allow-host hosts), and the value is { proxied, ok, request, response (wire output: response to a respond pane), changes, entry, entries, total, error? }: entries is the redacted log of every exchange, for a traffic pane. http.rules are applied to the request before it is sent and to the response before it is answered with. Outside a served canvas it only shows the request it would send (dry: true). The eighth, "static", answers a webhook\'s request from a folder (a files value) wired in: { status, path, response }. A request is { method, url, headers (lowercase names), body? }. A credential (Authorization, Cookie, an API-key or token header, user:pass@ or a ?key= / ?token= in a URL) comes out as "[redacted]" in every value and text, and a literal one in the settings is refused: put it in a secret pane, whose placeholder (mallory-secret:NAME) passes through. Bounded: 1 MiB of text, 200 requests, 50 rules',
|
|
60
|
+
fields: {
|
|
61
|
+
http: {
|
|
62
|
+
schema: {
|
|
63
|
+
type: "object",
|
|
64
|
+
description: `the settings: { mode ("${HTTP_MODES.join('" | "')}"), to ("${TARGETS.join('" | "')}": the form of its text output), compose { method, url, headers: [{ name, value }], query: [{ name, value }], body }, send { timeoutMs (${SEND_LIMITS.timeoutMs.join("-")}), maxBytes (${SEND_LIMITS.maxBytes.join("-")}: how much of the body is kept), via ("page" | "companion") }, tap { limit (1-500: entries shown) }, static { index (the file a directory answers with), spa (an unknown path answers the index), notFound (a file for a 404) }, rules: [{ when?: { method?, host?, pathPrefix?, status? }, op ("${REWRITE_OPS.join('" | "')}"), name?, value? }] }. A rule: set-header/remove-header/set-query/remove-query name the header or parameter; set-path and set-url, set-method and set-body take value; replace-path and replace-body take PLAIN TEXT to find in name (never a regular expression: a leading ^ anchors to the start, a trailing $ to the end; an optional all:false replaces the first only) and the replacement in value; a saved rule that used regex syntax is read as plain text. Response ops (applied to a wired response): set-status (value 100-599), set-status-text, set-response-header/remove-response-header, set-response-body, replace-response-body (plain text in name, as above), set-response-json/remove-response-json (a path like $.user.name in name, JSON in value); when.status (404 or "4xx") matches the response; at most ${MAX_RULES}. A credential header or parameter (Authorization, Cookie, X-Api-Key, ?token=) with a literal value is refused; use a secret placeholder. Only the keys passed change (compose keys merge). Editing it runs the pane again.`,
|
|
65
|
+
properties: {
|
|
66
|
+
mode: { type: "string", enum: HTTP_MODES },
|
|
67
|
+
to: { type: "string", enum: TARGETS },
|
|
68
|
+
compose: { type: "object" },
|
|
69
|
+
rules: { type: "array" },
|
|
70
|
+
send: { type: "object" },
|
|
71
|
+
tap: { type: "object" },
|
|
72
|
+
static: { type: "object" },
|
|
73
|
+
},
|
|
74
|
+
additionalProperties: false,
|
|
75
|
+
},
|
|
76
|
+
refuse: "convert, compose, diff, rewrite, send, tap, proxy or serve static HTTP (http)",
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export { cleanHttp };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// import: an npm package or a module URL, resolved by mport
|
|
2
|
+
// (src/model/imports.js). Its body is importBody (src/ui/bodies/import.js).
|
|
3
|
+
import { FRAME, VIEW_MENU, codeSpan } from "./shared.js";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
type: "import",
|
|
7
|
+
// The line the Markdown format writes for it (src/formats/markdown.js).
|
|
8
|
+
describe: (pane) => (pane.module?.spec ? `Imports ${codeSpan(pane.module.spec)}.` : null),
|
|
9
|
+
// Settings whose edit reruns a pane of this type (src/panes/registry.js, reruns).
|
|
10
|
+
reruns: ["module"],
|
|
11
|
+
title: "import",
|
|
12
|
+
description: "An npm package or a module URL",
|
|
13
|
+
icon: "⇩",
|
|
14
|
+
art: `${FRAME}<path class="f" d="M24 14.5l8 3.8v8.4L24 30.5l-8-3.8v-8.4z"/><path d="M16 18.3l8 3.8 8-3.8M24 22.1v8.4"/><path class="a" d="M38 14v8m-2.5-2.5L38 22l2.5-2.5"/>`,
|
|
15
|
+
namePrefix: "module",
|
|
16
|
+
defaults: () => ({ module: { spec: "", useDefault: false }, view: "auto", width: 300 }),
|
|
17
|
+
minimap: ["#dccfe6", "#463a57"],
|
|
18
|
+
exports: "its value (the module, as a preview)",
|
|
19
|
+
headless: "run",
|
|
20
|
+
readsEnv: false,
|
|
21
|
+
needsScreen: false,
|
|
22
|
+
frame: false,
|
|
23
|
+
subgraphOutput: true,
|
|
24
|
+
readsInputs: false, // run-time traits (src/panes/registry.js)
|
|
25
|
+
toolbar: ["outputs", "view"],
|
|
26
|
+
menu: [VIEW_MENU, "pane.plot-settings", "pane.profile-settings"],
|
|
27
|
+
agent: {
|
|
28
|
+
summary: "an npm package or URL",
|
|
29
|
+
fields: {
|
|
30
|
+
module: { schema: { type: "string", description: 'an npm spec ("lodash-es@4", "d3@7") or a module URL.' }, refuse: "have a module" },
|
|
31
|
+
useDefault: { schema: { type: "boolean", description: "use the module's default export instead of the namespace." }, refuse: "have a module" },
|
|
32
|
+
onError: true,
|
|
33
|
+
view: true,
|
|
34
|
+
profile: true,
|
|
35
|
+
plot: true,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// input: a widget (slider, number, text, checkbox, select, color, date, json,
|
|
2
|
+
// a generated form, an XY pad or an editable curve) whose value other panes take. Its body is
|
|
3
|
+
// inputBody (src/ui/bodies/input.js).
|
|
4
|
+
import { FRAME, CUTOFF_ITEM, codeSpan } from "./shared.js";
|
|
5
|
+
import { TYPE_ARG } from "./fields.js";
|
|
6
|
+
import { widgetType } from "../model/types.js";
|
|
7
|
+
import { cleanControl } from "../model/controls.js";
|
|
8
|
+
import { isPadKind, padProblem, numericSelectProblem } from "../model/widget-values.js";
|
|
9
|
+
import { springSettingProblem } from "../model/spring-player.js";
|
|
10
|
+
import { quantityProblem } from "../model/quantity-widget.js";
|
|
11
|
+
import { mathProblem } from "../model/math-widget.js";
|
|
12
|
+
import { gridProblem } from "../model/grid-widget.js";
|
|
13
|
+
|
|
14
|
+
/** The widget kinds an input pane can be. */
|
|
15
|
+
export const WIDGET_KINDS = ["number", "range", "text", "checkbox", "select", "color", "date", "when", "quantity", "math", "grid", "json", "form", "xy", "curve"];
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
presentation: "body",
|
|
19
|
+
type: "input",
|
|
20
|
+
// A saved widget must be one its kind can read: an XY pad or curve, a select of numbers, a quantity whose dimension and unit exist, a release spring (src/persist.js).
|
|
21
|
+
validate(pane, where) {
|
|
22
|
+
const name = `"${pane.name || pane.id}"${where}`;
|
|
23
|
+
const widget = pane.widget;
|
|
24
|
+
if (isPadKind(widget?.kind) && padProblem(widget)) throw new Error(`Pane ${name}: ${widget.kind} widget: ${padProblem(widget)}.`);
|
|
25
|
+
if (widget?.kind === "select" && widget.numeric && numericSelectProblem(widget)) throw new Error(`Pane ${name}: ${numericSelectProblem(widget)}.`);
|
|
26
|
+
if (widget?.kind === "quantity" && quantityProblem(widget)) throw new Error(`Pane ${name}: quantity widget: ${quantityProblem(widget)}.`);
|
|
27
|
+
if (widget?.kind === "math" && mathProblem(widget)) throw new Error(`Pane ${name}: math widget: ${mathProblem(widget)}.`);
|
|
28
|
+
if (widget?.kind === "grid" && gridProblem(widget)) throw new Error(`Pane ${name}: grid widget: ${gridProblem(widget)}.`);
|
|
29
|
+
if (widget && springSettingProblem(widget.spring)) throw new Error(`Pane ${name}: widget ${springSettingProblem(widget.spring)}.`);
|
|
30
|
+
},
|
|
31
|
+
// The LaTeX article (src/export/latex.js): its name and value on one line.
|
|
32
|
+
latex: (pane, tex) => {
|
|
33
|
+
const v = pane.widget?.value;
|
|
34
|
+
if (!pane.name || v === undefined) return null;
|
|
35
|
+
return [`\\noindent\\textbf{${tex.escape(pane.name)}}: ${tex.escape(typeof v === "object" ? JSON.stringify(v) : String(v))}`, ""];
|
|
36
|
+
},
|
|
37
|
+
// The line the Markdown format writes for it (src/formats/markdown.js).
|
|
38
|
+
describe: (pane) => (pane.widget ? `Input: ${pane.widget.kind ?? "a widget"}${pane.widget.value !== undefined ? `, ${codeSpan(JSON.stringify(pane.widget.value))}` : ""}.` : null),
|
|
39
|
+
// Settings whose edit reruns a pane of this type (src/panes/registry.js, reruns).
|
|
40
|
+
reruns: ["widget", "valueType"],
|
|
41
|
+
title: "input",
|
|
42
|
+
description: "A slider, number, text, checkbox, color, date…",
|
|
43
|
+
icon: "◧",
|
|
44
|
+
art: `${FRAME}<path d="M9 21h30"/><path class="a" d="M9 21h14"/><circle class="a f" cx="23.5" cy="21" r="3.2"/><path d="M9 27.5h6M33 27.5h6"/>`,
|
|
45
|
+
namePrefix: "input",
|
|
46
|
+
defaults: () => ({ widget: { kind: "number", value: 0, min: 0, max: 100, step: 1 }, width: 240 }),
|
|
47
|
+
minimap: ["#cde3d1", "#2f4a38"],
|
|
48
|
+
exports: "its value",
|
|
49
|
+
headless: "run",
|
|
50
|
+
readsEnv: false,
|
|
51
|
+
needsScreen: false,
|
|
52
|
+
frame: false,
|
|
53
|
+
subgraphOutput: false,
|
|
54
|
+
readsInputs: false, cutoff: true, pinnable: true, runInput: true, restorable: true, // run-time traits (src/panes/registry.js)
|
|
55
|
+
mcpEditable: ["widget"], // the settings `mallory serve --mcp` lets a client change on a served pane of this type (src/headless/mcp-endpoint.js)
|
|
56
|
+
menu: [CUTOFF_ITEM, { id: "subgraph.promote-inside", ifEnabled: true }],
|
|
57
|
+
// As a port (a subgraph's or the canvas's input): its type (declared, or the widget's) and description.
|
|
58
|
+
agentStatus: (pane) => ({
|
|
59
|
+
valueType: pane.valueType ?? widgetType(pane.widget),
|
|
60
|
+
...(pane.valueType === undefined ? { valueTypeFrom: "widget" } : {}),
|
|
61
|
+
...(cleanControl(pane.control) ? { control: cleanControl(pane.control) } : {}), // group, order, label, help, unit, advanced, hidden
|
|
62
|
+
}),
|
|
63
|
+
agent: {
|
|
64
|
+
summary: `a widget: ${WIDGET_KINDS.filter((k) => !["when", "quantity", "math", "grid", "form", "xy", "curve"].includes(k)).join(", ")}, form (a form generated from the JSON in \`fields\`), when (a time in words such as \"tomorrow 9am\" or \"in 3 hours\", read once when it is set; its value is { text, at (ms), zone, iso } with iso a ZonedDateTime like 2026-10-17T09:00:00+02:00[Europe/Paris], or null when empty), quantity (a number with a unit typed as text such as \"5 km\" or \"9.8 m/s^2\"; its value is { value, unit }, or null when empty; dimension (a name such as length or mass, or a unit) refuses text of another dimension, and unit converts the value into it), math (a typeset formula field; set value to its LaTeX such as \"x^{2}+1\"; its value is { latex, expr } with expr the expression string @johnhenry/math parses, such as \"x^2 + 1\"; LaTeX that cannot be read is refused), grid (a grid of cells you paint, the seed of a cellular automaton; width, height and depth are its size, at most 128 x 128 x 32 and 65,536 cells; its value is text WxH:bits or WxHxD:bits, bits 0 and 1 row by row, layer by layer, which the @mallory/automata panes read as a grid start (initial: grid); set value to that text, to rows of 0 and 1, to a list of live cells [[x, y]], or leave it for a blank grid; a size change crops or pads the cells), xy (a two-axis pad, value { x, y }) or curve (editable points, value { interpolation, points: [{ x, y }, …] })`,
|
|
65
|
+
fields: {
|
|
66
|
+
cutoff: "on by default.",
|
|
67
|
+
widget: {
|
|
68
|
+
schema: {
|
|
69
|
+
type: "object",
|
|
70
|
+
description: `the widget. kind is one of ${WIDGET_KINDS.join(", ")}; options (select) is a comma-separated string, and numeric: true makes a select of numbers (every option a number; the chosen option reaches the canvas as a number, type number); fields (form) is JSON text whose object defines the generated form's fields and defaults; xy and curve take their value as a plain object (xy: { x, y }; curve: { interpolation: "linear" | "step", points: [{ x, y }, …] }, 2 to 256 points sorted by x, no two at one x) and their ranges from xMin, xMax, xStep, yMin, yMax, yStep (default 0 to 1, step a hundredth of the range). quantity: set value to the text (or { value, unit }), checked against dimension and unit; a quantity of another dimension is refused and changes nothing. math: set value to the LaTeX (or { latex }); it is read as an expression, and LaTeX that is incomplete or unsupported is refused and changes nothing. when: set value to the phrase (read now, in zone, an IANA name or empty for local time, and stored as an instant; a phrase that isn't understood is refused and changes nothing). grid: width, height and depth give the size (a whole number from 1 to 128, depth to 32, at most 65,536 cells in all) and value is its text WxH:bits (or WxHxD:bits), rows of 0 and 1, or a list of live cells [[x, y]]; a cell outside the size is refused. spring (number, range and xy): true or { stiffness (default 170), damping (18), mass (1) } makes a pointer release keep the drag's velocity and settle with a spring; it never changes the value you set.`,
|
|
71
|
+
properties: {
|
|
72
|
+
kind: { type: "string", enum: WIDGET_KINDS },
|
|
73
|
+
value: {},
|
|
74
|
+
min: { type: "number" },
|
|
75
|
+
max: { type: "number" },
|
|
76
|
+
step: { type: "number" },
|
|
77
|
+
options: { type: "string" },
|
|
78
|
+
numeric: { type: "boolean" },
|
|
79
|
+
fields: { type: "string" },
|
|
80
|
+
width: { type: "integer", minimum: 1, maximum: 128 },
|
|
81
|
+
height: { type: "integer", minimum: 1, maximum: 128 },
|
|
82
|
+
depth: { type: "integer", minimum: 1, maximum: 32 },
|
|
83
|
+
xMin: { type: "number" },
|
|
84
|
+
xMax: { type: "number" },
|
|
85
|
+
xStep: { type: "number" },
|
|
86
|
+
yMin: { type: "number" },
|
|
87
|
+
yMax: { type: "number" },
|
|
88
|
+
yStep: { type: "number" },
|
|
89
|
+
zone: { type: "string" },
|
|
90
|
+
dimension: { type: "string" },
|
|
91
|
+
unit: { type: "string" },
|
|
92
|
+
spring: { type: ["boolean", "object", "null"], properties: { stiffness: { type: "number", exclusiveMinimum: 0, maximum: 100000 }, damping: { type: "number", exclusiveMinimum: 0, maximum: 10000 }, mass: { type: "number", exclusiveMinimum: 0, maximum: 1000 } }, additionalProperties: false },
|
|
93
|
+
},
|
|
94
|
+
additionalProperties: false,
|
|
95
|
+
},
|
|
96
|
+
refuse: "have a widget",
|
|
97
|
+
},
|
|
98
|
+
control: {
|
|
99
|
+
schema: {
|
|
100
|
+
type: ["object", "null"],
|
|
101
|
+
description: "how this control is organized where a function canvas's parameters are shown (its subgraph pane's form, a composite view, Present mode, pane packages): { group, order, label, help, unit, advanced, hidden, groupOrder, groupHelp, groupCollapsed }. group: a section heading shared by controls; order: a number, lower first (those without one follow, in pane order); label: shown instead of the name (wires still use the name); help: longer help text, Markdown (default: description); unit: a short suffix (px, ms); advanced: collapse under the group's advanced section; hidden: leave it out while it is unwired and still at its default. The group* keys describe the control's whole group, and the first control of the group (in pane order) that states one decides it: groupOrder: a number, groups with one come first, lowest first; groupHelp: Markdown under the group's heading; groupCollapsed: the group starts folded (a wired control, or one with a value of its own, opens it). Merged into the current one; a key set to null is removed; null clears it. Changes only what is drawn.",
|
|
102
|
+
properties: {
|
|
103
|
+
group: { type: ["string", "null"] },
|
|
104
|
+
order: { type: ["number", "null"] },
|
|
105
|
+
label: { type: ["string", "null"] },
|
|
106
|
+
help: { type: ["string", "null"] },
|
|
107
|
+
unit: { type: ["string", "null"] },
|
|
108
|
+
advanced: { type: ["boolean", "null"] },
|
|
109
|
+
hidden: { type: ["boolean", "null"] },
|
|
110
|
+
groupOrder: { type: ["number", "null"] },
|
|
111
|
+
groupHelp: { type: ["string", "null"] },
|
|
112
|
+
groupCollapsed: { type: ["boolean", "null"] },
|
|
113
|
+
},
|
|
114
|
+
additionalProperties: false,
|
|
115
|
+
},
|
|
116
|
+
refuse: "have a control",
|
|
117
|
+
},
|
|
118
|
+
valueType: {
|
|
119
|
+
schema: { type: ["string", "object", "null"], description: `its value's type (src/model/types.js) when it is a subgraph's or a canvas's input: agents' tool arguments, \`mallory run --describe\` and the subgraph's port show it, and a value of another type is this pane's error. Default: the widget's (number and range: number, checkbox: boolean, form, xy and curve: object, json: any, the rest: string). ${TYPE_ARG.description} null removes it.` },
|
|
120
|
+
refuse: "have a value type",
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// inputlog: an input log pane. Live, its value is what is wired into it (an action map's actions, a device pane's
|
|
2
|
+
// keyboard, pointer or gamepad, small values) as one sample, and a person's ● record keeps that stream as an input
|
|
3
|
+
// log (src/input/log.js) saved in the pane. Replay, it plays the log on the canvas transport with a timeline (play,
|
|
4
|
+
// pause, seek, step): the same log gives the same values, in the same order, every time. The rules are
|
|
5
|
+
// src/input/player.js (pure), the canvas side src/model/input-log-hub.js, its body and commands
|
|
6
|
+
// src/ui/input-log-pane.js.
|
|
7
|
+
import { FRAME } from "./shared.js";
|
|
8
|
+
import { INPUT_LOG_MODES, FPS_RANGE, defaultInputLog, inputLogSettings, describeInputLog } from "../input/player.js";
|
|
9
|
+
import { inputLogProblem } from "../input/player.js";
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
type: "inputlog",
|
|
13
|
+
// A saved log's mode, fps and log must be sound (a log that isn't one, or is over 1 MB): refused with the reason (src/persist.js).
|
|
14
|
+
validate(pane, where) {
|
|
15
|
+
if (pane.inputLog === undefined) return;
|
|
16
|
+
const problem = inputLogProblem(pane.inputLog);
|
|
17
|
+
if (problem) throw new Error(`Input log pane "${pane.name || pane.id}"${where}: ${problem}.`);
|
|
18
|
+
},
|
|
19
|
+
// The line the Markdown format writes for it (src/formats/markdown.js).
|
|
20
|
+
describe: (pane) => `Input log: ${describeInputLog(pane.inputLog)}.`,
|
|
21
|
+
// Settings whose edit reruns a pane of this type (src/panes/registry.js, reruns).
|
|
22
|
+
reruns: ["inputLog"],
|
|
23
|
+
title: "inputlog",
|
|
24
|
+
description: "An input log: record the actions and input wired in, and replay them on a timeline",
|
|
25
|
+
icon: "⏯",
|
|
26
|
+
art: `${FRAME}<path d="M8 27h32"/><path class="a" d="M12 24v6M19 25v4M27 23v8M33 25v4"/><circle class="a" cx="12" cy="17" r="2.5"/><path class="f" d="M20 14.5v6l5-3z"/>`,
|
|
27
|
+
namePrefix: "inputlog",
|
|
28
|
+
defaults: () => ({ inputLog: defaultInputLog(), width: 420 }),
|
|
29
|
+
minimap: ["#e6dccd", "#4d4234"],
|
|
30
|
+
exports: "its value (the sample at the playhead, or what is wired in now, as JSON); its log output is the input log itself",
|
|
31
|
+
headless: "run",
|
|
32
|
+
readsEnv: false,
|
|
33
|
+
needsScreen: false,
|
|
34
|
+
frame: false,
|
|
35
|
+
subgraphOutput: true,
|
|
36
|
+
takesSkips: true, // run-time traits (src/panes/registry.js): a device that isn't started yet reads as nothing held
|
|
37
|
+
events: [
|
|
38
|
+
{ name: "pressed", description: "a button action went down in this frame (live or replayed): { action }" },
|
|
39
|
+
{ name: "released", description: "a button action came up in this frame: { action }" },
|
|
40
|
+
],
|
|
41
|
+
// The log itself, published only when it changes: wire it into a render pane to replay it there, or read it with mallory_input_log.
|
|
42
|
+
values: [{ name: "log", description: "the input log the pane holds (null before one is recorded): wire it into a render pane, or export it", value: (pane) => inputLogSettings(pane.inputLog).log ?? null }],
|
|
43
|
+
menu: ["inputlog.record", "inputlog.play", "inputlog.step", "inputlog.rewind"],
|
|
44
|
+
// Live or replay, the playhead, a recording in progress (its log is in the pane's settings).
|
|
45
|
+
agentStatus: (pane, canvas) => (canvas.inputLogs ? { inputLog: { ...canvas.inputLogs.status(pane.id), describes: describeInputLog(pane.inputLog) } } : {}),
|
|
46
|
+
agent: {
|
|
47
|
+
summary:
|
|
48
|
+
'records the actions and input wired into it (an action map, device panes, small values) as an input log, and replays the log on the canvas transport with a timeline. Its value has an action map\'s shape with the rest of a sample beside it: { frame, t, actions: { jump: { down, pressed, released, value }, move: { x, y } }, pressed, released, keys, pointer, pads, values }; "pressed" and "released" events say which action changed, and its "log" output is the log itself. Mode live: its value is what is wired in now. Mode replay: the log\'s frame at the playhead; it opens stopped at frame 0, plays with mallory_transport (its own play and pause, and step to the next change) and seeks with mallory_input_log seek. The same log gives the same values in the same order every time. Recording needs a person\'s click (an agent cannot record); a log recorded from a keyboard stays out of share links',
|
|
49
|
+
fields: {
|
|
50
|
+
inputLog: {
|
|
51
|
+
schema: {
|
|
52
|
+
type: "object",
|
|
53
|
+
description: `the pane's settings: mode (${INPUT_LOG_MODES.join(" or ")}: live, its value is what is wired in now; replay, the log's frame at the playhead), fps (a recording's frames per second, ${FPS_RANGE.join(" to ")}, default 30), loop (a replay starts again at frame 0 at the end), and log (an input log, { format: "mallory-input-log", version: 1, fps, seed, frames, deltas, checks? }, at most 1 MB of JSON; null removes it). Only the keys passed change; changing the log or the mode stops a replay and puts it back at frame 0. A log that isn't one is refused with the reason.`,
|
|
54
|
+
properties: {
|
|
55
|
+
mode: { type: "string", enum: INPUT_LOG_MODES },
|
|
56
|
+
fps: { type: "integer", minimum: FPS_RANGE[0], maximum: FPS_RANGE[1] },
|
|
57
|
+
loop: { type: "boolean" },
|
|
58
|
+
log: { type: ["object", "null"] },
|
|
59
|
+
},
|
|
60
|
+
additionalProperties: false,
|
|
61
|
+
},
|
|
62
|
+
refuse: "hold an input log (inputLog)",
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// ledger: a shared ledger of INTERNAL CREDITS that the members of a room agree on by PBFT consensus (CLW-CONS-01 to -07, CLW-SET-21; docs/guide/collaboration-and-sharing.md "The ledger pane").
|
|
2
|
+
// NOT REAL MONEY: no payment rail, no wallet, nothing settles. Validators are room members with a persistent identity the person allowed (the ACL); their keys are the vault-held identity,
|
|
3
|
+
// never a new key. Under 4 validators it is NOT Byzantine-fault-tolerant, and the pane says so. The ledger itself (balances, blocks) lives in this browser's own store and never in a canvas;
|
|
4
|
+
// the pane saves only its view and the transactions an agent PROPOSED. An agent can propose; a person signs, and what an agent's proposal spends counts against the A-1 spending ceilings.
|
|
5
|
+
// The pane's value is counts, never a balance, key or name.
|
|
6
|
+
import { FRAME } from "./shared.js";
|
|
7
|
+
import { LEDGER_VIEWS, LEDGER_LIMITS, PROPOSAL_KINDS, defaultLedger, describeLedger, ledgerProblem, ledgerSettings } from "../model/ledger-pane.js";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
type: "ledger",
|
|
11
|
+
validate(pane, where) {
|
|
12
|
+
const problem = ledgerProblem(pane.ledger);
|
|
13
|
+
if (problem) throw new Error(`Ledger pane "${pane.name || pane.id}"${where}: ${problem}.`);
|
|
14
|
+
},
|
|
15
|
+
describe: (pane) => describeLedger(pane.ledger),
|
|
16
|
+
reruns: ["ledger"],
|
|
17
|
+
title: "ledger",
|
|
18
|
+
description: "Internal credits (not real money) that your room's members agree on by consensus: mint, transfer, escrow",
|
|
19
|
+
icon: "⚄",
|
|
20
|
+
art: `${FRAME}<ellipse cx="24" cy="15" rx="10" ry="4"/><path d="M14 15v9c0 2.2 4.5 4 10 4s10-1.8 10-4v-9"/><path d="M14 24v9c0 2.2 4.5 4 10 4s10-1.8 10-4v-9" opacity=".6"/>`,
|
|
21
|
+
namePrefix: "ledger",
|
|
22
|
+
defaults: () => ({ ledger: defaultLedger(), width: 520 }),
|
|
23
|
+
minimap: ["#efe8cf", "#4d4318"],
|
|
24
|
+
exports: "counts (JSON: state, height, validators, byzantineSafe, pending, proposalsWaiting, notRealMoney), never a balance, key or who",
|
|
25
|
+
headless: "run", // its runner skips without a page (a ledger belongs to the mallory page, like a room)
|
|
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: (pane) => ({ ledger: `internal credits, not real money; ${ledgerSettings(pane.ledger).proposals.length} proposed transaction(s) wait for the person to sign` }),
|
|
35
|
+
agent: {
|
|
36
|
+
summary: `a ledger of INTERNAL CREDITS (not real money) that a room's members agree on by consensus. You can PROPOSE a transaction (\`ledger.proposals\`: ${PROPOSAL_KINDS.join(", ")}); it waits in the pane until a person reads it and signs it with their own identity, and the credits it spends count against the person's spending ceilings. You cannot mint, change the validators, sign, start or join a ledger, or read a balance or key. Its value is counts only`,
|
|
37
|
+
fields: {
|
|
38
|
+
ledger: {
|
|
39
|
+
schema: {
|
|
40
|
+
type: "object",
|
|
41
|
+
description: `a PROPOSAL, never a transaction: { view?: ${LEDGER_VIEWS.map((v) => `"${v}"`).join(" | ")}, proposals: [{ draft: { kind: "transfer", to, amount } | { kind: "escrow", to, amount, minutes } | { kind: "release" | "refund", escrow }, reason }] } replaces the pending list (up to ${LEDGER_LIMITS.proposals}). \`to\` is a member's identity key and amounts are whole credits. A person signs a proposal in the pane, or drops it.`,
|
|
42
|
+
properties: {
|
|
43
|
+
view: { type: "string", enum: [...LEDGER_VIEWS] },
|
|
44
|
+
proposals: {
|
|
45
|
+
type: "array",
|
|
46
|
+
maxItems: LEDGER_LIMITS.proposals,
|
|
47
|
+
items: { type: "object", properties: { draft: { type: "object" }, reason: { type: "string", maxLength: LEDGER_LIMITS.reason } }, required: ["draft"], additionalProperties: false },
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
additionalProperties: false,
|
|
51
|
+
},
|
|
52
|
+
refuse: "propose a ledger transaction (ledger)",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// machine: a tape machine (docs/design/machine-pane.md; Phase 4c wave L-G). A tape of typed cells, a head and named control states; each step
|
|
2
|
+
// the model proposes one bounded action, a head move and the next state, and a deterministic validator accepts or rejects it. The engine is
|
|
3
|
+
// src/machine/ (pure), its run on the page src/machine/session.js, the runner src/model/runners/machine.js, the body src/ui/machine-pane.js.
|
|
4
|
+
// The caps, the watchdog, approvals, parking and restarts are the agent pane's (src/agent/, docs/design/agent-guards.md).
|
|
5
|
+
import { FRAME } from "./shared.js";
|
|
6
|
+
import { DEFAULT_WATCHDOG } from "../agent/guards.js";
|
|
7
|
+
import { MACHINE_PROVIDERS as PROVIDERS } from "../machine/random.js";
|
|
8
|
+
import { ROUTER_SCHEMA } from "../agent/router.js";
|
|
9
|
+
import { DEFAULT_MAX_STEPS, MAX_STEPS_LIMIT, machineProblems, orphanedProtections } from "../machine/tape.js";
|
|
10
|
+
|
|
11
|
+
/** What a new pane starts as: one cell, two states, and a recording that writes "hello, machine" and finishes (offline, deterministic). */
|
|
12
|
+
export const STARTER = {
|
|
13
|
+
id: "starter",
|
|
14
|
+
initial: "WORK",
|
|
15
|
+
tape: { mode: "fixed", boundary: "clamp", head: 0, cells: [{ id: "note", kind: "text", content: "" }] },
|
|
16
|
+
schema: { kinds: ["text", "empty"], empty: { kind: "empty", content: "", meta: {}, status: "idle" }, content: { maxChars: 2000, trim: true, forbidControl: true } },
|
|
17
|
+
states: {
|
|
18
|
+
WORK: { prompt: "Write a short greeting into the cell, then finish.", actions: ["WRITE", "NOOP"], next: ["WORK", "DONE"] },
|
|
19
|
+
DONE: { terminal: true },
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
const STARTER_REPLIES = [{ calls: [{ name: "propose", args: { action: { kind: "WRITE", text: "hello, machine" }, move: "S", nextState: "DONE" } }] }];
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
type: "machine",
|
|
26
|
+
// Settings whose edit reruns a pane of this type (src/panes/registry.js, reruns).
|
|
27
|
+
reruns: ["machine", "llm", "replies", "inject", "capSteps", "capUsd", "capMs", "stepwise", "lockedCells", "needsApproval", "noApproval", "rejections", "canAsk", "riskGate", "askTimeoutMs", "approvalTimeoutMs", "price", "watchdog", "restart", "parkMs"],
|
|
28
|
+
// The caps are the person's to raise: an agent may set one or lower it (src/model/person-only.js lowerOnlyProblem).
|
|
29
|
+
lowerOnly: ["capSteps", "capUsd", "capMs"],
|
|
30
|
+
// The settings a scheduled run's grant bundle writes its caps into (src/headless/scheduled.js).
|
|
31
|
+
spendCaps: { usd: "capUsd", ms: "capMs" },
|
|
32
|
+
// What keeps the machine honest is the person's alone: which cells it can never change, which states wait for a person, what a refusal does,
|
|
33
|
+
// whether it may ask, what prices a call, the loop detector, more attempts, and waiting for days (docs/design/machine-pane.md, "Who sets what").
|
|
34
|
+
personOnly: ["modelEndpoint", "lockedCells", "needsApproval", "noApproval", "rejections", "canAsk", "riskGate", "price.input", "price.output", "price.models", "watchdog.repeat", "watchdog.stall", "restart.max", "restart.backoffMs", "restart.jitter", "parkMs", "askTimeoutMs", "approvalTimeoutMs"],
|
|
35
|
+
// An agent's edit of `machine` that would leave a lock or a gate of the person's naming nothing (a renamed cell or state) is refused (S2).
|
|
36
|
+
editProblem(patch, current) {
|
|
37
|
+
if (patch.machine === undefined || !current) return null;
|
|
38
|
+
// A locked cell's content, kind and meta are the person's: an agent's edit that changes them is refused (S2b). Cells the agent adds or the person never locked stay its own.
|
|
39
|
+
const locked = new Set(Array.isArray(current.lockedCells) ? current.lockedCells : []);
|
|
40
|
+
for (const before of current.machine?.tape?.cells ?? []) {
|
|
41
|
+
if (!locked.has(before?.id)) continue;
|
|
42
|
+
const after = (patch.machine?.tape?.cells ?? []).find((c) => c?.id === before.id);
|
|
43
|
+
if (after && JSON.stringify([before.content, before.kind, before.meta ?? {}]) !== JSON.stringify([after.content, after.kind, after.meta ?? {}])) return `machine: locked cell ${JSON.stringify(before.id)}: its content, kind and meta are the person's, so an edit cannot change them. The person edits it in the tape view.`;
|
|
44
|
+
}
|
|
45
|
+
const now = new Set(orphanedProtections(current.machine, current));
|
|
46
|
+
const fresh = orphanedProtections(patch.machine, current).filter((p) => !now.has(p));
|
|
47
|
+
return fresh.length ? `machine: that edit would drop the person's protection (${fresh.slice(0, 2).join("; ")}). Keep the cell ids and state names the person locked or gated; the person changes the lists in the pane's settings.` : null;
|
|
48
|
+
},
|
|
49
|
+
// An undo or redo that puts an older `machine` back keeps the person's current text in the locked cells (S2b): it takes back the agent's edit, not the person's.
|
|
50
|
+
restoreGuard(patch, current) {
|
|
51
|
+
if (!patch.machine || !current?.machine) return patch;
|
|
52
|
+
const locked = new Set(Array.isArray(current.lockedCells) ? current.lockedCells : []);
|
|
53
|
+
const now = new Map((current.machine.tape?.cells ?? []).filter((c) => locked.has(c?.id)).map((c) => [c.id, c]));
|
|
54
|
+
if (!now.size) return patch;
|
|
55
|
+
const machine = structuredClone(patch.machine);
|
|
56
|
+
machine.tape.cells = (machine.tape?.cells ?? []).map((c) => (now.has(c?.id) ? { ...c, content: now.get(c.id).content, kind: now.get(c.id).kind, meta: structuredClone(now.get(c.id).meta ?? {}) } : c));
|
|
57
|
+
return { ...patch, machine };
|
|
58
|
+
},
|
|
59
|
+
// A saved pane's definition must be sound (src/persist.js).
|
|
60
|
+
validate(pane, where) {
|
|
61
|
+
const problems = machineProblems(pane.machine);
|
|
62
|
+
if (problems.length) throw new Error(`Machine pane "${pane.name || pane.id}"${where}: ${problems.slice(0, 3).join("; ")}.`);
|
|
63
|
+
},
|
|
64
|
+
describe: (pane) => `Machine: ${Object.keys(pane.machine?.states ?? {}).length} states on a tape of ${pane.machine?.tape?.cells?.length ?? 0} cells, up to ${pane.capSteps ?? DEFAULT_MAX_STEPS} steps.`,
|
|
65
|
+
title: "machine",
|
|
66
|
+
description: "A tape machine: the model proposes one bounded action, a move and the next state each step, and a deterministic validator decides",
|
|
67
|
+
icon: "⌸",
|
|
68
|
+
art: `${FRAME}<rect class="f" x="9" y="26" width="9" height="9" rx="1.5"/><rect x="19.5" y="26" width="9" height="9" rx="1.5"/><rect x="30" y="26" width="9" height="9" rx="1.5"/><path class="a" d="M24 22v-6M20 18l4-4 4 4"/><path d="M9 14h11"/>`,
|
|
69
|
+
namePrefix: "machine",
|
|
70
|
+
defaults: () => ({
|
|
71
|
+
machine: structuredClone(STARTER),
|
|
72
|
+
llm: { provider: "recorded", model: "" },
|
|
73
|
+
replies: structuredClone(STARTER_REPLIES),
|
|
74
|
+
capSteps: DEFAULT_MAX_STEPS,
|
|
75
|
+
capUsd: 0,
|
|
76
|
+
capMs: 0,
|
|
77
|
+
stepwise: false,
|
|
78
|
+
lockedCells: [],
|
|
79
|
+
needsApproval: {},
|
|
80
|
+
noApproval: [],
|
|
81
|
+
rejections: { invalid: "halt", apply: "halt", retries: 2, backoffMs: 0 },
|
|
82
|
+
canAsk: false,
|
|
83
|
+
watchdog: { ...DEFAULT_WATCHDOG },
|
|
84
|
+
restart: { max: 0, backoffMs: 1000, jitter: 0.25 },
|
|
85
|
+
parkMs: 0,
|
|
86
|
+
askTimeoutMs: 0,
|
|
87
|
+
approvalTimeoutMs: 0,
|
|
88
|
+
width: 520,
|
|
89
|
+
}),
|
|
90
|
+
minimap: ["#e3d8c4", "#4a3f2a"],
|
|
91
|
+
exports: "its value (the state, head, step, halt kind and reason, the tape and the trace, as JSON)",
|
|
92
|
+
headless: "run",
|
|
93
|
+
readsEnv: false,
|
|
94
|
+
needsScreen: false,
|
|
95
|
+
frame: false,
|
|
96
|
+
subgraphOutput: true,
|
|
97
|
+
pinnable: true,
|
|
98
|
+
restorable: true, // run-time traits (src/panes/registry.js): its value is JSON, so a sandbox restart puts it back instead of asking the model again
|
|
99
|
+
menu: ["machine.step", "machine.run", "machine.pause", "machine.reset", "machine.check", "machine.example", "machine.export"],
|
|
100
|
+
// What an agent learns besides the value: the program's shape and the run's state, never the person's settings.
|
|
101
|
+
agentStatus: (pane) => {
|
|
102
|
+
const m = pane.machine ?? {};
|
|
103
|
+
return { machine: { states: Object.keys(m.states ?? {}), cells: m.tape?.cells?.length ?? 0, problems: machineProblems(m).slice(0, 5) }, stepCap: pane.capSteps ?? DEFAULT_MAX_STEPS };
|
|
104
|
+
},
|
|
105
|
+
agent: {
|
|
106
|
+
summary:
|
|
107
|
+
'a tape machine: a tape of typed cells, a head and named states. Each step the model sees the head cell and its two neighbours and proposes one action (NOOP, WRITE, APPEND, CLEAR, SET_KIND, SET_STATUS, INSERT_LEFT, INSERT_RIGHT, DELETE, HALT, ASK), a head move (L, S, R) and the next state; a deterministic validator accepts or rejects it, so the model is only a hint. `machine` is the definition; `llm` picks the model (provider "recorded" replays `replies`, offline). Every run has a finite step cap. Its value is { state, head, step, halted, haltKind, haltReason, tape, trace, usage }. Which cells are protected, which states wait for a person, what a refusal does and the watchdog are the person\'s, not settable here',
|
|
108
|
+
fields: {
|
|
109
|
+
onError: true, // the error policy (retry, skip, fallback): a machine that halts on a cap or a refusal is an error of the pane, as an agent's is
|
|
110
|
+
machine: {
|
|
111
|
+
schema: {
|
|
112
|
+
type: "object",
|
|
113
|
+
description: "the definition: { id?, initial, tape: { mode: fixed | dynamic, boundary: reject | clamp | grow, min?, max?, head, cells: [{ id, kind, content, meta?, status? }] }, schema: { kinds: [...], empty: { kind, content, meta, status }, content: { maxChars, trim, forbidControl } }, prompts?: { name: text }, states: { NAME: { terminal?, promptRefs?, prompt?, actions?, moves?, next?, defaultNext?, routes?: [{ match: regex, to }], llm?: { model } } } }. Omitted `actions` means NOOP, WRITE, APPEND, SET_STATUS, HALT; list the others to allow them. `next` is the enforced list of states a proposal may go to. A route forces the next state when what was written matches. Check it with mallory_check_machine. Editing it runs the pane again, from the start.",
|
|
114
|
+
additionalProperties: true,
|
|
115
|
+
},
|
|
116
|
+
refuse: "be a tape machine (machine)",
|
|
117
|
+
},
|
|
118
|
+
llm: {
|
|
119
|
+
schema: {
|
|
120
|
+
type: "object",
|
|
121
|
+
description: `the model: { provider (one of ${PROVIDERS.join(", ")}; "recorded" replays \`replies\`; "random" walks at random, offline and free; "pane" asks the wired pane named in \`pane\`, which returns each proposal), pane? (the name of a pane wired into the machine, for "pane"), model?, seed? (whole number, for "random"), baseUrl?, keyName? (only its name), routing?, schema? ("nested", the default, or "flat": the propose tool without nested objects, for a hosted backend that rejects them) }.`,
|
|
122
|
+
properties: { provider: { type: "string", enum: PROVIDERS }, model: { type: "string" }, baseUrl: { type: "string" }, keyName: { type: "string" }, seed: { type: "integer", minimum: 0 }, pane: { type: "string" }, routing: ROUTER_SCHEMA, schema: { type: "string", enum: ["nested", "flat"] } },
|
|
123
|
+
additionalProperties: false,
|
|
124
|
+
},
|
|
125
|
+
refuse: "have a model",
|
|
126
|
+
},
|
|
127
|
+
replies: {
|
|
128
|
+
schema: { type: "array", description: 'the replies provider "recorded" replays, one per model call: { text?, calls?: [{ name: "propose", args: { action, move, nextState } }] }, or JSON in text.', items: { type: "object" } },
|
|
129
|
+
refuse: "have a recording",
|
|
130
|
+
},
|
|
131
|
+
inject: { schema: { type: "object", additionalProperties: { type: "string" }, description: "text put into chosen cells before step 0 of every run, { cellId: text }: a case for an evaluation (the evaluation matrix sets it per row). The run header records it, and a replay or a fork starts from it. An unknown cell, or a text over the cell limit, stops the run with the reason." }, refuse: "have injected cells" },
|
|
132
|
+
capSteps: { schema: { type: "integer", minimum: 1, maximum: MAX_STEPS_LIMIT, description: `steps per run before it halts with kind maxSteps (default ${DEFAULT_MAX_STEPS}); there is no unlimited setting. You can lower it, never raise it.` }, refuse: "have a step cap" },
|
|
133
|
+
capUsd: { schema: { type: "number", minimum: 0, description: "a cost cap per run, in US dollars (0 = none). You can set a cap where there is none or lower one, never raise or remove it. With a cap, a model whose price is unknown stops the run (the person sets a price)." }, refuse: "have a cost cap" },
|
|
134
|
+
capMs: { schema: { type: "integer", minimum: 0, description: "a wall-clock cap per run, in milliseconds (0 = none). You can set a cap where there is none or lower one, never raise or remove it." }, refuse: "have a time cap" },
|
|
135
|
+
stepwise: { schema: { type: "boolean", description: "true: the pane starts stopped and the person steps it (default false: it runs to a halt)." }, refuse: "be stepped" },
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
};
|