@fnndsc/brasa 0.49.1 → 0.50.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.
- package/dist/buildinfo.json +1 -1
- package/dist/builtins/fs/cat.js +6 -5
- package/dist/builtins/fs/cat.js.map +1 -1
- package/dist/builtins/fs/configWrite.js +6 -5
- package/dist/builtins/fs/configWrite.js.map +1 -1
- package/dist/builtins/fs/cp.js +3 -2
- package/dist/builtins/fs/cp.js.map +1 -1
- package/dist/builtins/fs/download.js +5 -4
- package/dist/builtins/fs/download.js.map +1 -1
- package/dist/builtins/fs/du.js +4 -6
- package/dist/builtins/fs/du.js.map +1 -1
- package/dist/builtins/fs/edit.js +10 -9
- package/dist/builtins/fs/edit.js.map +1 -1
- package/dist/builtins/fs/find.js +3 -2
- package/dist/builtins/fs/find.js.map +1 -1
- package/dist/builtins/fs/ls.js +2 -1
- package/dist/builtins/fs/ls.js.map +1 -1
- package/dist/builtins/fs/mv.js +3 -2
- package/dist/builtins/fs/mv.js.map +1 -1
- package/dist/builtins/fs/pull.js +13 -12
- package/dist/builtins/fs/pull.js.map +1 -1
- package/dist/builtins/fs/rmdir.js +2 -1
- package/dist/builtins/fs/rmdir.js.map +1 -1
- package/dist/builtins/fs/tree.js +30 -39
- package/dist/builtins/fs/tree.js.map +1 -1
- package/dist/builtins/fs/upload.js +3 -2
- package/dist/builtins/fs/upload.js.map +1 -1
- package/dist/builtins/fs/url.js +2 -1
- package/dist/builtins/fs/url.js.map +1 -1
- package/dist/builtins/games/stdin.d.ts +8 -0
- package/dist/builtins/games/stdin.js +26 -14
- package/dist/builtins/games/stdin.js.map +1 -1
- package/dist/builtins/help.js +19 -3
- package/dist/builtins/help.js.map +1 -1
- package/dist/builtins/net/connect.js +2 -1
- package/dist/builtins/net/connect.js.map +1 -1
- package/dist/builtins/net/cubepath.js +5 -4
- package/dist/builtins/net/cubepath.js.map +1 -1
- package/dist/builtins/net/pacs.js +6 -5
- package/dist/builtins/net/pacs.js.map +1 -1
- package/dist/builtins/net/query.js +14 -13
- package/dist/builtins/net/query.js.map +1 -1
- package/dist/builtins/net/status.js +5 -4
- package/dist/builtins/net/status.js.map +1 -1
- package/dist/builtins/parametersofplugin.js +2 -1
- package/dist/builtins/parametersofplugin.js.map +1 -1
- package/dist/builtins/pluginExecute.js +2 -1
- package/dist/builtins/pluginExecute.js.map +1 -1
- package/dist/builtins/proc.js +31 -30
- package/dist/builtins/proc.js.map +1 -1
- package/dist/builtins/res/compute.js +4 -3
- package/dist/builtins/res/compute.js.map +1 -1
- package/dist/builtins/res/dicom.js +4 -3
- package/dist/builtins/res/dicom.js.map +1 -1
- package/dist/builtins/res/expect.js +8 -7
- package/dist/builtins/res/expect.js.map +1 -1
- package/dist/builtins/res/feed.diagram.js +4 -3
- package/dist/builtins/res/feed.diagram.js.map +1 -1
- package/dist/builtins/res/feed.js +13 -12
- package/dist/builtins/res/feed.js.map +1 -1
- package/dist/builtins/res/feed.tree.js +3 -2
- package/dist/builtins/res/feed.tree.js.map +1 -1
- package/dist/builtins/res/files.js +3 -2
- package/dist/builtins/res/files.js.map +1 -1
- package/dist/builtins/res/gather.js +2 -1
- package/dist/builtins/res/gather.js.map +1 -1
- package/dist/builtins/res/gather.process.js +2 -1
- package/dist/builtins/res/gather.process.js.map +1 -1
- package/dist/builtins/res/group.js +7 -6
- package/dist/builtins/res/group.js.map +1 -1
- package/dist/builtins/res/image.js +2 -1
- package/dist/builtins/res/image.js.map +1 -1
- package/dist/builtins/res/pipeline.diagram.js +2 -1
- package/dist/builtins/res/pipeline.diagram.js.map +1 -1
- package/dist/builtins/res/pipeline.js +20 -19
- package/dist/builtins/res/pipeline.js.map +1 -1
- package/dist/builtins/res/play.js +25 -31
- package/dist/builtins/res/play.js.map +1 -1
- package/dist/builtins/res/plugin.js +7 -6
- package/dist/builtins/res/plugin.js.map +1 -1
- package/dist/builtins/res/plugininstance.js +6 -5
- package/dist/builtins/res/plugininstance.js.map +1 -1
- package/dist/builtins/res/pluginmeta.js +5 -4
- package/dist/builtins/res/pluginmeta.js.map +1 -1
- package/dist/builtins/res/record.js +6 -5
- package/dist/builtins/res/record.js.map +1 -1
- package/dist/builtins/res/tag.js +5 -4
- package/dist/builtins/res/tag.js.map +1 -1
- package/dist/builtins/res/user.js +2 -1
- package/dist/builtins/res/user.js.map +1 -1
- package/dist/builtins/res/workflow.js +5 -4
- package/dist/builtins/res/workflow.js.map +1 -1
- package/dist/builtins/store.js +5 -4
- package/dist/builtins/store.js.map +1 -1
- package/dist/builtins/sys/apropos.js +2 -1
- package/dist/builtins/sys/apropos.js.map +1 -1
- package/dist/builtins/sys/echo.js +4 -3
- package/dist/builtins/sys/echo.js.map +1 -1
- package/dist/builtins/sys/grep.js +3 -2
- package/dist/builtins/sys/grep.js.map +1 -1
- package/dist/builtins/sys/joblets.d.ts +28 -0
- package/dist/builtins/sys/joblets.js +95 -0
- package/dist/builtins/sys/joblets.js.map +1 -0
- package/dist/builtins/sys/tasks.d.ts +1 -1
- package/dist/builtins/sys/tasks.js +7 -1
- package/dist/builtins/sys/tasks.js.map +1 -1
- package/dist/builtins/sys/textFilters.js +5 -4
- package/dist/builtins/sys/textFilters.js.map +1 -1
- package/dist/builtins/sys/variables.js +6 -5
- package/dist/builtins/sys/variables.js.map +1 -1
- package/dist/builtins/sys/whoami.js +4 -3
- package/dist/builtins/sys/whoami.js.map +1 -1
- package/dist/chris/chiliDelegate.js +2 -1
- package/dist/chris/chiliDelegate.js.map +1 -1
- package/dist/chris/chrisCommands.d.ts +0 -1
- package/dist/chris/chrisCommands.js +13 -0
- package/dist/chris/chrisCommands.js.map +1 -1
- package/dist/chris/connect.js +8 -5
- package/dist/chris/connect.js.map +1 -1
- package/dist/core/assignment.js +2 -2
- package/dist/core/assignment.js.map +1 -1
- package/dist/core/cancellation.d.ts +10 -7
- package/dist/core/cancellation.js +39 -24
- package/dist/core/cancellation.js.map +1 -1
- package/dist/core/commandRegistry.d.ts +19 -0
- package/dist/core/commandRegistry.js +12 -0
- package/dist/core/commandRegistry.js.map +1 -1
- package/dist/core/coreCommands.d.ts +0 -1
- package/dist/core/coreCommands.js +22 -0
- package/dist/core/coreCommands.js.map +1 -1
- package/dist/core/dispatch.js +12 -18
- package/dist/core/dispatch.js.map +1 -1
- package/dist/core/elevation.js +7 -6
- package/dist/core/elevation.js.map +1 -1
- package/dist/core/engine.d.ts +43 -40
- package/dist/core/engine.js +43 -19
- package/dist/core/engine.js.map +1 -1
- package/dist/core/handlerRun.d.ts +16 -6
- package/dist/core/handlerRun.js +47 -2
- package/dist/core/handlerRun.js.map +1 -1
- package/dist/core/holds.d.ts +25 -0
- package/dist/core/holds.js +74 -0
- package/dist/core/holds.js.map +1 -0
- package/dist/core/joblets.d.ts +94 -0
- package/dist/core/joblets.js +363 -0
- package/dist/core/joblets.js.map +1 -0
- package/dist/core/lineOrigin.d.ts +31 -0
- package/dist/core/lineOrigin.js +38 -0
- package/dist/core/lineOrigin.js.map +1 -0
- package/dist/core/listing.d.ts +8 -0
- package/dist/core/listing.js +26 -14
- package/dist/core/listing.js.map +1 -1
- package/dist/core/runner.d.ts +15 -0
- package/dist/core/runner.js +25 -7
- package/dist/core/runner.js.map +1 -1
- package/dist/core/surface.d.ts +17 -2
- package/dist/core/surface.js +26 -3
- package/dist/core/surface.js.map +1 -1
- package/dist/core/variables.d.ts +7 -0
- package/dist/core/variables.js +9 -0
- package/dist/core/variables.js.map +1 -1
- package/dist/notes.json +1 -1
- package/dist/session/answer.d.ts +8 -11
- package/dist/session/answer.js +36 -25
- package/dist/session/answer.js.map +1 -1
- package/dist/session/cwdScope.d.ts +25 -0
- package/dist/session/cwdScope.js +36 -0
- package/dist/session/cwdScope.js.map +1 -0
- package/dist/session/index.js +14 -4
- package/dist/session/index.js.map +1 -1
- package/dist/session/recorder.d.ts +7 -4
- package/dist/session/recorder.js +16 -21
- package/dist/session/recorder.js.map +1 -1
- package/package.json +5 -5
- package/dist/core/turn.d.ts +0 -61
- package/dist/core/turn.js +0 -83
- package/dist/core/turn.js.map +0 -1
package/dist/session/answer.d.ts
CHANGED
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
* against the most recent one. The numbering belongs to the MODEL rather
|
|
11
11
|
* than to any rendering of it: a console table and a graphical pane show the
|
|
12
12
|
* same answer differently, and an index that meant different rows on
|
|
13
|
-
* different
|
|
13
|
+
* different renderings would be worse than no index at all.
|
|
14
|
+
*
|
|
15
|
+
* Each surface keeps its own last answer: a listing read on one surface
|
|
16
|
+
* does not renumber the rows another is about to act on (#1273). A line
|
|
17
|
+
* counts against the answer of the surface it came from.
|
|
14
18
|
*
|
|
15
19
|
* What a row IS differs by listing, and each one says: a path for files and
|
|
16
20
|
* PACS series, a feed id for feeds, an instance id for jobs. A verb then
|
|
@@ -65,13 +69,6 @@ export interface NumberedHandle {
|
|
|
65
69
|
ordinal: number;
|
|
66
70
|
address: string;
|
|
67
71
|
}
|
|
68
|
-
/** What a surface is told about the numbering. */
|
|
69
|
-
export interface Numbering {
|
|
70
|
-
id: number;
|
|
71
|
-
source: string;
|
|
72
|
-
rows: number;
|
|
73
|
-
handles: NumberedHandle[];
|
|
74
|
-
}
|
|
75
72
|
/** The answer a session most recently gave, with the line that asked. */
|
|
76
73
|
export interface SessionAnswer {
|
|
77
74
|
/** The line that produced it, for the readout that says what was numbered. */
|
|
@@ -216,8 +213,8 @@ export declare function answerConsulted_take(): SessionAnswer | null;
|
|
|
216
213
|
/** Forgets the answer, for a test that needs a session that has listed nothing. */
|
|
217
214
|
export declare function answer_forget(): void;
|
|
218
215
|
/**
|
|
219
|
-
*
|
|
216
|
+
* Forgets one surface's answer, when the surface has gone.
|
|
220
217
|
*
|
|
221
|
-
* @
|
|
218
|
+
* @param origin - The surface's origin.
|
|
222
219
|
*/
|
|
223
|
-
export declare function
|
|
220
|
+
export declare function answerOrigin_forget(origin: string): void;
|
package/dist/session/answer.js
CHANGED
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
* against the most recent one. The numbering belongs to the MODEL rather
|
|
11
11
|
* than to any rendering of it: a console table and a graphical pane show the
|
|
12
12
|
* same answer differently, and an index that meant different rows on
|
|
13
|
-
* different
|
|
13
|
+
* different renderings would be worse than no index at all.
|
|
14
|
+
*
|
|
15
|
+
* Each surface keeps its own last answer: a listing read on one surface
|
|
16
|
+
* does not renumber the rows another is about to act on (#1273). A line
|
|
17
|
+
* counts against the answer of the surface it came from.
|
|
14
18
|
*
|
|
15
19
|
* What a row IS differs by listing, and each one says: a path for files and
|
|
16
20
|
* PACS series, a feed id for feeds, an instance id for jobs. A verb then
|
|
@@ -19,12 +23,19 @@
|
|
|
19
23
|
* @module
|
|
20
24
|
*/
|
|
21
25
|
import { ambient_publish } from '../core/ambient.js';
|
|
26
|
+
import { lineOrigin_get } from '../core/lineOrigin.js';
|
|
22
27
|
/** Model kind to the rows it holds. */
|
|
23
28
|
const adapters = new Map();
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
|
|
29
|
+
/** Each surface's last answer, by the origin its lines carry. */
|
|
30
|
+
const answers = new Map();
|
|
31
|
+
/** The running line's surface's answer, or undefined before it has listed. */
|
|
32
|
+
function origin_answer() {
|
|
33
|
+
return answers.get(lineOrigin_get());
|
|
34
|
+
}
|
|
35
|
+
/** The running line's surface's last answer, or null before it has listed. */
|
|
36
|
+
function held_get() {
|
|
37
|
+
return origin_answer()?.held ?? null;
|
|
38
|
+
}
|
|
28
39
|
/** Rises with each answer, so a surface can tell newer from older. */
|
|
29
40
|
let sequence = 0;
|
|
30
41
|
/** Past this many rows the addresses stay in the kernel and off the wire. */
|
|
@@ -55,11 +66,14 @@ export function answer_note(kind, data, source) {
|
|
|
55
66
|
if (rows === null || rows.length === 0)
|
|
56
67
|
return;
|
|
57
68
|
sequence += 1;
|
|
58
|
-
|
|
69
|
+
const origin = lineOrigin_get();
|
|
70
|
+
answers.set(origin, { held: { source, rows, kind, data }, consulted: false });
|
|
59
71
|
// A surface cannot light the index pills on the right listing unless it is
|
|
60
72
|
// told which one the numbers now count. Pills that lie are worse than none.
|
|
73
|
+
// Only the surface whose line listed is told: the others' numbers stand.
|
|
61
74
|
ambient_publish({
|
|
62
75
|
kind: 'numbered',
|
|
76
|
+
origin,
|
|
63
77
|
id: sequence,
|
|
64
78
|
source,
|
|
65
79
|
rows: rows.length,
|
|
@@ -77,15 +91,17 @@ export function answer_note(kind, data, source) {
|
|
|
77
91
|
* from the answer, or the ordinal is past that kind's end.
|
|
78
92
|
*/
|
|
79
93
|
export function answerRow_get(handle) {
|
|
80
|
-
|
|
94
|
+
const mine = origin_answer();
|
|
95
|
+
if (mine === undefined)
|
|
81
96
|
return null;
|
|
97
|
+
const held = mine.held;
|
|
82
98
|
// By the number the row wears, which a filtered listing keeps (#1100).
|
|
83
99
|
const numbered = rows_number(held.rows, held.data);
|
|
84
100
|
const at = numbered.findIndex((one) => one.kind === handle.kind && one.ordinal === handle.ordinal);
|
|
85
101
|
const row = at < 0 ? undefined : held.rows[at];
|
|
86
102
|
if (row === undefined)
|
|
87
103
|
return null;
|
|
88
|
-
consulted = true;
|
|
104
|
+
mine.consulted = true;
|
|
89
105
|
return row;
|
|
90
106
|
}
|
|
91
107
|
/**
|
|
@@ -95,6 +111,7 @@ export function answerRow_get(handle) {
|
|
|
95
111
|
* @returns The count, zero when nothing is numbered.
|
|
96
112
|
*/
|
|
97
113
|
export function answerKind_count(kind) {
|
|
114
|
+
const held = held_get();
|
|
98
115
|
if (held === null)
|
|
99
116
|
return 0;
|
|
100
117
|
return held.rows.filter((row) => row.kind === kind).length;
|
|
@@ -108,6 +125,7 @@ export function answerKind_count(kind) {
|
|
|
108
125
|
* @returns The handles.
|
|
109
126
|
*/
|
|
110
127
|
export function answerHandles_get() {
|
|
128
|
+
const held = held_get();
|
|
111
129
|
return held === null ? [] : rows_number(held.rows, held.data);
|
|
112
130
|
}
|
|
113
131
|
/** Numbers a listing's rows already wore, kept with the listing's data (a filtered listing). */
|
|
@@ -241,7 +259,7 @@ export function numberedFooter_render(handles) {
|
|
|
241
259
|
* @returns The held answer, or null when nothing has listed.
|
|
242
260
|
*/
|
|
243
261
|
export function answer_get() {
|
|
244
|
-
return
|
|
262
|
+
return held_get();
|
|
245
263
|
}
|
|
246
264
|
/**
|
|
247
265
|
* Takes the note that an index was resolved, for the line's readout.
|
|
@@ -252,30 +270,23 @@ export function answer_get() {
|
|
|
252
270
|
* @returns What was consulted, or null when this line used no index.
|
|
253
271
|
*/
|
|
254
272
|
export function answerConsulted_take() {
|
|
255
|
-
|
|
273
|
+
const mine = origin_answer();
|
|
274
|
+
if (mine === undefined || !mine.consulted)
|
|
256
275
|
return null;
|
|
257
|
-
consulted = false;
|
|
258
|
-
return held;
|
|
276
|
+
mine.consulted = false;
|
|
277
|
+
return mine.held;
|
|
259
278
|
}
|
|
260
279
|
/** Forgets the answer, for a test that needs a session that has listed nothing. */
|
|
261
280
|
export function answer_forget() {
|
|
262
|
-
|
|
263
|
-
consulted = false;
|
|
281
|
+
answers.clear();
|
|
264
282
|
sequence = 0;
|
|
265
283
|
}
|
|
266
284
|
/**
|
|
267
|
-
*
|
|
285
|
+
* Forgets one surface's answer, when the surface has gone.
|
|
268
286
|
*
|
|
269
|
-
* @
|
|
287
|
+
* @param origin - The surface's origin.
|
|
270
288
|
*/
|
|
271
|
-
export function
|
|
272
|
-
|
|
273
|
-
return null;
|
|
274
|
-
return {
|
|
275
|
-
id: sequence,
|
|
276
|
-
source: held.source,
|
|
277
|
-
rows: held.rows.length,
|
|
278
|
-
handles: held.rows.length <= VALUES_ON_THE_WIRE_MAX ? answerHandles_get() : [],
|
|
279
|
-
};
|
|
289
|
+
export function answerOrigin_forget(origin) {
|
|
290
|
+
answers.delete(origin);
|
|
280
291
|
}
|
|
281
292
|
//# sourceMappingURL=answer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"answer.js","sourceRoot":"","sources":["../../src/session/answer.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version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CAAC,SAAS,GAAG,KAAK,CAAC;IACvB,OAAO,IAAI,CAAC,IAAI,CAAC;AACnB,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,aAAa;IAC3B,OAAO,CAAC,KAAK,EAAE,CAAC;IAChB,QAAQ,GAAG,CAAC,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAc;IAChD,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Where a line stands, once it has asked. */
|
|
2
|
+
export interface LineCwd {
|
|
3
|
+
cwd: string | null;
|
|
4
|
+
/**
|
|
5
|
+
* Whether its `cd` is its own: a joblet's is, as a subshell's is, and the
|
|
6
|
+
* session stays where it was.
|
|
7
|
+
*/
|
|
8
|
+
own: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Runs a line standing where the session stands when it first asks.
|
|
12
|
+
*
|
|
13
|
+
* @param operation - The line.
|
|
14
|
+
* @param cwd - Where it stands from the start, its `cd`s its own (a
|
|
15
|
+
* joblet, where it was started); null to read the session's when it first
|
|
16
|
+
* asks, its `cd`s the session's.
|
|
17
|
+
* @returns What the line returns.
|
|
18
|
+
*/
|
|
19
|
+
export declare function cwdScope_run<T>(operation: () => Promise<T>, cwd?: string | null): Promise<T>;
|
|
20
|
+
/**
|
|
21
|
+
* Where the running line stands.
|
|
22
|
+
*
|
|
23
|
+
* @returns Its slot, or undefined outside any line.
|
|
24
|
+
*/
|
|
25
|
+
export declare function lineCwd_get(): LineCwd | undefined;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The working directory a line stands in.
|
|
3
|
+
*
|
|
4
|
+
* It is read once, when the line first asks, and kept for the rest of it.
|
|
5
|
+
* Lines run side by side, and a read that began in one folder must not
|
|
6
|
+
* finish in another because a `cd` ran beside it (#1273). A line's own `cd`
|
|
7
|
+
* moves it, and the session with it (`session.setCWD`).
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
12
|
+
const cwdScope = new AsyncLocalStorage();
|
|
13
|
+
/**
|
|
14
|
+
* Runs a line standing where the session stands when it first asks.
|
|
15
|
+
*
|
|
16
|
+
* @param operation - The line.
|
|
17
|
+
* @param cwd - Where it stands from the start, its `cd`s its own (a
|
|
18
|
+
* joblet, where it was started); null to read the session's when it first
|
|
19
|
+
* asks, its `cd`s the session's.
|
|
20
|
+
* @returns What the line returns.
|
|
21
|
+
*/
|
|
22
|
+
export async function cwdScope_run(operation, cwd = null) {
|
|
23
|
+
// A line inside one that already stands somewhere (a joblet's) stands there too.
|
|
24
|
+
if (cwd === null && cwdScope.getStore() !== undefined)
|
|
25
|
+
return await operation();
|
|
26
|
+
return await cwdScope.run({ cwd, own: cwd !== null }, operation);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Where the running line stands.
|
|
30
|
+
*
|
|
31
|
+
* @returns Its slot, or undefined outside any line.
|
|
32
|
+
*/
|
|
33
|
+
export function lineCwd_get() {
|
|
34
|
+
return cwdScope.getStore();
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=cwdScope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cwdScope.js","sourceRoot":"","sources":["../../src/session/cwdScope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAYrD,MAAM,QAAQ,GAA+B,IAAI,iBAAiB,EAAW,CAAC;AAE9E;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAI,SAA2B,EAAE,MAAqB,IAAI;IAC1F,iFAAiF;IACjF,IAAI,GAAG,KAAK,IAAI,IAAI,QAAQ,CAAC,QAAQ,EAAE,KAAK,SAAS;QAAE,OAAO,MAAM,SAAS,EAAE,CAAC;IAChF,OAAO,MAAM,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,KAAK,IAAI,EAAE,EAAE,SAAS,CAAC,CAAC;AACnE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO,QAAQ,CAAC,QAAQ,EAAE,CAAC;AAC7B,CAAC"}
|
package/dist/session/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { backend_get } from '../core/backend.js';
|
|
2
|
+
import { lineCwd_get } from './cwdScope.js';
|
|
2
3
|
/**
|
|
3
4
|
* Manages the shell session state (Connection, Context).
|
|
4
5
|
*/
|
|
@@ -38,16 +39,25 @@ export class Session {
|
|
|
38
39
|
* always honoured, `/` included, since the operator put it there.
|
|
39
40
|
*/
|
|
40
41
|
async getCWD() {
|
|
42
|
+
const line = lineCwd_get();
|
|
43
|
+
if (line?.cwd)
|
|
44
|
+
return line.cwd;
|
|
41
45
|
const stored = await backend_get().session.cwd_load();
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
const cwd = stored ? stored : await backend_get().session.home_get();
|
|
47
|
+
if (line !== undefined)
|
|
48
|
+
line.cwd = cwd;
|
|
49
|
+
return cwd;
|
|
45
50
|
}
|
|
46
51
|
/**
|
|
47
52
|
* Set Current Working Directory: the backend stores it for the identity.
|
|
48
53
|
*/
|
|
49
54
|
async setCWD(path) {
|
|
50
|
-
|
|
55
|
+
const line = lineCwd_get();
|
|
56
|
+
// A joblet's `cd` is its own: the session stays where it was.
|
|
57
|
+
if (line?.own !== true)
|
|
58
|
+
await backend_get().session.cwd_save(path);
|
|
59
|
+
if (line !== undefined)
|
|
60
|
+
line.cwd = path;
|
|
51
61
|
}
|
|
52
62
|
/**
|
|
53
63
|
* Changes directory as an interactive `cd` operation while retaining the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/session/index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AAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACH,UAAU,CAAC,MAAc;QACvB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAY,OAAO,CAAC,WAAW,EAAE,CAAC"}
|
|
@@ -24,10 +24,13 @@ export declare function recorder_start(path: string): void;
|
|
|
24
24
|
* @param line - The line, as it was run.
|
|
25
25
|
*/
|
|
26
26
|
export declare function recorder_note(line: string): void;
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Runs a manifest's own lines uncaptured.
|
|
29
|
+
*
|
|
30
|
+
* @param operation - The play.
|
|
31
|
+
* @returns What the play returns.
|
|
32
|
+
*/
|
|
33
|
+
export declare function recorderMuted_run<T>(operation: () => Promise<T>): Promise<T>;
|
|
31
34
|
/**
|
|
32
35
|
* Ends the recording.
|
|
33
36
|
*
|
package/dist/session/recorder.js
CHANGED
|
@@ -13,23 +13,19 @@
|
|
|
13
13
|
*
|
|
14
14
|
* @module
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
16
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
17
17
|
/** Where the recording will be written, or null when nothing is recording. */
|
|
18
18
|
let target = null;
|
|
19
19
|
/** The lines captured so far, in the order they ran. */
|
|
20
20
|
let captured = [];
|
|
21
21
|
/** When the recording started. */
|
|
22
22
|
let startedAt = 0;
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
save: () => muted,
|
|
30
|
-
clear: () => { muted = 0; },
|
|
31
|
-
restore: (saved) => { muted = typeof saved === 'number' ? saved : 0; },
|
|
32
|
-
});
|
|
23
|
+
/**
|
|
24
|
+
* Work that must not be captured: a played manifest's own lines. The mute
|
|
25
|
+
* is the manifest's and its lines', so a line another surface runs while it
|
|
26
|
+
* plays is recorded as the operator's own.
|
|
27
|
+
*/
|
|
28
|
+
const muteScope = new AsyncLocalStorage();
|
|
33
29
|
/**
|
|
34
30
|
* Begins a recording.
|
|
35
31
|
*
|
|
@@ -39,7 +35,6 @@ export function recorder_start(path) {
|
|
|
39
35
|
target = path;
|
|
40
36
|
captured = [];
|
|
41
37
|
startedAt = Date.now();
|
|
42
|
-
muted = 0;
|
|
43
38
|
}
|
|
44
39
|
/**
|
|
45
40
|
* Notes a line the session ran.
|
|
@@ -52,7 +47,7 @@ export function recorder_start(path) {
|
|
|
52
47
|
* @param line - The line, as it was run.
|
|
53
48
|
*/
|
|
54
49
|
export function recorder_note(line) {
|
|
55
|
-
if (target === null ||
|
|
50
|
+
if (target === null || muteScope.getStore() === true)
|
|
56
51
|
return;
|
|
57
52
|
const trimmed = line.trim();
|
|
58
53
|
if (trimmed.length === 0)
|
|
@@ -62,14 +57,14 @@ export function recorder_note(line) {
|
|
|
62
57
|
return;
|
|
63
58
|
captured.push(trimmed);
|
|
64
59
|
}
|
|
65
|
-
/**
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Runs a manifest's own lines uncaptured.
|
|
62
|
+
*
|
|
63
|
+
* @param operation - The play.
|
|
64
|
+
* @returns What the play returns.
|
|
65
|
+
*/
|
|
66
|
+
export async function recorderMuted_run(operation) {
|
|
67
|
+
return await muteScope.run(true, operation);
|
|
73
68
|
}
|
|
74
69
|
/**
|
|
75
70
|
* Ends the recording.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recorder.js","sourceRoot":"","sources":["../../src/session/recorder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"recorder.js","sourceRoot":"","sources":["../../src/session/recorder.ts"],"names":[],"mappings":"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AAE,CAAC,GAAG,QAAQ,CAAC;QACpB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;KAClC,CAAC;IACF,MAAM,GAAG,IAAI,CAAC;IACd,QAAQ,GAAG,EAAE,CAAC;IACd,SAAS,GAAG,CAAC,CAAC;IACd,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO;QACL,MAAM;QACN,KAAK,EAAE,QAAQ,CAAC,MAAM;QACtB,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;KACxD,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fnndsc/brasa",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.50.1",
|
|
4
4
|
"description": "BRASA Runs Abstracted Shell Actions - the hostable ChRIS shell engine (kernel)",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -48,17 +48,17 @@
|
|
|
48
48
|
"author": "FNNDSC <dev@babyMRI.org>",
|
|
49
49
|
"license": "MIT",
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@fnndsc/chili": "^3.8.
|
|
51
|
+
"@fnndsc/chili": "^3.8.1",
|
|
52
52
|
"@fnndsc/fond": "^0.6.0",
|
|
53
|
-
"@fnndsc/cumin": "^3.29.
|
|
54
|
-
"@fnndsc/salsa": "^4.4.
|
|
53
|
+
"@fnndsc/cumin": "^3.29.4",
|
|
54
|
+
"@fnndsc/salsa": "^4.4.3",
|
|
55
55
|
"bsd-trek": "^0.4.0",
|
|
56
56
|
"chalk": "^4.1.2",
|
|
57
57
|
"cli-highlight": "^2.1.11",
|
|
58
58
|
"js-yaml": "^4.1.0",
|
|
59
59
|
"minimatch": "^10.1.1",
|
|
60
60
|
"ws": "^8.21.0",
|
|
61
|
-
"@fnndsc/menu": "^0.
|
|
61
|
+
"@fnndsc/menu": "^0.31.0",
|
|
62
62
|
"@fnndsc/orrery": "^0.7.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
package/dist/core/turn.d.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file A command's turn: the per-command state a command leaves behind when
|
|
3
|
-
* it steps aside to wait on a person, and finds again when it resumes.
|
|
4
|
-
*
|
|
5
|
-
* The session runs one command at a time, but a command waiting on a
|
|
6
|
-
* question gives up its turn (the host's lane), and other commands run to
|
|
7
|
-
* completion before it resumes. Some state is module-level and belongs to
|
|
8
|
-
* whichever command is running: the exit code it has set, a pipe's text or
|
|
9
|
-
* listing not yet taken, the depth of a `play` manifest, a mute on the
|
|
10
|
-
* recorder, the command Ctrl-C cancels. Each such part registers here how to
|
|
11
|
-
* save, clear and restore itself; the host calls `turn_leave` as a command
|
|
12
|
-
* steps aside (so the next command starts clean) and `turn_resume` when it
|
|
13
|
-
* returns (so it finds its own state, not what ran in between).
|
|
14
|
-
*
|
|
15
|
-
* @module
|
|
16
|
-
*/
|
|
17
|
-
/** One piece of per-command state, and how to hand it over. */
|
|
18
|
-
export interface TurnPart {
|
|
19
|
-
/** A name for the part, for diagnostics. */
|
|
20
|
-
name: string;
|
|
21
|
-
/** Reads the part as the running command left it. */
|
|
22
|
-
save: () => unknown;
|
|
23
|
-
/** Puts the part to its idle value, for the next command. */
|
|
24
|
-
clear: () => void;
|
|
25
|
-
/** Puts back what `save` read. */
|
|
26
|
-
restore: (saved: unknown) => void;
|
|
27
|
-
}
|
|
28
|
-
/** What a command left behind when it stepped aside. */
|
|
29
|
-
export interface TurnState {
|
|
30
|
-
saved: Map<string, unknown>;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Registers a piece of per-command state. Registering a name again replaces
|
|
34
|
-
* the part (a module loaded twice under test).
|
|
35
|
-
*
|
|
36
|
-
* @param part - The part.
|
|
37
|
-
*/
|
|
38
|
-
export declare function turnPart_register(part: TurnPart): void;
|
|
39
|
-
/**
|
|
40
|
-
* The running command steps aside: its state is saved and cleared.
|
|
41
|
-
*
|
|
42
|
-
* @returns What it left behind, for `turn_resume`.
|
|
43
|
-
*/
|
|
44
|
-
export declare function turn_leave(): TurnState;
|
|
45
|
-
/**
|
|
46
|
-
* A command resumes: its state is put back, over whatever ran in between.
|
|
47
|
-
*
|
|
48
|
-
* @param state - What it left behind.
|
|
49
|
-
*/
|
|
50
|
-
export declare function turn_resume(state: TurnState): void;
|
|
51
|
-
/**
|
|
52
|
-
* Acts on a command that stepped aside, from outside its turn: its state is
|
|
53
|
-
* put in place, the act runs, and the running command's state is put back.
|
|
54
|
-
* All of it is synchronous, so nothing runs in between (a STOP pressed on a
|
|
55
|
-
* command that waits aside).
|
|
56
|
-
*
|
|
57
|
-
* @param state - What the stepped-aside command left behind.
|
|
58
|
-
* @param act - What to do with its state in place.
|
|
59
|
-
* @returns Its state after the act, for its `turn_resume`.
|
|
60
|
-
*/
|
|
61
|
-
export declare function turn_within(state: TurnState, act: () => void): TurnState;
|
package/dist/core/turn.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file A command's turn: the per-command state a command leaves behind when
|
|
3
|
-
* it steps aside to wait on a person, and finds again when it resumes.
|
|
4
|
-
*
|
|
5
|
-
* The session runs one command at a time, but a command waiting on a
|
|
6
|
-
* question gives up its turn (the host's lane), and other commands run to
|
|
7
|
-
* completion before it resumes. Some state is module-level and belongs to
|
|
8
|
-
* whichever command is running: the exit code it has set, a pipe's text or
|
|
9
|
-
* listing not yet taken, the depth of a `play` manifest, a mute on the
|
|
10
|
-
* recorder, the command Ctrl-C cancels. Each such part registers here how to
|
|
11
|
-
* save, clear and restore itself; the host calls `turn_leave` as a command
|
|
12
|
-
* steps aside (so the next command starts clean) and `turn_resume` when it
|
|
13
|
-
* returns (so it finds its own state, not what ran in between).
|
|
14
|
-
*
|
|
15
|
-
* @module
|
|
16
|
-
*/
|
|
17
|
-
const parts = new Map();
|
|
18
|
-
/**
|
|
19
|
-
* Registers a piece of per-command state. Registering a name again replaces
|
|
20
|
-
* the part (a module loaded twice under test).
|
|
21
|
-
*
|
|
22
|
-
* @param part - The part.
|
|
23
|
-
*/
|
|
24
|
-
export function turnPart_register(part) {
|
|
25
|
-
parts.set(part.name, part);
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* The running command steps aside: its state is saved and cleared.
|
|
29
|
-
*
|
|
30
|
-
* @returns What it left behind, for `turn_resume`.
|
|
31
|
-
*/
|
|
32
|
-
export function turn_leave() {
|
|
33
|
-
const saved = new Map();
|
|
34
|
-
for (const part of parts.values()) {
|
|
35
|
-
saved.set(part.name, part.save());
|
|
36
|
-
part.clear();
|
|
37
|
-
}
|
|
38
|
-
return { saved };
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* A command resumes: its state is put back, over whatever ran in between.
|
|
42
|
-
*
|
|
43
|
-
* @param state - What it left behind.
|
|
44
|
-
*/
|
|
45
|
-
export function turn_resume(state) {
|
|
46
|
-
for (const part of parts.values()) {
|
|
47
|
-
if (state.saved.has(part.name))
|
|
48
|
-
part.restore(state.saved.get(part.name));
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Acts on a command that stepped aside, from outside its turn: its state is
|
|
53
|
-
* put in place, the act runs, and the running command's state is put back.
|
|
54
|
-
* All of it is synchronous, so nothing runs in between (a STOP pressed on a
|
|
55
|
-
* command that waits aside).
|
|
56
|
-
*
|
|
57
|
-
* @param state - What the stepped-aside command left behind.
|
|
58
|
-
* @param act - What to do with its state in place.
|
|
59
|
-
* @returns Its state after the act, for its `turn_resume`.
|
|
60
|
-
*/
|
|
61
|
-
export function turn_within(state, act) {
|
|
62
|
-
const running = turn_leave();
|
|
63
|
-
turn_resume(state);
|
|
64
|
-
try {
|
|
65
|
-
act();
|
|
66
|
-
}
|
|
67
|
-
finally {
|
|
68
|
-
const after = turn_leave();
|
|
69
|
-
turn_resume(running);
|
|
70
|
-
state.saved = after.saved;
|
|
71
|
-
}
|
|
72
|
-
return state;
|
|
73
|
-
}
|
|
74
|
-
// The exit code: legacy handlers report failure by setting it, and the
|
|
75
|
-
// engine reads the change across a command. A command that stepped aside
|
|
76
|
-
// must not inherit another's failure, nor lose its own.
|
|
77
|
-
turnPart_register({
|
|
78
|
-
name: 'exitCode',
|
|
79
|
-
save: () => process.exitCode,
|
|
80
|
-
clear: () => { process.exitCode = undefined; },
|
|
81
|
-
restore: (saved) => { process.exitCode = typeof saved === 'number' ? saved : undefined; },
|
|
82
|
-
});
|
|
83
|
-
//# sourceMappingURL=turn.js.map
|
package/dist/core/turn.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"turn.js","sourceRoot":"","sources":["../../src/core/turn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAmBH,MAAM,KAAK,GAA0B,IAAI,GAAG,EAAE,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAc;IAC9C,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC7B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU;IACxB,MAAM,KAAK,GAAyB,IAAI,GAAG,EAAE,CAAC;IAC9C,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;QAClC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAClC,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,CAAC;AACnB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,KAAgB;IAC1C,KAAK,MAAM,IAAI,IAAI,KAAK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