@fnndsc/chell 4.3.2 → 5.0.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.
Files changed (233) 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 -1
  4. package/dist/chell.js +2 -1
  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.d.ts +3 -1
  10. package/dist/core/boot.js +93 -154
  11. package/dist/core/boot.js.map +1 -1
  12. package/dist/core/cli.d.ts +3 -1
  13. package/dist/core/cli.js +11 -1
  14. package/dist/core/cli.js.map +1 -1
  15. package/dist/core/cliSurface.d.ts +26 -0
  16. package/dist/core/cliSurface.js +152 -0
  17. package/dist/core/cliSurface.js.map +1 -0
  18. package/dist/core/progressRenderer.d.ts +42 -0
  19. package/dist/core/progressRenderer.js +176 -0
  20. package/dist/core/progressRenderer.js.map +1 -0
  21. package/dist/core/prompt/session.d.ts +45 -0
  22. package/dist/core/prompt/session.js +48 -0
  23. package/dist/core/prompt/session.js.map +1 -0
  24. package/dist/core/repl.d.ts +25 -5
  25. package/dist/core/repl.js +58 -45
  26. package/dist/core/repl.js.map +1 -1
  27. package/dist/core/surfaceDispatch.d.ts +21 -0
  28. package/dist/core/surfaceDispatch.js +33 -0
  29. package/dist/core/surfaceDispatch.js.map +1 -0
  30. package/dist/core/warnings.d.ts +14 -0
  31. package/dist/core/warnings.js +25 -0
  32. package/dist/core/warnings.js.map +1 -0
  33. package/dist/index.js +2 -12
  34. package/dist/index.js.map +1 -1
  35. package/dist/remote/client.d.ts +6 -0
  36. package/dist/remote/client.js +71 -0
  37. package/dist/remote/client.js.map +1 -0
  38. package/dist/remote/remoteEngine.d.ts +125 -0
  39. package/dist/remote/remoteEngine.js +286 -0
  40. package/dist/remote/remoteEngine.js.map +1 -0
  41. package/package.json +5 -3
  42. package/dist/builtins/debug.d.ts +0 -6
  43. package/dist/builtins/debug.js +0 -47
  44. package/dist/builtins/debug.js.map +0 -1
  45. package/dist/builtins/executable.d.ts +0 -22
  46. package/dist/builtins/executable.js +0 -115
  47. package/dist/builtins/executable.js.map +0 -1
  48. package/dist/builtins/fs/cat.d.ts +0 -16
  49. package/dist/builtins/fs/cat.js +0 -249
  50. package/dist/builtins/fs/cat.js.map +0 -1
  51. package/dist/builtins/fs/cd.d.ts +0 -41
  52. package/dist/builtins/fs/cd.js +0 -178
  53. package/dist/builtins/fs/cd.js.map +0 -1
  54. package/dist/builtins/fs/cp.d.ts +0 -7
  55. package/dist/builtins/fs/cp.js +0 -73
  56. package/dist/builtins/fs/cp.js.map +0 -1
  57. package/dist/builtins/fs/download.d.ts +0 -6
  58. package/dist/builtins/fs/download.js +0 -41
  59. package/dist/builtins/fs/download.js.map +0 -1
  60. package/dist/builtins/fs/du.d.ts +0 -58
  61. package/dist/builtins/fs/du.js +0 -210
  62. package/dist/builtins/fs/du.js.map +0 -1
  63. package/dist/builtins/fs/edit.d.ts +0 -7
  64. package/dist/builtins/fs/edit.js +0 -86
  65. package/dist/builtins/fs/edit.js.map +0 -1
  66. package/dist/builtins/fs/ls.d.ts +0 -8
  67. package/dist/builtins/fs/ls.js +0 -68
  68. package/dist/builtins/fs/ls.js.map +0 -1
  69. package/dist/builtins/fs/mkdir.d.ts +0 -6
  70. package/dist/builtins/fs/mkdir.js +0 -38
  71. package/dist/builtins/fs/mkdir.js.map +0 -1
  72. package/dist/builtins/fs/mv.d.ts +0 -7
  73. package/dist/builtins/fs/mv.js +0 -75
  74. package/dist/builtins/fs/mv.js.map +0 -1
  75. package/dist/builtins/fs/pull.args.d.ts +0 -22
  76. package/dist/builtins/fs/pull.args.js +0 -30
  77. package/dist/builtins/fs/pull.args.js.map +0 -1
  78. package/dist/builtins/fs/pull.d.ts +0 -26
  79. package/dist/builtins/fs/pull.js +0 -417
  80. package/dist/builtins/fs/pull.js.map +0 -1
  81. package/dist/builtins/fs/pwd.d.ts +0 -7
  82. package/dist/builtins/fs/pwd.js +0 -75
  83. package/dist/builtins/fs/pwd.js.map +0 -1
  84. package/dist/builtins/fs/rm.d.ts +0 -31
  85. package/dist/builtins/fs/rm.js +0 -148
  86. package/dist/builtins/fs/rm.js.map +0 -1
  87. package/dist/builtins/fs/touch.d.ts +0 -6
  88. package/dist/builtins/fs/touch.js +0 -64
  89. package/dist/builtins/fs/touch.js.map +0 -1
  90. package/dist/builtins/fs/tree.d.ts +0 -15
  91. package/dist/builtins/fs/tree.js +0 -84
  92. package/dist/builtins/fs/tree.js.map +0 -1
  93. package/dist/builtins/fs/upload.d.ts +0 -6
  94. package/dist/builtins/fs/upload.js +0 -45
  95. package/dist/builtins/fs/upload.js.map +0 -1
  96. package/dist/builtins/help.d.ts +0 -74
  97. package/dist/builtins/help.js +0 -1217
  98. package/dist/builtins/help.js.map +0 -1
  99. package/dist/builtins/index.d.ts +0 -45
  100. package/dist/builtins/index.js +0 -45
  101. package/dist/builtins/index.js.map +0 -1
  102. package/dist/builtins/net/connect.d.ts +0 -7
  103. package/dist/builtins/net/connect.js +0 -42
  104. package/dist/builtins/net/connect.js.map +0 -1
  105. package/dist/builtins/net/cubepath.d.ts +0 -18
  106. package/dist/builtins/net/cubepath.js +0 -102
  107. package/dist/builtins/net/cubepath.js.map +0 -1
  108. package/dist/builtins/net/logout.d.ts +0 -6
  109. package/dist/builtins/net/logout.js +0 -24
  110. package/dist/builtins/net/logout.js.map +0 -1
  111. package/dist/builtins/net/pacs.d.ts +0 -24
  112. package/dist/builtins/net/pacs.js +0 -121
  113. package/dist/builtins/net/pacs.js.map +0 -1
  114. package/dist/builtins/net/pacsUtils.d.ts +0 -85
  115. package/dist/builtins/net/pacsUtils.js +0 -184
  116. package/dist/builtins/net/pacsUtils.js.map +0 -1
  117. package/dist/builtins/net/query.d.ts +0 -60
  118. package/dist/builtins/net/query.js +0 -324
  119. package/dist/builtins/net/query.js.map +0 -1
  120. package/dist/builtins/parametersofplugin.d.ts +0 -13
  121. package/dist/builtins/parametersofplugin.js +0 -43
  122. package/dist/builtins/parametersofplugin.js.map +0 -1
  123. package/dist/builtins/pluginExecute.d.ts +0 -27
  124. package/dist/builtins/pluginExecute.js +0 -165
  125. package/dist/builtins/pluginExecute.js.map +0 -1
  126. package/dist/builtins/proc.d.ts +0 -6
  127. package/dist/builtins/proc.helpers.d.ts +0 -68
  128. package/dist/builtins/proc.helpers.js +0 -102
  129. package/dist/builtins/proc.helpers.js.map +0 -1
  130. package/dist/builtins/proc.js +0 -289
  131. package/dist/builtins/proc.js.map +0 -1
  132. package/dist/builtins/res/compute.d.ts +0 -6
  133. package/dist/builtins/res/compute.js +0 -55
  134. package/dist/builtins/res/compute.js.map +0 -1
  135. package/dist/builtins/res/feed.d.ts +0 -6
  136. package/dist/builtins/res/feed.js +0 -244
  137. package/dist/builtins/res/feed.js.map +0 -1
  138. package/dist/builtins/res/feed.notes.d.ts +0 -28
  139. package/dist/builtins/res/feed.notes.js +0 -24
  140. package/dist/builtins/res/feed.notes.js.map +0 -1
  141. package/dist/builtins/res/files.d.ts +0 -18
  142. package/dist/builtins/res/files.js +0 -85
  143. package/dist/builtins/res/files.js.map +0 -1
  144. package/dist/builtins/res/group.d.ts +0 -6
  145. package/dist/builtins/res/group.js +0 -54
  146. package/dist/builtins/res/group.js.map +0 -1
  147. package/dist/builtins/res/pipeline.args.d.ts +0 -22
  148. package/dist/builtins/res/pipeline.args.js +0 -28
  149. package/dist/builtins/res/pipeline.args.js.map +0 -1
  150. package/dist/builtins/res/pipeline.d.ts +0 -20
  151. package/dist/builtins/res/pipeline.js +0 -252
  152. package/dist/builtins/res/pipeline.js.map +0 -1
  153. package/dist/builtins/res/plugin.d.ts +0 -13
  154. package/dist/builtins/res/plugin.js +0 -140
  155. package/dist/builtins/res/plugin.js.map +0 -1
  156. package/dist/builtins/res/plugininstance.d.ts +0 -6
  157. package/dist/builtins/res/plugininstance.js +0 -53
  158. package/dist/builtins/res/plugininstance.js.map +0 -1
  159. package/dist/builtins/res/pluginmeta.d.ts +0 -6
  160. package/dist/builtins/res/pluginmeta.js +0 -53
  161. package/dist/builtins/res/pluginmeta.js.map +0 -1
  162. package/dist/builtins/res/tag.d.ts +0 -6
  163. package/dist/builtins/res/tag.js +0 -53
  164. package/dist/builtins/res/tag.js.map +0 -1
  165. package/dist/builtins/res/workflow.d.ts +0 -6
  166. package/dist/builtins/res/workflow.js +0 -53
  167. package/dist/builtins/res/workflow.js.map +0 -1
  168. package/dist/builtins/store.d.ts +0 -6
  169. package/dist/builtins/store.js +0 -108
  170. package/dist/builtins/store.js.map +0 -1
  171. package/dist/builtins/sys/context.d.ts +0 -6
  172. package/dist/builtins/sys/context.js +0 -50
  173. package/dist/builtins/sys/context.js.map +0 -1
  174. package/dist/builtins/sys/physicalmode.d.ts +0 -6
  175. package/dist/builtins/sys/physicalmode.js +0 -41
  176. package/dist/builtins/sys/physicalmode.js.map +0 -1
  177. package/dist/builtins/sys/timing.d.ts +0 -6
  178. package/dist/builtins/sys/timing.js +0 -41
  179. package/dist/builtins/sys/timing.js.map +0 -1
  180. package/dist/builtins/sys/whoami.d.ts +0 -12
  181. package/dist/builtins/sys/whoami.js +0 -37
  182. package/dist/builtins/sys/whoami.js.map +0 -1
  183. package/dist/builtins/utils.d.ts +0 -55
  184. package/dist/builtins/utils.js +0 -145
  185. package/dist/builtins/utils.js.map +0 -1
  186. package/dist/builtins/wildcard.d.ts +0 -26
  187. package/dist/builtins/wildcard.js +0 -120
  188. package/dist/builtins/wildcard.js.map +0 -1
  189. package/dist/command-keys.d.ts +0 -8
  190. package/dist/command-keys.js +0 -32
  191. package/dist/command-keys.js.map +0 -1
  192. package/dist/core/dispatch.d.ts +0 -48
  193. package/dist/core/dispatch.js +0 -544
  194. package/dist/core/dispatch.js.map +0 -1
  195. package/dist/core/preprocess.d.ts +0 -46
  196. package/dist/core/preprocess.js +0 -146
  197. package/dist/core/preprocess.js.map +0 -1
  198. package/dist/core/question.d.ts +0 -34
  199. package/dist/core/question.js +0 -76
  200. package/dist/core/question.js.map +0 -1
  201. package/dist/lib/completer/index.d.ts +0 -15
  202. package/dist/lib/completer/index.js +0 -212
  203. package/dist/lib/completer/index.js.map +0 -1
  204. package/dist/lib/completer/pathComplete.helpers.d.ts +0 -22
  205. package/dist/lib/completer/pathComplete.helpers.js +0 -49
  206. package/dist/lib/completer/pathComplete.helpers.js.map +0 -1
  207. package/dist/lib/parser.d.ts +0 -13
  208. package/dist/lib/parser.js +0 -52
  209. package/dist/lib/parser.js.map +0 -1
  210. package/dist/lib/pipe.d.ts +0 -11
  211. package/dist/lib/pipe.js +0 -90
  212. package/dist/lib/pipe.js.map +0 -1
  213. package/dist/lib/prefetch.d.ts +0 -25
  214. package/dist/lib/prefetch.js +0 -64
  215. package/dist/lib/prefetch.js.map +0 -1
  216. package/dist/lib/semicolonParser.d.ts +0 -22
  217. package/dist/lib/semicolonParser.js +0 -53
  218. package/dist/lib/semicolonParser.js.map +0 -1
  219. package/dist/lib/spinner.d.ts +0 -23
  220. package/dist/lib/spinner.js +0 -70
  221. package/dist/lib/spinner.js.map +0 -1
  222. package/dist/lib/vfs/providers/static.d.ts +0 -65
  223. package/dist/lib/vfs/providers/static.js +0 -164
  224. package/dist/lib/vfs/providers/static.js.map +0 -1
  225. package/dist/lib/vfs/providers/static_content.d.ts +0 -27
  226. package/dist/lib/vfs/providers/static_content.js +0 -180
  227. package/dist/lib/vfs/providers/static_content.js.map +0 -1
  228. package/dist/lib/vfs/vfs.d.ts +0 -59
  229. package/dist/lib/vfs/vfs.js +0 -198
  230. package/dist/lib/vfs/vfs.js.map +0 -1
  231. package/dist/session/index.d.ts +0 -76
  232. package/dist/session/index.js +0 -120
  233. package/dist/session/index.js.map +0 -1
