@fnndsc/chell 4.4.0 → 5.0.1

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.
Files changed (248) hide show
  1. package/dist/builtins/sys/prompt.js +2 -2
  2. package/dist/builtins/sys/prompt.js.map +1 -1
  3. package/dist/chell.d.ts +2 -2
  4. package/dist/chell.js +2 -2
  5. package/dist/chell.js.map +1 -1
  6. package/dist/config/settings.d.ts +4 -2
  7. package/dist/config/settings.js +7 -2
  8. package/dist/config/settings.js.map +1 -1
  9. package/dist/core/boot.js +49 -60
  10. package/dist/core/boot.js.map +1 -1
  11. package/dist/core/cliSurface.d.ts +1 -1
  12. package/dist/core/cliSurface.js +1 -1
  13. package/dist/core/cliSurface.js.map +1 -1
  14. package/dist/core/progressRenderer.d.ts +2 -2
  15. package/dist/core/prompt/session.d.ts +26 -1
  16. package/dist/core/prompt/session.js +25 -20
  17. package/dist/core/prompt/session.js.map +1 -1
  18. package/dist/core/repl.d.ts +2 -2
  19. package/dist/core/repl.js +6 -4
  20. package/dist/core/repl.js.map +1 -1
  21. package/dist/core/surfaceDispatch.d.ts +21 -0
  22. package/dist/core/surfaceDispatch.js +33 -0
  23. package/dist/core/surfaceDispatch.js.map +1 -0
  24. package/dist/remote/client.js +2 -2
  25. package/dist/remote/client.js.map +1 -1
  26. package/dist/remote/remoteEngine.d.ts +3 -3
  27. package/dist/remote/remoteEngine.js +7 -4
  28. package/dist/remote/remoteEngine.js.map +1 -1
  29. package/package.json +6 -6
  30. package/dist/builtins/debug.d.ts +0 -8
  31. package/dist/builtins/debug.js +0 -39
  32. package/dist/builtins/debug.js.map +0 -1
  33. package/dist/builtins/executable.d.ts +0 -22
  34. package/dist/builtins/executable.js +0 -115
  35. package/dist/builtins/executable.js.map +0 -1
  36. package/dist/builtins/fs/cat.d.ts +0 -16
  37. package/dist/builtins/fs/cat.js +0 -266
  38. package/dist/builtins/fs/cat.js.map +0 -1
  39. package/dist/builtins/fs/cd.d.ts +0 -42
  40. package/dist/builtins/fs/cd.js +0 -193
  41. package/dist/builtins/fs/cd.js.map +0 -1
  42. package/dist/builtins/fs/cp.d.ts +0 -10
  43. package/dist/builtins/fs/cp.js +0 -86
  44. package/dist/builtins/fs/cp.js.map +0 -1
  45. package/dist/builtins/fs/download.d.ts +0 -6
  46. package/dist/builtins/fs/download.js +0 -45
  47. package/dist/builtins/fs/download.js.map +0 -1
  48. package/dist/builtins/fs/du.d.ts +0 -58
  49. package/dist/builtins/fs/du.js +0 -210
  50. package/dist/builtins/fs/du.js.map +0 -1
  51. package/dist/builtins/fs/edit.d.ts +0 -7
  52. package/dist/builtins/fs/edit.js +0 -104
  53. package/dist/builtins/fs/edit.js.map +0 -1
  54. package/dist/builtins/fs/ls.d.ts +0 -8
  55. package/dist/builtins/fs/ls.js +0 -68
  56. package/dist/builtins/fs/ls.js.map +0 -1
  57. package/dist/builtins/fs/mkdir.d.ts +0 -9
  58. package/dist/builtins/fs/mkdir.js +0 -52
  59. package/dist/builtins/fs/mkdir.js.map +0 -1
  60. package/dist/builtins/fs/mv.d.ts +0 -10
  61. package/dist/builtins/fs/mv.js +0 -88
  62. package/dist/builtins/fs/mv.js.map +0 -1
  63. package/dist/builtins/fs/pull.args.d.ts +0 -22
  64. package/dist/builtins/fs/pull.args.js +0 -30
  65. package/dist/builtins/fs/pull.args.js.map +0 -1
  66. package/dist/builtins/fs/pull.d.ts +0 -26
  67. package/dist/builtins/fs/pull.js +0 -445
  68. package/dist/builtins/fs/pull.js.map +0 -1
  69. package/dist/builtins/fs/pwd.d.ts +0 -10
  70. package/dist/builtins/fs/pwd.js +0 -73
  71. package/dist/builtins/fs/pwd.js.map +0 -1
  72. package/dist/builtins/fs/rm.d.ts +0 -37
  73. package/dist/builtins/fs/rm.js +0 -197
  74. package/dist/builtins/fs/rm.js.map +0 -1
  75. package/dist/builtins/fs/touch.d.ts +0 -9
  76. package/dist/builtins/fs/touch.js +0 -76
  77. package/dist/builtins/fs/touch.js.map +0 -1
  78. package/dist/builtins/fs/tree.d.ts +0 -15
  79. package/dist/builtins/fs/tree.js +0 -84
  80. package/dist/builtins/fs/tree.js.map +0 -1
  81. package/dist/builtins/fs/upload.d.ts +0 -6
  82. package/dist/builtins/fs/upload.js +0 -48
  83. package/dist/builtins/fs/upload.js.map +0 -1
  84. package/dist/builtins/help.d.ts +0 -74
  85. package/dist/builtins/help.js +0 -1217
  86. package/dist/builtins/help.js.map +0 -1
  87. package/dist/builtins/index.d.ts +0 -46
  88. package/dist/builtins/index.js +0 -46
  89. package/dist/builtins/index.js.map +0 -1
  90. package/dist/builtins/net/connect.d.ts +0 -7
  91. package/dist/builtins/net/connect.js +0 -42
  92. package/dist/builtins/net/connect.js.map +0 -1
  93. package/dist/builtins/net/cubepath.d.ts +0 -18
  94. package/dist/builtins/net/cubepath.js +0 -102
  95. package/dist/builtins/net/cubepath.js.map +0 -1
  96. package/dist/builtins/net/logout.d.ts +0 -6
  97. package/dist/builtins/net/logout.js +0 -24
  98. package/dist/builtins/net/logout.js.map +0 -1
  99. package/dist/builtins/net/pacs.d.ts +0 -24
  100. package/dist/builtins/net/pacs.js +0 -121
  101. package/dist/builtins/net/pacs.js.map +0 -1
  102. package/dist/builtins/net/pacsUtils.d.ts +0 -85
  103. package/dist/builtins/net/pacsUtils.js +0 -184
  104. package/dist/builtins/net/pacsUtils.js.map +0 -1
  105. package/dist/builtins/net/query.d.ts +0 -60
  106. package/dist/builtins/net/query.js +0 -324
  107. package/dist/builtins/net/query.js.map +0 -1
  108. package/dist/builtins/parametersofplugin.d.ts +0 -13
  109. package/dist/builtins/parametersofplugin.js +0 -43
  110. package/dist/builtins/parametersofplugin.js.map +0 -1
  111. package/dist/builtins/pluginExecute.d.ts +0 -27
  112. package/dist/builtins/pluginExecute.js +0 -165
  113. package/dist/builtins/pluginExecute.js.map +0 -1
  114. package/dist/builtins/proc.d.ts +0 -6
  115. package/dist/builtins/proc.helpers.d.ts +0 -68
  116. package/dist/builtins/proc.helpers.js +0 -102
  117. package/dist/builtins/proc.helpers.js.map +0 -1
  118. package/dist/builtins/proc.js +0 -289
  119. package/dist/builtins/proc.js.map +0 -1
  120. package/dist/builtins/res/compute.d.ts +0 -6
  121. package/dist/builtins/res/compute.js +0 -55
  122. package/dist/builtins/res/compute.js.map +0 -1
  123. package/dist/builtins/res/feed.d.ts +0 -6
  124. package/dist/builtins/res/feed.js +0 -244
  125. package/dist/builtins/res/feed.js.map +0 -1
  126. package/dist/builtins/res/feed.notes.d.ts +0 -28
  127. package/dist/builtins/res/feed.notes.js +0 -24
  128. package/dist/builtins/res/feed.notes.js.map +0 -1
  129. package/dist/builtins/res/files.d.ts +0 -18
  130. package/dist/builtins/res/files.js +0 -85
  131. package/dist/builtins/res/files.js.map +0 -1
  132. package/dist/builtins/res/group.d.ts +0 -6
  133. package/dist/builtins/res/group.js +0 -54
  134. package/dist/builtins/res/group.js.map +0 -1
  135. package/dist/builtins/res/pipeline.args.d.ts +0 -22
  136. package/dist/builtins/res/pipeline.args.js +0 -28
  137. package/dist/builtins/res/pipeline.args.js.map +0 -1
  138. package/dist/builtins/res/pipeline.d.ts +0 -20
  139. package/dist/builtins/res/pipeline.js +0 -252
  140. package/dist/builtins/res/pipeline.js.map +0 -1
  141. package/dist/builtins/res/plugin.d.ts +0 -13
  142. package/dist/builtins/res/plugin.js +0 -140
  143. package/dist/builtins/res/plugin.js.map +0 -1
  144. package/dist/builtins/res/plugininstance.d.ts +0 -6
  145. package/dist/builtins/res/plugininstance.js +0 -53
  146. package/dist/builtins/res/plugininstance.js.map +0 -1
  147. package/dist/builtins/res/pluginmeta.d.ts +0 -6
  148. package/dist/builtins/res/pluginmeta.js +0 -53
  149. package/dist/builtins/res/pluginmeta.js.map +0 -1
  150. package/dist/builtins/res/tag.d.ts +0 -6
  151. package/dist/builtins/res/tag.js +0 -53
  152. package/dist/builtins/res/tag.js.map +0 -1
  153. package/dist/builtins/res/workflow.d.ts +0 -6
  154. package/dist/builtins/res/workflow.js +0 -53
  155. package/dist/builtins/res/workflow.js.map +0 -1
  156. package/dist/builtins/store.d.ts +0 -6
  157. package/dist/builtins/store.js +0 -108
  158. package/dist/builtins/store.js.map +0 -1
  159. package/dist/builtins/sys/context.d.ts +0 -6
  160. package/dist/builtins/sys/context.js +0 -50
  161. package/dist/builtins/sys/context.js.map +0 -1
  162. package/dist/builtins/sys/physicalmode.d.ts +0 -8
  163. package/dist/builtins/sys/physicalmode.js +0 -34
  164. package/dist/builtins/sys/physicalmode.js.map +0 -1
  165. package/dist/builtins/sys/timing.d.ts +0 -8
  166. package/dist/builtins/sys/timing.js +0 -34
  167. package/dist/builtins/sys/timing.js.map +0 -1
  168. package/dist/builtins/sys/version.d.ts +0 -15
  169. package/dist/builtins/sys/version.js +0 -23
  170. package/dist/builtins/sys/version.js.map +0 -1
  171. package/dist/builtins/sys/whoami.d.ts +0 -17
  172. package/dist/builtins/sys/whoami.js +0 -44
  173. package/dist/builtins/sys/whoami.js.map +0 -1
  174. package/dist/builtins/utils.d.ts +0 -55
  175. package/dist/builtins/utils.js +0 -145
  176. package/dist/builtins/utils.js.map +0 -1
  177. package/dist/builtins/wildcard.d.ts +0 -26
  178. package/dist/builtins/wildcard.js +0 -120
  179. package/dist/builtins/wildcard.js.map +0 -1
  180. package/dist/calypso.d.ts +0 -13
  181. package/dist/calypso.js +0 -44
  182. package/dist/calypso.js.map +0 -1
  183. package/dist/command-keys.d.ts +0 -8
  184. package/dist/command-keys.js +0 -32
  185. package/dist/command-keys.js.map +0 -1
  186. package/dist/core/dispatch.d.ts +0 -101
  187. package/dist/core/dispatch.js +0 -636
  188. package/dist/core/dispatch.js.map +0 -1
  189. package/dist/core/engine.d.ts +0 -91
  190. package/dist/core/engine.js +0 -222
  191. package/dist/core/engine.js.map +0 -1
  192. package/dist/core/preprocess.d.ts +0 -46
  193. package/dist/core/preprocess.js +0 -146
  194. package/dist/core/preprocess.js.map +0 -1
  195. package/dist/core/progress.d.ts +0 -25
  196. package/dist/core/progress.js +0 -10
  197. package/dist/core/progress.js.map +0 -1
  198. package/dist/core/question.d.ts +0 -27
  199. package/dist/core/question.js +0 -33
  200. package/dist/core/question.js.map +0 -1
  201. package/dist/core/sink.d.ts +0 -201
  202. package/dist/core/sink.js +0 -300
  203. package/dist/core/sink.js.map +0 -1
  204. package/dist/core/surface.d.ts +0 -172
  205. package/dist/core/surface.js +0 -105
  206. package/dist/core/surface.js.map +0 -1
  207. package/dist/core/version.d.ts +0 -20
  208. package/dist/core/version.js +0 -82
  209. package/dist/core/version.js.map +0 -1
  210. package/dist/daemon/launch.d.ts +0 -9
  211. package/dist/daemon/launch.js +0 -82
  212. package/dist/daemon/launch.js.map +0 -1
  213. package/dist/lib/completer/index.d.ts +0 -15
  214. package/dist/lib/completer/index.js +0 -212
  215. package/dist/lib/completer/index.js.map +0 -1
  216. package/dist/lib/completer/pathComplete.helpers.d.ts +0 -22
  217. package/dist/lib/completer/pathComplete.helpers.js +0 -49
  218. package/dist/lib/completer/pathComplete.helpers.js.map +0 -1
  219. package/dist/lib/parser.d.ts +0 -13
  220. package/dist/lib/parser.js +0 -52
  221. package/dist/lib/parser.js.map +0 -1
  222. package/dist/lib/pipe.d.ts +0 -11
  223. package/dist/lib/pipe.js +0 -90
  224. package/dist/lib/pipe.js.map +0 -1
  225. package/dist/lib/prefetch.d.ts +0 -25
  226. package/dist/lib/prefetch.js +0 -64
  227. package/dist/lib/prefetch.js.map +0 -1
  228. package/dist/lib/semicolonParser.d.ts +0 -22
  229. package/dist/lib/semicolonParser.js +0 -53
  230. package/dist/lib/semicolonParser.js.map +0 -1
  231. package/dist/lib/spinner.d.ts +0 -23
  232. package/dist/lib/spinner.js +0 -71
  233. package/dist/lib/spinner.js.map +0 -1
  234. package/dist/lib/vfs/providers/static.d.ts +0 -65
  235. package/dist/lib/vfs/providers/static.js +0 -164
  236. package/dist/lib/vfs/providers/static.js.map +0 -1
  237. package/dist/lib/vfs/providers/static_content.d.ts +0 -27
  238. package/dist/lib/vfs/providers/static_content.js +0 -180
  239. package/dist/lib/vfs/providers/static_content.js.map +0 -1
  240. package/dist/lib/vfs/vfs.d.ts +0 -59
  241. package/dist/lib/vfs/vfs.js +0 -202
  242. package/dist/lib/vfs/vfs.js.map +0 -1
  243. package/dist/remote/discovery.d.ts +0 -23
  244. package/dist/remote/discovery.js +0 -55
  245. package/dist/remote/discovery.js.map +0 -1
  246. package/dist/session/index.d.ts +0 -76
  247. package/dist/session/index.js +0 -120
  248. package/dist/session/index.js.map +0 -1
