@fnndsc/brasa 0.33.4 → 0.35.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/dist/api/models.d.ts +1 -2
- package/dist/api/models.js.map +1 -1
- package/dist/buildinfo.json +1 -1
- package/dist/builtins/debug.d.ts +1 -1
- package/dist/builtins/debug.js +12 -8
- package/dist/builtins/debug.js.map +1 -1
- package/dist/builtins/executable.d.ts +1 -1
- package/dist/builtins/executable.js +2 -1
- package/dist/builtins/executable.js.map +1 -1
- package/dist/builtins/fs/acl.d.ts +1 -16
- package/dist/builtins/fs/acl.js +3 -1
- package/dist/builtins/fs/acl.js.map +1 -1
- package/dist/builtins/fs/archive.js +1 -1
- package/dist/builtins/fs/archive.js.map +1 -1
- package/dist/builtins/fs/cat.d.ts +1 -1
- package/dist/builtins/fs/cat.js +47 -7
- package/dist/builtins/fs/cat.js.map +1 -1
- package/dist/builtins/fs/cd.d.ts +1 -19
- package/dist/builtins/fs/cd.js +45 -94
- package/dist/builtins/fs/cd.js.map +1 -1
- package/dist/builtins/fs/configWrite.d.ts +1 -1
- package/dist/builtins/fs/configWrite.js +1 -1
- package/dist/builtins/fs/configWrite.js.map +1 -1
- package/dist/builtins/fs/cp.d.ts +1 -1
- package/dist/builtins/fs/cp.js +19 -13
- package/dist/builtins/fs/cp.js.map +1 -1
- package/dist/builtins/fs/download.d.ts +1 -1
- package/dist/builtins/fs/download.js +2 -1
- package/dist/builtins/fs/download.js.map +1 -1
- package/dist/builtins/fs/du.d.ts +10 -1
- package/dist/builtins/fs/du.js +36 -2
- package/dist/builtins/fs/du.js.map +1 -1
- package/dist/builtins/fs/edit.d.ts +1 -1
- package/dist/builtins/fs/edit.js +10 -4
- package/dist/builtins/fs/edit.js.map +1 -1
- package/dist/builtins/fs/entries.d.ts +43 -0
- package/dist/builtins/fs/entries.js +81 -0
- package/dist/builtins/fs/entries.js.map +1 -0
- package/dist/builtins/fs/ls.d.ts +1 -2
- package/dist/builtins/fs/ls.js +70 -10
- package/dist/builtins/fs/ls.js.map +1 -1
- package/dist/builtins/fs/mkdir.d.ts +1 -1
- package/dist/builtins/fs/mkdir.js +29 -20
- package/dist/builtins/fs/mkdir.js.map +1 -1
- package/dist/builtins/fs/mv.d.ts +1 -1
- package/dist/builtins/fs/mv.js +40 -23
- package/dist/builtins/fs/mv.js.map +1 -1
- package/dist/builtins/fs/pull.d.ts +1 -1
- package/dist/builtins/fs/pull.js +2 -1
- package/dist/builtins/fs/pull.js.map +1 -1
- package/dist/builtins/fs/pwd.d.ts +1 -1
- package/dist/builtins/fs/pwd.js +9 -45
- package/dist/builtins/fs/pwd.js.map +1 -1
- package/dist/builtins/fs/rm.d.ts +1 -22
- package/dist/builtins/fs/rm.js +33 -58
- package/dist/builtins/fs/rm.js.map +1 -1
- package/dist/builtins/fs/rmdir.d.ts +1 -1
- package/dist/builtins/fs/rmdir.js +21 -40
- package/dist/builtins/fs/rmdir.js.map +1 -1
- package/dist/builtins/fs/touch.d.ts +1 -1
- package/dist/builtins/fs/touch.js +64 -25
- package/dist/builtins/fs/touch.js.map +1 -1
- package/dist/builtins/fs/tree.d.ts +1 -1
- package/dist/builtins/fs/tree.js +26 -3
- package/dist/builtins/fs/tree.js.map +1 -1
- package/dist/builtins/fs/upload.d.ts +1 -1
- package/dist/builtins/fs/upload.js +3 -1
- package/dist/builtins/fs/upload.js.map +1 -1
- package/dist/builtins/fs/xattr.d.ts +1 -10
- package/dist/builtins/fs/xattr.js +3 -1
- package/dist/builtins/fs/xattr.js.map +1 -1
- package/dist/builtins/games/bytes.d.ts +1 -1
- package/dist/builtins/games/bytes.js +2 -1
- package/dist/builtins/games/bytes.js.map +1 -1
- package/dist/builtins/games/chimes.d.ts +1 -13
- package/dist/builtins/games/chimes.js +1 -1
- package/dist/builtins/games/chimes.js.map +1 -1
- package/dist/builtins/games/chrislab.d.ts +33 -0
- package/dist/builtins/games/chrislab.js +117 -0
- package/dist/builtins/games/chrislab.js.map +1 -0
- package/dist/builtins/games/cowsay.d.ts +1 -11
- package/dist/builtins/games/cowsay.js +1 -1
- package/dist/builtins/games/cowsay.js.map +1 -1
- package/dist/builtins/games/figlet.d.ts +1 -11
- package/dist/builtins/games/figlet.js +1 -1
- package/dist/builtins/games/figlet.js.map +1 -1
- package/dist/builtins/games/lab.d.ts +1 -43
- package/dist/builtins/games/lab.js +7 -111
- package/dist/builtins/games/lab.js.map +1 -1
- package/dist/builtins/games/lolcat.d.ts +1 -11
- package/dist/builtins/games/lolcat.js +1 -1
- package/dist/builtins/games/lolcat.js.map +1 -1
- package/dist/builtins/games/morse.d.ts +1 -10
- package/dist/builtins/games/morse.js +1 -1
- package/dist/builtins/games/morse.js.map +1 -1
- package/dist/builtins/games/numbers.d.ts +1 -10
- package/dist/builtins/games/numbers.js +1 -1
- package/dist/builtins/games/numbers.js.map +1 -1
- package/dist/builtins/games/play.d.ts +1 -11
- package/dist/builtins/games/play.js +1 -1
- package/dist/builtins/games/play.js.map +1 -1
- package/dist/builtins/games/qr.d.ts +1 -12
- package/dist/builtins/games/qr.js +1 -1
- package/dist/builtins/games/qr.js.map +1 -1
- package/dist/builtins/games/show.d.ts +1 -12
- package/dist/builtins/games/show.js +1 -1
- package/dist/builtins/games/show.js.map +1 -1
- package/dist/builtins/games/sky.d.ts +1 -11
- package/dist/builtins/games/sky.js +1 -1
- package/dist/builtins/games/sky.js.map +1 -1
- package/dist/builtins/games/text.d.ts +1 -10
- package/dist/builtins/games/text.js +1 -1
- package/dist/builtins/games/text.js.map +1 -1
- package/dist/builtins/games/wtf.d.ts +1 -9
- package/dist/builtins/games/wtf.js +1 -1
- package/dist/builtins/games/wtf.js.map +1 -1
- package/dist/builtins/help.d.ts +18 -15
- package/dist/builtins/help.js +51 -1200
- package/dist/builtins/help.js.map +1 -1
- package/dist/builtins/net/connect.d.ts +1 -1
- package/dist/builtins/net/connect.js +2 -1
- package/dist/builtins/net/connect.js.map +1 -1
- package/dist/builtins/net/cubepath.d.ts +1 -1
- package/dist/builtins/net/cubepath.js +1 -1
- package/dist/builtins/net/cubepath.js.map +1 -1
- package/dist/builtins/net/logout.d.ts +1 -1
- package/dist/builtins/net/logout.js +1 -1
- package/dist/builtins/net/logout.js.map +1 -1
- package/dist/builtins/net/netstat.d.ts +1 -1
- package/dist/builtins/net/netstat.js +1 -2
- package/dist/builtins/net/netstat.js.map +1 -1
- package/dist/builtins/net/pacs.d.ts +1 -1
- package/dist/builtins/net/pacs.js +3 -2
- package/dist/builtins/net/pacs.js.map +1 -1
- package/dist/builtins/net/pacsUtils.js +2 -1
- package/dist/builtins/net/pacsUtils.js.map +1 -1
- package/dist/builtins/net/query.csv.js +1 -1
- package/dist/builtins/net/query.csv.js.map +1 -1
- package/dist/builtins/net/query.d.ts +2 -2
- package/dist/builtins/net/query.fanout.d.ts +1 -1
- package/dist/builtins/net/query.fanout.js +1 -1
- package/dist/builtins/net/query.fanout.js.map +1 -1
- package/dist/builtins/net/query.js +3 -2
- package/dist/builtins/net/query.js.map +1 -1
- package/dist/builtins/net/status.d.ts +1 -1
- package/dist/builtins/net/status.js +2 -1
- package/dist/builtins/net/status.js.map +1 -1
- package/dist/builtins/parametersofplugin.d.ts +1 -1
- package/dist/builtins/parametersofplugin.js +1 -1
- package/dist/builtins/parametersofplugin.js.map +1 -1
- package/dist/builtins/pluginExecute.d.ts +1 -1
- package/dist/builtins/pluginExecute.js +3 -1
- package/dist/builtins/pluginExecute.js.map +1 -1
- package/dist/builtins/proc.d.ts +1 -2
- package/dist/builtins/proc.js +4 -3
- package/dist/builtins/proc.js.map +1 -1
- package/dist/builtins/res/compute.d.ts +1 -1
- package/dist/builtins/res/compute.js +2 -1
- package/dist/builtins/res/compute.js.map +1 -1
- package/dist/builtins/res/dicom.d.ts +2 -2
- package/dist/builtins/res/dicom.js +1 -2
- package/dist/builtins/res/dicom.js.map +1 -1
- package/dist/builtins/res/expect.d.ts +1 -1
- package/dist/builtins/res/expect.js +2 -1
- package/dist/builtins/res/expect.js.map +1 -1
- package/dist/builtins/res/feed.d.ts +1 -1
- package/dist/builtins/res/feed.diagram.d.ts +1 -2
- package/dist/builtins/res/feed.diagram.js +2 -2
- package/dist/builtins/res/feed.diagram.js.map +1 -1
- package/dist/builtins/res/feed.js +3 -1
- package/dist/builtins/res/feed.js.map +1 -1
- package/dist/builtins/res/feed.tree.d.ts +1 -1
- package/dist/builtins/res/feed.tree.js +1 -1
- package/dist/builtins/res/feed.tree.js.map +1 -1
- package/dist/builtins/res/files.d.ts +1 -1
- package/dist/builtins/res/files.js +1 -1
- package/dist/builtins/res/files.js.map +1 -1
- package/dist/builtins/res/gather.d.ts +1 -1
- package/dist/builtins/res/gather.js +1 -1
- package/dist/builtins/res/gather.js.map +1 -1
- package/dist/builtins/res/gather.store.js.map +1 -1
- package/dist/builtins/res/group.d.ts +1 -1
- package/dist/builtins/res/group.js +1 -1
- package/dist/builtins/res/group.js.map +1 -1
- package/dist/builtins/res/image.d.ts +1 -20
- package/dist/builtins/res/image.js +1 -2
- package/dist/builtins/res/image.js.map +1 -1
- package/dist/builtins/res/pipeline.d.ts +1 -1
- package/dist/builtins/res/pipeline.diagram.d.ts +1 -1
- package/dist/builtins/res/pipeline.diagram.js +2 -2
- package/dist/builtins/res/pipeline.diagram.js.map +1 -1
- package/dist/builtins/res/pipeline.js +3 -1
- package/dist/builtins/res/pipeline.js.map +1 -1
- package/dist/builtins/res/play.d.ts +1 -1
- package/dist/builtins/res/play.js +2 -1
- package/dist/builtins/res/play.js.map +1 -1
- package/dist/builtins/res/plugin.d.ts +1 -1
- package/dist/builtins/res/plugin.info.d.ts +1 -1
- package/dist/builtins/res/plugin.info.js +2 -1
- package/dist/builtins/res/plugin.info.js.map +1 -1
- package/dist/builtins/res/plugin.js +2 -2
- package/dist/builtins/res/plugin.js.map +1 -1
- package/dist/builtins/res/plugininstance.d.ts +1 -1
- package/dist/builtins/res/plugininstance.js +1 -1
- package/dist/builtins/res/plugininstance.js.map +1 -1
- package/dist/builtins/res/pluginmeta.d.ts +1 -1
- package/dist/builtins/res/pluginmeta.js +1 -1
- package/dist/builtins/res/pluginmeta.js.map +1 -1
- package/dist/builtins/res/record.d.ts +1 -1
- package/dist/builtins/res/record.js +1 -1
- package/dist/builtins/res/record.js.map +1 -1
- package/dist/builtins/res/tag.d.ts +1 -1
- package/dist/builtins/res/tag.js +1 -1
- package/dist/builtins/res/tag.js.map +1 -1
- package/dist/builtins/res/user.d.ts +1 -1
- package/dist/builtins/res/user.js +2 -1
- package/dist/builtins/res/user.js.map +1 -1
- package/dist/builtins/res/workflow.d.ts +1 -1
- package/dist/builtins/res/workflow.js +1 -1
- package/dist/builtins/res/workflow.js.map +1 -1
- package/dist/builtins/store.d.ts +1 -1
- package/dist/builtins/store.js +2 -1
- package/dist/builtins/store.js.map +1 -1
- package/dist/builtins/sys/cal.d.ts +1 -12
- package/dist/builtins/sys/cal.js +1 -1
- package/dist/builtins/sys/cal.js.map +1 -1
- package/dist/builtins/sys/context.d.ts +1 -1
- package/dist/builtins/sys/context.js +1 -1
- package/dist/builtins/sys/context.js.map +1 -1
- package/dist/builtins/sys/date.d.ts +1 -12
- package/dist/builtins/sys/date.js +1 -1
- package/dist/builtins/sys/date.js.map +1 -1
- package/dist/builtins/sys/fortune.d.ts +1 -11
- package/dist/builtins/sys/fortune.js +1 -1
- package/dist/builtins/sys/fortune.js.map +1 -1
- package/dist/builtins/sys/motd.d.ts +1 -18
- package/dist/builtins/sys/motd.js +3 -3
- package/dist/builtins/sys/motd.js.map +1 -1
- package/dist/builtins/sys/notes.d.ts +1 -2
- package/dist/builtins/sys/notes.js +1 -2
- package/dist/builtins/sys/notes.js.map +1 -1
- package/dist/builtins/sys/physicalmode.d.ts +1 -1
- package/dist/builtins/sys/physicalmode.js +1 -1
- package/dist/builtins/sys/physicalmode.js.map +1 -1
- package/dist/builtins/sys/timing.d.ts +1 -1
- package/dist/builtins/sys/timing.js +1 -1
- package/dist/builtins/sys/timing.js.map +1 -1
- package/dist/builtins/sys/version.d.ts +1 -7
- package/dist/builtins/sys/version.js +1 -1
- package/dist/builtins/sys/version.js.map +1 -1
- package/dist/builtins/sys/weather.d.ts +1 -1
- package/dist/builtins/sys/weather.js +1 -1
- package/dist/builtins/sys/weather.js.map +1 -1
- package/dist/builtins/sys/whoami.d.ts +1 -1
- package/dist/builtins/sys/whoami.js +2 -1
- package/dist/builtins/sys/whoami.js.map +1 -1
- package/dist/builtins/utils.d.ts +2 -19
- package/dist/builtins/utils.js +5 -55
- package/dist/builtins/utils.js.map +1 -1
- package/dist/builtins/wildcard.d.ts +4 -53
- package/dist/builtins/wildcard.js +3 -177
- package/dist/builtins/wildcard.js.map +1 -1
- package/dist/chris/backend.d.ts +22 -0
- package/dist/chris/backend.js +102 -0
- package/dist/chris/backend.js.map +1 -0
- package/dist/chris/binEntry.js.map +1 -0
- package/dist/chris/binMount.d.ts +60 -0
- package/dist/chris/binMount.js +154 -0
- package/dist/chris/binMount.js.map +1 -0
- package/dist/{core → chris}/chiliDelegate.d.ts +1 -1
- package/dist/{core → chris}/chiliDelegate.js +1 -1
- package/dist/chris/chiliDelegate.js.map +1 -0
- package/dist/chris/chrisCommands.d.ts +14 -0
- package/dist/chris/chrisCommands.js +168 -0
- package/dist/chris/chrisCommands.js.map +1 -0
- package/dist/chris/commandFallback.d.ts +3 -0
- package/dist/chris/commandFallback.js +113 -0
- package/dist/chris/commandFallback.js.map +1 -0
- package/dist/chris/completion.d.ts +3 -0
- package/dist/chris/completion.js +100 -0
- package/dist/chris/completion.js.map +1 -0
- package/dist/chris/connect.js.map +1 -0
- package/dist/chris/debug.d.ts +10 -0
- package/dist/chris/debug.js +9 -0
- package/dist/chris/debug.js.map +1 -0
- package/dist/chris/files.d.ts +16 -0
- package/dist/chris/files.js +141 -0
- package/dist/chris/files.js.map +1 -0
- package/dist/chris/filesystem.d.ts +3 -0
- package/dist/chris/filesystem.js +57 -0
- package/dist/chris/filesystem.js.map +1 -0
- package/dist/chris/help.d.ts +16 -0
- package/dist/chris/help.js +1193 -0
- package/dist/chris/help.js.map +1 -0
- package/dist/chris/jobsState.js.map +1 -0
- package/dist/chris/mounts.d.ts +7 -0
- package/dist/chris/mounts.js +34 -0
- package/dist/chris/mounts.js.map +1 -0
- package/dist/chris/navigation.d.ts +40 -0
- package/dist/chris/navigation.js +160 -0
- package/dist/chris/navigation.js.map +1 -0
- package/dist/{core → chris}/promptContext.d.ts +2 -2
- package/dist/{core → chris}/promptContext.js +3 -3
- package/dist/chris/promptContext.js.map +1 -0
- package/dist/chris/references.d.ts +14 -0
- package/dist/chris/references.js +113 -0
- package/dist/chris/references.js.map +1 -0
- package/dist/chris/tasks.d.ts +31 -0
- package/dist/chris/tasks.js +55 -0
- package/dist/chris/tasks.js.map +1 -0
- package/dist/chris/universeLayout.js.map +1 -0
- package/dist/chris/watch.d.ts +3 -0
- package/dist/chris/watch.js +15 -0
- package/dist/chris/watch.js.map +1 -0
- package/dist/core/answerKinds.d.ts +32 -0
- package/dist/core/answerKinds.js +56 -0
- package/dist/core/answerKinds.js.map +1 -0
- package/dist/core/backend.d.ts +261 -0
- package/dist/core/backend.js +32 -0
- package/dist/core/backend.js.map +1 -0
- package/dist/core/commandOrder.d.ts +16 -0
- package/dist/core/commandOrder.js +17 -0
- package/dist/core/commandOrder.js.map +1 -0
- package/dist/core/commandRegistry.d.ts +120 -0
- package/dist/core/commandRegistry.js +124 -0
- package/dist/core/commandRegistry.js.map +1 -0
- package/dist/core/coreCommands.d.ts +16 -0
- package/dist/core/coreCommands.js +156 -0
- package/dist/core/coreCommands.js.map +1 -0
- package/dist/core/dispatch.d.ts +2 -19
- package/dist/core/dispatch.js +86 -447
- package/dist/core/dispatch.js.map +1 -1
- package/dist/core/elevation.d.ts +5 -5
- package/dist/core/elevation.js +12 -7
- package/dist/core/elevation.js.map +1 -1
- package/dist/core/engine.d.ts +28 -18
- package/dist/core/engine.js +44 -119
- package/dist/core/engine.js.map +1 -1
- package/dist/core/errorText.d.ts +14 -0
- package/dist/core/errorText.js +26 -0
- package/dist/core/errorText.js.map +1 -0
- package/dist/core/expansion.d.ts +0 -2
- package/dist/core/expansion.js +43 -101
- package/dist/core/expansion.js.map +1 -1
- package/dist/core/fileRefusal.d.ts +4 -15
- package/dist/core/fileRefusal.js +4 -26
- package/dist/core/fileRefusal.js.map +1 -1
- package/dist/core/filesystem.d.ts +27 -0
- package/dist/core/filesystem.js +45 -0
- package/dist/core/filesystem.js.map +1 -0
- package/dist/core/handlerRun.d.ts +30 -0
- package/dist/core/handlerRun.js +34 -0
- package/dist/core/handlerRun.js.map +1 -0
- package/dist/core/paths.d.ts +18 -0
- package/dist/core/paths.js +49 -0
- package/dist/core/paths.js.map +1 -0
- package/dist/core/preprocess.d.ts +1 -1
- package/dist/core/preprocess.js +1 -1
- package/dist/core/preprocess.js.map +1 -1
- package/dist/core/sink.d.ts +3 -25
- package/dist/core/sink.js +0 -8
- package/dist/core/sink.js.map +1 -1
- package/dist/core/surface.d.ts +3 -179
- package/dist/core/surface.js.map +1 -1
- package/dist/core/taskWatch.d.ts +42 -0
- package/dist/core/taskWatch.js +142 -0
- package/dist/core/taskWatch.js.map +1 -0
- package/dist/core/tasks.d.ts +46 -0
- package/dist/core/tasks.js +102 -0
- package/dist/core/tasks.js.map +1 -0
- package/dist/core.d.ts +22 -0
- package/dist/core.js +23 -0
- package/dist/core.js.map +1 -0
- package/dist/index.d.ts +8 -5
- package/dist/index.js +17 -5
- package/dist/index.js.map +1 -1
- package/dist/lib/completer/index.js +41 -99
- package/dist/lib/completer/index.js.map +1 -1
- package/dist/lib/prefetch.js +2 -2
- package/dist/lib/prefetch.js.map +1 -1
- package/dist/lib/vfs/listing.d.ts +1 -1
- package/dist/lib/vfs/providers/static.d.ts +15 -6
- package/dist/lib/vfs/providers/static.js +20 -43
- package/dist/lib/vfs/providers/static.js.map +1 -1
- package/dist/lib/vfs/providers/static_content.d.ts +4 -4
- package/dist/lib/vfs/providers/static_content.js +4 -24
- package/dist/lib/vfs/providers/static_content.js.map +1 -1
- package/dist/lib/vfs/vfs.d.ts +11 -2
- package/dist/lib/vfs/vfs.js +90 -51
- package/dist/lib/vfs/vfs.js.map +1 -1
- package/dist/lib/wildcard.d.ts +57 -0
- package/dist/lib/wildcard.js +183 -0
- package/dist/lib/wildcard.js.map +1 -0
- package/dist/notes.json +1 -1
- package/dist/null/backend.d.ts +29 -0
- package/dist/null/backend.js +41 -0
- package/dist/null/backend.js.map +1 -0
- package/dist/session/answer.d.ts +4 -4
- package/dist/session/answer.js +0 -2
- package/dist/session/answer.js.map +1 -1
- package/dist/session/index.d.ts +12 -10
- package/dist/session/index.js +9 -38
- package/dist/session/index.js.map +1 -1
- package/package.json +12 -6
- package/dist/builtins/fs/folderExists.d.ts +0 -8
- package/dist/builtins/fs/folderExists.js +0 -67
- package/dist/builtins/fs/folderExists.js.map +0 -1
- package/dist/command-keys.d.ts +0 -8
- package/dist/command-keys.js +0 -37
- package/dist/command-keys.js.map +0 -1
- package/dist/core/chiliDelegate.js.map +0 -1
- package/dist/core/connect.js.map +0 -1
- package/dist/core/jobsState.js.map +0 -1
- package/dist/core/promptContext.js.map +0 -1
- package/dist/lib/vfs/providers/binEntry.js.map +0 -1
- package/dist/universe/universeLayout.js.map +0 -1
- /package/dist/{lib/vfs/providers → chris}/binEntry.d.ts +0 -0
- /package/dist/{lib/vfs/providers → chris}/binEntry.js +0 -0
- /package/dist/{core → chris}/connect.d.ts +0 -0
- /package/dist/{core → chris}/connect.js +0 -0
- /package/dist/{core → chris}/jobsState.d.ts +0 -0
- /package/dist/{core → chris}/jobsState.js +0 -0
- /package/dist/{universe → chris}/universeLayout.d.ts +0 -0
- /package/dist/{universe → chris}/universeLayout.js +0 -0
package/dist/core/sink.js
CHANGED
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
* @module
|
|
23
23
|
*/
|
|
24
24
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
25
|
-
import { runtimeOutput_set } from '@fnndsc/cumin/runtime-output';
|
|
26
25
|
import { NullProgressRenderer } from './progress.js';
|
|
27
26
|
/**
|
|
28
27
|
* Sink that writes both channels to the process's standard output.
|
|
@@ -217,13 +216,6 @@ let hostSink = new StdoutSink();
|
|
|
217
216
|
* at once without their output stomping a shared global.
|
|
218
217
|
*/
|
|
219
218
|
const sinkScope = new AsyncLocalStorage();
|
|
220
|
-
// Lower layers report operational notices through Cumin's narrow port. The
|
|
221
|
-
// callback resolves the sink at write time, preserving each invocation's
|
|
222
|
-
// AsyncLocalStorage scope rather than pinning output to one terminal.
|
|
223
|
-
runtimeOutput_set({
|
|
224
|
-
data_write: (chunk) => { sink_get().data_write(chunk); },
|
|
225
|
-
err_write: (chunk) => { sink_get().err_write(chunk); },
|
|
226
|
-
});
|
|
227
219
|
/**
|
|
228
220
|
* Returns the sink in effect for the current async context.
|
|
229
221
|
*
|
package/dist/core/sink.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sink.js","sourceRoot":"","sources":["../../src/core/sink.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,
|
|
1
|
+
{"version":3,"file":"sink.js","sourceRoot":"","sources":["../../src/core/sink.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAA6C,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAQhG;;;;;GAKG;AACH,MAAM,OAAO,UAAU;IACJ,gBAAgB,CAAmB;IAEpD,YAAY,mBAAqC,IAAI,oBAAoB,EAAE;QACzE,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAC3C,CAAC;IAED,kBAAkB;IACX,UAAU,CAAC,KAAsB;QACtC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;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;AAED,0EAA0E;AAC1E,MAAM,YAAY,GAAW,yBAAyB,CAAC;AAEvD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AACxC,CAAC"}
|
package/dist/core/surface.d.ts
CHANGED
|
@@ -23,186 +23,10 @@
|
|
|
23
23
|
* @see docs/calypso.adoc — "Interactivity is a declared surface capability".
|
|
24
24
|
* @module
|
|
25
25
|
*/
|
|
26
|
-
/**
|
|
27
|
-
* What interaction an attached surface can provide.
|
|
28
|
-
*
|
|
29
|
-
* @property hiddenInput - The surface can read a line without echoing it
|
|
30
|
-
* (password entry).
|
|
31
|
-
* @property localEdit - The surface can open content in a local editor and
|
|
32
|
-
* return the edited result.
|
|
33
|
-
* @property tty - The surface is an interactive terminal (as opposed to a
|
|
34
|
-
* pipe, a script, or a headless host).
|
|
35
|
-
* @property color - The surface renders ANSI colour. A colour terminal and a
|
|
36
|
-
* browser console both do; a bare pipe or a file does not. A command that
|
|
37
|
-
* can render richly with colour and plainly without it — an image thumbnail
|
|
38
|
-
* as ANSI half-blocks or an ASCII ramp — reads this to choose, and the
|
|
39
|
-
* plain rendering is always the floor.
|
|
40
|
-
* @property pipeSegments - The surface can run a pipeline's non-first
|
|
41
|
-
* segments (`... | grep foo`) through its own tools. Nothing ever spawns on
|
|
42
|
-
* a daemon host: the local CLI runs segments in-process, a remote CLI runs
|
|
43
|
-
* them on the client machine, and a browser surface lacks the capability
|
|
44
|
-
* and fails such pipelines with a clear message.
|
|
45
|
-
* @property shellCommands - The surface can run a `!`-prefixed host-shell
|
|
46
|
-
* command on its own machine. A daemon delegates this capability to the
|
|
47
|
-
* command's originating surface and never launches the process itself.
|
|
48
|
-
* @property fileDelivery - The surface can put a file where its operator can
|
|
49
|
-
* reach it. What that means is the surface's business — a path on the local
|
|
50
|
-
* CLI's disk, a path on a remote CLI's client machine, a saved file in a
|
|
51
|
-
* browser — but never the daemon host's disk.
|
|
52
|
-
* @property engineFilesystem - The surface's operator sits at the same
|
|
53
|
-
* filesystem the engine runs on, so a path the engine resolves is a path
|
|
54
|
-
* they can open. True only for an in-process local shell. When false, a
|
|
55
|
-
* builtin that would write to disk must deliver through the surface instead,
|
|
56
|
-
* because the engine's disk is somebody else's machine.
|
|
57
|
-
* @property localFilesystem - The surface can put many files into a directory
|
|
58
|
-
* structure of its own. True for any shell, remote included; false for a
|
|
59
|
-
* browser, which has no directory to fill and can only accept files one at a
|
|
60
|
-
* time. It answers a different question from `engineFilesystem`: not *whose*
|
|
61
|
-
* disk, but whether there is one at all.
|
|
62
|
-
*/
|
|
63
|
-
export interface SurfaceCapabilities {
|
|
64
|
-
hiddenInput: boolean;
|
|
65
|
-
localEdit: boolean;
|
|
66
|
-
tty: boolean;
|
|
67
|
-
color: boolean;
|
|
68
|
-
pipeSegments: boolean;
|
|
69
|
-
shellCommands: boolean;
|
|
70
|
-
fileDelivery: boolean;
|
|
71
|
-
engineFilesystem: boolean;
|
|
72
|
-
localFilesystem: boolean;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* A request to prompt the user for a line of input.
|
|
76
|
-
*
|
|
77
|
-
* `wants` is what the question is asking FOR, so a surface can choose the
|
|
78
|
-
* instrument that answers it — a browser to walk for a location, a masked
|
|
79
|
-
* field for a secret, two capsules for a yes/no — rather than reading the
|
|
80
|
-
* wording and guessing. A terminal ignores all of it and reads a line,
|
|
81
|
-
* which is why every field beyond `message` is optional.
|
|
82
|
-
*
|
|
83
|
-
* @property message - The prompt text to display.
|
|
84
|
-
* @property hidden - When true, the entered text is not echoed; requires the
|
|
85
|
-
* `hiddenInput` capability. Kept beside `wants` because it is what an
|
|
86
|
-
* older surface reads.
|
|
87
|
-
* @property wants - The kind of value that answers this.
|
|
88
|
-
* @property path - Where browsing starts and what to compose, for a `path`.
|
|
89
|
-
* @property commit - The word the committing control should read.
|
|
90
|
-
*/
|
|
91
|
-
export interface PromptRequest {
|
|
92
|
-
message: string;
|
|
93
|
-
hidden?: boolean;
|
|
94
|
-
wants?: PromptKind;
|
|
95
|
-
path?: PromptPath;
|
|
96
|
-
commit?: string;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Content handed to a surface's local editor.
|
|
100
|
-
*
|
|
101
|
-
* @property content - The text to open in the editor.
|
|
102
|
-
* @property extension - Optional filename extension (e.g. `.txt`, `.json`) so
|
|
103
|
-
* the editor can apply the right syntax mode.
|
|
104
|
-
*/
|
|
105
|
-
export interface LocalEditRequest {
|
|
106
|
-
content: string;
|
|
107
|
-
extension?: string;
|
|
108
|
-
/** The file being edited; an editor that stays open saves back to it. */
|
|
109
|
-
path?: string;
|
|
110
|
-
}
|
|
111
26
|
export type { FileDeliverRequest, FileDeliverResult, PromptKind, PromptPath } from '@fnndsc/menu';
|
|
112
|
-
import type { FileDeliverRequest, FileDeliverResult
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
*
|
|
116
|
-
* @property content - The content after editing.
|
|
117
|
-
* @property changed - Whether the content differs from what was opened.
|
|
118
|
-
*/
|
|
119
|
-
export interface LocalEditResult {
|
|
120
|
-
content: string;
|
|
121
|
-
changed: boolean;
|
|
122
|
-
/**
|
|
123
|
-
* The surface opened an editor that stays open (a browser pane) instead of
|
|
124
|
-
* returning the edited text. The command has nothing to save: every save
|
|
125
|
-
* made in that editor runs as its own command line.
|
|
126
|
-
*/
|
|
127
|
-
opened?: boolean;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* The interaction seam a host installs. Builtins reach it through
|
|
131
|
-
* {@link surface_get}; hosts declare their capabilities and back the
|
|
132
|
-
* prompt and local-edit operations with whatever their surface supports.
|
|
133
|
-
*/
|
|
134
|
-
/** Another surface on the same session, as the host sees it. */
|
|
135
|
-
export interface SurfacePeer {
|
|
136
|
-
/** The host's name for it. */
|
|
137
|
-
id: string;
|
|
138
|
-
/** A terminal or a browser. */
|
|
139
|
-
kind: 'chell' | 'browser';
|
|
140
|
-
/** Whether it is the surface running the current command. */
|
|
141
|
-
you: boolean;
|
|
142
|
-
}
|
|
143
|
-
export interface Surface {
|
|
144
|
-
/** What this surface can do; read by builtins before they interact. */
|
|
145
|
-
readonly capabilities: SurfaceCapabilities;
|
|
146
|
-
/**
|
|
147
|
-
* The surfaces attached to this session, when the host knows of more than
|
|
148
|
-
* itself (a daemon does; a local shell is alone). Absent means unknown.
|
|
149
|
-
*/
|
|
150
|
-
peers?(): SurfacePeer[];
|
|
151
|
-
/**
|
|
152
|
-
* Prompts for a line of input.
|
|
153
|
-
*
|
|
154
|
-
* @param request - The prompt message and whether to hide the input.
|
|
155
|
-
* @returns The entered line, trimmed.
|
|
156
|
-
* @throws {CapabilityError} When hidden input is requested but the surface
|
|
157
|
-
* lacks the `hiddenInput` capability, or the surface cannot prompt.
|
|
158
|
-
*/
|
|
159
|
-
prompt(request: PromptRequest): Promise<string>;
|
|
160
|
-
/**
|
|
161
|
-
* Runs one pipeline segment against an input, returning its output. Where
|
|
162
|
-
* this runs is the surface's business — in-process for the local CLI, on
|
|
163
|
-
* the client machine for a remote CLI — but never on a daemon host.
|
|
164
|
-
*
|
|
165
|
-
* @param command - The segment command line (e.g. `grep foo`).
|
|
166
|
-
* @param input - The bytes to feed the segment on stdin.
|
|
167
|
-
* @returns The segment's stdout.
|
|
168
|
-
* @throws {CapabilityError} When the surface lacks the `pipeSegments`
|
|
169
|
-
* capability.
|
|
170
|
-
*/
|
|
171
|
-
pipeSegment(command: string, input: Buffer): Promise<Buffer>;
|
|
172
|
-
/**
|
|
173
|
-
* Runs one host-shell command on the surface machine.
|
|
174
|
-
*
|
|
175
|
-
* @param command - The shell command without the leading `!`.
|
|
176
|
-
* @returns The process exit code.
|
|
177
|
-
* @throws {CapabilityError} When the surface lacks `shellCommands`.
|
|
178
|
-
*/
|
|
179
|
-
shellCommand(command: string): Promise<number>;
|
|
180
|
-
/**
|
|
181
|
-
* Opens content in the surface's local editor and returns the result. The
|
|
182
|
-
* editor mechanics are the surface's business — a temp file and `$EDITOR`
|
|
183
|
-
* for the local CLI, the client's editor for a remote CLI, an editor
|
|
184
|
-
* component in a browser.
|
|
185
|
-
*
|
|
186
|
-
* @param request - The content to edit and an optional extension.
|
|
187
|
-
* @returns The edited content and whether it changed.
|
|
188
|
-
* @throws {CapabilityError} When the surface lacks the `localEdit`
|
|
189
|
-
* capability.
|
|
190
|
-
*/
|
|
191
|
-
localEdit(request: LocalEditRequest): Promise<LocalEditResult>;
|
|
192
|
-
/**
|
|
193
|
-
* Places one file where this surface's operator can reach it.
|
|
194
|
-
*
|
|
195
|
-
* The mechanics are the surface's: a write to the resolved path for the
|
|
196
|
-
* local CLI, a write on the client machine for a remote CLI, a saved file
|
|
197
|
-
* for a browser. A daemon never writes to its own disk on a surface's
|
|
198
|
-
* behalf, for the same reason it never spawns a shell there.
|
|
199
|
-
*
|
|
200
|
-
* @param request - What to deliver and where the operator asked for it.
|
|
201
|
-
* @returns Where it landed and how large it was.
|
|
202
|
-
* @throws {CapabilityError} When the surface lacks `fileDelivery`.
|
|
203
|
-
*/
|
|
204
|
-
fileDeliver(request: FileDeliverRequest): Promise<FileDeliverResult>;
|
|
205
|
-
}
|
|
27
|
+
import type { FileDeliverRequest, FileDeliverResult } from '@fnndsc/menu';
|
|
28
|
+
import type { SurfaceCapabilities, PromptRequest, LocalEditRequest, LocalEditResult, Surface } from '@fnndsc/menu/surface';
|
|
29
|
+
export type { SurfaceCapabilities, PromptRequest, LocalEditRequest, LocalEditResult, SurfacePeer, Surface } from '@fnndsc/menu/surface';
|
|
206
30
|
/**
|
|
207
31
|
* Raised when a builtin requests an interaction the attached surface cannot
|
|
208
32
|
* provide. Carries the capability name so a host can present it uniformly.
|
package/dist/core/surface.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surface.js","sourceRoot":"","sources":["../../src/core/surface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAw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c,EAAE,qCAAqC,CAAC,CAAC;IACnF,CAAC;CACF;AAED,0EAA0E;AAC1E,IAAI,aAAa,GAAY,IAAI,eAAe,EAAE,CAAC;AAEnD;;;;GAIG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO,aAAa,CAAC;AACvB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,OAAgB;IAC1C,MAAM,QAAQ,GAAY,aAAa,CAAC;IACxC,aAAa,GAAG,OAAO,CAAC;IACxB,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAChC,UAAqC,EACrC,OAAe;IAEf,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,eAAe,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Watching any backend's task: the core asks its source until the task
|
|
3
|
+
* is over, and tells every surface how the watch stands (`live`, `settled`,
|
|
4
|
+
* or `stale` when the source cannot answer).
|
|
5
|
+
*
|
|
6
|
+
* A backend that watches its own subjects (ChRIS's feeds) answers first; this
|
|
7
|
+
* watch is for a task the backend leaves to the core.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import { type WatchState } from '@fnndsc/menu';
|
|
12
|
+
import type { TaskSource } from './backend.js';
|
|
13
|
+
/** How soon a watched task is asked again while it changes, and at most how long between asks. */
|
|
14
|
+
export declare const TASK_WATCH_FLOOR_MS: number;
|
|
15
|
+
export declare const TASK_WATCH_CAP_MS: number;
|
|
16
|
+
/**
|
|
17
|
+
* The task a subject names: `/proc/<source>/<id>`, in one of the sources.
|
|
18
|
+
*
|
|
19
|
+
* @param subject - The subject.
|
|
20
|
+
* @param sources - The session's task sources.
|
|
21
|
+
* @returns The source and the task's id, or null when no source has that name.
|
|
22
|
+
*/
|
|
23
|
+
export declare function taskSubject_parse(subject: string, sources: ReadonlyArray<TaskSource>): {
|
|
24
|
+
source: TaskSource;
|
|
25
|
+
id: string;
|
|
26
|
+
} | null;
|
|
27
|
+
/**
|
|
28
|
+
* Starts or stops one owner's watch of a task.
|
|
29
|
+
*
|
|
30
|
+
* @param subject - The task's path, `/proc/<source>/<id>`.
|
|
31
|
+
* @param owner - Who watches (a surface).
|
|
32
|
+
* @param on - Start, or stop.
|
|
33
|
+
* @param sources - The session's task sources.
|
|
34
|
+
* @returns The watch's state, or null when the subject names no task source.
|
|
35
|
+
*/
|
|
36
|
+
export declare function taskWatch_set(subject: string, owner: string, on: boolean, sources: ReadonlyArray<TaskSource>): WatchState | null;
|
|
37
|
+
/**
|
|
38
|
+
* Ends every watch an owner holds (a surface that went away).
|
|
39
|
+
*
|
|
40
|
+
* @param owner - The owner.
|
|
41
|
+
*/
|
|
42
|
+
export declare function taskWatch_release(owner: string): void;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Watching any backend's task: the core asks its source until the task
|
|
3
|
+
* is over, and tells every surface how the watch stands (`live`, `settled`,
|
|
4
|
+
* or `stale` when the source cannot answer).
|
|
5
|
+
*
|
|
6
|
+
* A backend that watches its own subjects (ChRIS's feeds) answers first; this
|
|
7
|
+
* watch is for a task the backend leaves to the core.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import { taskState_isOver } from '@fnndsc/menu';
|
|
12
|
+
import { ambient_publish } from './ambient.js';
|
|
13
|
+
/** How soon a watched task is asked again while it changes, and at most how long between asks. */
|
|
14
|
+
export const TASK_WATCH_FLOOR_MS = 3000;
|
|
15
|
+
export const TASK_WATCH_CAP_MS = 30000;
|
|
16
|
+
const watches = new Map();
|
|
17
|
+
/**
|
|
18
|
+
* The task a subject names: `/proc/<source>/<id>`, in one of the sources.
|
|
19
|
+
*
|
|
20
|
+
* @param subject - The subject.
|
|
21
|
+
* @param sources - The session's task sources.
|
|
22
|
+
* @returns The source and the task's id, or null when no source has that name.
|
|
23
|
+
*/
|
|
24
|
+
export function taskSubject_parse(subject, sources) {
|
|
25
|
+
const match = /^\/proc\/([^/]+)\/([^/]+)\/?$/.exec(subject.trim());
|
|
26
|
+
if (match === null)
|
|
27
|
+
return null;
|
|
28
|
+
const source = sources.find((candidate) => candidate.id === match[1]);
|
|
29
|
+
return source === undefined ? null : { source, id: match[2] };
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Records a watch's state, and tells the surfaces when it changed.
|
|
33
|
+
*
|
|
34
|
+
* @param watch - The watch.
|
|
35
|
+
* @param state - Its state now.
|
|
36
|
+
*/
|
|
37
|
+
function state_set(watch, state) {
|
|
38
|
+
if (watch.state === state)
|
|
39
|
+
return;
|
|
40
|
+
watch.state = state;
|
|
41
|
+
ambient_publish({ kind: 'watched', subject: watch.subject, state });
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Asks the source once: over is settled (and the watch ends), a source that
|
|
45
|
+
* cannot answer or no longer has the task is stale, anything else live, asked
|
|
46
|
+
* again sooner when it changed.
|
|
47
|
+
*
|
|
48
|
+
* @param watch - The watch.
|
|
49
|
+
*/
|
|
50
|
+
async function watch_tick(watch) {
|
|
51
|
+
let task;
|
|
52
|
+
let answered = true;
|
|
53
|
+
try {
|
|
54
|
+
task = (await watch.source.list()).find((candidate) => candidate.id === watch.id);
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
answered = false;
|
|
58
|
+
}
|
|
59
|
+
if (!watches.has(watch.subject))
|
|
60
|
+
return;
|
|
61
|
+
if (!answered || task === undefined) {
|
|
62
|
+
state_set(watch, 'stale');
|
|
63
|
+
watch.delayMs = TASK_WATCH_CAP_MS;
|
|
64
|
+
}
|
|
65
|
+
else if (taskState_isOver(task.state)) {
|
|
66
|
+
state_set(watch, 'settled');
|
|
67
|
+
watch_stop(watch);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
const now = JSON.stringify(task);
|
|
72
|
+
const changed = now !== watch.last;
|
|
73
|
+
watch.last = now;
|
|
74
|
+
state_set(watch, 'live');
|
|
75
|
+
watch.delayMs = changed ? TASK_WATCH_FLOOR_MS : Math.min(TASK_WATCH_CAP_MS, watch.delayMs * 2);
|
|
76
|
+
}
|
|
77
|
+
watch.timer = setTimeout(() => {
|
|
78
|
+
watch.timer = null;
|
|
79
|
+
void watch_tick(watch);
|
|
80
|
+
}, watch.delayMs);
|
|
81
|
+
watch.timer.unref();
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Ends a watch.
|
|
85
|
+
*
|
|
86
|
+
* @param watch - The watch.
|
|
87
|
+
*/
|
|
88
|
+
function watch_stop(watch) {
|
|
89
|
+
if (watch.timer)
|
|
90
|
+
clearTimeout(watch.timer);
|
|
91
|
+
watch.timer = null;
|
|
92
|
+
watches.delete(watch.subject);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Starts or stops one owner's watch of a task.
|
|
96
|
+
*
|
|
97
|
+
* @param subject - The task's path, `/proc/<source>/<id>`.
|
|
98
|
+
* @param owner - Who watches (a surface).
|
|
99
|
+
* @param on - Start, or stop.
|
|
100
|
+
* @param sources - The session's task sources.
|
|
101
|
+
* @returns The watch's state, or null when the subject names no task source.
|
|
102
|
+
*/
|
|
103
|
+
export function taskWatch_set(subject, owner, on, sources) {
|
|
104
|
+
const named = taskSubject_parse(subject, sources);
|
|
105
|
+
if (named === null)
|
|
106
|
+
return null;
|
|
107
|
+
const key = `/proc/${named.source.id}/${named.id}`;
|
|
108
|
+
const existing = watches.get(key);
|
|
109
|
+
if (!on) {
|
|
110
|
+
if (existing) {
|
|
111
|
+
existing.owners.delete(owner);
|
|
112
|
+
if (existing.owners.size === 0)
|
|
113
|
+
watch_stop(existing);
|
|
114
|
+
return existing.state;
|
|
115
|
+
}
|
|
116
|
+
return 'settled';
|
|
117
|
+
}
|
|
118
|
+
if (existing) {
|
|
119
|
+
existing.owners.add(owner);
|
|
120
|
+
return existing.state;
|
|
121
|
+
}
|
|
122
|
+
const watch = {
|
|
123
|
+
subject: key, source: named.source, id: named.id, owners: new Set([owner]),
|
|
124
|
+
state: 'live', last: null, delayMs: TASK_WATCH_FLOOR_MS, timer: null,
|
|
125
|
+
};
|
|
126
|
+
watches.set(key, watch);
|
|
127
|
+
void watch_tick(watch);
|
|
128
|
+
return watch.state;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Ends every watch an owner holds (a surface that went away).
|
|
132
|
+
*
|
|
133
|
+
* @param owner - The owner.
|
|
134
|
+
*/
|
|
135
|
+
export function taskWatch_release(owner) {
|
|
136
|
+
for (const watch of Array.from(watches.values())) {
|
|
137
|
+
watch.owners.delete(owner);
|
|
138
|
+
if (watch.owners.size === 0)
|
|
139
|
+
watch_stop(watch);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=taskWatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"taskWatch.js","sourceRoot":"","sources":["../../src/core/taskWatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,gBAAgB,EAA8B,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,kGAAkG;AAClG,MAAM,CAAC,MAAM,mBAAmB,GAAW,IAAI,CAAC;AAChD,MAAM,CAAC,MAAM,iBAAiB,GAAW,KAAK,CAAC;AAe/C,MAAM,OAAO,GAA2B,IAAI,GAAG,EAAE,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAe,EAAE,OAAkC;IACnF,MAAM,KAAK,GAA4B,+BAA+B,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAC5F,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;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AC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC3B,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC;YAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file A backend's tasks as files: `/proc/<source>/<task>/` holds a task's
|
|
3
|
+
* fields, one file each, the way `/proc/jobs` holds a job's.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import { type Result, type VFSItem, type VFSProvider, type CpOptions, type VfsOutcome } from '@fnndsc/fond';
|
|
8
|
+
import type { Task } from '@fnndsc/menu';
|
|
9
|
+
import type { TaskSource } from './backend.js';
|
|
10
|
+
/** The files each task's folder holds, in listing order. */
|
|
11
|
+
export declare const TASK_FIELDS: ReadonlyArray<string>;
|
|
12
|
+
/**
|
|
13
|
+
* A task field's text, as its file reads.
|
|
14
|
+
*
|
|
15
|
+
* @param task - The task.
|
|
16
|
+
* @param field - The field.
|
|
17
|
+
* @returns The text (empty for a field the task has not got).
|
|
18
|
+
*/
|
|
19
|
+
export declare function taskField_text(task: Task, field: string): string;
|
|
20
|
+
/** One task source, mounted at `/proc/<id>`. */
|
|
21
|
+
export declare class TaskSourceVfsProvider implements VFSProvider {
|
|
22
|
+
private readonly source;
|
|
23
|
+
readonly prefix: string;
|
|
24
|
+
/**
|
|
25
|
+
* @param source - The source it shows.
|
|
26
|
+
*/
|
|
27
|
+
constructor(source: TaskSource);
|
|
28
|
+
/**
|
|
29
|
+
* The path's parts below the mount: none, a task, or a task's field.
|
|
30
|
+
*
|
|
31
|
+
* @param where - The path.
|
|
32
|
+
* @returns The parts.
|
|
33
|
+
*/
|
|
34
|
+
private parts_of;
|
|
35
|
+
/**
|
|
36
|
+
* A task by id, now.
|
|
37
|
+
*
|
|
38
|
+
* @param id - Its id.
|
|
39
|
+
* @returns It, or undefined.
|
|
40
|
+
*/
|
|
41
|
+
private task_get;
|
|
42
|
+
list(where: string): Promise<Result<VFSItem[]>>;
|
|
43
|
+
read(where: string): Promise<VfsOutcome<string>>;
|
|
44
|
+
readBinary(where: string): Promise<VfsOutcome<Buffer>>;
|
|
45
|
+
cp(_src: string, _dest: string, _options: CpOptions): Promise<VfsOutcome>;
|
|
46
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file A backend's tasks as files: `/proc/<source>/<task>/` holds a task's
|
|
3
|
+
* fields, one file each, the way `/proc/jobs` holds a job's.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import { Ok, Err, errorStack, vfs_ok, vfs_fail } from '@fnndsc/fond';
|
|
8
|
+
/** The files each task's folder holds, in listing order. */
|
|
9
|
+
export const TASK_FIELDS = ['label', 'state', 'progress', 'started', 'ended', 'log'];
|
|
10
|
+
/**
|
|
11
|
+
* A task field's text, as its file reads.
|
|
12
|
+
*
|
|
13
|
+
* @param task - The task.
|
|
14
|
+
* @param field - The field.
|
|
15
|
+
* @returns The text (empty for a field the task has not got).
|
|
16
|
+
*/
|
|
17
|
+
export function taskField_text(task, field) {
|
|
18
|
+
switch (field) {
|
|
19
|
+
case 'label': return `${task.label}\n`;
|
|
20
|
+
case 'state': return `${task.state}\n`;
|
|
21
|
+
case 'progress': {
|
|
22
|
+
if (task.progress === undefined)
|
|
23
|
+
return '';
|
|
24
|
+
const of = task.progress.total === null ? '' : `/${task.progress.total}`;
|
|
25
|
+
return `${task.progress.current}${of}${task.progress.unit ? ` ${task.progress.unit}` : ''}\n`;
|
|
26
|
+
}
|
|
27
|
+
case 'started': return task.started ? `${task.started}\n` : '';
|
|
28
|
+
case 'ended': return task.ended ? `${task.ended}\n` : '';
|
|
29
|
+
case 'log': return task.logTail ?? '';
|
|
30
|
+
default: return '';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/** One task source, mounted at `/proc/<id>`. */
|
|
34
|
+
export class TaskSourceVfsProvider {
|
|
35
|
+
source;
|
|
36
|
+
prefix;
|
|
37
|
+
/**
|
|
38
|
+
* @param source - The source it shows.
|
|
39
|
+
*/
|
|
40
|
+
constructor(source) {
|
|
41
|
+
this.source = source;
|
|
42
|
+
this.prefix = `/proc/${source.id}`;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The path's parts below the mount: none, a task, or a task's field.
|
|
46
|
+
*
|
|
47
|
+
* @param where - The path.
|
|
48
|
+
* @returns The parts.
|
|
49
|
+
*/
|
|
50
|
+
parts_of(where) {
|
|
51
|
+
return where.slice(this.prefix.length).split('/').filter(Boolean);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A task by id, now.
|
|
55
|
+
*
|
|
56
|
+
* @param id - Its id.
|
|
57
|
+
* @returns It, or undefined.
|
|
58
|
+
*/
|
|
59
|
+
async task_get(id) {
|
|
60
|
+
return (await this.source.list()).find((task) => task.id === id);
|
|
61
|
+
}
|
|
62
|
+
async list(where) {
|
|
63
|
+
const parts = this.parts_of(where);
|
|
64
|
+
const now = new Date().toISOString();
|
|
65
|
+
if (parts.length === 0) {
|
|
66
|
+
return Ok((await this.source.list()).map((task) => ({
|
|
67
|
+
name: task.id, type: 'dir', size: 0, owner: this.source.id, date: task.started ?? now,
|
|
68
|
+
})));
|
|
69
|
+
}
|
|
70
|
+
const task = parts.length === 1 ? await this.task_get(parts[0]) : undefined;
|
|
71
|
+
if (task === undefined) {
|
|
72
|
+
errorStack.stack_push('error', `Cannot list ${where}: No such file or directory`);
|
|
73
|
+
return Err();
|
|
74
|
+
}
|
|
75
|
+
return Ok(TASK_FIELDS.map((field) => ({
|
|
76
|
+
name: field, type: 'file', size: taskField_text(task, field).length, owner: this.source.id, date: task.started ?? now,
|
|
77
|
+
})));
|
|
78
|
+
}
|
|
79
|
+
async read(where) {
|
|
80
|
+
const parts = this.parts_of(where);
|
|
81
|
+
if (parts.length < 2)
|
|
82
|
+
return vfs_fail(parts.length === 0 ? 'EISDIR' : (await this.task_get(parts[0])) ? 'EISDIR' : 'ENOENT');
|
|
83
|
+
const [id, field] = parts;
|
|
84
|
+
const task = await this.task_get(id);
|
|
85
|
+
if (task === undefined || parts.length > 2 || !TASK_FIELDS.includes(field))
|
|
86
|
+
return vfs_fail('ENOENT');
|
|
87
|
+
if (field === 'log' && this.source.log) {
|
|
88
|
+
const whole = await this.source.log(id);
|
|
89
|
+
if (whole !== null)
|
|
90
|
+
return vfs_ok(whole);
|
|
91
|
+
}
|
|
92
|
+
return vfs_ok(taskField_text(task, field));
|
|
93
|
+
}
|
|
94
|
+
async readBinary(where) {
|
|
95
|
+
const text = await this.read(where);
|
|
96
|
+
return text.ok ? vfs_ok(Buffer.from(text.value, 'utf-8')) : text;
|
|
97
|
+
}
|
|
98
|
+
async cp(_src, _dest, _options) {
|
|
99
|
+
return vfs_fail('EROFS', `cp: a task is not copied: ${this.prefix} is the ${this.source.label}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=tasks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tasks.js","sourceRoot":"","sources":["../../src/core/tasks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAgF,MAAM,cAAc,CAAC;AAInJ,4DAA4D;AAC5D,MAAM,CAAC,MAAM,WAAW,GAA0B,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAE5G;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,IAAU,EAAE,KAAa;IACtD,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,OAAO,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC;QACvC,KAAK,OAAO,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,KA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cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,KAAa;QAC5B,MAAM,IAAI,GAAuB,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACxD,OAAO,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACnE,CAAC;IAED,KAAK,CAAC,EAAE,CAAC,IAAY,EAAE,KAAa,EAAE,QAAmB;QACvD,OAAO,QAAQ,CAAC,OAAO,EAAE,6BAA6B,IAAI,CAAC,MAAM,WAAW,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IACnG,CAAC;CACF"}
|
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file `@fnndsc/brasa/core`: the engine with no backend installed.
|
|
3
|
+
*
|
|
4
|
+
* The package root installs ChRIS for every consumer. This entry installs
|
|
5
|
+
* nothing: a host hands `engine_create` the backend its session runs over
|
|
6
|
+
* (the null backend here, or its own), and none of the ChRIS packages load
|
|
7
|
+
* unless that backend loads them.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
export * from './core/engine.js';
|
|
12
|
+
export * from './core/dispatch.js';
|
|
13
|
+
export * from './core/backend.js';
|
|
14
|
+
export * from './core/sink.js';
|
|
15
|
+
export * from './core/surface.js';
|
|
16
|
+
export * from './core/question.js';
|
|
17
|
+
export * from './core/progress.js';
|
|
18
|
+
export * from './core/commandRegistry.js';
|
|
19
|
+
export * from './core/tasks.js';
|
|
20
|
+
export * from './core/version.js';
|
|
21
|
+
export * from './logo/brain.js';
|
|
22
|
+
export { nullBackend_make, type NullBackendOptions } from './null/backend.js';
|
package/dist/core.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file `@fnndsc/brasa/core`: the engine with no backend installed.
|
|
3
|
+
*
|
|
4
|
+
* The package root installs ChRIS for every consumer. This entry installs
|
|
5
|
+
* nothing: a host hands `engine_create` the backend its session runs over
|
|
6
|
+
* (the null backend here, or its own), and none of the ChRIS packages load
|
|
7
|
+
* unless that backend loads them.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
export * from './core/engine.js';
|
|
12
|
+
export * from './core/dispatch.js';
|
|
13
|
+
export * from './core/backend.js';
|
|
14
|
+
export * from './core/sink.js';
|
|
15
|
+
export * from './core/surface.js';
|
|
16
|
+
export * from './core/question.js';
|
|
17
|
+
export * from './core/progress.js';
|
|
18
|
+
export * from './core/commandRegistry.js';
|
|
19
|
+
export * from './core/tasks.js';
|
|
20
|
+
export * from './core/version.js';
|
|
21
|
+
export * from './logo/brain.js';
|
|
22
|
+
export { nullBackend_make } from './null/backend.js';
|
|
23
|
+
//# sourceMappingURL=core.js.map
|
package/dist/core.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAA2B,MAAM,mBAAmB,CAAC"}
|