package/dist/core/repl.js CHANGED
@@ -1,66 +1,78 @@
1
1
  /**
2
2
  * @file REPL Logic.
3
3
  *
4
- * Manages the Read-Eval-Print Loop using Node.js readline.
4
+ * The CLI host around the chell engine: a readline loop that reads lines,
5
+ * hands them to the engine, and owns the terminal-facing concerns (prompt,
6
+ * history, output sink, interactive questions).
5
7
  *
6
8
  * @module
7
9
  */
8
10
  import * as readline from 'readline';
9
11
  import * as fs from 'fs';
10
12
  import chalk from 'chalk';
11
- import { session } from '../session/index.js';
12
- import { input_complete } from '../lib/completer/index.js';
13
13
  import { settings } from '../config/settings.js';
14
- import { context_getSingle } from '@fnndsc/salsa';
15
- import { prompt_render } from './prompt/index.js';
16
- import { repl_questionRegister } from './question.js';
17
- import { procCache_get } from '@fnndsc/cumin';
14
+ import { sessionPrompt_render } from './prompt/session.js';
15
+ import { surface_set } from '@fnndsc/brasa';
16
+ import { cliSurface_create } from './cliSurface.js';
17
+ import { sink_set, StdoutSink } from '@fnndsc/brasa';
18
+ import { TerminalProgressRenderer } from './progressRenderer.js';
19
+ import { surfaceLine_execute } from './surfaceDispatch.js';
18
20
  /**
19
21
  * Handles the Read-Eval-Print Loop (REPL) interaction.
20
22
  */
