@fnndsc/brasa 0.9.2 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/dist/buildinfo.json +1 -0
  2. package/dist/builtins/argumentTokens.d.ts +18 -0
  3. package/dist/builtins/argumentTokens.js +58 -0
  4. package/dist/builtins/argumentTokens.js.map +1 -0
  5. package/dist/builtins/executable.d.ts +3 -7
  6. package/dist/builtins/executable.js +32 -29
  7. package/dist/builtins/executable.js.map +1 -1
  8. package/dist/builtins/feedCreation.d.ts +23 -0
  9. package/dist/builtins/feedCreation.js +45 -0
  10. package/dist/builtins/feedCreation.js.map +1 -0
  11. package/dist/builtins/fs/cat.args.d.ts +36 -0
  12. package/dist/builtins/fs/cat.args.js +63 -0
  13. package/dist/builtins/fs/cat.args.js.map +1 -0
  14. package/dist/builtins/fs/cat.d.ts +2 -2
  15. package/dist/builtins/fs/cat.js +222 -101
  16. package/dist/builtins/fs/cat.js.map +1 -1
  17. package/dist/builtins/fs/cd.js +41 -5
  18. package/dist/builtins/fs/cd.js.map +1 -1
  19. package/dist/builtins/fs/cp.js +3 -2
  20. package/dist/builtins/fs/cp.js.map +1 -1
  21. package/dist/builtins/fs/download.d.ts +1 -1
  22. package/dist/builtins/fs/download.js +52 -13
  23. package/dist/builtins/fs/download.js.map +1 -1
  24. package/dist/builtins/fs/du.js +15 -1
  25. package/dist/builtins/fs/du.js.map +1 -1
  26. package/dist/builtins/fs/ls.js +10 -1
  27. package/dist/builtins/fs/ls.js.map +1 -1
  28. package/dist/builtins/fs/mv.js +7 -3
  29. package/dist/builtins/fs/mv.js.map +1 -1
  30. package/dist/builtins/fs/pull.args.d.ts +14 -1
  31. package/dist/builtins/fs/pull.args.js +72 -9
  32. package/dist/builtins/fs/pull.args.js.map +1 -1
  33. package/dist/builtins/fs/pull.d.ts +1 -0
  34. package/dist/builtins/fs/pull.js +191 -259
  35. package/dist/builtins/fs/pull.js.map +1 -1
  36. package/dist/builtins/fs/rm.js +4 -0
  37. package/dist/builtins/fs/rm.js.map +1 -1
  38. package/dist/builtins/fs/tree.js +7 -3
  39. package/dist/builtins/fs/tree.js.map +1 -1
  40. package/dist/builtins/fs/upload.js +29 -2
  41. package/dist/builtins/fs/upload.js.map +1 -1
  42. package/dist/builtins/help.d.ts +7 -0
  43. package/dist/builtins/help.js +144 -36
  44. package/dist/builtins/help.js.map +1 -1
  45. package/dist/builtins/index.d.ts +1 -0
  46. package/dist/builtins/index.js +1 -0
  47. package/dist/builtins/index.js.map +1 -1
  48. package/dist/builtins/net/pacs.d.ts +1 -0
  49. package/dist/builtins/net/pacs.js +5 -1
  50. package/dist/builtins/net/pacs.js.map +1 -1
  51. package/dist/builtins/net/pacsUtils.d.ts +5 -4
  52. package/dist/builtins/net/pacsUtils.js +12 -32
  53. package/dist/builtins/net/pacsUtils.js.map +1 -1
  54. package/dist/builtins/net/query.js +4 -1
  55. package/dist/builtins/net/query.js.map +1 -1
  56. package/dist/builtins/net/status.d.ts +14 -0
  57. package/dist/builtins/net/status.js +210 -0
  58. package/dist/builtins/net/status.js.map +1 -0
  59. package/dist/builtins/pluginExecute.d.ts +3 -2
  60. package/dist/builtins/pluginExecute.js +41 -70
  61. package/dist/builtins/pluginExecute.js.map +1 -1
  62. package/dist/builtins/pluginSelector.d.ts +15 -0
  63. package/dist/builtins/pluginSelector.js +21 -0
  64. package/dist/builtins/pluginSelector.js.map +1 -0
  65. package/dist/builtins/proc.js +106 -4
  66. package/dist/builtins/proc.js.map +1 -1
  67. package/dist/builtins/res/compute.js +8 -3
  68. package/dist/builtins/res/compute.js.map +1 -1
  69. package/dist/builtins/res/group.d.ts +1 -1
  70. package/dist/builtins/res/group.js +122 -5
  71. package/dist/builtins/res/group.js.map +1 -1
  72. package/dist/builtins/res/pipeline.args.d.ts +4 -0
  73. package/dist/builtins/res/pipeline.args.js +63 -12
  74. package/dist/builtins/res/pipeline.args.js.map +1 -1
  75. package/dist/builtins/res/pipeline.d.ts +3 -1
  76. package/dist/builtins/res/pipeline.js +155 -60
  77. package/dist/builtins/res/pipeline.js.map +1 -1
  78. package/dist/builtins/res/pipeline.manifest.d.ts +15 -0
  79. package/dist/builtins/res/pipeline.manifest.js +93 -0
  80. package/dist/builtins/res/pipeline.manifest.js.map +1 -0
  81. package/dist/builtins/res/plugin.js +14 -7
  82. package/dist/builtins/res/plugin.js.map +1 -1
  83. package/dist/builtins/res/user.d.ts +8 -0
  84. package/dist/builtins/res/user.js +87 -0
  85. package/dist/builtins/res/user.js.map +1 -0
  86. package/dist/builtins/store.js +24 -3
  87. package/dist/builtins/store.js.map +1 -1
  88. package/dist/builtins/sys/fortune.d.ts +9 -0
  89. package/dist/builtins/sys/fortune.js +16 -1
  90. package/dist/builtins/sys/fortune.js.map +1 -1
  91. package/dist/builtins/sys/whoami.d.ts +13 -1
  92. package/dist/builtins/sys/whoami.js +47 -2
  93. package/dist/builtins/sys/whoami.js.map +1 -1
  94. package/dist/builtins/utils.d.ts +14 -1
  95. package/dist/builtins/utils.js +13 -3
  96. package/dist/builtins/utils.js.map +1 -1
  97. package/dist/builtins/wildcard.d.ts +31 -0
  98. package/dist/builtins/wildcard.js +112 -50
  99. package/dist/builtins/wildcard.js.map +1 -1
  100. package/dist/command-keys.js +2 -1
  101. package/dist/command-keys.js.map +1 -1
  102. package/dist/core/cancellation.d.ts +28 -0
  103. package/dist/core/cancellation.js +70 -0
  104. package/dist/core/cancellation.js.map +1 -0
  105. package/dist/core/dispatch.d.ts +1 -8
  106. package/dist/core/dispatch.js +82 -82
  107. package/dist/core/dispatch.js.map +1 -1
  108. package/dist/core/elevation.d.ts +35 -0
  109. package/dist/core/elevation.js +77 -0
  110. package/dist/core/elevation.js.map +1 -0
  111. package/dist/core/engine.d.ts +12 -0
  112. package/dist/core/engine.js +35 -8
  113. package/dist/core/engine.js.map +1 -1
  114. package/dist/core/preprocess.d.ts +11 -4
  115. package/dist/core/preprocess.js +43 -10
  116. package/dist/core/preprocess.js.map +1 -1
  117. package/dist/core/progress.d.ts +15 -5
  118. package/dist/core/progress.js +14 -0
  119. package/dist/core/progress.js.map +1 -1
  120. package/dist/core/promptContext.d.ts +3 -5
  121. package/dist/core/promptContext.js +9 -2
  122. package/dist/core/promptContext.js.map +1 -1
  123. package/dist/core/sink.d.ts +9 -0
  124. package/dist/core/sink.js +23 -3
  125. package/dist/core/sink.js.map +1 -1
  126. package/dist/core/surface.d.ts +14 -0
  127. package/dist/core/surface.js +5 -0
  128. package/dist/core/surface.js.map +1 -1
  129. package/dist/core/version.d.ts +34 -0
  130. package/dist/core/version.js +51 -0
  131. package/dist/core/version.js.map +1 -1
  132. package/dist/index.d.ts +1 -0
  133. package/dist/index.js +1 -0
  134. package/dist/index.js.map +1 -1
  135. package/dist/lib/completer/index.js +39 -1
  136. package/dist/lib/completer/index.js.map +1 -1
  137. package/dist/lib/parser.d.ts +75 -2
  138. package/dist/lib/parser.js +158 -15
  139. package/dist/lib/parser.js.map +1 -1
  140. package/dist/lib/vfs/providers/binEntry.d.ts +20 -0
  141. package/dist/lib/vfs/providers/binEntry.js +47 -0
  142. package/dist/lib/vfs/providers/binEntry.js.map +1 -0
  143. package/dist/lib/vfs/providers/static.js +1 -0
  144. package/dist/lib/vfs/providers/static.js.map +1 -1
  145. package/dist/lib/vfs/providers/static_content.js +5 -36
  146. package/dist/lib/vfs/providers/static_content.js.map +1 -1
  147. package/dist/lib/vfs/vfs.d.ts +7 -0
  148. package/dist/lib/vfs/vfs.js +25 -0
  149. package/dist/lib/vfs/vfs.js.map +1 -1
  150. package/dist/session/index.d.ts +18 -0
  151. package/dist/session/index.js +29 -1
  152. package/dist/session/index.js.map +1 -1
  153. package/package.json +10 -5
