@qodalis/cli 2.0.0-beta.13 → 2.0.0-beta.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qodalis/cli",
3
- "version": "2.0.0-beta.13",
3
+ "version": "2.0.0-beta.14",
4
4
  "description": "Framework-agnostic CLI engine for @qodalis terminal applications.",
5
5
  "author": "Nicolae Lupei, Qodalis Solutions",
6
6
  "license": "MIT",
@@ -30,7 +30,7 @@
30
30
  "./assets/*": "./assets/*"
31
31
  },
32
32
  "dependencies": {
33
- "@qodalis/cli-core": "2.0.0-beta.13",
33
+ "@qodalis/cli-core": "2.0.0-beta.14",
34
34
  "@xterm/xterm": "^5.5.0",
35
35
  "@xterm/addon-fit": "^0.10.0",
36
36
  "@xterm/addon-web-links": "^0.11.0",
package/public-api.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _qodalis_cli_core from '@qodalis/cli-core';
2
- import { ICliCommandProcessor, ICliCommandParameterDescriptor, ICliCommandProcessorRegistry, ICliCommandChildProcessor, CliProcessorMetadata, CliStateConfiguration, ICliExecutionContext, CliProcessCommand, ICliCommandAuthor, CliThemeInfo, ICliExecutionProcess, ICliUserSession, ICliSpinner, ICliPercentageProgressBar, ICliTextAnimator, ICliTerminalWriter, ICliCommandExecutorService, ICliClipboard, ICliStateStore, CliOptions, ICliLogger, ICliServiceProvider, ICliTranslationService, ICliInputReader, ICliBackgroundServiceRegistry, ICliHttpClient, ICliNotifier, ICliManagedInterval, ICliManagedTimer, ICliKeyValueStore, ICliCompletionProvider, ICliFilePickerProvider, CliFullScreenOptions, ICliProcessRegistry, ICliBackgroundService, ICliServiceContext, ICliBackgroundServiceInfo, ICliServiceLogEntry, CliServiceEventHandler, ICliGlobalParameterHandler, CliForegroundColor, CliBackgroundColor, CliProvider, CliTableOptions, CliLogLevel, CliPercentageProgressBarUpdateValueOptions, CliTextAnimatorOptions, ICliModule, CliModuleRegistry, Package, ICliPingServerService, CliLineOptions, CliSelectOption, CliSelectOptions, CliMultiSelectOption, CliMultiSelectOptions, CliNumberOptions, CliDateOptions, CliFilePickerOptions, CliFileResult, ICliProcessRegisterOptions, ICliProcessEntry, ICliDragDropService, CliHttpRequestOptions, CliNotification, CliState, CliEngineSnapshot, CliServerConfig, ICliServerAuthService, CliServerCommandDescriptor, CliServerCapabilities, CliServerResponse, CliServerOutput, CliIcon } from '@qodalis/cli-core';
2
+ import { ICliCommandProcessor, ICliCommandParameterDescriptor, ICliCommandProcessorRegistry, ICliCommandChildProcessor, CliProcessorMetadata, CliStateConfiguration, ICliExecutionContext, CliProcessCommand, ICliCommandAuthor, CliThemeInfo, ICliExecutionProcess, ICliUserSession, ICliSpinner, ICliPercentageProgressBar, ICliTextAnimator, ICliTerminalWriter, ICliCommandExecutorService, ICliClipboard, ICliStateStore, CliOptions, ICliLogger, ICliServiceProvider, ICliTranslationService, ICliInputReader, ICliBackgroundServiceRegistry, ICliHttpClient, ICliNotifier, ICliManagedInterval, ICliManagedTimer, ICliKeyValueStore, ICliCompletionProvider, ICliFilePickerProvider, CliFullScreenOptions, ICliProcessRegistry, ICliBackgroundService, ICliServiceContext, ICliBackgroundServiceInfo, ICliServiceLogEntry, CliServiceEventHandler, ICliGlobalParameterHandler, CliForegroundColor, CliBackgroundColor, CliProvider, CliTableOptions, CliLogLevel, CliPercentageProgressBarUpdateValueOptions, CliTextAnimatorOptions, ICliModule, CliModuleRegistry, Package, ICliPingServerService, CliLineOptions, CliSelectOption, CliSelectOptions, CliMultiSelectOption, CliMultiSelectOptions, CliNumberOptions, CliDateOptions, CliFilePickerOptions, CliFileResult, ICliProcessRegisterOptions, ICliProcessEntry, ICliDragDropService, CliHttpRequestOptions, CliNotification, ICliPermissionRegistry, CliPermissionDefinition, CliState, CliEngineSnapshot, CliServerConfig, ICliServerAuthService, CliServerCommandDescriptor, CliServerCapabilities, CliServerResponse, CliServerOutput, CliIcon } from '@qodalis/cli-core';
3
3
  export { ICliUserSessionService_TOKEN, ICliUsersStoreService_TOKEN } from '@qodalis/cli-core';
4
4
  import { ITheme, Terminal, ITerminalAddon, ITerminalOptions, ITerminalInitOnlyOptions } from '@xterm/xterm';
5
5
  import * as rxjs from 'rxjs';
@@ -153,7 +153,7 @@ declare const CliKeyValueStore_TOKEN = "cli-key-value-store";
153
153
  */
154
154
  declare const SyntaxHighlighterRegistry_TOKEN = "syntax-highlighter-registry";
155
155
 
156
- declare const LIBRARY_VERSION = "2.0.0-beta.13";
156
+ declare const LIBRARY_VERSION = "2.0.0-beta.14";
157
157
  declare const API_VERSION = 2;
158
158
 
159
159
  declare class CliAliasCommandProcessor implements ICliCommandProcessor {
@@ -163,7 +163,11 @@ declare class CliAliasCommandProcessor implements ICliCommandProcessor {
163
163
  processors?: ICliCommandProcessor[] | undefined;
164
164
  metadata?: CliProcessorMetadata | undefined;
165
165
  stateConfiguration?: CliStateConfiguration | undefined;
166
+ /** Shared aliases (used when no auth module is loaded) */
166
167
  userAliases: Record<string, string>;
168
+ private aliasState;
169
+ /** Aliases visible to the current principal */
170
+ aliasesFor(context: Pick<ICliExecutionContext, 'services'>): Record<string, string>;
167
171
  private stateSubscription?;
168
172
  constructor();
169
173
  writeDescription(context: ICliExecutionContext): void;
@@ -1124,6 +1128,11 @@ interface InputModeHost {
1124
1128
  interface PromptOptions {
1125
1129
  userName?: string;
1126
1130
  hideUserName?: boolean;
1131
+ /**
1132
+ * Shown (dimmed) instead of the user name when an auth module is loaded
1133
+ * but nobody is signed in, e.g. `anonymous:/$`. Empty/undefined: nothing.
1134
+ */
1135
+ anonymousName?: string;
1127
1136
  contextProcessor?: string;
1128
1137
  pathProvider?: () => string | null;
1129
1138
  }
@@ -1419,6 +1428,14 @@ declare class CliCommandExecutor implements ICliCommandExecutorService {
1419
1428
  * parameter. In that case the global handler must be skipped so the
1420
1429
  * processor can handle the flag itself.
1421
1430
  */
1431
+ /**
1432
+ * Runs all registered {@link ICliCommandGuard}s that apply to this command,
1433
+ * in priority order. Returns the block message of the first guard that
1434
+ * denies the command, or `undefined` when every guard allows it.
1435
+ * A guard that throws is treated as a denial (fail closed).
1436
+ */
1437
+ private runGuards;
1438
+ private guardDenial;
1422
1439
  private processorOwnsParameter;
1423
1440
  }
1424
1441
 
@@ -1804,6 +1821,13 @@ declare class CliBoot {
1804
1821
  getModuleRegistry(): CliModuleRegistry;
1805
1822
  boot(context: CliExecutionContext, modules: ICliModule[]): Promise<void>;
1806
1823
  private bootModule;
1824
+ /**
1825
+ * Sub-processors of an `extendsProcessor` processor are merged into the
1826
+ * processor it extends, so they belong to that one: re-parent them so they
1827
+ * inherit its access rules (`requiredPermissions` etc.) and help/root
1828
+ * lookups resolve to the registered processor.
1829
+ */
1830
+ private adoptMergedSubProcessors;
1807
1831
  private buildCoreModule;
1808
1832
  /**
1809
1833
  * Topologically sort modules by their dependencies using DFS.
@@ -2068,6 +2092,14 @@ declare class CliNotifier implements ICliNotifier {
2068
2092
  private set;
2069
2093
  }
2070
2094
 
2095
+ /** Default {@link ICliPermissionRegistry}: permissions declared by modules. */
2096
+ declare class CliPermissionRegistry implements ICliPermissionRegistry {
2097
+ private readonly definitions;
2098
+ register(definitions: CliPermissionDefinition[], module?: string): void;
2099
+ list(): CliPermissionDefinition[];
2100
+ get(name: string): CliPermissionDefinition | undefined;
2101
+ }
2102
+
2071
2103
  declare class OverlayAddon implements ITerminalAddon {
2072
2104
  private terminal;
2073
2105
  private overlayNode;
@@ -2146,6 +2178,12 @@ interface CliEngineOptions extends CliOptions {
2146
2178
  terminalOptions?: Partial<ITerminalOptions & ITerminalInitOnlyOptions>;
2147
2179
  /** Optional snapshot to restore on start() */
2148
2180
  snapshot?: CliEngineSnapshot;
2181
+ /**
2182
+ * Explicit URL of `qodalis_cli_wasm_bg.wasm` (optional accelerator). When
2183
+ * omitted it is looked up next to the page (`document.baseURI`), then at
2184
+ * `/assets/wasm/` and `/wasm/`; the CLI works without it.
2185
+ */
2186
+ wasmUrl?: string;
2149
2187
  }
2150
2188
  declare class CliEngine {
2151
2189
  private readonly container;
@@ -2324,6 +2362,8 @@ declare class CliServerConnection {
2324
2362
  private _basePath;
2325
2363
  private _wsReconnectAttempts;
2326
2364
  private _wsReconnectTimer;
2365
+ /** True once this connection registered its `server-events:<name>` background service */
2366
+ private _eventServiceRegistered;
2327
2367
  private static readonly WS_MAX_RECONNECT_ATTEMPTS;
2328
2368
  private static readonly WS_MAX_RECONNECT_DELAY_MS;
2329
2369
  private _healthCheckTimer;
@@ -2344,6 +2384,11 @@ declare class CliServerConnection {
2344
2384
  * ICliServerAuthTokenProviders), or falls back to config headers directly.
2345
2385
  */
2346
2386
  resolveAuthHeaders(): Record<string, string>;
2387
+ /**
2388
+ * WebSocket URL for this server with auth: single-use upgrade params from
2389
+ * auth providers when available, otherwise headers copied into the URL.
2390
+ */
2391
+ buildWebSocketUrl(path: string): Promise<string>;
2347
2392
  connect(): Promise<void>;
2348
2393
  disconnect(): void;
2349
2394
  startHealthCheck(): void;
@@ -2358,6 +2403,13 @@ declare class CliServerConnection {
2358
2403
  ping(): Promise<boolean>;
2359
2404
  private connectEventSocket;
2360
2405
  private connectEventSocketDirect;
2406
+ private connectEventSocketDirectAsync;
2407
+ /**
2408
+ * The server closes the event socket with 4401 when the session behind it
2409
+ * ended (logout, revoke, expiry). Retrying with the same credentials cannot
2410
+ * succeed; the auth layer reconnects the server when the session changes.
2411
+ */
2412
+ private isSessionEndedClose;
2361
2413
  private handleServerDisconnect;
2362
2414
  private closeEventSocket;
2363
2415
  private closeEventSocketDirect;
@@ -2392,6 +2444,7 @@ declare class CliServerProxyProcessor implements ICliCommandProcessor {
2392
2444
  metadata?: CliProcessorMetadata;
2393
2445
  parameters?: ICliCommandParameterDescriptor[];
2394
2446
  processors?: ICliCommandProcessor[];
2447
+ acceptsRawInput?: boolean;
2395
2448
  /** Full command path from root to this processor (e.g. ["aws", "lambda", "list"]) */
2396
2449
  private readonly commandPath;
2397
2450
  constructor(connection: CliServerConnection, descriptor: CliServerCommandDescriptor, serverName: string, isNested?: boolean, parentPath?: string[]);
@@ -2420,6 +2473,7 @@ declare class CliServerMultiProxyProcessor implements ICliCommandProcessor {
2420
2473
  metadata?: CliProcessorMetadata;
2421
2474
  parameters?: ICliCommandParameterDescriptor[];
2422
2475
  processors?: ICliCommandProcessor[];
2476
+ acceptsRawInput?: boolean;
2423
2477
  /** Full command path from root to this processor */
2424
2478
  private readonly commandPath;
2425
2479
  constructor(entries: MultiProxyEntry[], provider: DefaultServerProvider, parentPath?: string[]);
@@ -2434,9 +2488,12 @@ declare class CliServerManager implements DefaultServerProvider {
2434
2488
  private _logger?;
2435
2489
  private _cliLogger?;
2436
2490
  private _defaultServer;
2491
+ /** Bare-name aliases this manager registered (only these are ever removed) */
2492
+ private readonly _bareAliases;
2437
2493
  private _backgroundServices?;
2438
2494
  constructor(registry: ICliCommandProcessorRegistry, authService?: ICliServerAuthService | undefined);
2439
2495
  get defaultServer(): string | null;
2496
+ preferredServer(): string | null;
2440
2497
  setDefaultServer(name: string | null): void;
2441
2498
  connectAll(servers: CliServerConfig[], logger?: {
2442
2499
  warn(msg: string): void;
@@ -2475,19 +2532,24 @@ declare class CliSshCommandProcessor implements ICliCommandProcessor {
2475
2532
  valueRequired: boolean;
2476
2533
  metadata: CliProcessorMetadata;
2477
2534
  parameters?: ICliCommandParameterDescriptor[];
2478
- private socket;
2479
- private context;
2480
- private resolved;
2481
2535
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
2482
- onData(data: string, context: ICliExecutionContext): Promise<void>;
2483
- onResize(cols: number, rows: number, _context: ICliExecutionContext): void;
2484
- onDispose(_context: ICliExecutionContext): void;
2536
+ /**
2537
+ * Full-screen handler for one session: input, resize and disposal go to
2538
+ * that session's socket only.
2539
+ */
2540
+ private fullScreenHandler;
2485
2541
  private resolveServer;
2486
2542
  private executeInteractive;
2487
2543
  private executeOneShot;
2544
+ /** `ssh <server> <cmd...>` → `<cmd...>` exactly as typed */
2545
+ private remoteCommandFromRaw;
2488
2546
  private buildShellUrl;
2489
2547
  private cleanup;
2490
2548
  }
2549
+ declare function describeShellClose(event: {
2550
+ code?: number;
2551
+ reason?: string;
2552
+ }, serverName: string): string | null;
2491
2553
 
2492
2554
  /**
2493
2555
  * Result of executing a command through the test harness.
@@ -2539,7 +2601,13 @@ declare class CliTestHarness {
2539
2601
  userSession?: ICliUserSession;
2540
2602
  /** Reader responses — set via setReaderResponses() for interactive commands */
2541
2603
  private readerResponses;
2604
+ private userSessionProvider?;
2542
2605
  constructor();
2606
+ /**
2607
+ * Resolve `context.userSession` on every command from this function
2608
+ * (e.g. a session service), instead of the value set via setUserSession().
2609
+ */
2610
+ setUserSessionProvider(provider: () => ICliUserSession | undefined): void;
2543
2611
  /**
2544
2612
  * Register a service in the test container.
2545
2613
  */
@@ -2632,4 +2700,4 @@ declare function getAccelerator(): ICliWasmAccelerator;
2632
2700
  */
2633
2701
  declare function isWasmAccelerated(): boolean;
2634
2702
 
2635
- export { API_VERSION, CLi_Name_Art, CapturingTerminalWriter, type CdnSourceName, CliAliasCommandProcessor, CliArgsParser, CliBackgroundServiceRegistry_TOKEN, CliBoot, CliCalCommandProcessor, CliCaptureCommandProcessor, CliClearCommandProcessor, CliClipboard, CliClipboardCommandProcessor, CliColorCommandProcessor, CliCommandExecutionContext, CliCommandExecutor, CliCommandHistory, CliCommandHistory_TOKEN, CliCommandProcessorRegistry, CliConfigureCommandProcessor, CliConvertCommandProcessor, CliDebugCommandProcessor, CliDefaultPingServerService, CliDiffCommandProcessor, CliDragDropService, CliEchoCommandProcessor, CliEngine, type CliEngineOptions, CliEnvCommandProcessor, CliEnvironment, CliEvalCommandProcessor, CliExecutionContext, type CliExecutionContextDeps, CliExecutionProcess, CliExportCommandProcessor, CliFeedbackCommandProcessor, CliFontSizeCommandProcessor, CliFullScreenManager, CliHelpCommandProcessor, CliHistoryCommandProcessor, CliHotKeysCommandProcessor, CliHtopCommandProcessor, CliHttpClient, CliInputReader, CliJsonCommandProcessor, CliKeyValueStore, CliKeyValueStore_TOKEN, CliKillCommandProcessor, CliLogger, CliLoremCommandProcessor, CliModuleRegistry_TOKEN, CliNanoCommandProcessor, CliNotifier, CliOpenCommandProcessor, CliPackageManagerService, CliPackageManagerService_TOKEN, CliPackagesCommandProcessor, CliPingCommandProcessor, CliProcessRegistry, CliProcessRegistry_TOKEN, CliProcessorsRegistry_TOKEN, CliPsCommandProcessor, CliRandomCommandProcessor, CliScreenCommandProcessor, CliSeqCommandProcessor, CliServerCommandProcessor, CliServerConnection, CliServerManager, CliServerManager_TOKEN, CliServerMultiProxyProcessor, CliServerProxyProcessor, CliServiceContainer, CliServicesCommandProcessor, CliSleepCommandProcessor, CliSnippetCommandProcessor, CliSshCommandProcessor, CliStateStore, CliStateStoreManager, CliStateStoreManager_TOKEN, CliTerminalProgressBar, CliTerminalSpinner, CliTerminalTextAnimator, CliTerminalWriter, CliTestHarness, type CliTestResult, CliThemeCommandProcessor, CliTimeCommandProcessor, CliTimerManager, CliTimestampCommandProcessor, CliUnAliasCommandProcessor, CliUnameCommandProcessor, CliUnsetCommandProcessor, CliUptimeCommandProcessor, CliVersionCommandProcessor, type CliWelcomeMessageConfig, CliYesCommandProcessor, CommandParser, type CommandParserOutput, type CommandPart, type ConfigureState, type DefaultServerProvider, type DiffLine, type DiffType, type ICliEnvironment, ICliEnvironment_TOKEN, type ICliExecutionHost, ICliPingServerService_TOKEN, type ICliStateStoreManager, type ICliWasmAccelerator, type InitializeServicesOptions, type InitializeServicesResult, JsFallbackAccelerator, LIBRARY_VERSION, type MultiProxyEntry, OverlayAddon, type ParsedArg, type ParsedToken, ProcessExitedError, ScriptLoaderService, SyntaxHighlighterRegistry_TOKEN, type TerminalSetupResult, type ThemeState, appendOutputToFile, appendStderrToFile, builtinProcessors, computeDiff, contextGlobalParameter, createServerModule, executeOnServer, expandEnvironmentVars, formatDiff, getAccelerator, getCliNameArt, getGreetingBasedOnTime, getTerminalOptions, groupBy, helpGlobalParameter, hotkeysInfo, initWasmAccelerator, initializeServices, initializeTerminal, isWasmAccelerated, miscProcessors, openLink, reconcileArgs, renderServerResponse, renderSingleOutput, substituteVars, systemProcessors, themeInfos, themes, tryExecuteScript, versionGlobalParameter, waitForLayout, welcomeModule, writeOutputToFile, writeStderrToFile };
2703
+ export { API_VERSION, CLi_Name_Art, CapturingTerminalWriter, type CdnSourceName, CliAliasCommandProcessor, CliArgsParser, CliBackgroundServiceRegistry_TOKEN, CliBoot, CliCalCommandProcessor, CliCaptureCommandProcessor, CliClearCommandProcessor, CliClipboard, CliClipboardCommandProcessor, CliColorCommandProcessor, CliCommandExecutionContext, CliCommandExecutor, CliCommandHistory, CliCommandHistory_TOKEN, CliCommandProcessorRegistry, CliConfigureCommandProcessor, CliConvertCommandProcessor, CliDebugCommandProcessor, CliDefaultPingServerService, CliDiffCommandProcessor, CliDragDropService, CliEchoCommandProcessor, CliEngine, type CliEngineOptions, CliEnvCommandProcessor, CliEnvironment, CliEvalCommandProcessor, CliExecutionContext, type CliExecutionContextDeps, CliExecutionProcess, CliExportCommandProcessor, CliFeedbackCommandProcessor, CliFontSizeCommandProcessor, CliFullScreenManager, CliHelpCommandProcessor, CliHistoryCommandProcessor, CliHotKeysCommandProcessor, CliHtopCommandProcessor, CliHttpClient, CliInputReader, CliJsonCommandProcessor, CliKeyValueStore, CliKeyValueStore_TOKEN, CliKillCommandProcessor, CliLogger, CliLoremCommandProcessor, CliModuleRegistry_TOKEN, CliNanoCommandProcessor, CliNotifier, CliOpenCommandProcessor, CliPackageManagerService, CliPackageManagerService_TOKEN, CliPackagesCommandProcessor, CliPermissionRegistry, CliPingCommandProcessor, CliProcessRegistry, CliProcessRegistry_TOKEN, CliProcessorsRegistry_TOKEN, CliPsCommandProcessor, CliRandomCommandProcessor, CliScreenCommandProcessor, CliSeqCommandProcessor, CliServerCommandProcessor, CliServerConnection, CliServerManager, CliServerManager_TOKEN, CliServerMultiProxyProcessor, CliServerProxyProcessor, CliServiceContainer, CliServicesCommandProcessor, CliSleepCommandProcessor, CliSnippetCommandProcessor, CliSshCommandProcessor, CliStateStore, CliStateStoreManager, CliStateStoreManager_TOKEN, CliTerminalProgressBar, CliTerminalSpinner, CliTerminalTextAnimator, CliTerminalWriter, CliTestHarness, type CliTestResult, CliThemeCommandProcessor, CliTimeCommandProcessor, CliTimerManager, CliTimestampCommandProcessor, CliUnAliasCommandProcessor, CliUnameCommandProcessor, CliUnsetCommandProcessor, CliUptimeCommandProcessor, CliVersionCommandProcessor, type CliWelcomeMessageConfig, CliYesCommandProcessor, CommandParser, type CommandParserOutput, type CommandPart, type ConfigureState, type DefaultServerProvider, type DiffLine, type DiffType, type ICliEnvironment, ICliEnvironment_TOKEN, type ICliExecutionHost, ICliPingServerService_TOKEN, type ICliStateStoreManager, type ICliWasmAccelerator, type InitializeServicesOptions, type InitializeServicesResult, JsFallbackAccelerator, LIBRARY_VERSION, type MultiProxyEntry, OverlayAddon, type ParsedArg, type ParsedToken, ProcessExitedError, ScriptLoaderService, SyntaxHighlighterRegistry_TOKEN, type TerminalSetupResult, type ThemeState, appendOutputToFile, appendStderrToFile, builtinProcessors, computeDiff, contextGlobalParameter, createServerModule, describeShellClose, executeOnServer, expandEnvironmentVars, formatDiff, getAccelerator, getCliNameArt, getGreetingBasedOnTime, getTerminalOptions, groupBy, helpGlobalParameter, hotkeysInfo, initWasmAccelerator, initializeServices, initializeTerminal, isWasmAccelerated, miscProcessors, openLink, reconcileArgs, renderServerResponse, renderSingleOutput, substituteVars, systemProcessors, themeInfos, themes, tryExecuteScript, versionGlobalParameter, waitForLayout, welcomeModule, writeOutputToFile, writeStderrToFile };
package/public-api.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _qodalis_cli_core from '@qodalis/cli-core';
2
- import { ICliCommandProcessor, ICliCommandParameterDescriptor, ICliCommandProcessorRegistry, ICliCommandChildProcessor, CliProcessorMetadata, CliStateConfiguration, ICliExecutionContext, CliProcessCommand, ICliCommandAuthor, CliThemeInfo, ICliExecutionProcess, ICliUserSession, ICliSpinner, ICliPercentageProgressBar, ICliTextAnimator, ICliTerminalWriter, ICliCommandExecutorService, ICliClipboard, ICliStateStore, CliOptions, ICliLogger, ICliServiceProvider, ICliTranslationService, ICliInputReader, ICliBackgroundServiceRegistry, ICliHttpClient, ICliNotifier, ICliManagedInterval, ICliManagedTimer, ICliKeyValueStore, ICliCompletionProvider, ICliFilePickerProvider, CliFullScreenOptions, ICliProcessRegistry, ICliBackgroundService, ICliServiceContext, ICliBackgroundServiceInfo, ICliServiceLogEntry, CliServiceEventHandler, ICliGlobalParameterHandler, CliForegroundColor, CliBackgroundColor, CliProvider, CliTableOptions, CliLogLevel, CliPercentageProgressBarUpdateValueOptions, CliTextAnimatorOptions, ICliModule, CliModuleRegistry, Package, ICliPingServerService, CliLineOptions, CliSelectOption, CliSelectOptions, CliMultiSelectOption, CliMultiSelectOptions, CliNumberOptions, CliDateOptions, CliFilePickerOptions, CliFileResult, ICliProcessRegisterOptions, ICliProcessEntry, ICliDragDropService, CliHttpRequestOptions, CliNotification, CliState, CliEngineSnapshot, CliServerConfig, ICliServerAuthService, CliServerCommandDescriptor, CliServerCapabilities, CliServerResponse, CliServerOutput, CliIcon } from '@qodalis/cli-core';
2
+ import { ICliCommandProcessor, ICliCommandParameterDescriptor, ICliCommandProcessorRegistry, ICliCommandChildProcessor, CliProcessorMetadata, CliStateConfiguration, ICliExecutionContext, CliProcessCommand, ICliCommandAuthor, CliThemeInfo, ICliExecutionProcess, ICliUserSession, ICliSpinner, ICliPercentageProgressBar, ICliTextAnimator, ICliTerminalWriter, ICliCommandExecutorService, ICliClipboard, ICliStateStore, CliOptions, ICliLogger, ICliServiceProvider, ICliTranslationService, ICliInputReader, ICliBackgroundServiceRegistry, ICliHttpClient, ICliNotifier, ICliManagedInterval, ICliManagedTimer, ICliKeyValueStore, ICliCompletionProvider, ICliFilePickerProvider, CliFullScreenOptions, ICliProcessRegistry, ICliBackgroundService, ICliServiceContext, ICliBackgroundServiceInfo, ICliServiceLogEntry, CliServiceEventHandler, ICliGlobalParameterHandler, CliForegroundColor, CliBackgroundColor, CliProvider, CliTableOptions, CliLogLevel, CliPercentageProgressBarUpdateValueOptions, CliTextAnimatorOptions, ICliModule, CliModuleRegistry, Package, ICliPingServerService, CliLineOptions, CliSelectOption, CliSelectOptions, CliMultiSelectOption, CliMultiSelectOptions, CliNumberOptions, CliDateOptions, CliFilePickerOptions, CliFileResult, ICliProcessRegisterOptions, ICliProcessEntry, ICliDragDropService, CliHttpRequestOptions, CliNotification, ICliPermissionRegistry, CliPermissionDefinition, CliState, CliEngineSnapshot, CliServerConfig, ICliServerAuthService, CliServerCommandDescriptor, CliServerCapabilities, CliServerResponse, CliServerOutput, CliIcon } from '@qodalis/cli-core';
3
3
  export { ICliUserSessionService_TOKEN, ICliUsersStoreService_TOKEN } from '@qodalis/cli-core';
4
4
  import { ITheme, Terminal, ITerminalAddon, ITerminalOptions, ITerminalInitOnlyOptions } from '@xterm/xterm';
5
5
  import * as rxjs from 'rxjs';
@@ -153,7 +153,7 @@ declare const CliKeyValueStore_TOKEN = "cli-key-value-store";
153
153
  */
154
154
  declare const SyntaxHighlighterRegistry_TOKEN = "syntax-highlighter-registry";
155
155
 
156
- declare const LIBRARY_VERSION = "2.0.0-beta.13";
156
+ declare const LIBRARY_VERSION = "2.0.0-beta.14";
157
157
  declare const API_VERSION = 2;
158
158
 
159
159
  declare class CliAliasCommandProcessor implements ICliCommandProcessor {
@@ -163,7 +163,11 @@ declare class CliAliasCommandProcessor implements ICliCommandProcessor {
163
163
  processors?: ICliCommandProcessor[] | undefined;
164
164
  metadata?: CliProcessorMetadata | undefined;
165
165
  stateConfiguration?: CliStateConfiguration | undefined;
166
+ /** Shared aliases (used when no auth module is loaded) */
166
167
  userAliases: Record<string, string>;
168
+ private aliasState;
169
+ /** Aliases visible to the current principal */
170
+ aliasesFor(context: Pick<ICliExecutionContext, 'services'>): Record<string, string>;
167
171
  private stateSubscription?;
168
172
  constructor();
169
173
  writeDescription(context: ICliExecutionContext): void;
@@ -1124,6 +1128,11 @@ interface InputModeHost {
1124
1128
  interface PromptOptions {
1125
1129
  userName?: string;
1126
1130
  hideUserName?: boolean;
1131
+ /**
1132
+ * Shown (dimmed) instead of the user name when an auth module is loaded
1133
+ * but nobody is signed in, e.g. `anonymous:/$`. Empty/undefined: nothing.
1134
+ */
1135
+ anonymousName?: string;
1127
1136
  contextProcessor?: string;
1128
1137
  pathProvider?: () => string | null;
1129
1138
  }
@@ -1419,6 +1428,14 @@ declare class CliCommandExecutor implements ICliCommandExecutorService {
1419
1428
  * parameter. In that case the global handler must be skipped so the
1420
1429
  * processor can handle the flag itself.
1421
1430
  */
1431
+ /**
1432
+ * Runs all registered {@link ICliCommandGuard}s that apply to this command,
1433
+ * in priority order. Returns the block message of the first guard that
1434
+ * denies the command, or `undefined` when every guard allows it.
1435
+ * A guard that throws is treated as a denial (fail closed).
1436
+ */
1437
+ private runGuards;
1438
+ private guardDenial;
1422
1439
  private processorOwnsParameter;
1423
1440
  }
1424
1441
 
@@ -1804,6 +1821,13 @@ declare class CliBoot {
1804
1821
  getModuleRegistry(): CliModuleRegistry;
1805
1822
  boot(context: CliExecutionContext, modules: ICliModule[]): Promise<void>;
1806
1823
  private bootModule;
1824
+ /**
1825
+ * Sub-processors of an `extendsProcessor` processor are merged into the
1826
+ * processor it extends, so they belong to that one: re-parent them so they
1827
+ * inherit its access rules (`requiredPermissions` etc.) and help/root
1828
+ * lookups resolve to the registered processor.
1829
+ */
1830
+ private adoptMergedSubProcessors;
1807
1831
  private buildCoreModule;
1808
1832
  /**
1809
1833
  * Topologically sort modules by their dependencies using DFS.
@@ -2068,6 +2092,14 @@ declare class CliNotifier implements ICliNotifier {
2068
2092
  private set;
2069
2093
  }
2070
2094
 
2095
+ /** Default {@link ICliPermissionRegistry}: permissions declared by modules. */
2096
+ declare class CliPermissionRegistry implements ICliPermissionRegistry {
2097
+ private readonly definitions;
2098
+ register(definitions: CliPermissionDefinition[], module?: string): void;
2099
+ list(): CliPermissionDefinition[];
2100
+ get(name: string): CliPermissionDefinition | undefined;
2101
+ }
2102
+
2071
2103
  declare class OverlayAddon implements ITerminalAddon {
2072
2104
  private terminal;
2073
2105
  private overlayNode;
@@ -2146,6 +2178,12 @@ interface CliEngineOptions extends CliOptions {
2146
2178
  terminalOptions?: Partial<ITerminalOptions & ITerminalInitOnlyOptions>;
2147
2179
  /** Optional snapshot to restore on start() */
2148
2180
  snapshot?: CliEngineSnapshot;
2181
+ /**
2182
+ * Explicit URL of `qodalis_cli_wasm_bg.wasm` (optional accelerator). When
2183
+ * omitted it is looked up next to the page (`document.baseURI`), then at
2184
+ * `/assets/wasm/` and `/wasm/`; the CLI works without it.
2185
+ */
2186
+ wasmUrl?: string;
2149
2187
  }
2150
2188
  declare class CliEngine {
2151
2189
  private readonly container;
@@ -2324,6 +2362,8 @@ declare class CliServerConnection {
2324
2362
  private _basePath;
2325
2363
  private _wsReconnectAttempts;
2326
2364
  private _wsReconnectTimer;
2365
+ /** True once this connection registered its `server-events:<name>` background service */
2366
+ private _eventServiceRegistered;
2327
2367
  private static readonly WS_MAX_RECONNECT_ATTEMPTS;
2328
2368
  private static readonly WS_MAX_RECONNECT_DELAY_MS;
2329
2369
  private _healthCheckTimer;
@@ -2344,6 +2384,11 @@ declare class CliServerConnection {
2344
2384
  * ICliServerAuthTokenProviders), or falls back to config headers directly.
2345
2385
  */
2346
2386
  resolveAuthHeaders(): Record<string, string>;
2387
+ /**
2388
+ * WebSocket URL for this server with auth: single-use upgrade params from
2389
+ * auth providers when available, otherwise headers copied into the URL.
2390
+ */
2391
+ buildWebSocketUrl(path: string): Promise<string>;
2347
2392
  connect(): Promise<void>;
2348
2393
  disconnect(): void;
2349
2394
  startHealthCheck(): void;
@@ -2358,6 +2403,13 @@ declare class CliServerConnection {
2358
2403
  ping(): Promise<boolean>;
2359
2404
  private connectEventSocket;
2360
2405
  private connectEventSocketDirect;
2406
+ private connectEventSocketDirectAsync;
2407
+ /**
2408
+ * The server closes the event socket with 4401 when the session behind it
2409
+ * ended (logout, revoke, expiry). Retrying with the same credentials cannot
2410
+ * succeed; the auth layer reconnects the server when the session changes.
2411
+ */
2412
+ private isSessionEndedClose;
2361
2413
  private handleServerDisconnect;
2362
2414
  private closeEventSocket;
2363
2415
  private closeEventSocketDirect;
@@ -2392,6 +2444,7 @@ declare class CliServerProxyProcessor implements ICliCommandProcessor {
2392
2444
  metadata?: CliProcessorMetadata;
2393
2445
  parameters?: ICliCommandParameterDescriptor[];
2394
2446
  processors?: ICliCommandProcessor[];
2447
+ acceptsRawInput?: boolean;
2395
2448
  /** Full command path from root to this processor (e.g. ["aws", "lambda", "list"]) */
2396
2449
  private readonly commandPath;
2397
2450
  constructor(connection: CliServerConnection, descriptor: CliServerCommandDescriptor, serverName: string, isNested?: boolean, parentPath?: string[]);
@@ -2420,6 +2473,7 @@ declare class CliServerMultiProxyProcessor implements ICliCommandProcessor {
2420
2473
  metadata?: CliProcessorMetadata;
2421
2474
  parameters?: ICliCommandParameterDescriptor[];
2422
2475
  processors?: ICliCommandProcessor[];
2476
+ acceptsRawInput?: boolean;
2423
2477
  /** Full command path from root to this processor */
2424
2478
  private readonly commandPath;
2425
2479
  constructor(entries: MultiProxyEntry[], provider: DefaultServerProvider, parentPath?: string[]);
@@ -2434,9 +2488,12 @@ declare class CliServerManager implements DefaultServerProvider {
2434
2488
  private _logger?;
2435
2489
  private _cliLogger?;
2436
2490
  private _defaultServer;
2491
+ /** Bare-name aliases this manager registered (only these are ever removed) */
2492
+ private readonly _bareAliases;
2437
2493
  private _backgroundServices?;
2438
2494
  constructor(registry: ICliCommandProcessorRegistry, authService?: ICliServerAuthService | undefined);
2439
2495
  get defaultServer(): string | null;
2496
+ preferredServer(): string | null;
2440
2497
  setDefaultServer(name: string | null): void;
2441
2498
  connectAll(servers: CliServerConfig[], logger?: {
2442
2499
  warn(msg: string): void;
@@ -2475,19 +2532,24 @@ declare class CliSshCommandProcessor implements ICliCommandProcessor {
2475
2532
  valueRequired: boolean;
2476
2533
  metadata: CliProcessorMetadata;
2477
2534
  parameters?: ICliCommandParameterDescriptor[];
2478
- private socket;
2479
- private context;
2480
- private resolved;
2481
2535
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
2482
- onData(data: string, context: ICliExecutionContext): Promise<void>;
2483
- onResize(cols: number, rows: number, _context: ICliExecutionContext): void;
2484
- onDispose(_context: ICliExecutionContext): void;
2536
+ /**
2537
+ * Full-screen handler for one session: input, resize and disposal go to
2538
+ * that session's socket only.
2539
+ */
2540
+ private fullScreenHandler;
2485
2541
  private resolveServer;
2486
2542
  private executeInteractive;
2487
2543
  private executeOneShot;
2544
+ /** `ssh <server> <cmd...>` → `<cmd...>` exactly as typed */
2545
+ private remoteCommandFromRaw;
2488
2546
  private buildShellUrl;
2489
2547
  private cleanup;
2490
2548
  }
2549
+ declare function describeShellClose(event: {
2550
+ code?: number;
2551
+ reason?: string;
2552
+ }, serverName: string): string | null;
2491
2553
 
2492
2554
  /**
2493
2555
  * Result of executing a command through the test harness.
@@ -2539,7 +2601,13 @@ declare class CliTestHarness {
2539
2601
  userSession?: ICliUserSession;
2540
2602
  /** Reader responses — set via setReaderResponses() for interactive commands */
2541
2603
  private readerResponses;
2604
+ private userSessionProvider?;
2542
2605
  constructor();
2606
+ /**
2607
+ * Resolve `context.userSession` on every command from this function
2608
+ * (e.g. a session service), instead of the value set via setUserSession().
2609
+ */
2610
+ setUserSessionProvider(provider: () => ICliUserSession | undefined): void;
2543
2611
  /**
2544
2612
  * Register a service in the test container.
2545
2613
  */
@@ -2632,4 +2700,4 @@ declare function getAccelerator(): ICliWasmAccelerator;
2632
2700
  */
2633
2701
  declare function isWasmAccelerated(): boolean;
2634
2702
 
2635
- export { API_VERSION, CLi_Name_Art, CapturingTerminalWriter, type CdnSourceName, CliAliasCommandProcessor, CliArgsParser, CliBackgroundServiceRegistry_TOKEN, CliBoot, CliCalCommandProcessor, CliCaptureCommandProcessor, CliClearCommandProcessor, CliClipboard, CliClipboardCommandProcessor, CliColorCommandProcessor, CliCommandExecutionContext, CliCommandExecutor, CliCommandHistory, CliCommandHistory_TOKEN, CliCommandProcessorRegistry, CliConfigureCommandProcessor, CliConvertCommandProcessor, CliDebugCommandProcessor, CliDefaultPingServerService, CliDiffCommandProcessor, CliDragDropService, CliEchoCommandProcessor, CliEngine, type CliEngineOptions, CliEnvCommandProcessor, CliEnvironment, CliEvalCommandProcessor, CliExecutionContext, type CliExecutionContextDeps, CliExecutionProcess, CliExportCommandProcessor, CliFeedbackCommandProcessor, CliFontSizeCommandProcessor, CliFullScreenManager, CliHelpCommandProcessor, CliHistoryCommandProcessor, CliHotKeysCommandProcessor, CliHtopCommandProcessor, CliHttpClient, CliInputReader, CliJsonCommandProcessor, CliKeyValueStore, CliKeyValueStore_TOKEN, CliKillCommandProcessor, CliLogger, CliLoremCommandProcessor, CliModuleRegistry_TOKEN, CliNanoCommandProcessor, CliNotifier, CliOpenCommandProcessor, CliPackageManagerService, CliPackageManagerService_TOKEN, CliPackagesCommandProcessor, CliPingCommandProcessor, CliProcessRegistry, CliProcessRegistry_TOKEN, CliProcessorsRegistry_TOKEN, CliPsCommandProcessor, CliRandomCommandProcessor, CliScreenCommandProcessor, CliSeqCommandProcessor, CliServerCommandProcessor, CliServerConnection, CliServerManager, CliServerManager_TOKEN, CliServerMultiProxyProcessor, CliServerProxyProcessor, CliServiceContainer, CliServicesCommandProcessor, CliSleepCommandProcessor, CliSnippetCommandProcessor, CliSshCommandProcessor, CliStateStore, CliStateStoreManager, CliStateStoreManager_TOKEN, CliTerminalProgressBar, CliTerminalSpinner, CliTerminalTextAnimator, CliTerminalWriter, CliTestHarness, type CliTestResult, CliThemeCommandProcessor, CliTimeCommandProcessor, CliTimerManager, CliTimestampCommandProcessor, CliUnAliasCommandProcessor, CliUnameCommandProcessor, CliUnsetCommandProcessor, CliUptimeCommandProcessor, CliVersionCommandProcessor, type CliWelcomeMessageConfig, CliYesCommandProcessor, CommandParser, type CommandParserOutput, type CommandPart, type ConfigureState, type DefaultServerProvider, type DiffLine, type DiffType, type ICliEnvironment, ICliEnvironment_TOKEN, type ICliExecutionHost, ICliPingServerService_TOKEN, type ICliStateStoreManager, type ICliWasmAccelerator, type InitializeServicesOptions, type InitializeServicesResult, JsFallbackAccelerator, LIBRARY_VERSION, type MultiProxyEntry, OverlayAddon, type ParsedArg, type ParsedToken, ProcessExitedError, ScriptLoaderService, SyntaxHighlighterRegistry_TOKEN, type TerminalSetupResult, type ThemeState, appendOutputToFile, appendStderrToFile, builtinProcessors, computeDiff, contextGlobalParameter, createServerModule, executeOnServer, expandEnvironmentVars, formatDiff, getAccelerator, getCliNameArt, getGreetingBasedOnTime, getTerminalOptions, groupBy, helpGlobalParameter, hotkeysInfo, initWasmAccelerator, initializeServices, initializeTerminal, isWasmAccelerated, miscProcessors, openLink, reconcileArgs, renderServerResponse, renderSingleOutput, substituteVars, systemProcessors, themeInfos, themes, tryExecuteScript, versionGlobalParameter, waitForLayout, welcomeModule, writeOutputToFile, writeStderrToFile };
2703
+ export { API_VERSION, CLi_Name_Art, CapturingTerminalWriter, type CdnSourceName, CliAliasCommandProcessor, CliArgsParser, CliBackgroundServiceRegistry_TOKEN, CliBoot, CliCalCommandProcessor, CliCaptureCommandProcessor, CliClearCommandProcessor, CliClipboard, CliClipboardCommandProcessor, CliColorCommandProcessor, CliCommandExecutionContext, CliCommandExecutor, CliCommandHistory, CliCommandHistory_TOKEN, CliCommandProcessorRegistry, CliConfigureCommandProcessor, CliConvertCommandProcessor, CliDebugCommandProcessor, CliDefaultPingServerService, CliDiffCommandProcessor, CliDragDropService, CliEchoCommandProcessor, CliEngine, type CliEngineOptions, CliEnvCommandProcessor, CliEnvironment, CliEvalCommandProcessor, CliExecutionContext, type CliExecutionContextDeps, CliExecutionProcess, CliExportCommandProcessor, CliFeedbackCommandProcessor, CliFontSizeCommandProcessor, CliFullScreenManager, CliHelpCommandProcessor, CliHistoryCommandProcessor, CliHotKeysCommandProcessor, CliHtopCommandProcessor, CliHttpClient, CliInputReader, CliJsonCommandProcessor, CliKeyValueStore, CliKeyValueStore_TOKEN, CliKillCommandProcessor, CliLogger, CliLoremCommandProcessor, CliModuleRegistry_TOKEN, CliNanoCommandProcessor, CliNotifier, CliOpenCommandProcessor, CliPackageManagerService, CliPackageManagerService_TOKEN, CliPackagesCommandProcessor, CliPermissionRegistry, CliPingCommandProcessor, CliProcessRegistry, CliProcessRegistry_TOKEN, CliProcessorsRegistry_TOKEN, CliPsCommandProcessor, CliRandomCommandProcessor, CliScreenCommandProcessor, CliSeqCommandProcessor, CliServerCommandProcessor, CliServerConnection, CliServerManager, CliServerManager_TOKEN, CliServerMultiProxyProcessor, CliServerProxyProcessor, CliServiceContainer, CliServicesCommandProcessor, CliSleepCommandProcessor, CliSnippetCommandProcessor, CliSshCommandProcessor, CliStateStore, CliStateStoreManager, CliStateStoreManager_TOKEN, CliTerminalProgressBar, CliTerminalSpinner, CliTerminalTextAnimator, CliTerminalWriter, CliTestHarness, type CliTestResult, CliThemeCommandProcessor, CliTimeCommandProcessor, CliTimerManager, CliTimestampCommandProcessor, CliUnAliasCommandProcessor, CliUnameCommandProcessor, CliUnsetCommandProcessor, CliUptimeCommandProcessor, CliVersionCommandProcessor, type CliWelcomeMessageConfig, CliYesCommandProcessor, CommandParser, type CommandParserOutput, type CommandPart, type ConfigureState, type DefaultServerProvider, type DiffLine, type DiffType, type ICliEnvironment, ICliEnvironment_TOKEN, type ICliExecutionHost, ICliPingServerService_TOKEN, type ICliStateStoreManager, type ICliWasmAccelerator, type InitializeServicesOptions, type InitializeServicesResult, JsFallbackAccelerator, LIBRARY_VERSION, type MultiProxyEntry, OverlayAddon, type ParsedArg, type ParsedToken, ProcessExitedError, ScriptLoaderService, SyntaxHighlighterRegistry_TOKEN, type TerminalSetupResult, type ThemeState, appendOutputToFile, appendStderrToFile, builtinProcessors, computeDiff, contextGlobalParameter, createServerModule, describeShellClose, executeOnServer, expandEnvironmentVars, formatDiff, getAccelerator, getCliNameArt, getGreetingBasedOnTime, getTerminalOptions, groupBy, helpGlobalParameter, hotkeysInfo, initWasmAccelerator, initializeServices, initializeTerminal, isWasmAccelerated, miscProcessors, openLink, reconcileArgs, renderServerResponse, renderSingleOutput, substituteVars, systemProcessors, themeInfos, themes, tryExecuteScript, versionGlobalParameter, waitForLayout, welcomeModule, writeOutputToFile, writeStderrToFile };