21
23
  export class REPL {
22
24
  rl;
25
+ engine;
23
26
  isOpen = true;
24
27
  lastCommandDurationMs = 0;
25
28
  lastExitCode = 0;
29
+ promptText;
26
30
  /**
27
- * Initializes the REPL interface.
31
+ * Initializes the REPL interface around an engine.
32
+ *
33
+ * @param engine - The engine that executes lines and answers completions.
34
+ * @param options - Optional host settings (e.g. a fixed prompt string).
28
35
  */
29
- constructor() {
36
+ constructor(engine, options) {
37
+ this.engine = engine;
38
+ this.promptText = options?.promptText;
30
39
  this.rl = readline.createInterface({
31
40
  input: process.stdin,
32
41
  output: process.stdout,
33
42
  prompt: '> ',
34
- completer: input_complete,
43
+ completer: (line, callback) => {
44
+ this.engine.line_complete(line)
45
+ .then((result) => callback(null, [result.candidates, result.prefix]))
46
+ .catch(() => callback(null, [[], line]));
47
+ },
35
48
  });
36
49
  }
37
50
  /**
38
- * Starts the REPL loop.
39
- * @param commandHandler - Async function to process each input line.
51
+ * Starts the REPL loop, executing each input line through the engine.
40
52
  */
41
- async start(commandHandler) {
42
- repl_questionRegister((prompt) => new Promise((resolve) => {
43
- this.rl.question(prompt, (answer) => resolve(answer.trim()));
44
- }), (prompt) => {
45
- const rlInternal = this.rl;
46
- const origWrite = rlInternal._writeToOutput.bind(this.rl);
47
- rlInternal._writeToOutput = (_str) => { };
48
- process.stdout.write(prompt);
49
- return new Promise((resolve) => {
50
- this.rl.question('', (answer) => {
51
- rlInternal._writeToOutput = origWrite;
52
- process.stdout.write('\n');
53
- resolve(answer.trim());
54
- });
55
- });
56
- });
53
+ async start() {
54
+ // The REPL is the host that owns the interaction channels: command output
55
+ // reaches the terminal through the sink it installs, and interactive
56
+ // prompts run through the surface it installs — both backed by the REPL's
57
+ // single readline interface, so builtins never assume a terminal exists.
58
+ sink_set(new StdoutSink(new TerminalProgressRenderer()));
59
+ surface_set(cliSurface_create(this.rl));
57
60
  await this.history_load();
58
61
  await this.prompt_update();
59
62
  this.rl.on('line', async (line) => {
60
63
  await this.history_append(line);
64
+ // `exit` quits this shell, never the engine. Closing readline runs the
65
+ // 'close' handler (goodbye, then process exit). Crucially, for a remote
66
+ // surface this detaches the client and leaves the daemon — and its other
67
+ // surfaces — running; forwarding `exit` to the engine would instead reach
68
+ // dispatch's process.exit on the daemon and tear every surface down.
69
+ if (line.trim().split(/\s+/)[0] === 'exit') {
70
+ this.rl.close();
71
+ return;
72
+ }
61
73
  const startMs = Date.now();
62
74
  process.exitCode = 0;
63
- await commandHandler(line);
75
+ await surfaceLine_execute(this.engine, line);
64
76
  this.lastCommandDurationMs = Date.now() - startMs;
65
77
  this.lastExitCode = process.exitCode ?? 0;
66
78
  if (this.isOpen) {
@@ -85,24 +97,25 @@ export class REPL {
85
97
  async prompt_update() {
86
98
  if (!this.isOpen)
87
99
  return;
88
- const context = await context_getSingle();
89
- const cwd = await session.getCWD();
90
- const isOffline = session.offline;
91
- const warmupRaw = procCache_get().warmupProgress_get();
92
- const procWarmup = warmupRaw.active ? { loaded: warmupRaw.loaded } : undefined;
93
- const ctx = {
94
- user: isOffline ? 'disconnected' : (context.user ?? 'disconnected'),
95
- uri: isOffline ? 'no-cube' : (context.URL ?? 'no-cube'),
96
- cwd: isOffline ? '/' : cwd,
97
- pacsserver: context.pacsserver ?? null,
98
- physicalMode: session.physicalMode_get(),
99
- terminalWidth: process.stdout.columns || 80,
100
+ // An injected prompt (the remote client) skips local context rendering:
101
+ // the session lives in the daemon, not this process. It may be a fixed
102
+ // string or a provider returning the latest daemon-pushed prompt.
103
+ if (this.promptText !== undefined) {
104
+ const text = typeof this.promptText === 'function' ? this.promptText() : this.promptText;
105
+ this.rl.setPrompt(text);
106
+ try {
107
+ this.rl.prompt();
108
+ }
109
+ catch (e) {
110
+ // Interface might be closed
111
+ }
112
+ return;
113
+ }
114
+ const rendered = await sessionPrompt_render({
100
115
  lastExitCode: this.lastExitCode,
101
116
  lastCommandDurationMs: this.lastCommandDurationMs,
102
- p10kSegments: settings.config.p10kSegments,
103
- procWarmup,
104
- };
105
- this.rl.setPrompt(prompt_render(settings.config.promptTheme, ctx));
117
+ });
118
+ this.rl.setPrompt(rendered);
106
119
  try {
107
120
  this.rl.prompt();
108
121
  }
@@ -1 +1 @@
1
- {"version":3,"file":"repl.js","sourceRoot":"","sources":["../../src/core/repl.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,aAAa,EAAsB,MAAM,mBAAmB,CAAC;AACtE,OAA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ACzB,MAAM,IAAI,GAAW,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC;QACjD,IAAI,CAAC;YACH,MAAM,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC,CAAC;QAClD,CAAC;QAAC,OAAO,CAAU,EAAE,CAAC;YACpB,2CAA2C;QAC7C,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @file Surface command interception.
3
+ *
4
+ * A few commands are purely frontend-local: they configure how *this* terminal
5
+ * renders and produce no engine output. `prompt` (theme selection) is the
6
+ * canonical case — a remote client themes its own prompt, so the engine, which
7
+ * may be a shared daemon, must never own it. The CLI surface handles these
8
+ * itself and delegates everything else to the engine.
9
+ *
10
+ * @module
11
+ */
12
+ import type { CommandEnvelope } from '@fnndsc/cumin';
13
+ import type { BrasaEngine } from '@fnndsc/brasa';
14
+ /**
15
+ * Runs a command line, intercepting surface-local commands before the engine.
16
+ *
17
+ * @param engine - The engine that executes non-surface commands.
18
+ * @param line - The raw command line.
19
+ * @returns The engine's envelopes, or an empty list for a surface command.
20
+ */
21
+ export declare function surfaceLine_execute(engine: BrasaEngine, line: string): Promise<CommandEnvelope[]>;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @file Surface command interception.
3
+ *
4
+ * A few commands are purely frontend-local: they configure how *this* terminal
5
+ * renders and produce no engine output. `prompt` (theme selection) is the
6
+ * canonical case — a remote client themes its own prompt, so the engine, which
7
+ * may be a shared daemon, must never own it. The CLI surface handles these
8
+ * itself and delegates everything else to the engine.
9
+ *
10
+ * @module
11
+ */
12
+ import { builtin_prompt } from '../builtins/sys/prompt.js';
13
+ /** Commands the CLI surface runs locally and never forwards to the engine. */
14
+ const SURFACE_COMMANDS = {
15
+ prompt: builtin_prompt,
16
+ };
17
+ /**
18
+ * Runs a command line, intercepting surface-local commands before the engine.
19
+ *
20
+ * @param engine - The engine that executes non-surface commands.
21
+ * @param line - The raw command line.
22
+ * @returns The engine's envelopes, or an empty list for a surface command.
23
+ */
24
+ export async function surfaceLine_execute(engine, line) {
25
+ const tokens = line.trim().split(/\s+/);
26
+ const handler = SURFACE_COMMANDS[tokens[0]];
27
+ if (handler !== undefined) {
28
+ await handler(tokens.slice(1));
29
+ return [];
30
+ }
31
+ return engine.line_execute(line);
32
+ }
33
+ //# sourceMappingURL=surfaceDispatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"surfaceDispatch.js","sourceRoot":"","sources":["../../src/core/surfaceDispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,8EAA8E;AAC9E,MAAM,gBAAgB,GAAsD;IAC1E,MAAM,EAAE,cAAc;CACvB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,MAAmB,EAAE,IAAY;IACzE,MAAM,MAAM,GAAa,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,OAAO,GAAoD,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7F,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/B,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @file Node deprecation-warning suppression shared by chell's entry points.
3
+ *
4
+ * @module
5
+ */
6
+ /**
7
+ * Suppresses the DEP0169 `url.parse()` deprecation warning emitted through the
8
+ * axios -> proxy-from-env dependency chain.
9
+ *
10
+ * proxy-from-env 1.1.0 (pulled via axios) still uses `url.parse()`, which
11
+ * triggers the warning in Node. Safe to remove once that dependency migrates to
12
+ * the WHATWG URL API or axios drops it.
13
+ */
14
+ export declare function warnings_suppress(): void;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @file Node deprecation-warning suppression shared by chell's entry points.
3
+ *
4
+ * @module
5
+ */
6
+ /**
7
+ * Suppresses the DEP0169 `url.parse()` deprecation warning emitted through the
8
+ * axios -> proxy-from-env dependency chain.
9
+ *
10
+ * proxy-from-env 1.1.0 (pulled via axios) still uses `url.parse()`, which
11
+ * triggers the warning in Node. Safe to remove once that dependency migrates to
12
+ * the WHATWG URL API or axios drops it.
13
+ */
14
+ export function warnings_suppress() {
15
+ const originalEmitWarning = process.emitWarning;
16
+ process.emitWarning = function (warning, ...args) {
17
+ if (typeof warning === 'string' &&
18
+ (warning.includes('DEP0169') || warning.includes('url.parse()'))) {
19
+ return;
20
+ }
21
+ // eslint-disable-next-line prefer-spread
22
+ return originalEmitWarning.apply(process, [warning, ...args]);
23
+ };
24
+ }
25
+ //# sourceMappingURL=warnings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"warnings.js","sourceRoot":"","sources":["../../src/core/warnings.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,mBAAmB,GAA+B,OAAO,CAAC,WAAW,CAAC;IAC5E,OAAO,CAAC,WAAW,GAAG,UAAU,OAAuB,EAAE,GAAG,IAAe;QACzE,IACE,OAAO,OAAO,KAAK,QAAQ;YAC3B,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,EAChE,CAAC;YACD,OAAO;QACT,CAAC;QACD,yCAAyC;QACzC,OAAQ,mBAAiD,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;IAC/F,CAAC,CAAC;AACJ,CAAC"}
package/dist/index.js CHANGED
@@ -4,21 +4,11 @@
4
4
  *
5
5
  * @module
6
6
  */
7
- // Suppress DEP0169 warning from axios/proxy-from-env dependency.
8
- // proxy-from-env 1.1.0 (pulled via axios) still uses url.parse(), which triggers
9
- // a deprecation warning in Node. This suppression is safe to remove once that
10
- // dependency migrates to the WHATWG URL API or axios drops it.
11
- const originalEmitWarning = process.emitWarning;
12
- process.emitWarning = function (warning, ...args) {
13
- if (typeof warning === 'string' &&
14
- (warning.includes('DEP0169') || warning.includes('url.parse()'))) {
15
- return;
16
- }
17
- return originalEmitWarning.call(process, warning, ...args);
18
- };
19
7
  import { fileURLToPath } from 'url';
20
8
  import { realpathSync } from 'fs';
9
+ import { warnings_suppress } from './core/warnings.js';
21
10
  import { chell_start } from './core/boot.js';
11
+ warnings_suppress();
22
12
  const currentFile = fileURLToPath(import.meta.url);
23
13
  // Compare real paths to handle symlinks (e.g. global install)
24
14
  let isMain = false;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;GAIG;AAEH,iEAAiE;AACjE,iFAAiF;AACjF,8EAA8E;AAC9E,+DAA+D;AAC/D,MAAM,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC;AAChD,OAAO,CAAC,WAAW,GAAG,UAAU,OAAuB,EAAE,GAAG,IAAW;IACrE,IACE,OAAO,OAAO,KAAK,QAAQ;QAC3B,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,EAChE,CAAC;QACD,OAAO;IACT,CAAC;IACD,OAAO,mBAAmB,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;AAC7D,CAAC,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,WAAW,GAAW,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE3D,8DAA8D;AAC9D,IAAI,MAAM,GAAY,KAAK,CAAC;AAC5B,IAAI,CAAC;IACH,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,YAAY,CAAC,WAAW,CAAC,CAAC;AACvE,CAAC;AAAC,OAAO,CAAU,EAAE,CAAC;IACpB,qBAAqB;AACvB,CAAC;AAED,IAAI,MAAM,EAAE,CAAC;IACX,WAAW,EAAE,CAAC;AAChB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,iBAAiB,EAAE,CAAC;AAEpB,MAAM,WAAW,GAAW,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE3D,8DAA8D;AAC9D,IAAI,MAAM,GAAY,KAAK,CAAC;AAC5B,IAAI,CAAC;IACH,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,YAAY,CAAC,WAAW,CAAC,CAAC;AACvE,CAAC;AAAC,OAAO,CAAU,EAAE,CAAC;IACpB,qBAAqB;AACvB,CAAC;AAED,IAAI,MAAM,EAAE,CAAC;IACX,WAAW,EAAE,CAAC;AAChB,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Runs the remote client: discovers a daemon, attaches, and enters the REPL.
3
+ *
4
+ * @returns A promise that resolves when the client session ends.
5
+ */
6
+ export declare function remote_run(): Promise<void>;
@@ -0,0 +1,71 @@
1
+ /**
2
+ * @file The `chell --remote` client.
3
+ *
4
+ * Attaches to a same-user CALYPSO daemon and drives it with the ordinary REPL,
5
+ * proving the sibling-surfaces topology: the same REPL runs over either an
6
+ * in-process engine or a remote one. The remote engine delivers received
7
+ * output to the sink exactly as the local engine delivers live, so the REPL is
8
+ * unchanged. Another surface's activity (the session bus) is printed as it
9
+ * arrives.
10
+ *
11
+ * @module
12
+ */
13
+ import chalk from 'chalk';
14
+ import { REPL } from '../core/repl.js';
15
+ import { RemoteEngine } from './remoteEngine.js';
16
+ import { discovery_read } from '@fnndsc/calypso';
17
+ import { surface_get } from '@fnndsc/brasa';
18
+ /**
19
+ * Runs the remote client: discovers a daemon, attaches, and enters the REPL.
20
+ *
21
+ * @returns A promise that resolves when the client session ends.
22
+ */
23
+ export async function remote_run() {
24
+ const discovery = discovery_read();
25
+ if (!discovery) {
26
+ console.error(chalk.red('[!] No CALYPSO daemon found. Start one with: chell --daemon'));
27
+ process.exit(1);
28
+ }
29
+ let engine;
30
+ try {
31
+ engine = await RemoteEngine.connect({
32
+ url: discovery.url,
33
+ token: discovery.token,
34
+ onSession: (surface, envelope) => {
35
+ if (envelope.rendered.length > 0) {
36
+ process.stdout.write(`\n${chalk.gray(`[surface ${surface.slice(0, 6)}]`)}\n${envelope.rendered}`);
37
+ }
38
+ },
39
+ onPrompt: (message, hidden) =>
40
+ // The REPL has installed the CLI surface (readline-backed) by the time
41
+ // a prompt can arrive, so this reads from the local terminal.
42
+ surface_get().prompt({ message, hidden }),
43
+ onPipe: (command, input) =>
44
+ // Pipeline segments run on this machine, through the client's own
45
+ // tools — never on the daemon host.
46
+ surface_get().pipeSegment(command, input),
47
+ onEdit: (content, extension) =>
48
+ // Editing happens in this machine's editor.
49
+ surface_get().localEdit({ content, extension }),
50
+ onClose: () => {
51
+ console.log(chalk.yellow('\n[!] Daemon disconnected.'));
52
+ process.exit(0);
53
+ },
54
+ });
55
+ }
56
+ catch (err) {
57
+ const message = err instanceof Error ? err.message : String(err);
58
+ console.error(chalk.red(`[!] Could not attach to the daemon: ${message}`));
59
+ process.exit(1);
60
+ return;
61
+ }
62
+ console.log(chalk.green(`[+] Attached to CALYPSO daemon at ${discovery.url}`));
63
+ console.log(chalk.gray(" Type 'exit' to detach.\n"));
64
+ // The daemon pushes the themed prompt string; the REPL renders whatever the
65
+ // daemon last sent, falling back until the first push arrives.
66
+ const repl = new REPL(engine, {
67
+ promptText: () => engine.promptLine() || 'chell(remote) ❯ ',
68
+ });
69
+ await repl.start();
70
+ }
71
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/remote/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAkB,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU;IAC9B,MAAM,SAAS,GAAqB,cAAc,EAAE,CAAC;IACrD,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,8DAA8D,CAAC,CAAC,CAAC;QACzF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,IAAI,MAAoB,CAAC;IACzB,IAAI,CAAC;QACH,MAAM,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC;YAClC,GAAG,EAAE,SAAS,CAAC,GAAG;YAClB,KAAK,EAAE,SAAS,CAAC,KAAK;YACtB,SAAS,EAAE,CAAC,OAAe,EAAE,QAAyB,EAAQ,EAAE;gBAC9D,IAAI,QAAQ,CAAC,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AO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,qCAAqC,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC/E,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC;IAExD,4EAA4E;IAC5E,+DAA+D;IAC/D,MAAM,IAAI,GAAS,IAAI,IAAI,CAAC,MAAM,EAAE;QAClC,UAAU,EAAE,GAAW,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,kBAAkB;KACpE,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;AACrB,CAAC"}
@@ -0,0 +1,125 @@
1
+ import type { CommandEnvelope } from '@fnndsc/cumin';
2
+ import type { BrasaEngine, CompletionResult } from '@fnndsc/brasa';
3
+ /** Options for connecting a remote engine. */
4
+ export interface RemoteEngineOptions {
5
+ /** The daemon WebSocket URL, e.g. `ws://127.0.0.1:4300`. */
6
+ url: string;
7
+ /** The attach token. */
8
+ token: string;
9
+ /** Called with each session-bus broadcast from another surface. */
10
+ onSession?: (surface: string, envelope: CommandEnvelope) => void;
11
+ /** Answers a prompt the daemon raised during a command (password, confirmation). */
12
+ onPrompt?: (message: string, hidden: boolean) => Promise<string>;
13
+ /** Runs a pipeline segment on this machine and returns its output. */
14
+ onPipe?: (command: string, input: Buffer) => Promise<Buffer>;
15
+ /** Opens content in this machine's editor and returns the edited result. */
16
+ onEdit?: (content: string, extension: string | undefined) => Promise<{
17
+ content: string;
18
+ changed: boolean;
19
+ }>;
20
+ /** Called when the connection closes unexpectedly. */
21
+ onClose?: () => void;
22
+ }
23
+ /**
24
+ * A `BrasaEngine` implementation that drives a remote daemon.
25
+ */
26
+ export declare class RemoteEngine implements BrasaEngine {
27
+ private readonly ws;
28
+ private readonly pending;
29
+ private readonly onSession;
30
+ private readonly onPrompt;
31
+ private readonly onPipe;
32
+ private readonly onEdit;
33
+ private latestPrompt;
34
+ private nextId;
35
+ private readonly liveEnvelopeChannels;
36
+ /**
37
+ * @param ws - An open, already-attached socket to the daemon.
38
+ * @param options - The callbacks for session broadcasts and prompts.
39
+ */
40
+ private constructor();
41
+ /**
42
+ * Connects to a daemon, performs the attach handshake, and returns a ready
43
+ * remote engine.
44
+ *
45
+ * @param options - The daemon URL, attach token, and callbacks.
46
+ * @returns The connected remote engine.
47
+ * @throws {Error} When the connection fails or the attach is refused.
48
+ */
49
+ static connect(options: RemoteEngineOptions): Promise<RemoteEngine>;
50
+ /** @inheritdoc */
51
+ line_execute(line: string): Promise<CommandEnvelope[]>;
52
+ /** @inheritdoc */
53
+ line_complete(linePrefix: string): Promise<CompletionResult>;
54
+ /**
55
+ * Sends a correlated request and returns a promise for its reply.
56
+ *
57
+ * @param type - The request message type.
58
+ * @param fields - The message fields besides `type` and `id`.
59
+ * @returns The reply payload.
60
+ */
61
+ private request;
62
+ /**
63
+ * Dispatches a message from the daemon: correlated replies resolve their
64
+ * pending request, session broadcasts reach the callback, and uncorrelated
65
+ * errors are surfaced.
66
+ *
67
+ * @param payload - The raw message bytes.
68
+ */
69
+ private message_handle;
70
+ /**
71
+ * Answers a prompt the daemon raised: asks the local surface and sends the
72
+ * answer back. With no prompt handler, answers empty so the command does not
73
+ * hang.
74
+ *
75
+ * @param promptId - The prompt correlation id.
76
+ * @param message - The prompt text.
77
+ * @param hidden - Whether the entry should be hidden (a password).
78
+ */
79
+ private prompt_answer;
80
+ /**
81
+ * Runs a pipeline segment the daemon asked for on this machine and returns
82
+ * its output. Data crosses the wire base64-encoded. With no pipe handler,
83
+ * returns the input unchanged so the pipeline does not hang.
84
+ *
85
+ * @param pipeId - The pipe correlation id.
86
+ * @param command - The segment command line.
87
+ * @param input - The base64-encoded input bytes.
88
+ */
89
+ private pipe_run;
90
+ /**
91
+ * Opens content in this machine's editor (the daemon asked for it) and
92
+ * returns the edited result. With no edit handler, returns the content
93
+ * unchanged so the command does not hang.
94
+ *
95
+ * @param editId - The edit correlation id.
96
+ * @param content - The content to edit.
97
+ * @param extension - An optional filename extension.
98
+ */
99
+ private edit_run;
100
+ /**
101
+ * Renders a streamed output chunk to the local sink on its channel.
102
+ *
103
+ * @param channel - The sink channel the chunk belongs to.
104
+ * @param chunk - The streamed text.
105
+ */
106
+ private output_render;
107
+ /**
108
+ * Applies a settlement to the pending request for an id, if one exists.
109
+ *
110
+ * @param id - The correlation id.
111
+ * @param settle - The settlement to apply.
112
+ */
113
+ private pending_settle;
114
+ /**
115
+ * The latest themed prompt string the daemon pushed, or empty before the
116
+ * first push.
117
+ *
118
+ * @returns The current prompt string.
119
+ */
120
+ promptLine(): string;
121
+ /**
122
+ * Closes the connection.
123
+ */
124
+ close(): void;
125
+ }