@fnndsc/brasa 0.56.1 → 0.56.2
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/berth/berth.d.ts +90 -3
- package/dist/builtins/berth/berth.js +129 -76
- package/dist/builtins/berth/berth.js.map +1 -1
- package/dist/builtins/berth/berthClose.d.ts +25 -6
- package/dist/builtins/berth/berthClose.js +8 -64
- package/dist/builtins/berth/berthClose.js.map +1 -1
- package/dist/builtins/berth/berthCube.js +4 -6
- package/dist/builtins/berth/berthCube.js.map +1 -1
- package/dist/builtins/berth/berthProcesses.js +33 -3
- package/dist/builtins/berth/berthProcesses.js.map +1 -1
- package/dist/builtins/fs/cat.js +3 -3
- package/dist/builtins/fs/cat.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.d.ts +31 -4
- package/dist/builtins/fs/download.js +75 -38
- package/dist/builtins/fs/download.js.map +1 -1
- package/dist/builtins/fs/ls.d.ts +69 -4
- package/dist/builtins/fs/ls.js +84 -45
- package/dist/builtins/fs/ls.js.map +1 -1
- package/dist/builtins/fs/pull.js +37 -9
- package/dist/builtins/fs/pull.js.map +1 -1
- package/dist/builtins/help.d.ts +3 -1
- package/dist/builtins/help.js +22 -33
- package/dist/builtins/help.js.map +1 -1
- package/dist/builtins/res/dicom.d.ts +3 -4
- package/dist/builtins/res/dicom.js +5 -19
- package/dist/builtins/res/dicom.js.map +1 -1
- package/dist/builtins/sys/textFilters.js +2 -2
- package/dist/builtins/sys/textFilters.js.map +1 -1
- package/dist/builtins/utils.d.ts +1 -1
- package/dist/builtins/utils.js +1 -1
- package/dist/builtins/utils.js.map +1 -1
- package/dist/chris/backend.js +2 -0
- package/dist/chris/backend.js.map +1 -1
- package/dist/chris/chrisCommands.js +6 -9
- package/dist/chris/chrisCommands.js.map +1 -1
- package/dist/chris/files.js +24 -85
- package/dist/chris/files.js.map +1 -1
- package/dist/chris/help.js +0 -64
- package/dist/chris/help.js.map +1 -1
- package/dist/chris/kinds.d.ts +9 -0
- package/dist/chris/kinds.js +42 -0
- package/dist/chris/kinds.js.map +1 -0
- package/dist/chris/promptContext.d.ts +6 -0
- package/dist/chris/promptContext.js +3 -1
- package/dist/chris/promptContext.js.map +1 -1
- package/dist/core/argumentKinds.d.ts +107 -0
- package/dist/core/argumentKinds.js +223 -0
- package/dist/core/argumentKinds.js.map +1 -0
- package/dist/core/backend.d.ts +4 -1
- package/dist/core/backend.js.map +1 -1
- package/dist/core/commandDeclaration.d.ts +363 -0
- package/dist/core/commandDeclaration.js +31 -0
- package/dist/core/commandDeclaration.js.map +1 -0
- package/dist/core/commandParse.d.ts +64 -0
- package/dist/core/commandParse.js +420 -0
- package/dist/core/commandParse.js.map +1 -0
- package/dist/core/commandRegistry.d.ts +36 -0
- package/dist/core/commandRegistry.js +72 -3
- package/dist/core/commandRegistry.js.map +1 -1
- package/dist/core/commandSchema.d.ts +32 -0
- package/dist/core/commandSchema.js +114 -0
- package/dist/core/commandSchema.js.map +1 -0
- package/dist/core/commandUsage.d.ts +47 -0
- package/dist/core/commandUsage.js +195 -0
- package/dist/core/commandUsage.js.map +1 -0
- package/dist/core/coreCommands.js +5 -4
- package/dist/core/coreCommands.js.map +1 -1
- package/dist/core/dispatch.js +15 -8
- package/dist/core/dispatch.js.map +1 -1
- package/dist/core/paths.d.ts +23 -0
- package/dist/core/paths.js +73 -2
- package/dist/core/paths.js.map +1 -1
- package/dist/core/preprocess.d.ts +10 -8
- package/dist/core/preprocess.js +11 -20
- package/dist/core/preprocess.js.map +1 -1
- package/dist/core/warmupFailures.d.ts +34 -2
- package/dist/core/warmupFailures.js +43 -2
- package/dist/core/warmupFailures.js.map +1 -1
- package/dist/lib/completer/cfsPaths.d.ts +14 -0
- package/dist/lib/completer/cfsPaths.js +91 -0
- package/dist/lib/completer/cfsPaths.js.map +1 -0
- package/dist/lib/completer/declared.d.ts +15 -0
- package/dist/lib/completer/declared.js +186 -0
- package/dist/lib/completer/declared.js.map +1 -0
- package/dist/lib/completer/index.js +33 -74
- package/dist/lib/completer/index.js.map +1 -1
- package/dist/lib/parser.d.ts +5 -0
- package/dist/lib/parser.js +2 -0
- package/dist/lib/parser.js.map +1 -1
- package/dist/lib/vfs/vfs.js +4 -2
- package/dist/lib/vfs/vfs.js.map +1 -1
- package/dist/lib/wildcard.js +2 -3
- package/dist/lib/wildcard.js.map +1 -1
- package/dist/notes.json +1 -1
- package/package.json +5 -4
package/dist/core/paths.d.ts
CHANGED
|
@@ -16,3 +16,26 @@ export declare function path_resolveFrom(inputPath: string, home: string, cwd: s
|
|
|
16
16
|
* @returns The absolute path.
|
|
17
17
|
*/
|
|
18
18
|
export declare function path_resolve(inputPath: string): Promise<string>;
|
|
19
|
+
/**
|
|
20
|
+
* Where a path lives in the backend's store: the one answer every reader
|
|
21
|
+
* and lister asks before it goes to the dispatcher.
|
|
22
|
+
*
|
|
23
|
+
* The session's namespace first (`~`, a relative path), then, hop by hop,
|
|
24
|
+
* whatever stands in the way: a mount that stands for a store folder hands
|
|
25
|
+
* back the store path (`/proc/jobs/…/data/…` is the job's output folder and
|
|
26
|
+
* the rest of the path in it), and the backend follows the store's own links
|
|
27
|
+
* on a store path (ChRIS: `.chrislink`s at any depth). A link may land
|
|
28
|
+
* under another mount, and a mount's answer may pass through links, so the
|
|
29
|
+
* two are asked in turn until neither moves the path.
|
|
30
|
+
*
|
|
31
|
+
* Best effort by design: a path that resolves no further stands as it is,
|
|
32
|
+
* and the read that follows refuses it by its own name.
|
|
33
|
+
*
|
|
34
|
+
* @param inputPath - The path as typed or as a surface gave it.
|
|
35
|
+
* @returns The store path; a path a mount holds itself (a file it makes),
|
|
36
|
+
* as resolved in the namespace.
|
|
37
|
+
* @example
|
|
38
|
+
* await storePath_resolve('/proc/jobs/feed_7/pl-dircopy_12/data/home_alice_uploads_set/a.txt');
|
|
39
|
+
* // '/home/alice/uploads/set/a.txt', the dircopy's output holding a link to ~/uploads/set
|
|
40
|
+
*/
|
|
41
|
+
export declare function storePath_resolve(inputPath: string): Promise<string>;
|
package/dist/core/paths.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file A path as the session means it: `~` is the session's home,
|
|
3
|
-
* relative path stands under the working directory
|
|
2
|
+
* @file A path as the session means it: `~` is the session's home, a
|
|
3
|
+
* relative path stands under the working directory, and where the store
|
|
4
|
+
* keeps it (`storePath_resolve`), which every reader and lister asks.
|
|
4
5
|
*
|
|
5
6
|
* @module
|
|
6
7
|
*/
|
|
7
8
|
import * as path from 'path';
|
|
9
|
+
import { errorStack } from '@fnndsc/fond';
|
|
8
10
|
import { session } from '../session/index.js';
|
|
9
11
|
import { backendInstalled_get } from './backend.js';
|
|
12
|
+
import { vfsDispatcher_get } from './filesystem.js';
|
|
10
13
|
/**
|
|
11
14
|
* Resolves a path against a home and a working directory, without asking
|
|
12
15
|
* anything: `~` and `~/x` under the home, a relative path under the working
|
|
@@ -46,4 +49,72 @@ export async function path_resolve(inputPath) {
|
|
|
46
49
|
const cwd = await session.getCWD();
|
|
47
50
|
return path_resolveFrom(inputPath, home, cwd);
|
|
48
51
|
}
|
|
52
|
+
/** How many mount-and-link hops a path may take before it is read where it stands. */
|
|
53
|
+
const STORE_HOPS_MAX = 8;
|
|
54
|
+
/**
|
|
55
|
+
* Where a path lives in the backend's store: the one answer every reader
|
|
56
|
+
* and lister asks before it goes to the dispatcher.
|
|
57
|
+
*
|
|
58
|
+
* The session's namespace first (`~`, a relative path), then, hop by hop,
|
|
59
|
+
* whatever stands in the way: a mount that stands for a store folder hands
|
|
60
|
+
* back the store path (`/proc/jobs/…/data/…` is the job's output folder and
|
|
61
|
+
* the rest of the path in it), and the backend follows the store's own links
|
|
62
|
+
* on a store path (ChRIS: `.chrislink`s at any depth). A link may land
|
|
63
|
+
* under another mount, and a mount's answer may pass through links, so the
|
|
64
|
+
* two are asked in turn until neither moves the path.
|
|
65
|
+
*
|
|
66
|
+
* Best effort by design: a path that resolves no further stands as it is,
|
|
67
|
+
* and the read that follows refuses it by its own name.
|
|
68
|
+
*
|
|
69
|
+
* @param inputPath - The path as typed or as a surface gave it.
|
|
70
|
+
* @returns The store path; a path a mount holds itself (a file it makes),
|
|
71
|
+
* as resolved in the namespace.
|
|
72
|
+
* @example
|
|
73
|
+
* await storePath_resolve('/proc/jobs/feed_7/pl-dircopy_12/data/home_alice_uploads_set/a.txt');
|
|
74
|
+
* // '/home/alice/uploads/set/a.txt', the dircopy's output holding a link to ~/uploads/set
|
|
75
|
+
*/
|
|
76
|
+
export async function storePath_resolve(inputPath) {
|
|
77
|
+
// An absolute path needs no session to stand where it is.
|
|
78
|
+
let at = inputPath.startsWith('/') ? path_resolveFrom(inputPath, '/', '/') : await path_resolve(inputPath);
|
|
79
|
+
const dispatcher = vfsDispatcher_get();
|
|
80
|
+
const links = backendInstalled_get()?.vfs?.path_physical;
|
|
81
|
+
// A dispatcher that cannot say where its mounts are holds none.
|
|
82
|
+
const mounted = (candidate) => typeof dispatcher.path_isVirtual === 'function' && dispatcher.path_isVirtual(candidate);
|
|
83
|
+
for (let hop = 0; hop < STORE_HOPS_MAX; hop++) {
|
|
84
|
+
if (mounted(at)) {
|
|
85
|
+
const mount = dispatcher.provider_get(at);
|
|
86
|
+
if (mount.storePath_resolve === undefined)
|
|
87
|
+
return at;
|
|
88
|
+
let mapped;
|
|
89
|
+
try {
|
|
90
|
+
mapped = await mount.storePath_resolve(at);
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
return at;
|
|
94
|
+
}
|
|
95
|
+
if (!mapped.ok || mapped.value === null || mapped.value === at)
|
|
96
|
+
return at;
|
|
97
|
+
at = mapped.value;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (links === undefined)
|
|
101
|
+
return at;
|
|
102
|
+
// A walk that cannot follow a link (one that fails, or throws) leaves
|
|
103
|
+
// the path as it was; what it noted on the way is not the read's
|
|
104
|
+
// reason, which the read gives.
|
|
105
|
+
const mark = errorStack.checkpoint_mark();
|
|
106
|
+
let followed = at;
|
|
107
|
+
try {
|
|
108
|
+
followed = await links(at);
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
// The path stands as asked.
|
|
112
|
+
}
|
|
113
|
+
errorStack.checkpoint_drain(mark);
|
|
114
|
+
if (followed === at || !mounted(followed))
|
|
115
|
+
return followed;
|
|
116
|
+
at = followed;
|
|
117
|
+
}
|
|
118
|
+
return at;
|
|
119
|
+
}
|
|
49
120
|
//# sourceMappingURL=paths.js.map
|
package/dist/core/paths.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/core/paths.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/core/paths.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAqD,MAAM,cAAc,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAAiB,EAAE,IAAY,EAAE,GAAW;IAC3E,IAAI,QAAQ,GAAW,SAAS,CAAC;IAEjC,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC9B,IAAI,SAAS,KAAK,GAAG,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;YAC5C,QAAQ,GAAG,IAAI,CAAC;QAClB,CAAC;aAAM,IAAI,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACtC,QAAQ,GAAG,I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AI,QAAQ,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;YAAE,OAAO,QAAQ,CAAC;QAC3D,EAAE,GAAG,QAAQ,CAAC;IAChB,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { Result } from '@fnndsc/fond';
|
|
2
2
|
/**
|
|
3
|
-
* Determines whether an argument belongs to the
|
|
3
|
+
* Determines whether an argument of a command not yet declared belongs to the
|
|
4
|
+
* CFS/VFS shell namespace. A declared command never asks: its grammar says
|
|
5
|
+
* which operands glob (core/commandParse.ts), and each command leaves this
|
|
6
|
+
* table as it is declared.
|
|
4
7
|
*
|
|
5
|
-
* Ordinary ChELL words expand before dispatch.
|
|
6
|
-
*
|
|
7
|
-
* while download keeps its final host destination literal.
|
|
8
|
+
* Ordinary ChELL words expand before dispatch. `upload` marks its host-local
|
|
9
|
+
* operands as a different realm and owns host-source expansion.
|
|
8
10
|
*
|
|
9
11
|
* @param command - Command word being executed.
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
12
|
-
* @param
|
|
12
|
+
* @param _index - Zero-based argument position before expansion.
|
|
13
|
+
* @param _argumentCount - Number of arguments before expansion.
|
|
14
|
+
* @param _args - Argument values before expansion.
|
|
13
15
|
* @returns True if the word is eligible for CFS/VFS pathname expansion.
|
|
14
16
|
*/
|
|
15
|
-
export declare function pathnameExpansion_isEligible(command: string,
|
|
17
|
+
export declare function pathnameExpansion_isEligible(command: string, _index: number, _argumentCount: number, _args?: readonly string[]): boolean;
|
|
16
18
|
/**
|
|
17
19
|
* Returns true if the input line is a shell escape (starts with `!`).
|
|
18
20
|
*
|
package/dist/core/preprocess.js
CHANGED
|
@@ -11,31 +11,22 @@ import { args_tokenize } from '../lib/parser.js';
|
|
|
11
11
|
import { Ok, Err, errorStack } from '@fnndsc/fond';
|
|
12
12
|
import { backslash_escapesNext } from '../lib/quoting.js';
|
|
13
13
|
/**
|
|
14
|
-
* Determines whether an argument belongs to the
|
|
14
|
+
* Determines whether an argument of a command not yet declared belongs to the
|
|
15
|
+
* CFS/VFS shell namespace. A declared command never asks: its grammar says
|
|
16
|
+
* which operands glob (core/commandParse.ts), and each command leaves this
|
|
17
|
+
* table as it is declared.
|
|
15
18
|
*
|
|
16
|
-
* Ordinary ChELL words expand before dispatch.
|
|
17
|
-
*
|
|
18
|
-
* while download keeps its final host destination literal.
|
|
19
|
+
* Ordinary ChELL words expand before dispatch. `upload` marks its host-local
|
|
20
|
+
* operands as a different realm and owns host-source expansion.
|
|
19
21
|
*
|
|
20
22
|
* @param command - Command word being executed.
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
23
|
-
* @param
|
|
23
|
+
* @param _index - Zero-based argument position before expansion.
|
|
24
|
+
* @param _argumentCount - Number of arguments before expansion.
|
|
25
|
+
* @param _args - Argument values before expansion.
|
|
24
26
|
* @returns True if the word is eligible for CFS/VFS pathname expansion.
|
|
25
27
|
*/
|
|
26
|
-
export function pathnameExpansion_isEligible(command,
|
|
27
|
-
|
|
28
|
-
return false;
|
|
29
|
-
if (command === 'download') {
|
|
30
|
-
const positionalIndexes = args.reduce((indexes, arg, argIndex) => {
|
|
31
|
-
if (arg !== '-f' && arg !== '--force')
|
|
32
|
-
indexes.push(argIndex);
|
|
33
|
-
return indexes;
|
|
34
|
-
}, []);
|
|
35
|
-
const destinationIndex = positionalIndexes.at(-1);
|
|
36
|
-
return destinationIndex !== undefined && index !== destinationIndex && positionalIndexes.includes(index);
|
|
37
|
-
}
|
|
38
|
-
return true;
|
|
28
|
+
export function pathnameExpansion_isEligible(command, _index, _argumentCount, _args = []) {
|
|
29
|
+
return command !== 'upload';
|
|
39
30
|
}
|
|
40
31
|
/**
|
|
41
32
|
* Returns true if the input line is a shell escape (starts with `!`).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preprocess.js","sourceRoot":"","sources":["../../src/core/preprocess.ts"],"names":[],"mappings":"AAAA;;;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GAAG,EAAE,CAAC;IACf,CAAC;IAED,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,MAAM,CAAC;IAClC,IAAI,OAAO,KAAK,KAAK,EAAE,CAAC;QACtB,UAAU,CAAC,UAAU,CAAC,OAAO,EAAE,oBAAoB,QAAQ,wDAAwD,OAAO,IAAI,CAAC,CAAC;QAChI,OAAO,GAAG,EAAE,CAAC;IACf,CAAC;IAED,MAAM,UAAU,GAAa,IAAI,CAAC,MAAM,CAAC,CAAC,GAAW,EAAW,EAAE,CAAC,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/F,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,UAAU,CAAC,UAAU,CAAC,OAAO,EAAE,oBAAoB,QAAQ,qDAAqD,CAAC,CAAC;QAClH,OAAO,GAAG,EAAE,CAAC;IACf,CAAC;IAED,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,UAAU,CAAC,UAAU,CAAC,OAAO,EAAE,oBAAoB,QAAQ,iFAAiF,CAAC,CAAC;QAC9I,OAAO,GAAG,EAAE,CAAC;IACf,CAAC;IAED,MAAM,UAAU,GAAW,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file Warm-up steps
|
|
2
|
+
* @file Warm-up steps behind the prompt: those still running, and those that failed.
|
|
3
3
|
*
|
|
4
4
|
* A warm-up moved off the boot gate reports its failure afterwards, and a
|
|
5
5
|
* boot readout has scrolled away by then. So a failure is held here until
|
|
6
6
|
* a later attempt succeeds, and every surface reads it from the prompt
|
|
7
7
|
* context: a message that vanishes is one nobody acts on.
|
|
8
8
|
*
|
|
9
|
+
* A step still running is held here too, from its start to its outcome: a
|
|
10
|
+
* daemon listens before its warm-up ends, and a surface that attaches
|
|
11
|
+
* meanwhile is told what the session is still warming.
|
|
12
|
+
*
|
|
9
13
|
* Kept free of imports so it can be unit tested; the engine graph cannot
|
|
10
14
|
* be loaded under jest.
|
|
11
15
|
*
|
|
@@ -21,6 +25,34 @@ export interface WarmupFailure {
|
|
|
21
25
|
label: string;
|
|
22
26
|
message: string;
|
|
23
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Records that a deferred warm-up step has started and not yet settled.
|
|
30
|
+
*
|
|
31
|
+
* @param label - The boot-step label.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* warmupPending_note('Public');
|
|
35
|
+
* warmupPending_list(); // ['Public']
|
|
36
|
+
*/
|
|
37
|
+
export declare function warmupPending_note(label: string): void;
|
|
38
|
+
/**
|
|
39
|
+
* Records that a deferred warm-up step has settled, whatever its outcome.
|
|
40
|
+
*
|
|
41
|
+
* @param label - The boot-step label.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* warmupPending_clear('Public');
|
|
45
|
+
*/
|
|
46
|
+
export declare function warmupPending_clear(label: string): void;
|
|
47
|
+
/**
|
|
48
|
+
* The steps still warming, in the order they started.
|
|
49
|
+
*
|
|
50
|
+
* @returns One label per step that has started and not yet settled.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* warmupPending_list(); // ['Public', 'Queries'] while those two run
|
|
54
|
+
*/
|
|
55
|
+
export declare function warmupPending_list(): string[];
|
|
24
56
|
/**
|
|
25
57
|
* Records that a deferred warm-up step failed.
|
|
26
58
|
*
|
|
@@ -40,5 +72,5 @@ export declare function warmupFailure_clear(label: string): void;
|
|
|
40
72
|
* @returns One entry per step that failed and has not since succeeded.
|
|
41
73
|
*/
|
|
42
74
|
export declare function warmupFailures_list(): WarmupFailure[];
|
|
43
|
-
/** Forgets every recorded failure (tests, and a session starting over). */
|
|
75
|
+
/** Forgets every recorded failure and running step (tests, and a session starting over). */
|
|
44
76
|
export declare function warmupFailures_reset(): void;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file Warm-up steps
|
|
2
|
+
* @file Warm-up steps behind the prompt: those still running, and those that failed.
|
|
3
3
|
*
|
|
4
4
|
* A warm-up moved off the boot gate reports its failure afterwards, and a
|
|
5
5
|
* boot readout has scrolled away by then. So a failure is held here until
|
|
6
6
|
* a later attempt succeeds, and every surface reads it from the prompt
|
|
7
7
|
* context: a message that vanishes is one nobody acts on.
|
|
8
8
|
*
|
|
9
|
+
* A step still running is held here too, from its start to its outcome: a
|
|
10
|
+
* daemon listens before its warm-up ends, and a surface that attaches
|
|
11
|
+
* meanwhile is told what the session is still warming.
|
|
12
|
+
*
|
|
9
13
|
* Kept free of imports so it can be unit tested; the engine graph cannot
|
|
10
14
|
* be loaded under jest.
|
|
11
15
|
*
|
|
@@ -13,6 +17,42 @@
|
|
|
13
17
|
*/
|
|
14
18
|
/** Failures by label, so a later attempt replaces rather than repeats. */
|
|
15
19
|
const failures = new Map();
|
|
20
|
+
/** Labels of the steps still running, in the order they started. */
|
|
21
|
+
const pending = new Set();
|
|
22
|
+
/**
|
|
23
|
+
* Records that a deferred warm-up step has started and not yet settled.
|
|
24
|
+
*
|
|
25
|
+
* @param label - The boot-step label.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* warmupPending_note('Public');
|
|
29
|
+
* warmupPending_list(); // ['Public']
|
|
30
|
+
*/
|
|
31
|
+
export function warmupPending_note(label) {
|
|
32
|
+
pending.add(label);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Records that a deferred warm-up step has settled, whatever its outcome.
|
|
36
|
+
*
|
|
37
|
+
* @param label - The boot-step label.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* warmupPending_clear('Public');
|
|
41
|
+
*/
|
|
42
|
+
export function warmupPending_clear(label) {
|
|
43
|
+
pending.delete(label);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The steps still warming, in the order they started.
|
|
47
|
+
*
|
|
48
|
+
* @returns One label per step that has started and not yet settled.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* warmupPending_list(); // ['Public', 'Queries'] while those two run
|
|
52
|
+
*/
|
|
53
|
+
export function warmupPending_list() {
|
|
54
|
+
return Array.from(pending);
|
|
55
|
+
}
|
|
16
56
|
/**
|
|
17
57
|
* Records that a deferred warm-up step failed.
|
|
18
58
|
*
|
|
@@ -38,8 +78,9 @@ export function warmupFailure_clear(label) {
|
|
|
38
78
|
export function warmupFailures_list() {
|
|
39
79
|
return Array.from(failures, ([label, message]) => ({ label, message }));
|
|
40
80
|
}
|
|
41
|
-
/** Forgets every recorded failure (tests, and a session starting over). */
|
|
81
|
+
/** Forgets every recorded failure and running step (tests, and a session starting over). */
|
|
42
82
|
export function warmupFailures_reset() {
|
|
43
83
|
failures.clear();
|
|
84
|
+
pending.clear();
|
|
44
85
|
}
|
|
45
86
|
//# sourceMappingURL=warmupFailures.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"warmupFailures.js","sourceRoot":"","sources":["../../src/core/warmupFailures.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"warmupFailures.js","sourceRoot":"","sources":["../../src/core/warmupFailures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAaH,0EAA0E;AAC1E,MAAM,QAAQ,GAAwB,IAAI,GAAG,EAAE,CAAC;AAEhD,oEAAoE;AACpE,MAAM,OAAO,GAAgB,IAAI,GAAG,EAAE,CAAC;AAEvC;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACrB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAa,EAAE,OAAe;IAC/D,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAC/B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACzB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,CAAmB,EAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;AAC3G,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,oBAAoB;IAClC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACjB,OAAO,CAAC,KAAK,EAAE,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The entries of the folder a partial path names that start with its last
|
|
3
|
+
* part, in the partial's own style (tilde or relative kept), a folder
|
|
4
|
+
* ending in `/`.
|
|
5
|
+
*
|
|
6
|
+
* @param partial - The path typed so far.
|
|
7
|
+
* @returns The candidates; none when the folder cannot be listed.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* await cfsPaths_complete('/home/mise-e2e/'); // ['/home/mise-e2e/feeds/', '/home/mise-e2e/uploads/', …]
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function cfsPaths_complete(partial: string): Promise<string[]>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Completion of a path in ChRIS's filesystem (CFS): the entries of the
|
|
3
|
+
* folder a partial path names that start with its last part, read through
|
|
4
|
+
* the session's filesystem and kept in the listing cache.
|
|
5
|
+
*
|
|
6
|
+
* Key components:
|
|
7
|
+
* - cfsPaths_complete: the candidates for a partial path.
|
|
8
|
+
*
|
|
9
|
+
* Typical usage:
|
|
10
|
+
* ```ts
|
|
11
|
+
* const candidates: string[] = await cfsPaths_complete('~/uploads/sub');
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* Dependencies: the session's working directory and home, its filesystem
|
|
15
|
+
* dispatcher and listing cache.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
import * as path from 'path';
|
|
20
|
+
import { session } from '../../session/index.js';
|
|
21
|
+
import { listingItemsFromVfs_make } from '../vfs/listing.js';
|
|
22
|
+
import { partialPath_split, completions_build } from './pathComplete.helpers.js';
|
|
23
|
+
import { backendInstalled_get } from '../../core/backend.js';
|
|
24
|
+
import { listingCache_get, vfsDispatcher_get } from '../../core/filesystem.js';
|
|
25
|
+
/**
|
|
26
|
+
* The entries of the folder a partial path names that start with its last
|
|
27
|
+
* part, in the partial's own style (tilde or relative kept), a folder
|
|
28
|
+
* ending in `/`.
|
|
29
|
+
*
|
|
30
|
+
* @param partial - The path typed so far.
|
|
31
|
+
* @returns The candidates; none when the folder cannot be listed.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* await cfsPaths_complete('/home/mise-e2e/'); // ['/home/mise-e2e/feeds/', '/home/mise-e2e/uploads/', …]
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export async function cfsPaths_complete(partial) {
|
|
39
|
+
let effectivePartial = partial;
|
|
40
|
+
if (partial.startsWith('~')) {
|
|
41
|
+
const home = (await backendInstalled_get()?.session.home_get()) ?? '/';
|
|
42
|
+
if (partial === '~' || partial === '~/') {
|
|
43
|
+
effectivePartial = home + (partial.endsWith('/') ? '/' : '');
|
|
44
|
+
}
|
|
45
|
+
else if (partial.startsWith('~/')) {
|
|
46
|
+
effectivePartial = path.posix.join(home, partial.substring(2));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const { dirToList, prefix } = partialPath_split(effectivePartial);
|
|
50
|
+
let absDirToList;
|
|
51
|
+
if (dirToList.startsWith('/')) {
|
|
52
|
+
absDirToList = dirToList;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
const cwd = await session.getCWD();
|
|
56
|
+
absDirToList = dirToList ? path.posix.resolve(cwd, dirToList) : cwd;
|
|
57
|
+
}
|
|
58
|
+
let items = [];
|
|
59
|
+
const listCache = listingCache_get();
|
|
60
|
+
const cached = listCache.cache_get(absDirToList);
|
|
61
|
+
if (cached) {
|
|
62
|
+
items = cached.data;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
try {
|
|
66
|
+
// The session's filesystem answers every path: the backend's mounts and fallback, and the core's.
|
|
67
|
+
const vfsResult = await vfsDispatcher_get().list(absDirToList);
|
|
68
|
+
if (vfsResult.ok) {
|
|
69
|
+
items = listingItemsFromVfs_make(vfsResult.value);
|
|
70
|
+
}
|
|
71
|
+
// Names completed at the root even when its listing lacks them.
|
|
72
|
+
if (absDirToList === '/' || absDirToList === '') {
|
|
73
|
+
const hasItem = (name) => items.some((item) => item.name === name);
|
|
74
|
+
for (const name of backendInstalled_get()?.completion?.rootWords ?? ['usr']) {
|
|
75
|
+
if (!hasItem(name)) {
|
|
76
|
+
items.push({ name, type: 'vfs', size: 0, owner: 'root', date: new Date().toISOString() });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (items.length > 0) {
|
|
81
|
+
listCache.cache_set(absDirToList, items);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
// A folder that cannot be listed (permissions, not a folder) completes nothing.
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// The partial's own style (tilde or relative) is kept, and a folder ends in "/".
|
|
89
|
+
return completions_build(items, prefix, partial);
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=cfsPaths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cfsPaths.js","sourceRoot":"","sources":["../../../src/lib/completer/cfsPaths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAI7B,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAqB,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE/E;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAAe;IACrD,IAAI,gBAAgB,GAAW,OAAO,CAAC;IAEvC,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,GAAW,CAAC,MAAM,oBAAoB,EAAE,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,GAAG,CAAC;QAC/E,IAAI,OAAO,KAAK,GAAG,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACxC,gBAAgB,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC/D,CAAC;aAAM,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACpC,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IA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,MAAM,IAAI,IAAI,oBAAoB,EAAE,EAAE,UAAU,EAAE,SAAS,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;oBAC5E,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;wBACnB,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;oBAC5F,CAAC;gBACH,CAAC;YACH,CAAC;YAED,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACrB,SAAS,CAAC,SAAS,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,gFAAgF;QAClF,CAAC;IACH,CAAC;IAED,iFAAiF;IACjF,OAAO,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type AnyCommandDeclaration } from '../../core/commandDeclaration.js';
|
|
2
|
+
/**
|
|
3
|
+
* The candidates for the word being typed in a declared command's line.
|
|
4
|
+
*
|
|
5
|
+
* @param declaration - The command.
|
|
6
|
+
* @param prior - The words after the command, before the one being typed.
|
|
7
|
+
* @param word - The word typed so far (quotes removed).
|
|
8
|
+
* @returns The candidates, each the whole word; a folder ends in `/`.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* await declaredWord_complete(lsCommand, ['--sort'], 's'); // ['size']
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function declaredWord_complete(declaration: AnyCommandDeclaration, prior: readonly string[], word: string): Promise<string[]>;
|