@fnndsc/brasa 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builtins/debug.d.ts +8 -0
- package/dist/builtins/debug.js +39 -0
- package/dist/builtins/debug.js.map +1 -0
- package/dist/builtins/executable.d.ts +22 -0
- package/dist/builtins/executable.js +115 -0
- package/dist/builtins/executable.js.map +1 -0
- package/dist/builtins/fs/cat.d.ts +16 -0
- package/dist/builtins/fs/cat.js +266 -0
- package/dist/builtins/fs/cat.js.map +1 -0
- package/dist/builtins/fs/cd.d.ts +42 -0
- package/dist/builtins/fs/cd.js +193 -0
- package/dist/builtins/fs/cd.js.map +1 -0
- package/dist/builtins/fs/cp.d.ts +10 -0
- package/dist/builtins/fs/cp.js +86 -0
- package/dist/builtins/fs/cp.js.map +1 -0
- package/dist/builtins/fs/download.d.ts +6 -0
- package/dist/builtins/fs/download.js +45 -0
- package/dist/builtins/fs/download.js.map +1 -0
- package/dist/builtins/fs/du.d.ts +58 -0
- package/dist/builtins/fs/du.js +210 -0
- package/dist/builtins/fs/du.js.map +1 -0
- package/dist/builtins/fs/edit.d.ts +7 -0
- package/dist/builtins/fs/edit.js +104 -0
- package/dist/builtins/fs/edit.js.map +1 -0
- package/dist/builtins/fs/ls.d.ts +8 -0
- package/dist/builtins/fs/ls.js +68 -0
- package/dist/builtins/fs/ls.js.map +1 -0
- package/dist/builtins/fs/mkdir.d.ts +9 -0
- package/dist/builtins/fs/mkdir.js +52 -0
- package/dist/builtins/fs/mkdir.js.map +1 -0
- package/dist/builtins/fs/mv.d.ts +10 -0
- package/dist/builtins/fs/mv.js +88 -0
- package/dist/builtins/fs/mv.js.map +1 -0
- package/dist/builtins/fs/pull.args.d.ts +22 -0
- package/dist/builtins/fs/pull.args.js +30 -0
- package/dist/builtins/fs/pull.args.js.map +1 -0
- package/dist/builtins/fs/pull.d.ts +26 -0
- package/dist/builtins/fs/pull.js +445 -0
- package/dist/builtins/fs/pull.js.map +1 -0
- package/dist/builtins/fs/pwd.d.ts +10 -0
- package/dist/builtins/fs/pwd.js +73 -0
- package/dist/builtins/fs/pwd.js.map +1 -0
- package/dist/builtins/fs/rm.d.ts +37 -0
- package/dist/builtins/fs/rm.js +197 -0
- package/dist/builtins/fs/rm.js.map +1 -0
- package/dist/builtins/fs/touch.d.ts +9 -0
- package/dist/builtins/fs/touch.js +76 -0
- package/dist/builtins/fs/touch.js.map +1 -0
- package/dist/builtins/fs/tree.d.ts +15 -0
- package/dist/builtins/fs/tree.js +84 -0
- package/dist/builtins/fs/tree.js.map +1 -0
- package/dist/builtins/fs/upload.d.ts +6 -0
- package/dist/builtins/fs/upload.js +48 -0
- package/dist/builtins/fs/upload.js.map +1 -0
- package/dist/builtins/help.d.ts +74 -0
- package/dist/builtins/help.js +1217 -0
- package/dist/builtins/help.js.map +1 -0
- package/dist/builtins/index.d.ts +45 -0
- package/dist/builtins/index.js +45 -0
- package/dist/builtins/index.js.map +1 -0
- package/dist/builtins/net/connect.d.ts +7 -0
- package/dist/builtins/net/connect.js +42 -0
- package/dist/builtins/net/connect.js.map +1 -0
- package/dist/builtins/net/cubepath.d.ts +18 -0
- package/dist/builtins/net/cubepath.js +102 -0
- package/dist/builtins/net/cubepath.js.map +1 -0
- package/dist/builtins/net/logout.d.ts +6 -0
- package/dist/builtins/net/logout.js +24 -0
- package/dist/builtins/net/logout.js.map +1 -0
- package/dist/builtins/net/pacs.d.ts +24 -0
- package/dist/builtins/net/pacs.js +121 -0
- package/dist/builtins/net/pacs.js.map +1 -0
- package/dist/builtins/net/pacsUtils.d.ts +85 -0
- package/dist/builtins/net/pacsUtils.js +184 -0
- package/dist/builtins/net/pacsUtils.js.map +1 -0
- package/dist/builtins/net/query.d.ts +60 -0
- package/dist/builtins/net/query.js +324 -0
- package/dist/builtins/net/query.js.map +1 -0
- package/dist/builtins/parametersofplugin.d.ts +13 -0
- package/dist/builtins/parametersofplugin.js +43 -0
- package/dist/builtins/parametersofplugin.js.map +1 -0
- package/dist/builtins/pluginExecute.d.ts +27 -0
- package/dist/builtins/pluginExecute.js +165 -0
- package/dist/builtins/pluginExecute.js.map +1 -0
- package/dist/builtins/proc.d.ts +6 -0
- package/dist/builtins/proc.helpers.d.ts +68 -0
- package/dist/builtins/proc.helpers.js +102 -0
- package/dist/builtins/proc.helpers.js.map +1 -0
- package/dist/builtins/proc.js +289 -0
- package/dist/builtins/proc.js.map +1 -0
- package/dist/builtins/res/compute.d.ts +6 -0
- package/dist/builtins/res/compute.js +55 -0
- package/dist/builtins/res/compute.js.map +1 -0
- package/dist/builtins/res/feed.d.ts +6 -0
- package/dist/builtins/res/feed.js +244 -0
- package/dist/builtins/res/feed.js.map +1 -0
- package/dist/builtins/res/feed.notes.d.ts +28 -0
- package/dist/builtins/res/feed.notes.js +24 -0
- package/dist/builtins/res/feed.notes.js.map +1 -0
- package/dist/builtins/res/files.d.ts +18 -0
- package/dist/builtins/res/files.js +85 -0
- package/dist/builtins/res/files.js.map +1 -0
- package/dist/builtins/res/group.d.ts +6 -0
- package/dist/builtins/res/group.js +54 -0
- package/dist/builtins/res/group.js.map +1 -0
- package/dist/builtins/res/pipeline.args.d.ts +22 -0
- package/dist/builtins/res/pipeline.args.js +28 -0
- package/dist/builtins/res/pipeline.args.js.map +1 -0
- package/dist/builtins/res/pipeline.d.ts +20 -0
- package/dist/builtins/res/pipeline.js +252 -0
- package/dist/builtins/res/pipeline.js.map +1 -0
- package/dist/builtins/res/plugin.d.ts +13 -0
- package/dist/builtins/res/plugin.js +140 -0
- package/dist/builtins/res/plugin.js.map +1 -0
- package/dist/builtins/res/plugininstance.d.ts +6 -0
- package/dist/builtins/res/plugininstance.js +53 -0
- package/dist/builtins/res/plugininstance.js.map +1 -0
- package/dist/builtins/res/pluginmeta.d.ts +6 -0
- package/dist/builtins/res/pluginmeta.js +53 -0
- package/dist/builtins/res/pluginmeta.js.map +1 -0
- package/dist/builtins/res/tag.d.ts +6 -0
- package/dist/builtins/res/tag.js +53 -0
- package/dist/builtins/res/tag.js.map +1 -0
- package/dist/builtins/res/workflow.d.ts +6 -0
- package/dist/builtins/res/workflow.js +53 -0
- package/dist/builtins/res/workflow.js.map +1 -0
- package/dist/builtins/store.d.ts +6 -0
- package/dist/builtins/store.js +107 -0
- package/dist/builtins/store.js.map +1 -0
- package/dist/builtins/sys/context.d.ts +6 -0
- package/dist/builtins/sys/context.js +50 -0
- package/dist/builtins/sys/context.js.map +1 -0
- package/dist/builtins/sys/physicalmode.d.ts +8 -0
- package/dist/builtins/sys/physicalmode.js +34 -0
- package/dist/builtins/sys/physicalmode.js.map +1 -0
- package/dist/builtins/sys/timing.d.ts +8 -0
- package/dist/builtins/sys/timing.js +34 -0
- package/dist/builtins/sys/timing.js.map +1 -0
- package/dist/builtins/sys/version.d.ts +15 -0
- package/dist/builtins/sys/version.js +23 -0
- package/dist/builtins/sys/version.js.map +1 -0
- package/dist/builtins/sys/whoami.d.ts +17 -0
- package/dist/builtins/sys/whoami.js +44 -0
- package/dist/builtins/sys/whoami.js.map +1 -0
- package/dist/builtins/utils.d.ts +55 -0
- package/dist/builtins/utils.js +145 -0
- package/dist/builtins/utils.js.map +1 -0
- package/dist/builtins/wildcard.d.ts +26 -0
- package/dist/builtins/wildcard.js +120 -0
- package/dist/builtins/wildcard.js.map +1 -0
- package/dist/command-keys.d.ts +8 -0
- package/dist/command-keys.js +32 -0
- package/dist/command-keys.js.map +1 -0
- package/dist/config/storeConfig.d.ts +57 -0
- package/dist/config/storeConfig.js +78 -0
- package/dist/config/storeConfig.js.map +1 -0
- package/dist/core/chiliDelegate.d.ts +21 -0
- package/dist/core/chiliDelegate.js +32 -0
- package/dist/core/chiliDelegate.js.map +1 -0
- package/dist/core/connect.d.ts +38 -0
- package/dist/core/connect.js +46 -0
- package/dist/core/connect.js.map +1 -0
- package/dist/core/dispatch.d.ts +95 -0
- package/dist/core/dispatch.js +618 -0
- package/dist/core/dispatch.js.map +1 -0
- package/dist/core/engine.d.ts +91 -0
- package/dist/core/engine.js +222 -0
- package/dist/core/engine.js.map +1 -0
- package/dist/core/preprocess.d.ts +46 -0
- package/dist/core/preprocess.js +146 -0
- package/dist/core/preprocess.js.map +1 -0
- package/dist/core/progress.d.ts +50 -0
- package/dist/core/progress.js +21 -0
- package/dist/core/progress.js.map +1 -0
- package/dist/core/promptContext.d.ts +49 -0
- package/dist/core/promptContext.js +39 -0
- package/dist/core/promptContext.js.map +1 -0
- package/dist/core/question.d.ts +27 -0
- package/dist/core/question.js +33 -0
- package/dist/core/question.js.map +1 -0
- package/dist/core/sink.d.ts +207 -0
- package/dist/core/sink.js +329 -0
- package/dist/core/sink.js.map +1 -0
- package/dist/core/surface.d.ts +172 -0
- package/dist/core/surface.js +105 -0
- package/dist/core/surface.js.map +1 -0
- package/dist/core/version.d.ts +20 -0
- package/dist/core/version.js +82 -0
- package/dist/core/version.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/completer/index.d.ts +15 -0
- package/dist/lib/completer/index.js +212 -0
- package/dist/lib/completer/index.js.map +1 -0
- package/dist/lib/completer/pathComplete.helpers.d.ts +22 -0
- package/dist/lib/completer/pathComplete.helpers.js +49 -0
- package/dist/lib/completer/pathComplete.helpers.js.map +1 -0
- package/dist/lib/parser.d.ts +13 -0
- package/dist/lib/parser.js +52 -0
- package/dist/lib/parser.js.map +1 -0
- package/dist/lib/pipe.d.ts +11 -0
- package/dist/lib/pipe.js +90 -0
- package/dist/lib/pipe.js.map +1 -0
- package/dist/lib/prefetch.d.ts +25 -0
- package/dist/lib/prefetch.js +64 -0
- package/dist/lib/prefetch.js.map +1 -0
- package/dist/lib/semicolonParser.d.ts +22 -0
- package/dist/lib/semicolonParser.js +53 -0
- package/dist/lib/semicolonParser.js.map +1 -0
- package/dist/lib/spinner.d.ts +23 -0
- package/dist/lib/spinner.js +71 -0
- package/dist/lib/spinner.js.map +1 -0
- package/dist/lib/vfs/providers/static.d.ts +65 -0
- package/dist/lib/vfs/providers/static.js +164 -0
- package/dist/lib/vfs/providers/static.js.map +1 -0
- package/dist/lib/vfs/providers/static_content.d.ts +27 -0
- package/dist/lib/vfs/providers/static_content.js +180 -0
- package/dist/lib/vfs/providers/static_content.js.map +1 -0
- package/dist/lib/vfs/vfs.d.ts +59 -0
- package/dist/lib/vfs/vfs.js +202 -0
- package/dist/lib/vfs/vfs.js.map +1 -0
- package/dist/session/index.d.ts +76 -0
- package/dist/session/index.js +120 -0
- package/dist/session/index.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Surface capabilities: the input/interaction seam a host provides.
|
|
3
|
+
*
|
|
4
|
+
* The output sink (`./sink.js`) lets a host decide where a command's output
|
|
5
|
+
* goes. This module is its input-side counterpart: it lets a host declare
|
|
6
|
+
* what *interaction* it can offer — prompting for a line, reading a secret
|
|
7
|
+
* without echo, opening a local editor — and lets a builtin ask for a
|
|
8
|
+
* capability and fail with a clear message when the attached surface cannot
|
|
9
|
+
* provide it, rather than hanging on a standard input that is not there.
|
|
10
|
+
*
|
|
11
|
+
* The CLI host backs this with readline and the local `$EDITOR`; a future
|
|
12
|
+
* daemon backs it with request messages to a remote surface, and a surface
|
|
13
|
+
* that cannot (say) open a local editor simply declares `localEdit: false`.
|
|
14
|
+
*
|
|
15
|
+
* Capabilities the surface can act on directly (prompting) are methods here;
|
|
16
|
+
* capabilities a builtin still performs itself (local editing, whose editor
|
|
17
|
+
* mechanics remain in the `edit` builtin until a remote surface needs its
|
|
18
|
+
* own implementation) are declared as flags a builtin gates on via
|
|
19
|
+
* {@link capability_require}. This module is deliberately free of Node
|
|
20
|
+
* built-ins so it stays trivially testable and host-agnostic; the readline
|
|
21
|
+
* implementation lives in `./cliSurface.js`.
|
|
22
|
+
*
|
|
23
|
+
* @see docs/calypso.adoc — "Interactivity is a declared surface capability".
|
|
24
|
+
* @module
|
|
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 pipeSegments - The surface can run a pipeline's non-first
|
|
36
|
+
* segments (`... | grep foo`) through its own tools. Nothing ever spawns on
|
|
37
|
+
* a daemon host: the local CLI runs segments in-process, a remote CLI runs
|
|
38
|
+
* them on the client machine, and a browser surface lacks the capability
|
|
39
|
+
* and fails such pipelines with a clear message.
|
|
40
|
+
*/
|
|
41
|
+
export interface SurfaceCapabilities {
|
|
42
|
+
hiddenInput: boolean;
|
|
43
|
+
localEdit: boolean;
|
|
44
|
+
tty: boolean;
|
|
45
|
+
pipeSegments: boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A request to prompt the user for a line of input.
|
|
49
|
+
*
|
|
50
|
+
* @property message - The prompt text to display.
|
|
51
|
+
* @property hidden - When true, the entered text is not echoed; requires the
|
|
52
|
+
* `hiddenInput` capability.
|
|
53
|
+
*/
|
|
54
|
+
export interface PromptRequest {
|
|
55
|
+
message: string;
|
|
56
|
+
hidden?: boolean;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Content handed to a surface's local editor.
|
|
60
|
+
*
|
|
61
|
+
* @property content - The text to open in the editor.
|
|
62
|
+
* @property extension - Optional filename extension (e.g. `.txt`, `.json`) so
|
|
63
|
+
* the editor can apply the right syntax mode.
|
|
64
|
+
*/
|
|
65
|
+
export interface LocalEditRequest {
|
|
66
|
+
content: string;
|
|
67
|
+
extension?: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The outcome of a local edit.
|
|
71
|
+
*
|
|
72
|
+
* @property content - The content after editing.
|
|
73
|
+
* @property changed - Whether the content differs from what was opened.
|
|
74
|
+
*/
|
|
75
|
+
export interface LocalEditResult {
|
|
76
|
+
content: string;
|
|
77
|
+
changed: boolean;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The interaction seam a host installs. Builtins reach it through
|
|
81
|
+
* {@link surface_get}; hosts declare their capabilities and back the
|
|
82
|
+
* prompt and local-edit operations with whatever their surface supports.
|
|
83
|
+
*/
|
|
84
|
+
export interface Surface {
|
|
85
|
+
/** What this surface can do; read by builtins before they interact. */
|
|
86
|
+
readonly capabilities: SurfaceCapabilities;
|
|
87
|
+
/**
|
|
88
|
+
* Prompts for a line of input.
|
|
89
|
+
*
|
|
90
|
+
* @param request - The prompt message and whether to hide the input.
|
|
91
|
+
* @returns The entered line, trimmed.
|
|
92
|
+
* @throws {CapabilityError} When hidden input is requested but the surface
|
|
93
|
+
* lacks the `hiddenInput` capability, or the surface cannot prompt.
|
|
94
|
+
*/
|
|
95
|
+
prompt(request: PromptRequest): Promise<string>;
|
|
96
|
+
/**
|
|
97
|
+
* Runs one pipeline segment against an input, returning its output. Where
|
|
98
|
+
* this runs is the surface's business — in-process for the local CLI, on
|
|
99
|
+
* the client machine for a remote CLI — but never on a daemon host.
|
|
100
|
+
*
|
|
101
|
+
* @param command - The segment command line (e.g. `grep foo`).
|
|
102
|
+
* @param input - The bytes to feed the segment on stdin.
|
|
103
|
+
* @returns The segment's stdout.
|
|
104
|
+
* @throws {CapabilityError} When the surface lacks the `pipeSegments`
|
|
105
|
+
* capability.
|
|
106
|
+
*/
|
|
107
|
+
pipeSegment(command: string, input: Buffer): Promise<Buffer>;
|
|
108
|
+
/**
|
|
109
|
+
* Opens content in the surface's local editor and returns the result. The
|
|
110
|
+
* editor mechanics are the surface's business — a temp file and `$EDITOR`
|
|
111
|
+
* for the local CLI, the client's editor for a remote CLI, an editor
|
|
112
|
+
* component in a browser.
|
|
113
|
+
*
|
|
114
|
+
* @param request - The content to edit and an optional extension.
|
|
115
|
+
* @returns The edited content and whether it changed.
|
|
116
|
+
* @throws {CapabilityError} When the surface lacks the `localEdit`
|
|
117
|
+
* capability.
|
|
118
|
+
*/
|
|
119
|
+
localEdit(request: LocalEditRequest): Promise<LocalEditResult>;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Raised when a builtin requests an interaction the attached surface cannot
|
|
123
|
+
* provide. Carries the capability name so a host can present it uniformly.
|
|
124
|
+
*/
|
|
125
|
+
export declare class CapabilityError extends Error {
|
|
126
|
+
/** The capability that was required but absent. */
|
|
127
|
+
readonly capability: keyof SurfaceCapabilities;
|
|
128
|
+
/**
|
|
129
|
+
* @param capability - The missing capability.
|
|
130
|
+
* @param message - Human-readable explanation.
|
|
131
|
+
*/
|
|
132
|
+
constructor(capability: keyof SurfaceCapabilities, message: string);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* The default surface for a host that has not installed one: it can do
|
|
136
|
+
* nothing interactive and says so clearly. This is the correct default for
|
|
137
|
+
* an unknown host — a CLI host replaces it (see `./cliSurface.js`), and any
|
|
138
|
+
* attempt to prompt or edit before a real surface is installed fails loudly
|
|
139
|
+
* instead of hanging.
|
|
140
|
+
*/
|
|
141
|
+
export declare class HeadlessSurface implements Surface {
|
|
142
|
+
/** @inheritdoc */
|
|
143
|
+
readonly capabilities: SurfaceCapabilities;
|
|
144
|
+
/** @inheritdoc */
|
|
145
|
+
prompt(_request: PromptRequest): Promise<string>;
|
|
146
|
+
/** @inheritdoc */
|
|
147
|
+
pipeSegment(_command: string, _input: Buffer): Promise<Buffer>;
|
|
148
|
+
/** @inheritdoc */
|
|
149
|
+
localEdit(_request: LocalEditRequest): Promise<LocalEditResult>;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Returns the currently installed surface.
|
|
153
|
+
*
|
|
154
|
+
* @returns The active surface.
|
|
155
|
+
*/
|
|
156
|
+
export declare function surface_get(): Surface;
|
|
157
|
+
/**
|
|
158
|
+
* Installs a surface. Called by the host that owns the interaction channel.
|
|
159
|
+
*
|
|
160
|
+
* @param surface - The surface to install.
|
|
161
|
+
* @returns The previously installed surface, so callers can restore it.
|
|
162
|
+
*/
|
|
163
|
+
export declare function surface_set(surface: Surface): Surface;
|
|
164
|
+
/**
|
|
165
|
+
* Asserts that the active surface has a capability, throwing a
|
|
166
|
+
* {@link CapabilityError} with a clear message when it does not.
|
|
167
|
+
*
|
|
168
|
+
* @param capability - The capability the caller needs.
|
|
169
|
+
* @param message - The message to present when it is absent.
|
|
170
|
+
* @throws {CapabilityError} When the active surface lacks the capability.
|
|
171
|
+
*/
|
|
172
|
+
export declare function capability_require(capability: keyof SurfaceCapabilities, message: string): void;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Surface capabilities: the input/interaction seam a host provides.
|
|
3
|
+
*
|
|
4
|
+
* The output sink (`./sink.js`) lets a host decide where a command's output
|
|
5
|
+
* goes. This module is its input-side counterpart: it lets a host declare
|
|
6
|
+
* what *interaction* it can offer — prompting for a line, reading a secret
|
|
7
|
+
* without echo, opening a local editor — and lets a builtin ask for a
|
|
8
|
+
* capability and fail with a clear message when the attached surface cannot
|
|
9
|
+
* provide it, rather than hanging on a standard input that is not there.
|
|
10
|
+
*
|
|
11
|
+
* The CLI host backs this with readline and the local `$EDITOR`; a future
|
|
12
|
+
* daemon backs it with request messages to a remote surface, and a surface
|
|
13
|
+
* that cannot (say) open a local editor simply declares `localEdit: false`.
|
|
14
|
+
*
|
|
15
|
+
* Capabilities the surface can act on directly (prompting) are methods here;
|
|
16
|
+
* capabilities a builtin still performs itself (local editing, whose editor
|
|
17
|
+
* mechanics remain in the `edit` builtin until a remote surface needs its
|
|
18
|
+
* own implementation) are declared as flags a builtin gates on via
|
|
19
|
+
* {@link capability_require}. This module is deliberately free of Node
|
|
20
|
+
* built-ins so it stays trivially testable and host-agnostic; the readline
|
|
21
|
+
* implementation lives in `./cliSurface.js`.
|
|
22
|
+
*
|
|
23
|
+
* @see docs/calypso.adoc — "Interactivity is a declared surface capability".
|
|
24
|
+
* @module
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* Raised when a builtin requests an interaction the attached surface cannot
|
|
28
|
+
* provide. Carries the capability name so a host can present it uniformly.
|
|
29
|
+
*/
|
|
30
|
+
export class CapabilityError extends Error {
|
|
31
|
+
/** The capability that was required but absent. */
|
|
32
|
+
capability;
|
|
33
|
+
/**
|
|
34
|
+
* @param capability - The missing capability.
|
|
35
|
+
* @param message - Human-readable explanation.
|
|
36
|
+
*/
|
|
37
|
+
constructor(capability, message) {
|
|
38
|
+
super(message);
|
|
39
|
+
this.name = 'CapabilityError';
|
|
40
|
+
this.capability = capability;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The default surface for a host that has not installed one: it can do
|
|
45
|
+
* nothing interactive and says so clearly. This is the correct default for
|
|
46
|
+
* an unknown host — a CLI host replaces it (see `./cliSurface.js`), and any
|
|
47
|
+
* attempt to prompt or edit before a real surface is installed fails loudly
|
|
48
|
+
* instead of hanging.
|
|
49
|
+
*/
|
|
50
|
+
export class HeadlessSurface {
|
|
51
|
+
/** @inheritdoc */
|
|
52
|
+
capabilities = {
|
|
53
|
+
hiddenInput: false,
|
|
54
|
+
localEdit: false,
|
|
55
|
+
tty: false,
|
|
56
|
+
pipeSegments: false,
|
|
57
|
+
};
|
|
58
|
+
/** @inheritdoc */
|
|
59
|
+
prompt(_request) {
|
|
60
|
+
throw new CapabilityError('tty', 'This surface cannot prompt for input.');
|
|
61
|
+
}
|
|
62
|
+
/** @inheritdoc */
|
|
63
|
+
pipeSegment(_command, _input) {
|
|
64
|
+
throw new CapabilityError('pipeSegments', 'This surface cannot run pipeline segments.');
|
|
65
|
+
}
|
|
66
|
+
/** @inheritdoc */
|
|
67
|
+
localEdit(_request) {
|
|
68
|
+
throw new CapabilityError('localEdit', 'This surface cannot open a local editor.');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/** The active surface. Defaults to headless until a host installs one. */
|
|
72
|
+
let activeSurface = new HeadlessSurface();
|
|
73
|
+
/**
|
|
74
|
+
* Returns the currently installed surface.
|
|
75
|
+
*
|
|
76
|
+
* @returns The active surface.
|
|
77
|
+
*/
|
|
78
|
+
export function surface_get() {
|
|
79
|
+
return activeSurface;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Installs a surface. Called by the host that owns the interaction channel.
|
|
83
|
+
*
|
|
84
|
+
* @param surface - The surface to install.
|
|
85
|
+
* @returns The previously installed surface, so callers can restore it.
|
|
86
|
+
*/
|
|
87
|
+
export function surface_set(surface) {
|
|
88
|
+
const previous = activeSurface;
|
|
89
|
+
activeSurface = surface;
|
|
90
|
+
return previous;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Asserts that the active surface has a capability, throwing a
|
|
94
|
+
* {@link CapabilityError} with a clear message when it does not.
|
|
95
|
+
*
|
|
96
|
+
* @param capability - The capability the caller needs.
|
|
97
|
+
* @param message - The message to present when it is absent.
|
|
98
|
+
* @throws {CapabilityError} When the active surface lacks the capability.
|
|
99
|
+
*/
|
|
100
|
+
export function capability_require(capability, message) {
|
|
101
|
+
if (!activeSurface.capabilities[capability]) {
|
|
102
|
+
throw new CapabilityError(capability, message);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=surface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface.js","sourceRoot":"","sources":["../../src/core/surface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAyGH;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC,mDAAmD;IACnC,UAAU,CAA4B;IAEtD;;;OAGG;IACH,YAAY,UAAqC,EAAE,OAAe;QAChE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,OAAO,eAAe;IAC1B,kBAAkB;IACF,YAAY,GAAwB;QAClD,WAAW,EAAE,KAAK;QAClB,SAAS,EAAE,KAAK;QAChB,GAAG,EAAE,KAAK;QACV,YAAY,EAAE,KAAK;KACpB,CAAC;IAEF,kBAAkB;IACX,MAAM,CAAC,QAAuB;QACnC,MAAM,IAAI,eAAe,CAAC,KAAK,EAAE,uCAAuC,CAAC,CAAC;IAC5E,CAAC;IAED,kBAAkB;IACX,WAAW,CAAC,QAAgB,EAAE,MAAc;QACjD,MAAM,IAAI,eAAe,CAAC,cAAc,EAAE,4CAA4C,CAAC,CAAC;IAC1F,CAAC;IAED,kBAAkB;IACX,SAAS,CAAC,QAA0B;QACzC,MAAM,IAAI,eAAe,CAAC,WAAW,EAAE,0CAA0C,CAAC,CAAC;IACrF,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,20 @@
|
|
|
1
|
+
/** The resolved version of every layer of the stack, in sandwich order. */
|
|
2
|
+
export interface StackVersions {
|
|
3
|
+
chell: string;
|
|
4
|
+
chili: string;
|
|
5
|
+
salsa: string;
|
|
6
|
+
cumin: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The resolved version of every layer of the stack.
|
|
10
|
+
*
|
|
11
|
+
* @returns The chell/chili/salsa/cumin version strings.
|
|
12
|
+
*/
|
|
13
|
+
export declare function versions_get(): StackVersions;
|
|
14
|
+
/**
|
|
15
|
+
* Builds the multi-line version report shown by the `version` command and
|
|
16
|
+
* `--version`: chell itself plus the sandwich layers it runs with.
|
|
17
|
+
*
|
|
18
|
+
* @returns The version report string.
|
|
19
|
+
*/
|
|
20
|
+
export declare function versionReport_build(): string;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Version reporting for chell and its sandwich layers.
|
|
3
|
+
*
|
|
4
|
+
* Reads chell's own package.json and those of the cumin/salsa/chili layers, so
|
|
5
|
+
* the boot panel, the `version` command, and `--version` all report a
|
|
6
|
+
* consistent set of versions. In the standalone bundled binary — where no
|
|
7
|
+
* package.json exists on disk — the versions esbuild injected at build time are
|
|
8
|
+
* used instead.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
import { readFileSync } from 'fs';
|
|
13
|
+
import * as path from 'path';
|
|
14
|
+
import { fileURLToPath } from 'url';
|
|
15
|
+
import { createRequire } from 'module';
|
|
16
|
+
const moduleDir = path.dirname(fileURLToPath(import.meta.url));
|
|
17
|
+
/**
|
|
18
|
+
* Reads chell's own package.json, falling back to the build-time version in the
|
|
19
|
+
* bundled binary where that file is not present on disk.
|
|
20
|
+
*
|
|
21
|
+
* @returns The parsed package.json (or a `{ name, version }` fallback).
|
|
22
|
+
*/
|
|
23
|
+
function selfPackageJson_load() {
|
|
24
|
+
try {
|
|
25
|
+
return JSON.parse(readFileSync(path.resolve(moduleDir, '../../package.json'), 'utf-8'));
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
const version = typeof __CHELL_VERSION__ !== 'undefined' ? __CHELL_VERSION__ : 'unknown';
|
|
29
|
+
return { name: '@fnndsc/chell', version };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Loads a dependency's package.json via node module resolution, so it works
|
|
34
|
+
* whether the dep is nested or hoisted to a workspace-root node_modules. In the
|
|
35
|
+
* bundled binary it falls back to the versions inlined at build time.
|
|
36
|
+
*
|
|
37
|
+
* @param name - The package name (e.g. `@fnndsc/cumin`).
|
|
38
|
+
* @returns The parsed package.json, or a fallback `{ name, version }`.
|
|
39
|
+
*/
|
|
40
|
+
function depPackageJson_load(name) {
|
|
41
|
+
try {
|
|
42
|
+
const req = createRequire(import.meta.url);
|
|
43
|
+
return req(`${name}/package.json`);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
const version = typeof __CHELL_DEP_VERSIONS__ !== 'undefined' ? (__CHELL_DEP_VERSIONS__[name] ?? 'unknown') : 'unknown';
|
|
47
|
+
return { name, version };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const chellJson = selfPackageJson_load();
|
|
51
|
+
const cuminJson = depPackageJson_load('@fnndsc/cumin');
|
|
52
|
+
const salsaJson = depPackageJson_load('@fnndsc/salsa');
|
|
53
|
+
const chiliJson = depPackageJson_load('@fnndsc/chili');
|
|
54
|
+
/**
|
|
55
|
+
* The resolved version of every layer of the stack.
|
|
56
|
+
*
|
|
57
|
+
* @returns The chell/chili/salsa/cumin version strings.
|
|
58
|
+
*/
|
|
59
|
+
export function versions_get() {
|
|
60
|
+
return {
|
|
61
|
+
chell: chellJson.version,
|
|
62
|
+
chili: chiliJson.version,
|
|
63
|
+
salsa: salsaJson.version,
|
|
64
|
+
cumin: cuminJson.version,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Builds the multi-line version report shown by the `version` command and
|
|
69
|
+
* `--version`: chell itself plus the sandwich layers it runs with.
|
|
70
|
+
*
|
|
71
|
+
* @returns The version report string.
|
|
72
|
+
*/
|
|
73
|
+
export function versionReport_build() {
|
|
74
|
+
const versions = versions_get();
|
|
75
|
+
return [
|
|
76
|
+
`chell ${versions.chell}`,
|
|
77
|
+
` chili ${versions.chili}`,
|
|
78
|
+
` salsa ${versions.salsa}`,
|
|
79
|
+
` cumin ${versions.cumin}`,
|
|
80
|
+
].join('\n');
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/core/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AASvC,MAAM,SAAS,GAAW,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAevE;;;;;GAKG;AACH,SAAS,oBAAoB;IAC3B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,oBAAoB,CAAC,EAAE,OAAO,CAAC,CAAgB,CAAC;IACzG,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,OAAO,GAAW,OAAO,iBAAiB,KAAK,WAAW,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC;QACjG,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,CAAC;IAC5C,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,mBAAmB,CAAC,IAAY;IACvC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC3C,OAAO,GAAG,CAAC,GAAG,IAAI,eAAe,CAAgB,CAAC;IACpD,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,OAAO,GACX,OAAO,sBAAsB,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,sBAAsB,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC1G,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAC3B,CAAC;AACH,CAAC;AAED,MAAM,SAAS,GAAgB,oBAAoB,EAAE,CAAC;AACtD,MAAM,SAAS,GAAgB,mBAAmB,CAAC,eAAe,CAAC,CAAC;AACpE,MAAM,SAAS,GAAgB,mBAAmB,CAAC,eAAe,CAAC,CAAC;AACpE,MAAM,SAAS,GAAgB,mBAAmB,CAAC,eAAe,CAAC,CAAC;AAUpE;;;;GAIG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO;QACL,KAAK,EAAE,SAAS,CAAC,OAAO;QACxB,KAAK,EAAE,SAAS,CAAC,OAAO;QACxB,KAAK,EAAE,SAAS,CAAC,OAAO;QACxB,KAAK,EAAE,SAAS,CAAC,OAAO;KACzB,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB;IACjC,MAAM,QAAQ,GAAkB,YAAY,EAAE,CAAC;IAC/C,OAAO;QACL,SAAS,QAAQ,CAAC,KAAK,EAAE;QACzB,WAAW,QAAQ,CAAC,KAAK,EAAE;QAC3B,WAAW,QAAQ,CAAC,KAAK,EAAE;QAC3B,WAAW,QAAQ,CAAC,KAAK,EAAE;KAC5B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BRASA Runs Abstracted Shell Actions.
|
|
3
|
+
*
|
|
4
|
+
* The hostable ChRIS shell engine (kernel): parsing, dispatch, pipes, builtins,
|
|
5
|
+
* session and output capture, with no terminal I/O of its own. Frontends
|
|
6
|
+
* (the chell CLI, the calypso daemon, future web clients) host this engine and
|
|
7
|
+
* supply their own output sink, surface and renderer implementations.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
export * from './core/engine.js';
|
|
12
|
+
export * from './core/dispatch.js';
|
|
13
|
+
export * from './core/preprocess.js';
|
|
14
|
+
export * from './core/sink.js';
|
|
15
|
+
export * from './core/progress.js';
|
|
16
|
+
export * from './core/surface.js';
|
|
17
|
+
export * from './core/promptContext.js';
|
|
18
|
+
export * from './core/connect.js';
|
|
19
|
+
export * from './core/question.js';
|
|
20
|
+
export * from './core/version.js';
|
|
21
|
+
export * from './command-keys.js';
|
|
22
|
+
export * from './session/index.js';
|
|
23
|
+
export * from './builtins/index.js';
|
|
24
|
+
export * from './config/storeConfig.js';
|
|
25
|
+
export * from './lib/vfs/vfs.js';
|
|
26
|
+
export * from './lib/spinner.js';
|
|
27
|
+
export * from './lib/prefetch.js';
|
|
28
|
+
export * from './lib/parser.js';
|
|
29
|
+
export * from './lib/pipe.js';
|
|
30
|
+
export * from './lib/semicolonParser.js';
|
|
31
|
+
export * from './lib/completer/index.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BRASA Runs Abstracted Shell Actions.
|
|
3
|
+
*
|
|
4
|
+
* The hostable ChRIS shell engine (kernel): parsing, dispatch, pipes, builtins,
|
|
5
|
+
* session and output capture, with no terminal I/O of its own. Frontends
|
|
6
|
+
* (the chell CLI, the calypso daemon, future web clients) host this engine and
|
|
7
|
+
* supply their own output sink, surface and renderer implementations.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
export * from './core/engine.js';
|
|
12
|
+
export * from './core/dispatch.js';
|
|
13
|
+
export * from './core/preprocess.js';
|
|
14
|
+
export * from './core/sink.js';
|
|
15
|
+
export * from './core/progress.js';
|
|
16
|
+
export * from './core/surface.js';
|
|
17
|
+
export * from './core/promptContext.js';
|
|
18
|
+
export * from './core/connect.js';
|
|
19
|
+
export * from './core/question.js';
|
|
20
|
+
export * from './core/version.js';
|
|
21
|
+
export * from './command-keys.js';
|
|
22
|
+
export * from './session/index.js';
|
|
23
|
+
export * from './builtins/index.js';
|
|
24
|
+
export * from './config/storeConfig.js';
|
|
25
|
+
export * from './lib/vfs/vfs.js';
|
|
26
|
+
export * from './lib/spinner.js';
|
|
27
|
+
export * from './lib/prefetch.js';
|
|
28
|
+
export * from './lib/parser.js';
|
|
29
|
+
export * from './lib/pipe.js';
|
|
30
|
+
export * from './lib/semicolonParser.js';
|
|
31
|
+
export * from './lib/completer/index.js';
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Callback function type for autocomplete results.
|
|
3
|
+
* @param err - Error if completion failed, null otherwise.
|
|
4
|
+
* @param result - Tuple of [matches array, original input string].
|
|
5
|
+
*/
|
|
6
|
+
type CompleterCallback = (err: Error | null, result: [string[], string]) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Computes autocomplete suggestions for a given input line.
|
|
9
|
+
* Uses the callback style to support asynchronous operations (fetching files).
|
|
10
|
+
*
|
|
11
|
+
* @param line - The current input line.
|
|
12
|
+
* @param callback - The callback function to return results.
|
|
13
|
+
*/
|
|
14
|
+
export declare function input_complete(line: string, callback: CompleterCallback): void;
|
|
15
|
+
export {};
|