@@ -7,8 +7,11 @@
7
7
  */
8
8
  import { minimatch } from 'minimatch';
9
9
  import { session } from '../session/index.js';
10
+ import { path_resolveChrisFs } from '@fnndsc/chili/utils/cli.js';
10
11
  import { vfsDispatcher } from '@fnndsc/salsa';
11
12
  import { listCache_get, Ok, Err, errorStack } from '@fnndsc/cumin';
13
+ import { shellWord_literal, shellWord_unquoted } from '../lib/parser.js';
14
+ import { path_resolve } from './utils.js';
12
15
  /**
13
16
  * Checks if a string contains wildcard characters.
14
17
  *
@@ -19,54 +22,49 @@ export function string_checkHasWildcard(arg) {
19
22
  return /[*?[\]]/.test(arg);
20
23
  }
21
24
  /**
22
- * Expands a wildcard pattern against the current directory.
25
+ * Expands a rendered pattern and its quote-aware minimatch pattern.
23
26
  *
24
- * @param pattern - The glob pattern (e.g., "*.ts", "test*.json").
25
- * @returns A Promise resolving to Result<string[]>.
27
+ * @param value - Rendered shell-word value.
28
+ * @param globPattern - Quote-aware minimatch pattern.
29
+ * @returns A Promise resolving to Result<WildcardMatch[]>.
26
30
  * Ok([]) = no matches (not an error).
27
31
  * Err(...) = couldn't expand (API failure, permission denied, etc.).
28
32
  */