@@ -1,164 +0,0 @@
1
- /**
2
- * @file Static Virtual File System Provider.
3
- *
4
- * Implements virtual directories for `/bin`, `/usr`, and `/usr/bin` under the VFSDispatcher.
5
- *
6
- * @module
7
- */
8
- import { Ok, Err, errorStack } from '@fnndsc/cumin';
9
- import { plugins_listAll, pipelines_getAll } from '@fnndsc/salsa';
10
- import { builtinCommands_list } from '../../../builtins/help.js';
11
- import { staticVfs_read, staticVfs_readBinary } from './static_content.js';
12
- /**
13
- * Static virtual filesystem provider for command and builtin paths.
14
- */
15
- export class StaticVfsProvider {
16
- /** The prefix path this provider handles. */
17
- prefix;
18
- /**
19
- * Initializes the static provider with its target prefix path.
20
- *
21
- * @param prefix - The absolute virtual directory prefix.
22
- */
23
- constructor(prefix) {
24
- this.prefix = prefix;
25
- }
26
- /**
27
- * Lists the contents of the matched static prefix path.
28
- *
29
- * @param pathStr - The absolute path.
30
- * @param options - Sort controls.
31
- * @returns Promise resolving to Result of VFSItems.
32
- */
33
- async list(pathStr, options) {
34
- try {
35
- let effectivePath = pathStr.startsWith("/") ? pathStr : "/" + pathStr;
36
- if (effectivePath.length > 1 && effectivePath.endsWith("/")) {
37
- effectivePath = effectivePath.slice(0, -1);
38
- }
39
- if (effectivePath === "/bin") {
40
- const [plugins, pipelinesResult] = await Promise.all([
41
- plugins_listAll({}),
42
- pipelines_getAll(),
43
- ]);
44
- const items = [];
45
- if (plugins && plugins.tableData) {
46
- plugins.tableData.forEach((plugin) => {
47
- const pluginName = typeof plugin.name === 'string' ? plugin.name : String(plugin.name);
48
- const pluginVersion = typeof plugin.version === 'string' ? plugin.version : String(plugin.version || '');
49
- const displayName = pluginVersion ? `${pluginName}-v${pluginVersion}` : pluginName;
50
- items.push({
51
- name: displayName,
52
- type: "plugin",
53
- size: 0,
54
- owner: "system",
55
- date: typeof plugin.creation_date === 'string' ? plugin.creation_date : '',
56
- });
57
- });
58
- }
59
- if (pipelinesResult.ok) {
60
- pipelinesResult.value.forEach((pipeline) => {
61
- const slug = typeof pipeline.slug === 'string' ? pipeline.slug : pipeline.name.replace(/\s+/g, '_');
62
- items.push({
63
- name: slug,
64
- type: "pipeline",
65
- size: 0,
66
- owner: typeof pipeline.authors === 'string' ? pipeline.authors : 'system',
67
- date: '',
68
- title: pipeline.name,
69
- });
70
- });
71
- }
72
- const sorted = this.staticVfsItems_sort(items, options?.sort, options?.reverse);
73
- return Ok(sorted);
74
- }
75
- if (effectivePath === "/usr") {
76
- const items = [
77
- {
78
- name: "bin",
79
- type: "vfs",
80
- size: 0,
81
- owner: "root",
82
- date: new Date().toISOString(),
83
- }
84
- ];
85
- return Ok(items);
86
- }
87
- if (effectivePath === "/usr/bin") {
88
- const builtinNames = builtinCommands_list();
89
- const items = builtinNames.map((name) => ({
90
- name,
91
- type: "plugin",
92
- size: 0,
93
- owner: "system",
94
- date: new Date().toISOString(),
95
- }));
96
- const sorted = this.staticVfsItems_sort(items, options?.sort, options?.reverse);
97
- return Ok(sorted);
98
- }
99
- return Ok([]);
100
- }
101
- catch (error) {
102
- const msg = error instanceof Error ? error.message : String(error);
103
- errorStack.stack_push("error", `Static VFS list failed for prefix ${this.prefix}: ${msg}`);
104
- return Err();
105
- }
106
- }
107
- /**
108
- * Block copy operations for static paths.
109
- *
110
- * @param src - Source path.
111
- * @param dest - Destination path.
112
- * @param options - Copy options.
113
- * @returns Promise resolving to false always to block copying.
114
- */
115
- async cp(src, dest, options) {
116
- errorStack.stack_push("error", `cp: Copying from static VFS path '${src}' is not supported.`);
117
- return false;
118
- }
119
- /**
120
- * Standard sort helper for virtual items.
121
- *
122
- * @param items - The VFSItem array to sort.
123
- * @param sortField - Field to sort by.
124
- * @param reverse - True to reverse output sorting.
125
- * @returns Sorted VFSItem array.
126
- */
127
- staticVfsItems_sort(items, sortField, reverse) {
128
- const field = sortField || "name";
129
- const sorted = [...items].sort((a, b) => {
130
- const valA = a[field];
131
- const valB = b[field];
132
- if (typeof valA === "string" && typeof valB === "string") {
133
- return valA.localeCompare(valB);
134
- }
135
- if (typeof valA === "number" && typeof valB === "number") {
136
- return valA - valB;
137
- }
138
- return 0;
139
- });
140
- if (reverse) {
141
- sorted.reverse();
142
- }
143
- return sorted;
144
- }
145
- /**
146
- * Reads virtual file content under command and builtin static paths.
147
- *
148
- * @param pathStr - The absolute virtual path of the file to read.
149
- * @returns Promise resolving to a Result containing the file contents.
150
- */
151
- async read(pathStr) {
152
- return staticVfs_read(pathStr, this.prefix);
153
- }
154
- /**
155
- * Reads virtual file binary content under command and builtin static paths.
156
- *
157
- * @param pathStr - The absolute virtual path of the file to read.
158
- * @returns Promise resolving to a Result containing the file contents as a Buffer.
159
- */
160
- async readBinary(pathStr) {
161
- return staticVfs_readBinary(pathStr, this.prefix);
162
- }
163
- }
164
- //# sourceMappingURL=static.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"static.js","sourceRoot":"","sources":["../../../../src/lib/vfs/providers/static.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAU,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAmC,eAAe,EAAE,gBAAgB,EAAkB,MAAM,eAAe,CAAC;AACnH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3E;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAC5B,6CAA6C;IAC7C,MAAM,CAAS;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AAE,qCAAqC,GAAG,qBAAqB,CAAC,CAAC;QAC9F,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;;;OAOG;IACK,mBAAmB,CACzB,KAAgB,EAChB,SAA8C,EAC9C,OAAiB;QAEjB,MAAM,KAAK,GAAkB,SAAS,IAAI,MAAM,CAAC;QACjD,MAAM,MAAM,GAAc,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAU,EAAE,CAAU,EAAE,EAAE;YACnE,MAAM,IAAI,GAAoB,CAAC,CAAC,KAAK,CAAC,CAAC;YACvC,MAAM,IAAI,GAAoB,CAAC,CAAC,KAAK,CAAC,CAAC;YACvC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACzD,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YAClC,CAAC;YACD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACzD,OAAQ,IAAe,GAAI,IAAe,CAAC;YAC7C,CAAC;YACD,OAAO,CAAC,CAAC;QACX,CAAC,CAAC,CAAC;QACH,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CAAC,OAAe;QACxB,OAAO,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,UAAU,CAAC,OAAe;QAC9B,OAAO,oBAAoB,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACpD,CAAC;CACF"}
@@ -1,27 +0,0 @@
1
- /**
2
- * @file Static VFS Content Handler.
3
- *
4
- * Implements specialized virtual file reading and content generation
5
- * for static command directories (/bin, /usr/bin).
6
- *
7
- * @module
8
- */
9
- import { Result } from '@fnndsc/cumin';
10
- /**
11
- * Reads virtual file content under command and builtin static paths.
12
- *
13
- * Handles help text formatting for /usr/bin and fetches parameter specifications for /bin plugins.
14
- *
15
- * @param pathStr - The absolute virtual path of the file to read.
16
- * @param prefix - The prefix of the calling provider (e.g. '/usr/bin', '/bin').
17
- * @returns Promise resolving to a Result containing the file contents as a string.
18
- */
19
- export declare function staticVfs_read(pathStr: string, prefix: string): Promise<Result<string>>;
20
- /**
21
- * Reads virtual file binary content under command and builtin static paths.
22
- *
23
- * @param pathStr - The absolute virtual path of the file to read.
24
- * @param prefix - The prefix of the calling provider.
25
- * @returns Promise resolving to a Result containing the file contents as a Buffer.
26
- */
27
- export declare function staticVfs_readBinary(pathStr: string, prefix: string): Promise<Result<Buffer>>;
@@ -1,180 +0,0 @@
1
- /**
2
- * @file Static VFS Content Handler.
3
- *
4
- * Implements specialized virtual file reading and content generation
5
- * for static command directories (/bin, /usr/bin).
6
- *
7
- * @module
8
- */
9
- import { Ok, Err, errorStack, pipeline_resolve } from '@fnndsc/cumin';
10
- import { commandHelp_get } from '../../../builtins/help.js';
11
- import { pipeline_sourceGet } from '@fnndsc/salsa';
12
- import chalk from 'chalk';
13
- import { session } from '../../../session/index.js';
14
- /**
15
- * Formats a plugin parameter list into a beautifully aligned text manual.
16
- *
17
- * @param plugin - The resolved ChRIS plugin object.
18
- * @param parameters - Array of plugin parameters.
19
- * @param command - The exact plugin command/filename.
20
- * @returns Formatted details string.
21
- */
22
- function pluginParameters_render(plugin, parameters, command) {
23
- const lines = [];
24
- lines.push('');
25
- lines.push(chalk.bold.magenta(`${plugin.data.name.toUpperCase()} (Version ${plugin.data.version})`));
26
- lines.push(chalk.gray('─'.repeat(74)));
27
- lines.push(`${chalk.bold.blue('Type:')} ${plugin.data.type || 'ds'}`);
28
- lines.push(`${chalk.bold.blue('Author:')} ${plugin.data.authors || 'FNNDSC <dev@babymri.org>'}`);
29
- if (plugin.data.documentation) {
30
- lines.push(`${chalk.bold.blue('Repository:')} ${plugin.data.documentation}`);
31
- }
32
- lines.push('');
33
- lines.push(chalk.bold.blue('DESCRIPTION'));
34
- lines.push(` ${plugin.data.description || 'No description provided.'}`);
35
- lines.push('');
36
- lines.push(chalk.bold.blue('PARAMETERS'));
37
- lines.push(` ${chalk.bold.white('Flag'.padEnd(22))}${chalk.bold.white('Type'.padEnd(11))}${chalk.bold.white('Required'.padEnd(11))}${chalk.bold.white('Default'.padEnd(13))}${chalk.bold.white('Description')}`);
38
- lines.push(` ${chalk.gray('─'.repeat(74))}`);
39
- parameters.forEach((param) => {
40
- const flag = `--${param.data.name}`;
41
- const type = param.data.type || 'string';
42
- const required = param.data.optional ? 'No' : 'Yes';
43
- let defaultValue = '';
44
- if (param.data.default !== undefined && param.data.default !== null) {
45
- defaultValue = String(param.data.default);
46
- if (defaultValue === '') {
47
- defaultValue = '""';
48
- }
49
- }
50
- else {
51
- defaultValue = 'None';
52
- }
53
- const help = param.data.help || '';
54
- lines.push(` ${chalk.yellow(flag.padEnd(22))}${type.padEnd(11)}${required.padEnd(11)}${defaultValue.padEnd(13)}${help}`);
55
- });
56
- lines.push('');
57
- lines.push(chalk.bold.blue('USAGE EXAMPLES'));
58
- const requiredParams = parameters.filter((p) => !p.data.optional);
59
- const optionalParams = parameters.filter((p) => p.data.optional);
60
- const requiredFlags = requiredParams.map((p) => `--${p.data.name} "value"`).join(' ');
61
- const basicExample = requiredFlags ? `${command} ${requiredFlags}` : command;
62
- lines.push(` ${chalk.white(basicExample)} ${chalk.gray('# Basic execution')}`);
63
- if (optionalParams.length > 0) {
64
- const exampleParam = optionalParams[0].data.name;
65
- const withOptional = requiredFlags
66
- ? `${command} ${requiredFlags} --${exampleParam} "value"`
67
- : `${command} --${exampleParam} "value"`;
68
- lines.push(` ${chalk.white(withOptional)} ${chalk.gray('# With optional parameter')}`);
69
- }
70
- lines.push('');
71
- return lines.join('\n');
72
- }
73
- /**
74
- * Renders a brief info block for a pipeline that has no registered YAML source.
75
- *
76
- * @param pipeline - The resolved PipelineRecord.
77
- * @returns Formatted summary string.
78
- */
79
- function pipelineSummary_render(pipeline) {
80
- const lines = [];
81
- lines.push('');
82
- lines.push(chalk.bold.magenta(pipeline.name));
83
- lines.push(chalk.gray('─'.repeat(74)));
84
- lines.push(`${chalk.bold.blue('ID:')} ${pipeline.id}`);
85
- if (pipeline.authors)
86
- lines.push(`${chalk.bold.blue('Authors:')} ${pipeline.authors}`);
87
- if (pipeline.category)
88
- lines.push(`${chalk.bold.blue('Category:')} ${pipeline.category}`);
89
- if (pipeline.locked !== undefined)
90
- lines.push(`${chalk.bold.blue('Locked:')} ${pipeline.locked}`);
91
- if (pipeline.description) {
92
- lines.push('');
93
- lines.push(chalk.bold.blue('DESCRIPTION'));
94
- lines.push(` ${pipeline.description}`);
95
- }
96
- lines.push('');
97
- lines.push(chalk.dim('No YAML source registered. Use `pipeline info <name>` for full DAG details.'));
98
- lines.push('');
99
- return lines.join('\n');
100
- }
101
- /**
102
- * Reads virtual file content under command and builtin static paths.
103
- *
104
- * Handles help text formatting for /usr/bin and fetches parameter specifications for /bin plugins.
105
- *
106
- * @param pathStr - The absolute virtual path of the file to read.
107
- * @param prefix - The prefix of the calling provider (e.g. '/usr/bin', '/bin').
108
- * @returns Promise resolving to a Result containing the file contents as a string.
109
- */
110
- export async function staticVfs_read(pathStr, prefix) {
111
- try {
112
- let effectivePath = pathStr.startsWith("/") ? pathStr : "/" + pathStr;
113
- if (effectivePath.length > 1 && effectivePath.endsWith("/")) {
114
- effectivePath = effectivePath.slice(0, -1);
115
- }
116
- if (prefix === "/usr/bin") {
117
- const commandName = effectivePath.substring("/usr/bin/".length);
118
- const helpStr = commandHelp_get(commandName);
119
- if (helpStr !== undefined) {
120
- return Ok(helpStr);
121
- }
122
- errorStack.stack_push("error", `No help available for command: ${commandName}`);
123
- return Err();
124
- }
125
- if (prefix === "/bin") {
126
- const commandName = effectivePath.substring("/bin/".length);
127
- const versionSeparatorIndex = commandName.lastIndexOf('-v');
128
- if (versionSeparatorIndex === -1) {
129
- const yamlResult = await pipeline_sourceGet(commandName);
130
- if (yamlResult.ok)
131
- return Ok(yamlResult.value);
132
- const resolveResult = await pipeline_resolve(commandName);
133
- if (resolveResult.ok)
134
- return Ok(pipelineSummary_render(resolveResult.value));
135
- errorStack.stack_push("error", `Unknown /bin entry: ${commandName}`);
136
- return Err();
137
- }
138
- const name = commandName.substring(0, versionSeparatorIndex);
139
- const version = commandName.substring(versionSeparatorIndex + 2);
140
- const client = await session.connection.client_get();
141
- if (!client) {
142
- errorStack.stack_push("error", "No active ChRIS connection to fetch plugin parameter specs");
143
- return Err();
144
- }
145
- const pluginsList = await client.getPlugins({ name_exact: name, version: version, limit: 1 });
146
- const plugins = pluginsList.getItems();
147
- if (!plugins || plugins.length === 0) {
148
- errorStack.stack_push("error", `Plugin not found on server: ${name} v${version}`);
149
- return Err();
150
- }
151
- const plugin = plugins[0];
152
- const parametersList = await plugin.getPluginParameters({ limit: 100 });
153
- const parameters = parametersList.getItems();
154
- const output = pluginParameters_render(plugin, parameters, commandName);
155
- return Ok(output);
156
- }
157
- errorStack.stack_push("error", `File not found: ${pathStr}`);
158
- return Err();
159
- }
160
- catch (error) {
161
- const msg = error instanceof Error ? error.message : String(error);
162
- errorStack.stack_push("error", `Static VFS read failed for prefix ${prefix}: ${msg}`);
163
- return Err();
164
- }
165
- }
166
- /**
167
- * Reads virtual file binary content under command and builtin static paths.
168
- *
169
- * @param pathStr - The absolute virtual path of the file to read.
170
- * @param prefix - The prefix of the calling provider.
171
- * @returns Promise resolving to a Result containing the file contents as a Buffer.
172
- */
173
- export async function staticVfs_readBinary(pathStr, prefix) {
174
- const res = await staticVfs_read(pathStr, prefix);
175
- if (res.ok) {
176
- return Ok(Buffer.from(res.value, "utf-8"));
177
- }
178
- return Err();
179
- }
180
- //# sourceMappingURL=static_content.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"static_content.js","sourceRoot":"","sources":["../../../../src/lib/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AAU,EAAE,WAAW,CAAC,CAAC;YAChF,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC;QACpB,CAAC;QAED,UAAU,CAAC,UAAU,CAAC,OAAO,EAAE,mBAAmB,OAAO,EAAE,CAAC,CAAC;QAC7D,OAAO,GAAG,EAAE,CAAC;IACf,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,MAAM,GAAG,GAAW,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC3E,UAAU,CAAC,UAAU,CAAC,OAAO,EAAE,qCAAqC,MAAM,KAAK,GAAG,EAAE,CAAC,CAAC;QACtF,OAAO,GAAG,EAAE,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAAe,EAAE,MAAc;IACxE,MAAM,GAAG,GAAmB,MAAM,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAClE,IAAI,GAAG,CAAC,EAAE,EAAE,CAAC;QACX,OAAO,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,GAAG,EAAE,CAAC;AACf,CAAC"}
@@ -1,59 +0,0 @@
1
- import { ListingItem } from '@fnndsc/chili/models/listing.js';
2
- import { Result } from '@fnndsc/cumin';
3
- /**
4
- * Virtual File System Router.
5
- * Dispatches operations to Virtual or Native providers.
6
- */
7
- export declare class VFS {
8
- /**
9
- * Gets data for a directory (Virtual or Native).
10
- * Separated from rendering to allow Result<T> pattern.
11
- *
12
- * @param targetPath - The path to get data for. If empty, uses CWD.
13
- * @param options - Options including directory flag and sort.
14
- * @returns Result<ListingItem[]> - Ok with items or Err with error message.
15
- */
16
- data_get(targetPath?: string, options?: {
17
- sort?: 'name' | 'size' | 'date' | 'owner';
18
- reverse?: boolean;
19
- directory?: boolean;
20
- }): Promise<Result<ListingItem[]>>;
21
- /**
22
- * Returns the directory entry for `absolutePath` itself (not its contents).
23
- * Looks up the entry in the parent's listing — used to implement `ls -d`.
24
- *
25
- * @param absolutePath - The fully resolved path of the target.
26
- * @param options - Sort options forwarded to the parent listing.
27
- */
28
- private directoryEntry_get;
29
- /**
30
- * List contents of a directory (Virtual or Native).
31
- * Convenience method that fetches data and renders it.
32
- * Implements optimistic rendering with progress feedback:
33
- * - Stale cache: serve immediately with "(cached, refreshing...)" indicator
34
- * - Cache miss: show "Fetching..." after 500ms if still loading
35
- *
36
- * @param targetPath - The path to list. If empty, uses CWD.
37
- * @param options - Listing options (long, human, sort, reverse, directory).
38
- */
39
- list(targetPath?: string, options?: {
40
- long?: boolean;
41
- human?: boolean;
42
- oneColumn?: boolean;
43
- sort?: 'name' | 'size' | 'date' | 'owner';
44
- reverse?: boolean;
45
- directory?: boolean;
46
- }): Promise<void>;
47
- /**
48
- * Refreshes cache in the background without blocking or updating display.
49
- * Used for optimistic rendering - fetch fresh data after serving stale cache.
50
- *
51
- * @param targetPath - The path to refresh.
52
- * @param options - Options including sort and reverse.
53
- */
54
- private refreshInBackground;
55
- }
56
- /**
57
- * Shared VFS singleton.
58
- */
59
- export declare const vfs: VFS;
@@ -1,202 +0,0 @@
1
- /**
2
- * @file Virtual File System Router.
3
- *
4
- * Handles path resolution and dispatching to appropriate file system providers
5
- * (native ChRIS or virtual overlays like /bin).
6
- *
7
- * @module
8
- */
9
- import { vfsDispatcher } from '@fnndsc/salsa';
10
- import { session } from '../../session/index.js';
11
- import chalk from 'chalk';
12
- import * as path from 'path';
13
- import { grid_render, long_render } from '@fnndsc/chili/views/ls.js';
14
- import { list_applySort } from '@fnndsc/chili/utils/sort.js';
15
- import { listCache_get, Ok, Err, errorStack } from '@fnndsc/cumin';
16
- import { spinner } from '../spinner.js';
17
- import { error_stripDebugPrefix } from '../../builtins/utils.js';
18
- /**
19
- * Virtual File System Router.
20
- * Dispatches operations to Virtual or Native providers.
21
- */
22
- export class VFS {
23
- /**
24
- * Gets data for a directory (Virtual or Native).
25
- * Separated from rendering to allow Result<T> pattern.
26
- *
27
- * @param targetPath - The path to get data for. If empty, uses CWD.
28
- * @param options - Options including directory flag and sort.
29
- * @returns Result<ListingItem[]> - Ok with items or Err with error message.
30
- */
31
- async data_get(targetPath, options = {}) {
32
- try {
33
- const cwd = await session.getCWD();
34
- const effectivePath = targetPath
35
- ? path.posix.resolve(cwd, targetPath)
36
- : cwd;
37
- // -d: show the target entry itself rather than descending into it
38
- if (options.directory && targetPath) {
39
- return this.directoryEntry_get(effectivePath, options);
40
- }
41
- // /proc paths are backed by ProcCache which manages its own freshness —
42
- // skip listCache entirely so proc refresh and live status reads are visible.
43
- const isProcPath = effectivePath.startsWith('/proc');
44
- // Check cache first (not for /proc paths)
45
- const listCache = listCache_get();
46
- if (!isProcPath) {
47
- const cached = listCache.cache_get(effectivePath);
48
- if (cached) {
49
- const sortField = options.sort || 'name';
50
- const sortedItems = list_applySort(cached.data, sortField, options.reverse);
51
- return Ok(sortedItems);
52
- }
53
- }
54
- // Delegate path queries to the unified vfsDispatcher (which handles both virtual and native paths)
55
- const vfsResult = await vfsDispatcher.list(effectivePath, options);
56
- if (vfsResult.ok) {
57
- const items = vfsResult.value;
58
- // Cache the results (not for /proc paths)
59
- if (!isProcPath) {
60
- listCache.cache_set(effectivePath, items);
61
- }
62
- return Ok(items);
63
- }
64
- return Err();
65
- }
66
- catch (error) {
67
- const errorMsg = error instanceof Error ? error.message : String(error);
68
- errorStack.stack_push("error", `Failed to get directory data: ${errorMsg}`);
69
- return Err();
70
- }
71
- }
72
- /**
73
- * Returns the directory entry for `absolutePath` itself (not its contents).
74
- * Looks up the entry in the parent's listing — used to implement `ls -d`.
75
- *
76
- * @param absolutePath - The fully resolved path of the target.
77
- * @param options - Sort options forwarded to the parent listing.
78
- */
79
- async directoryEntry_get(absolutePath, options) {
80
- const baseName = path.posix.basename(absolutePath);
81
- const parentPath = path.posix.dirname(absolutePath);
82
- if (!baseName || absolutePath === '/') {
83
- return Ok([{ name: '/', type: 'vfs', size: 0, owner: 'root', date: '' }]);
84
- }
85
- // Fetch parent listing (use cache when available)
86
- const listCache = listCache_get();
87
- let parentItems = null;
88
- const cached = listCache.cache_get(parentPath);
89
- if (cached) {
90
- parentItems = cached.data;
91
- }
92
- else {
93
- const parentResult = await vfsDispatcher.list(parentPath, options);
94
- if (parentResult.ok) {
95
- parentItems = parentResult.value;
96
- listCache.cache_set(parentPath, parentItems);
97
- }
98
- }
99
- if (parentItems) {
100
- const match = parentItems.find((item) => item.name === baseName);
101
- if (match)
102
- return Ok([match]);
103
- }
104
- // Fallback: synthesize an entry from the path name
105
- return Ok([{ name: baseName, type: 'dir', size: 0, owner: 'system', date: '' }]);
106
- }
107
- /**
108
- * List contents of a directory (Virtual or Native).
109
- * Convenience method that fetches data and renders it.
110
- * Implements optimistic rendering with progress feedback:
111
- * - Stale cache: serve immediately with "(cached, refreshing...)" indicator
112
- * - Cache miss: show "Fetching..." after 500ms if still loading
113
- *
114
- * @param targetPath - The path to list. If empty, uses CWD.
115
- * @param options - Listing options (long, human, sort, reverse, directory).
116
- */
117
- async list(targetPath, options = {}) {
118
- // Resolve effective path for cache checking
119
- const cwd = await session.getCWD();
120
- const effectivePath = targetPath
121
- ? path.posix.resolve(cwd, targetPath)
122
- : cwd;
123
- // Check if we're serving from stale cache BEFORE fetching
124
- const listCache = listCache_get();
125
- const cached = listCache.cache_get(effectivePath);
126
- const wasStale = cached && !cached.fresh;
127
- const isCacheMiss = !cached;
128
- // For cache miss, show loading indicator after 500ms timeout
129
- let spinnerStarted = false; // Flag to track if spinner was actually started
130
- let spinnerDelayTimeout = null;
131
- if (isCacheMiss) {
132
- spinnerDelayTimeout = setTimeout(() => {
133
- spinner.start('Fetching directory from remote', true); // The spinner message with timing
134
- spinnerStarted = true;
135
- }, 500);
136
- }
137
- // Fetch data (may be from cache)
138
- const result = await this.data_get(targetPath, options);
139
- // Clear loading timeout and indicator
140
- if (spinnerDelayTimeout) {
141
- clearTimeout(spinnerDelayTimeout);
142
- }
143
- if (spinnerStarted) {
144
- spinner.stop();
145
- }
146
- if (!result.ok) {
147
- const lastError = errorStack.stack_pop();
148
- if (lastError) {
149
- console.error(chalk.red(error_stripDebugPrefix(lastError.message)));
150
- }
151
- return;
152
- }
153
- if (result.value.length === 0) {
154
- return;
155
- }
156
- // Render based on options
157
- if (options.long) {
158
- console.log(long_render(result.value, { human: !!options.human }));
159
- }
160
- else {
161
- console.log(grid_render(result.value, { oneColumn: !!options.oneColumn }));
162
- }
163
- // If we served stale cache, show indicator and refresh in background
164
- if (wasStale) {
165
- console.log(chalk.gray('(cached, refreshing...)'));
166
- // Trigger background refresh - don't await. Fenced in its own error-stack
167
- // scope so its pushes/pops cannot corrupt a concurrent foreground
168
- // command's error-drain window.
169
- errorStack.scope_run(() => {
170
- this.refreshInBackground(effectivePath, options).catch(() => {
171
- // Silently ignore refresh errors - user has moved on
172
- });
173
- });
174
- }
175
- }
176
- /**
177
- * Refreshes cache in the background without blocking or updating display.
178
- * Used for optimistic rendering - fetch fresh data after serving stale cache.
179
- *
180
- * @param targetPath - The path to refresh.
181
- * @param options - Options including sort and reverse.
182
- */
183
- async refreshInBackground(targetPath, options) {
184
- try {
185
- // Invalidate cache to force fresh fetch
186
- const listCache = listCache_get();
187
- listCache.cache_invalidate(targetPath);
188
- // Fetch fresh data - this will repopulate cache
189
- await this.data_get(targetPath, options);
190
- // Don't update display - user has moved on
191
- // Fresh data is now cached for next access
192
- }
193
- catch (_error) {
194
- // Silently fail - background refresh is best-effort
195
- }
196
- }
197
- }
198
- /**
199
- * Shared VFS singleton.
200
- */
201
- export const vfs = new VFS();
202
- //# sourceMappingURL=vfs.js.map