29
- export async function wildcard_expand(pattern) {
30
- // If no wildcard, return as-is
31
- if (!string_checkHasWildcard(pattern)) {
32
- return Ok([pattern]);
33
- }
33
+ async function wildcardMatches_expand(value, globPattern) {
34
34
  try {
35
35
  // Get current directory
36
36
  const cwd = await session.getCWD();
37
+ const resolvedValue = await path_resolve(value);
38
+ const resolvedPattern = await path_resolve(globPattern);
37
39
  // Handle patterns with directory components (e.g., "data/*.txt")
38
40
  let searchDir = cwd;
39
- let matchPattern = pattern;
40
- // Check if pattern has directory separator
41
- if (pattern.includes('/')) {
42
- const parts = pattern.split('/');
43
- const lastPart = parts.pop() || '*';
44
- const dirPart = parts.join('/');
45
- // Resolve directory part (could be relative)
46
- if (dirPart.startsWith('/')) {
47
- searchDir = dirPart;
48
- }
49
- else if (dirPart === '.') {
50
- searchDir = cwd;
51
- }
52
- else {
53
- // Relative path - append to cwd
54
- searchDir = `${cwd}/${dirPart}`.replace(/\/+/g, '/');
55
- }
41
+ let physicalSearchDir = cwd;
42
+ let matchPattern = resolvedPattern;
43
+ // Resolve the non-wildcard parent directory before listing. This gives
44
+ // `~/...` its normal meaning and follows a CFS `.chrislink` parent while
45
+ // retaining the caller's logical spelling in the expanded result.
46
+ if (resolvedValue.includes('/')) {
47
+ const valueParts = resolvedValue.split('/');
48
+ const patternParts = resolvedPattern.split('/');
49
+ const lastPart = patternParts.pop() || '*';
50
+ valueParts.pop();
51
+ const dirPart = valueParts.join('/');
52
+ searchDir = dirPart || '/';
53
+ physicalSearchDir = await path_resolveChrisFs(searchDir, {});
56
54
  matchPattern = lastPart;
57
55
  }
58
56
  // List files in the directory (check cache first)
59
57
  let items = [];
60
58
  const listCache = listCache_get();
61
- const cached = listCache.cache_get(searchDir);
59
+ const cached = listCache.cache_get(physicalSearchDir);
62
60
  if (cached) {
63
61
  items = cached.data;
64
62
  }
65
63
  else {
66
- const vfsResult = await vfsDispatcher.list(searchDir);
64
+ const vfsResult = await vfsDispatcher.list(physicalSearchDir);
67
65
  if (vfsResult.ok) {
68
66
  items = vfsResult.value;
69
- listCache.cache_set(searchDir, items);
67
+ listCache.cache_set(physicalSearchDir, items);
70
68
  }
71
69
  else {
72
70
  return Err();
@@ -76,21 +74,96 @@ export async function wildcard_expand(pattern) {
76
74
  const matches = items
77
75
  .filter((item) => minimatch(item.name, matchPattern))
78
76
  .map((item) => {
79
- // Return full path if we searched a different directory
80
- if (searchDir !== cwd) {
81
- return `${searchDir}/${item.name}`.replace(/\/+/g, '/');
82
- }
83
- return item.name;
77
+ // Return a full path if we searched a different directory.
78
+ const itemPath = searchDir !== cwd
79
+ ? `${searchDir}/${item.name}`.replace(/\/+/g, '/')
80
+ : item.name;
81
+ return {
82
+ path: itemPath,
83
+ type: item.type,
84
+ };
84
85
  });
85
86
  // Ok([]) for no matches (not an error)
86
87
  return Ok(matches);
87
88
  }
88
89
  catch (error) {
89
90
  const errorMsg = error instanceof Error ? error.message : String(error);
90
- errorStack.stack_push("error", `Failed to expand wildcard '${pattern}': ${errorMsg}`);
91
+ errorStack.stack_push("error", `Failed to expand wildcard '${value}': ${errorMsg}`);
91
92
  return Err();
92
93
  }
93
94
  }
95
+ /**
96
+ * Expands one quote-aware shell word against the ChRIS filesystem.
97
+ *
98
+ * @param word - Parsed shell word.
99
+ * @returns Expanded words, or the original word when it has no match.
100
+ */
101
+ export async function shellWord_expand(word) {
102
+ if (!word.pathnameExpansion)
103
+ return Ok([word]);
104
+ const result = await wildcardMatches_expand(word.value, word.globPattern);
105
+ if (!result.ok)
106
+ return result;
107
+ if (result.value.length === 0)
108
+ return Ok([word]);
109
+ return Ok(result.value.map((match) => ({
110
+ ...shellWord_literal(match.path),
111
+ pathnameExpanded: true,
112
+ })));
113
+ }
114
+ /**
115
+ * Expands selected quote-aware shell words in argument order.
116
+ *
117
+ * @param words - Parsed shell words.
118
+ * @param eligible - Predicate that preserves explicit cross-realm operands.
119
+ * @returns Expanded words, retaining literal words when no path matches.
120
+ */
121
+ export async function shellWords_expand(words, eligible) {
122
+ const expanded = [];
123
+ for (const [index, word] of words.entries()) {
124
+ if (!eligible(word, index)) {
125
+ expanded.push(word);
126
+ continue;
127
+ }
128
+ const result = await shellWord_expand(word);
129
+ if (!result.ok)
130
+ return result;
131
+ expanded.push(...result.value);
132
+ }
133
+ return Ok(expanded);
134
+ }
135
+ /**
136
+ * Expands a wildcard pattern against the current directory with item type.
137
+ *
138
+ * @param pattern - The glob pattern (e.g., "*.ts", "test*.json").
139
+ * @returns A Promise resolving to Result<WildcardMatch[]>.
140
+ * Ok([]) = no matches (not an error).
141
+ * Err(...) = couldn't expand (API failure, permission denied, etc.).
142
+ */
143
+ export async function wildcard_expandMatches(pattern) {
144
+ if (!string_checkHasWildcard(pattern))
145
+ return Ok([{ path: pattern, type: 'file' }]);
146
+ return wildcardMatches_expand(pattern, pattern);
147
+ }
148
+ /**
149
+ * Expands a wildcard pattern against the current directory.
150
+ *
151
+ * @param pattern - The glob pattern (e.g., "*.ts", "test*.json").
152
+ * @returns A Promise resolving to Result<string[]>.
153
+ * Ok([]) = no matches (not an error).
154
+ * Err(...) = couldn't expand (API failure, permission denied, etc.).
155
+ */
156
+ export async function wildcard_expand(pattern) {
157
+ if (!string_checkHasWildcard(pattern))
158
+ return Ok([pattern]);
159
+ const word = shellWord_unquoted(pattern);
160
+ const result = await shellWord_expand(word);
161
+ if (!result.ok)
162
+ return result;
163
+ if (result.value.length === 1 && result.value[0] === word)
164
+ return Ok([]);
165
+ return Ok(result.value.map((match) => match.value));
166
+ }
94
167
  /**
95
168
  * Expands all wildcards in an argument list.
96
169
  *
@@ -100,21 +173,10 @@ export async function wildcard_expand(pattern) {
100
173
  * Empty matches return the original pattern.
101
174
  */
102
175
  export async function wildcards_expandAll(args) {
103
- const expanded = [];
104
- for (const arg of args) {
105
- const result = await wildcard_expand(arg);
106
- if (!result.ok) {
107
- // Propagate error up
108
- return result;
109
- }
110
- // If no matches, use original pattern (let command handle "not found")
111
- if (result.value.length === 0) {
112
- expanded.push(arg);
113
- }
114
- else {
115
- expanded.push(...result.value);
116
- }
117
- }
118
- return Ok(expanded);
176
+ const words = args.map((arg) => shellWord_unquoted(arg));
177
+ const result = await shellWords_expand(words, () => true);
178
+ if (!result.ok)
179
+ return result;
180
+ return Ok(result.value.map((word) => word.value));
119
181
  }
120
182
  //# sourceMappingURL=wildcard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wildcard.js","sourceRoot":"","sources":["../../src/builtins/wildcard.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAU,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3E;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,GAAW;IACjD,OAAO,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;;;GAOG;AACH,MAA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AI,CAAC,KAAK,CAAC,CAAC,CAAC;AACvE,CAAC"}
@@ -12,7 +12,7 @@ export const COMMAND_HANDLERS_KEYS = [
12
12
  // net
13
13
  'connect', 'logout', 'pacs', 'query', 'cubepath',
14
14
  // sys
15
- 'context', 'physicalmode', 'prompt', 'timing', 'whoami', 'whereami', 'debug', 'help', 'proc',
15
+ 'context', 'physicalmode', 'prompt', 'timing', 'id', 'whoami', 'whereami', 'debug', 'help', 'proc',
16
16
  // resources — canonical + aliases
17
17
  'plugin', 'plugins',
18
18
  'feed', 'feeds',
@@ -22,6 +22,7 @@ export const COMMAND_HANDLERS_KEYS = [
22
22
  'store',
23
23
  'tag', 'tags',
24
24
  'group', 'groups',
25
+ 'user', 'users',
25
26
  'pluginmeta', 'pluginmetas', 'meta', 'metas',
26
27
  'plugininstance', 'plugininstances', 'instance', 'instances', 'job', 'jobs',
27
28
  'workflow', 'workflows',
@@ -1 +1 @@
1
- {"version":3,"file":"command-keys.js","sourceRoot":"","sources":["../src/command-keys.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAa;IAC7C,aAAa;IACb,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI;IAC1E,QAAQ,EAAE,UAAU,EAAE,MAAM;IAC5B,MAAM;IACN,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU;IAChD,MAAM;IACN,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;IAC5F,kCAAkC;IAClC,QAAQ,EAAE,SAAS;IACnB,MAAM,EAAE,OAAO;IACf,UAAU,EAAE,WAAW;IACvB,SAAS,EAAE,UAAU;IACrB,OAAO,EAAE,OAAO,EAAE,MAAM;IACx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AAa,EAAE,cAAc;CAC7C,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Runs work inside the foreground-command cancellation scope.
3
+ *
4
+ * Nested line execution retains its parent's scope, so a semicolon batch has
5
+ * one cancellation lifetime rather than one controller per segment.
6
+ *
7
+ * @param operation - Work performed by one command line.
8
+ * @returns The operation result.
9
+ */
10
+ export declare function commandCancellation_run<T>(operation: () => Promise<T>): Promise<T>;
11
+ /**
12
+ * Marks the current command as able to honor a foreground cancellation.
13
+ *
14
+ * @returns Nothing. Calls outside a command scope have no effect.
15
+ */
16
+ export declare function commandCancellation_enable(): void;
17
+ /**
18
+ * Gets the abort signal for the command currently running on this async path.
19
+ *
20
+ * @returns The command signal, or undefined outside foreground execution.
21
+ */
22
+ export declare function commandCancellation_signalGet(): AbortSignal | undefined;
23
+ /**
24
+ * Requests cancellation of the currently running cancellable command.
25
+ *
26
+ * @returns True when a cancellable foreground command was signalled.
27
+ */
28
+ export declare function commandCancellation_request(): boolean;
@@ -0,0 +1,70 @@
1
+ /**
2
+ * @file Foreground-command cancellation scope.
3
+ *
4
+ * One interactive engine owns one foreground command at a time. This module
5
+ * carries that command's abort signal through asynchronous dispatch without
6
+ * turning cancellation into ambient process state for unrelated work.
7
+ *
8
+ * @module
9
+ */
10
+ import { AsyncLocalStorage } from 'node:async_hooks';
11
+ const cancellationScope = new AsyncLocalStorage();
12
+ let foreground;
13
+ /**
14
+ * Runs work inside the foreground-command cancellation scope.
15
+ *
16
+ * Nested line execution retains its parent's scope, so a semicolon batch has
17
+ * one cancellation lifetime rather than one controller per segment.
18
+ *
19
+ * @param operation - Work performed by one command line.
20
+ * @returns The operation result.
21
+ */
22
+ export async function commandCancellation_run(operation) {
23
+ if (cancellationScope.getStore() !== undefined) {
24
+ return await operation();
25
+ }
26
+ const state = {
27
+ controller: new AbortController(),
28
+ cancellable: false,
29
+ };
30
+ const previous = foreground;
31
+ foreground = state;
32
+ try {
33
+ return await cancellationScope.run(state, operation);
34
+ }
35
+ finally {
36
+ if (foreground === state)
37
+ foreground = previous;
38
+ }
39
+ }
40
+ /**
41
+ * Marks the current command as able to honor a foreground cancellation.
42
+ *
43
+ * @returns Nothing. Calls outside a command scope have no effect.
44
+ */
45
+ export function commandCancellation_enable() {
46
+ const state = cancellationScope.getStore();
47
+ if (state !== undefined)
48
+ state.cancellable = true;
49
+ }
50
+ /**
51
+ * Gets the abort signal for the command currently running on this async path.
52
+ *
53
+ * @returns The command signal, or undefined outside foreground execution.
54
+ */
55
+ export function commandCancellation_signalGet() {
56
+ return cancellationScope.getStore()?.controller.signal;
57
+ }
58
+ /**
59
+ * Requests cancellation of the currently running cancellable command.
60
+ *
61
+ * @returns True when a cancellable foreground command was signalled.
62
+ */
63
+ export function commandCancellation_request() {
64
+ if (foreground === undefined || !foreground.cancellable || foreground.controller.signal.aborted) {
65
+ return false;
66
+ }
67
+ foreground.controller.abort();
68
+ return true;
69
+ }
70
+ //# sourceMappingURL=cancellation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cancellation.js","sourceRoot":"","sources":["../../src/core/cancellation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAQrD,MAAM,iBAAiB,GACrB,IAAI,iBAAiB,EAA4B,CAAC;AACpD,IAAI,UAAgD,CAAC;AAErD;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAI,SAA2B;IAC1E,IAAI,iBAAiB,CAAC,QAAQ,EAAE,KAAK,SAAS,EAAE,CAAC;QAC/C,OAAO,MAAM,SAAS,EAAE,CAAC;IAC3B,CAAC;IAED,MAAM,KAAK,GAA6B;QACtC,UAAU,EAAE,IAAI,eAAe,EAAE;QACjC,WAAW,EAAE,KAAK;KACnB,CAAC;IACF,MAAM,QAAQ,GAAyC,UAAU,CAAC;IAClE,UAAU,GAAG,KAAK,CAAC;IACnB,IAAI,CAAC;QACH,OAAO,MAAM,iBAAiB,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IACvD,CAAC;YAAS,CAAC;QACT,IAAI,UAAU,KAAK,KAAK;YAAE,UAAU,GAAG,QAAQ,CAAC;IAClD,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B;IACxC,MAAM,KAAK,GAAyC,iBAAiB,CAAC,QAAQ,EAAE,CAAC;IACjF,IAAI,KAAK,KAAK,SAAS;QAAE,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;AACpD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,6BAA6B;IAC3C,OAAO,iBAAiB,CAAC,QAAQ,EAAE,EAAE,UAAU,CAAC,MAAM,CAAC;AACzD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,2BAA2B;IACzC,IAAI,UAAU,KAAK,SAAS,IAAI,CAAC,UAAU,CAAC,WAAW,IAAI,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QAChG,OAAO,KAAK,CAAC;IACf,CAAC;IACD,UAAU,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IAC9B,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -2,14 +2,7 @@ import type { CommandEnvelope } from '@fnndsc/cumin';
2
2
  import { type RedirectInfo } from './preprocess.js';
3
3
  import { chiliCommand_run } from './chiliDelegate.js';
4
4
  export { chiliCommand_run };
5
- /**
6
- * Executes a shell command on the host system (shell escape with ! prefix).
7
- *
8
- * @param shellCommand - The command to execute on the host shell.
9
- * @returns A Promise resolving to the command's exit code (1 on spawn failure).
10
- */
11
- export declare function shellCommand_execute(shellCommand: string): Promise<number>;
12
- type CommandHandler = (args: string[]) => Promise<void>;
5
+ type CommandHandler = (args: string[]) => Promise<void | CommandEnvelope>;
13
6
  /**
14
7
  * Shape of a converted builtin: returns its outcome as an envelope instead
15
8
  * of printing. The engine layer will consume these directly; the dispatch