@qodalis/cli 2.4.2 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qodalis/cli",
3
- "version": "2.4.2",
3
+ "version": "2.5.0",
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.4.2",
33
+ "@qodalis/cli-core": "2.5.0",
34
34
  "@xterm/xterm": "^6.0.0",
35
35
  "@xterm/addon-fit": "^0.11.0",
36
36
  "@xterm/addon-web-links": "^0.12.0",
package/public-api.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { ICliCommandProcessor, ICliCommandParameterDescriptor as ICliCommandParameterDescriptor$1, ICliCommandProcessorRegistry, ICliCommandChildProcessor, CliProcessorMetadata, CliStateConfiguration, ICliExecutionContext, CliProcessCommand, ICliCommandAuthor, ICliCommandControls, CliThemeInfo, ICliExecutionProcess, ICliUserSession, ICliSpinner, ICliPercentageProgressBar, ICliTextAnimator, ICliTerminalWriter, ICliCommandExecutorService, ICliClipboard, ICliStateStore, CliOptions, ICliLogger, ICliServiceProvider, ICliTranslationService, ICliInputReader, ICliBackgroundServiceRegistry, ICliHttpClient, ICliNotifier, ICliManagedInterval, ICliManagedTimer, ICliEventBus, ICliKeyValueStore, CliStateStoreOptions, ICliCompletionProvider, ICliFilePickerProvider, CliFullScreenOptions, ICliProcessRegistry, ICliBackgroundService, ICliServiceContext, ICliBackgroundServiceInfo, ICliServiceLogEntry, CliServiceEventHandler, ICliGlobalParameterHandler, CliForegroundColor, CliBackgroundColor, CliToken, 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, CliBranding, CliState, CliEngineSnapshot, CliEvent, CliEventType, CliEventMap, CliEmitOptions, CustomEventType, CliEventHandler, CliServerConfig, ICliServerAuthService, CliServerCommandDescriptor, CliServerCapabilities, CliServerResponse, CliServerOutput, CliPanelPosition, CliPanelConfig, CliPanelHideAlignment, ICliPanelRef, CliPanelThemeInput, CliPanelState } from '@qodalis/cli-core';
1
+ import { ICliCommandProcessor, ICliCommandParameterDescriptor as ICliCommandParameterDescriptor$1, ICliCommandProcessorRegistry, ICliCommandChildProcessor, CliProcessorMetadata, CliStateConfiguration, ICliExecutionContext, CliProcessCommand, ICliCommandAuthor, ICliCommandControls, CliThemeInfo, ICliExecutionProcess, ICliUserSession, ICliSpinner, ICliPercentageProgressBar, ICliTextAnimator, ICliTerminalWriter, ICliCommandExecutorService, ICliClipboard, ICliStateStore, CliOptions, ICliLogger, ICliServiceProvider, ICliTranslationService, ICliInputReader, ICliBackgroundServiceRegistry, ICliHttpClient, ICliNotifier, ICliManagedInterval, ICliManagedTimer, ICliEventBus, ICliKeyValueStore, CliStateStoreOptions, ICliCompletionProvider, ICliFilePickerProvider, CliFullScreenOptions, ICliProcessRegistry, ICliBackgroundService, ICliServiceContext, ICliBackgroundServiceInfo, ICliServiceLogEntry, CliServiceEventHandler, ICliGlobalParameterHandler, CliForegroundColor, CliBackgroundColor, CliToken, 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, CliBranding, CliState, CliEngineSnapshot, CliEvent, CliEventType, CliEventMap, CliEmitOptions, CustomEventType, CliEventHandler, CliServerConfig, ICliServerAuthService, CliServerCommandDescriptor, CliServerCapabilities, CliServerResponse, CliServerOutput, ICliSecretStore, CliPanelPosition, CliPanelConfig, CliPanelHideAlignment, ICliPanelRef, CliPanelThemeInput, CliPanelState } from '@qodalis/cli-core';
2
2
  export { ICliUserSessionService_TOKEN, ICliUsersStoreService_TOKEN } from '@qodalis/cli-core';
3
3
  import { ITheme, Terminal, ITerminalAddon, ITerminalOptions, ITerminalInitOnlyOptions } from '@xterm/xterm';
4
4
  import * as rxjs from 'rxjs';
@@ -165,7 +165,7 @@ declare const CliKeyValueStore_TOKEN: any;
165
165
  */
166
166
  declare const SyntaxHighlighterRegistry_TOKEN: any;
167
167
 
168
- declare const LIBRARY_VERSION = "2.4.2";
168
+ declare const LIBRARY_VERSION = "2.5.0";
169
169
  declare const API_VERSION = 2;
170
170
 
171
171
  declare class CliAliasCommandProcessor implements ICliCommandProcessor {
@@ -2953,7 +2953,10 @@ declare class CliEngine {
2953
2953
  private beginBootReport;
2954
2954
  /** 4. Environment variables, background services, server auth and manager. */
2955
2955
  private registerRuntimeServices;
2956
- /** 4. Connect to the configured servers, one boot step each. */
2956
+ /**
2957
+ * 4. Connect to the configured servers, one boot step each, then to the
2958
+ * servers the user linked (`server add`).
2959
+ */
2957
2960
  private connectServers;
2958
2961
  /**
2959
2962
  * 5. Built-in welcome and server modules, the app's modules, and the
@@ -3275,6 +3278,7 @@ declare class CliServerProxyProcessor implements ICliCommandProcessor {
3275
3278
  parameters?: ICliCommandParameterDescriptor$1[];
3276
3279
  processors?: ICliCommandProcessor[];
3277
3280
  acceptsRawInput?: boolean;
3281
+ writeDescription?: (context: ICliExecutionContext) => void;
3278
3282
  /** Full command path from root to this processor (e.g. ["aws", "lambda", "list"]) */
3279
3283
  private readonly commandPath;
3280
3284
  constructor(connection: CliServerConnection, descriptor: CliServerCommandDescriptor, serverName: string, isNested?: boolean, parentPath?: string[]);
@@ -3299,7 +3303,9 @@ declare class CliServerMultiProxyProcessor implements ICliCommandProcessor {
3299
3303
  private readonly entries;
3300
3304
  private readonly provider;
3301
3305
  command: string;
3306
+ aliases?: string[];
3302
3307
  description?: string;
3308
+ writeDescription?: (context: ICliExecutionContext) => void;
3303
3309
  metadata?: CliProcessorMetadata;
3304
3310
  parameters?: ICliCommandParameterDescriptor$1[];
3305
3311
  processors?: ICliCommandProcessor[];
@@ -3332,16 +3338,42 @@ declare class CliServerManager implements DefaultServerProvider {
3332
3338
  private readonly _bareAliases;
3333
3339
  private _backgroundServices?;
3334
3340
  private _hidden;
3341
+ /** Servers the user linked (`server add`), as opposed to the host's */
3342
+ private readonly _linked;
3335
3343
  /** `server:command` pairs already warned about, so each warns once */
3336
3344
  private readonly _warnedHidden;
3337
3345
  constructor(registry: ICliCommandProcessorRegistry, authService?: ICliServerAuthService, events?: ICliEventBus);
3346
+ /** Whether the user linked this server (`server add`): only those can be removed or edited. */
3347
+ isLinked(name: string): boolean;
3338
3348
  get defaultServer(): string | null;
3339
3349
  preferredServer(): string | null;
3340
3350
  setDefaultServer(name: string | null): void;
3351
+ /** Where connections report and run (set once at boot, before any server connects). */
3352
+ configure(logger?: {
3353
+ warn(msg: string): void;
3354
+ info(msg: string): void;
3355
+ }, backgroundServices?: ICliBackgroundServiceRegistry, cliLogger?: ICliLogger): void;
3341
3356
  connectAll(servers: CliServerConfig[], logger?: {
3342
3357
  warn(msg: string): void;
3343
3358
  info(msg: string): void;
3344
3359
  }, backgroundServices?: ICliBackgroundServiceRegistry, cliLogger?: ICliLogger): Promise<void>;
3360
+ /**
3361
+ * Connects one server and registers its commands (without the bare
3362
+ * aliases: callers refresh them once every server is connected).
3363
+ */
3364
+ private connectServer;
3365
+ /**
3366
+ * Connects a server added while the terminal runs (`server add`): its
3367
+ * commands are available at once. Throws when the name is taken.
3368
+ */
3369
+ addServer(config: CliServerConfig, options?: {
3370
+ linked?: boolean;
3371
+ }): Promise<CliServerConnection>;
3372
+ /**
3373
+ * Disconnects a server and forgets it (`server remove`): its commands go
3374
+ * away. False when there is no such server.
3375
+ */
3376
+ removeServer(name: string): boolean;
3345
3377
  reconnect(name: string): Promise<{
3346
3378
  success: boolean;
3347
3379
  commandCount: number;
@@ -3358,6 +3390,11 @@ declare class CliServerManager implements DefaultServerProvider {
3358
3390
  private unregisterBareAliases;
3359
3391
  private registerProxyProcessors;
3360
3392
  private registerBareAliases;
3393
+ /**
3394
+ * The server's aliases of a command that no registered command answers
3395
+ * to yet: a local command (or an earlier server alias) keeps its name.
3396
+ */
3397
+ private freeAliases;
3361
3398
  private recordHidden;
3362
3399
  }
3363
3400
 
@@ -3419,6 +3456,151 @@ declare function describeShellClose(event: {
3419
3456
  reason?: string;
3420
3457
  }, serverName: string): string | null;
3421
3458
 
3459
+ /** A server linked with `server add` (its token is kept apart, in the secret store). */
3460
+ interface CliLinkedServer {
3461
+ name: string;
3462
+ url: string;
3463
+ /** Epoch milliseconds. */
3464
+ addedAt: number;
3465
+ }
3466
+ /** Server names: a letter or digit, then letters, digits, `-` and `_` (at most 32). */
3467
+ declare const SERVER_NAME_PATTERN: RegExp;
3468
+ /** `https://` added when no scheme is given; trailing slashes dropped. Null for anything but http(s). */
3469
+ declare function normalizeServerUrl(input: string): string | null;
3470
+ /** Loopback, private (RFC 1918, link-local, ULA) or `.local` host names: http is allowed for them. */
3471
+ declare function isPrivateHost(hostname: string): boolean;
3472
+ /** What `server add` must check about a URL before using it. */
3473
+ interface CliServerUrlCheck {
3474
+ url: string;
3475
+ /** http to a private host: allowed after a confirmation. */
3476
+ insecure: boolean;
3477
+ /** An http server from an https page: the browser blocks the requests. */
3478
+ mixedContent: boolean;
3479
+ }
3480
+ /**
3481
+ * Normalises and checks a server URL: https anywhere, http only to private
3482
+ * hosts. Returns the reason as a string when refused.
3483
+ */
3484
+ declare function checkServerUrl(input: string, pageProtocol?: string): CliServerUrlCheck | string;
3485
+ /** Whether host options allow linking this URL (`userServers`). */
3486
+ declare function userServersAllow(options: CliOptions | undefined, url: string): boolean;
3487
+ /** Whether linking is switched on at all. */
3488
+ declare function userServersEnabled(options: CliOptions | undefined): boolean;
3489
+ /** A name from the URL's host: `api.example.com` → `api`, `localhost:8047` → `localhost-8047`. */
3490
+ declare function suggestServerName(url: string, taken: (name: string) => boolean): string;
3491
+ /** `qcli_pat_…abcd` → `••••abcd`. */
3492
+ declare function maskToken(token: string | undefined): string;
3493
+ /**
3494
+ * The command as kept in the history: values of `--token` and `--password`
3495
+ * replaced by `***`.
3496
+ */
3497
+ declare function redactSecrets(command: string): string;
3498
+ /**
3499
+ * The linked servers and their tokens: the list in the key-value store, each
3500
+ * token in the secret store.
3501
+ */
3502
+ declare class CliLinkedServers {
3503
+ private readonly kv;
3504
+ private readonly secrets;
3505
+ constructor(kv: ICliKeyValueStore, secrets: ICliSecretStore);
3506
+ list(): Promise<CliLinkedServer[]>;
3507
+ get(name: string): Promise<CliLinkedServer | undefined>;
3508
+ /** Saves a server (replacing one with the same name) and its token (none: deleted). */
3509
+ save(server: CliLinkedServer, token: string | undefined): Promise<void>;
3510
+ setToken(name: string, token: string): Promise<void>;
3511
+ token(name: string): Promise<string | undefined>;
3512
+ remove(name: string): Promise<boolean>;
3513
+ /** Removes every linked server and every secret. */
3514
+ clear(): Promise<void>;
3515
+ }
3516
+ /**
3517
+ * The connection config of a linked server: the token (kept in memory once
3518
+ * read) sent as a bearer header; sockets use the users plugin's tickets.
3519
+ */
3520
+ declare function linkedServerConfig(server: CliLinkedServer, token: string | undefined): CliServerConfig;
3521
+
3522
+ /**
3523
+ * The default {@link ICliSecretStore}: each secret encrypted with AES-GCM (own
3524
+ * random IV) by a 256-bit key that Web Crypto never exports, both kept in the
3525
+ * key-value store (IndexedDB). Reading the database gives ciphertext only; the
3526
+ * key cannot be read out, only used by this origin.
3527
+ */
3528
+ declare class CliWebCryptoSecretStore implements ICliSecretStore {
3529
+ private readonly kv;
3530
+ /** Null: no Web Crypto (an insecure page). */
3531
+ private readonly crypto;
3532
+ private keyPromise;
3533
+ constructor(kv: ICliKeyValueStore,
3534
+ /** Null: no Web Crypto (an insecure page). */
3535
+ crypto?: Crypto | null);
3536
+ isAvailable(): boolean;
3537
+ get(key: string): Promise<string | undefined>;
3538
+ set(key: string, value: string): Promise<void>;
3539
+ delete(key: string): Promise<void>;
3540
+ clear(): Promise<void>;
3541
+ /** The saved key, or a new one (created once, even for parallel calls). */
3542
+ private key;
3543
+ }
3544
+
3545
+ type CliFetch = (input: string, init?: RequestInit) => Promise<Response>;
3546
+ /** What `server add` shows about a server before linking it. */
3547
+ interface CliServerProbe {
3548
+ /** The server's version (capabilities), when it says. */
3549
+ version?: string;
3550
+ capabilities: CliServerCapabilities | null;
3551
+ /** Whether the commands need a sign-in (401/403 without a token). */
3552
+ needsSignIn: boolean;
3553
+ }
3554
+ /** A link request: the code to compare and the page where the user approves it. */
3555
+ interface CliLinkRequest {
3556
+ linkId: string;
3557
+ userCode: string;
3558
+ /** Absolute (resolved against the server URL). */
3559
+ verificationUrl: string;
3560
+ expiresIn: number;
3561
+ interval: number;
3562
+ }
3563
+ type CliLinkPoll = {
3564
+ status: 'pending';
3565
+ } | {
3566
+ status: 'denied';
3567
+ } | {
3568
+ status: 'expired';
3569
+ } | {
3570
+ status: 'approved';
3571
+ token: string;
3572
+ userName?: string;
3573
+ };
3574
+ /** Text from a server, safe to print: control characters (terminal escapes) dropped. */
3575
+ declare function plainText(value: unknown): string;
3576
+ /**
3577
+ * Whether `url` is a Qodalis CLI server: `GET /api/qcli/versions` answers with
3578
+ * its supported versions. Throws with the reason when not.
3579
+ */
3580
+ declare function probeServer(fetchFn: CliFetch, url: string): Promise<CliServerProbe>;
3581
+ /** Starts a link request; null when the server has no link endpoint (older servers, no users plugin). */
3582
+ declare function requestLink(fetchFn: CliFetch, url: string, client: string): Promise<CliLinkRequest | null>;
3583
+ /** One poll of a link request. */
3584
+ declare function pollLink(fetchFn: CliFetch, url: string, linkId: string): Promise<CliLinkPoll>;
3585
+ /**
3586
+ * Signs in with a password, creates an API token named `tokenName` with that
3587
+ * session, then ends the session: only the token is kept.
3588
+ */
3589
+ declare function createTokenWithPassword(fetchFn: CliFetch, url: string, username: string, password: string, tokenName: string): Promise<string>;
3590
+ /** "Qodalis CLI on <platform>" for link requests and token names (`[A-Za-z0-9._ -]` only). */
3591
+ declare function deviceName(appName?: string): string;
3592
+
3593
+ /** The secret store: the host's ({@link ICliSecretStore_TOKEN}) or the Web Crypto one. */
3594
+ declare function secretStoreOf(context: Pick<ICliExecutionContext, 'services'>): ICliSecretStore;
3595
+ /** The linked servers of this terminal. */
3596
+ declare function linkedServersOf(context: Pick<ICliExecutionContext, 'services'>): CliLinkedServers;
3597
+ /**
3598
+ * Connects the servers linked with `server add` (boot, after the host's
3599
+ * servers). Host servers win a name clash; servers the host options no longer
3600
+ * allow are skipped.
3601
+ */
3602
+ declare function restoreLinkedServers(context: Pick<ICliExecutionContext, 'services' | 'options'>, manager: CliServerManager, warn: (message: string) => void): Promise<void>;
3603
+
3422
3604
  /**
3423
3605
  * Result of executing a command through the test harness.
3424
3606
  */
@@ -4171,5 +4353,5 @@ interface PanelStatusDropdown {
4171
4353
  /** The open services or servers dropdown, or null when neither is open. */
4172
4354
  declare function openStatusDropdown(s: CliPanelSnapshot): PanelStatusDropdown | null;
4173
4355
 
4174
- export { API_VERSION, CLI_ENV_GLOBAL_PERMISSION, CLI_FRAMEWORK_SERVICE, CLOSE_GLYPH, CLOSE_ICON, CapturingTerminalWriter, CliAliasCommandProcessor, CliArgsParser, CliBackgroundServiceRegistry_TOKEN, CliBoot, CliBootLog, CliBootLog_TOKEN, CliCalCommandProcessor, CliCaptureCommandProcessor, CliClearCommandProcessor, CliClipboard, CliClipboardCommandProcessor, CliColorCommandProcessor, CliCommandExecutionContext, CliCommandExecutor, CliCommandHistory, CliCommandHistory_TOKEN, CliCommandProcessorRegistry, CliConfigureCommandProcessor, CliConvertCommandProcessor, CliDebugCommandProcessor, CliDefaultPingServerService, CliDiffCommandProcessor, CliDragDropService, CliEchoCommandProcessor, CliEngine, CliEnvCommandProcessor, CliEnvironment, CliEvalCommandProcessor, CliEventsCommandProcessor, CliExecutionContext, CliExecutionProcess, CliExportCommandProcessor, CliFalseCommandProcessor, 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, CliPanelController, CliPanelStatusTracker, CliPermissionRegistry, CliPingCommandProcessor, CliProcessRegistry, CliProcessRegistry_TOKEN, CliProcessorsRegistry_TOKEN, CliPsCommandProcessor, CliRandomCommandProcessor, CliScreenCommandProcessor, CliScriptSyntaxError, CliSeqCommandProcessor, CliServerCommandProcessor, CliServerConnection, CliServerManager, CliServerManager_TOKEN, CliServerMultiProxyProcessor, CliServerProxyProcessor, CliServiceContainer, CliServicesCommandProcessor, CliSleepCommandProcessor, CliSnippetCommandProcessor, CliSshCommandProcessor, CliStateStore, CliStateStoreManager, CliStateStoreManager_TOKEN, CliTerminalProgressBar, CliTerminalSpinner, CliTerminalTextAnimator, CliTerminalWriter, CliTestCommandProcessor, CliTestHarness, CliThemeCommandProcessor, CliTimeCommandProcessor, CliTimerManager, CliTimestampCommandProcessor, CliTrueCommandProcessor, CliUnAliasCommandProcessor, CliUnameCommandProcessor, CliUnsetCommandProcessor, CliUptimeCommandProcessor, CliVersionCommandProcessor, CliYesCommandProcessor, CommandParser, DEFAULT_CLI_NAME, DEFAULT_GLOBAL_STATUS, DEFAULT_PANEL_HEIGHT, DEFAULT_PANEL_WIDTH, DEFAULT_TAB_STATUS, ERROR_ICON, EXEC_POLL_MS, GLOBAL_POLL_MS, HIDE_ICON, HIDE_TAB_TERMINAL_ICON, ICliEnvironment_TOKEN, ICliPingServerService_TOKEN, ICliScriptRunner_TOKEN, JsFallbackAccelerator, LIBRARY_VERSION, MAXIMIZE_ICON, MIN_PANEL_SIZE, MIN_PANE_WIDTH_PERCENT, OverlayAddon, PANEL_LABELS, PANEL_POSITIONS, ProcessExitedError, RESTORE_ICON, SERVICES_ICON, SUCCESS_ICON, SVG_COMMON_ATTRS, SVG_VIEW_BOX, ScriptLoaderService, SyntaxHighlighterRegistry_TOKEN, TERMINAL_ICON, UPTIME_ICON, appendOutputToFile, appendStderrToFile, applyEnvironmentChange, builtinProcessors, capitalize, clampPanelSize, cliScriptRunner, collapseChevronIcon, computeDiff, computeGlobalStatus, computeTabStatus, contextGlobalParameter, contextMenuItems, contextMenuStyle, createCliEngine, createServerModule, defaultFontSize, describeShellClose, distributePaneWidths, dropdownAnchorStyle, executeOnServer, expandBraces, expandEnvironmentVars, expandGlobs, formatDiff, formatUptime, getAccelerator, getCliNameArt, getGreetingBasedOnTime, getTerminalOptions, glowLineClass, greetingModule, groupBy, handleRenameKey, helpGlobalParameter, hideTabChevronIcon, hotkeysInfo, initWasmAccelerator, initializeServices, initializeTerminal, interruptCommand, isHorizontalPosition, isWasmAccelerated, joinClasses, killProcess, matchGlob, mergeCliOptions, miscProcessors, nextRowsCommand, normalizePaneWidths, openLink, openStatusDropdown, paneClass, paneStyle, panelBranding, panelTabClass, panelTabDotClass, panelWrapperClass, panelWrapperStyle, panesContainerClass, panesContainerWidth, parseAssignments, parseScript, positionDropdownItemClass, positionIcon, positionOptions, reconcileArgs, renderServerResponse, renderSingleOutput, resizePaneWidths, resizedPanelSize, resolveCliBranding, resolveCliHostConfig, runContextMenuAction, runScript, splitWords, statusIndicators, substituteCommands, substituteVars, svgAttrs, systemProcessors, tabDotClass, themeInfos, themes, tryExecuteScript, versionGlobalParameter, waitForLayout, welcomeModule, writeOutputToFile, writeStderrToFile };
4175
- export type { AnchorRect, CdnSourceName, CliBootLogOptions, CliEngineOptions, CliEnvironmentChange, CliEnvironmentProfile, CliEnvironmentScope, CliEnvironmentSnapshot, CliEnvironmentSource, CliExecutionContextDeps, CliHiddenServerCommand, CliHostConfig, CliPanelCallbacks, CliPanelContextMenu, CliPanelControlledState, CliPanelControllerOptions, CliPanelExecutionState, CliPanelGlobalStatus, CliPanelPane, CliPanelServerDetail, CliPanelServerState, CliPanelServiceDetail, CliPanelSnapshot, CliPanelStatusTrackerListener, CliPanelTab, CliPanelTabStatus, CliPanelViewport, CliTestResult, CliWelcomeMessageConfig, CommandParserOutput, CommandPart, ConfigureState, CreateCliEngineConfig, DefaultServerProvider, DiffLine, DiffType, ICliEnvironment, ICliExecutionHost, ICliScriptRunOptions, ICliScriptRunner, ICliStateStoreManager, ICliWasmAccelerator, InitializeServicesOptions, InitializeServicesResult, MultiProxyEntry, PanelContextMenuAction, PanelContextMenuItem, PanelDropdownRow, PanelPositionOption, PanelStatusDropdown, PanelStatusIndicator, ParsedArg, ParsedToken, ResolvedCliBranding, SvgIcon, SvgShape, TerminalSetupResult, ThemeState };
4356
+ export { API_VERSION, CLI_ENV_GLOBAL_PERMISSION, CLI_FRAMEWORK_SERVICE, CLOSE_GLYPH, CLOSE_ICON, CapturingTerminalWriter, CliAliasCommandProcessor, CliArgsParser, CliBackgroundServiceRegistry_TOKEN, CliBoot, CliBootLog, CliBootLog_TOKEN, CliCalCommandProcessor, CliCaptureCommandProcessor, CliClearCommandProcessor, CliClipboard, CliClipboardCommandProcessor, CliColorCommandProcessor, CliCommandExecutionContext, CliCommandExecutor, CliCommandHistory, CliCommandHistory_TOKEN, CliCommandProcessorRegistry, CliConfigureCommandProcessor, CliConvertCommandProcessor, CliDebugCommandProcessor, CliDefaultPingServerService, CliDiffCommandProcessor, CliDragDropService, CliEchoCommandProcessor, CliEngine, CliEnvCommandProcessor, CliEnvironment, CliEvalCommandProcessor, CliEventsCommandProcessor, CliExecutionContext, CliExecutionProcess, CliExportCommandProcessor, CliFalseCommandProcessor, CliFeedbackCommandProcessor, CliFontSizeCommandProcessor, CliFullScreenManager, CliHelpCommandProcessor, CliHistoryCommandProcessor, CliHotKeysCommandProcessor, CliHtopCommandProcessor, CliHttpClient, CliInputReader, CliJsonCommandProcessor, CliKeyValueStore, CliKeyValueStore_TOKEN, CliKillCommandProcessor, CliLinkedServers, CliLogger, CliLoremCommandProcessor, CliModuleRegistry_TOKEN, CliNanoCommandProcessor, CliNotifier, CliOpenCommandProcessor, CliPackageManagerService, CliPackageManagerService_TOKEN, CliPackagesCommandProcessor, CliPanelController, CliPanelStatusTracker, CliPermissionRegistry, CliPingCommandProcessor, CliProcessRegistry, CliProcessRegistry_TOKEN, CliProcessorsRegistry_TOKEN, CliPsCommandProcessor, CliRandomCommandProcessor, CliScreenCommandProcessor, CliScriptSyntaxError, CliSeqCommandProcessor, CliServerCommandProcessor, CliServerConnection, CliServerManager, CliServerManager_TOKEN, CliServerMultiProxyProcessor, CliServerProxyProcessor, CliServiceContainer, CliServicesCommandProcessor, CliSleepCommandProcessor, CliSnippetCommandProcessor, CliSshCommandProcessor, CliStateStore, CliStateStoreManager, CliStateStoreManager_TOKEN, CliTerminalProgressBar, CliTerminalSpinner, CliTerminalTextAnimator, CliTerminalWriter, CliTestCommandProcessor, CliTestHarness, CliThemeCommandProcessor, CliTimeCommandProcessor, CliTimerManager, CliTimestampCommandProcessor, CliTrueCommandProcessor, CliUnAliasCommandProcessor, CliUnameCommandProcessor, CliUnsetCommandProcessor, CliUptimeCommandProcessor, CliVersionCommandProcessor, CliWebCryptoSecretStore, CliYesCommandProcessor, CommandParser, DEFAULT_CLI_NAME, DEFAULT_GLOBAL_STATUS, DEFAULT_PANEL_HEIGHT, DEFAULT_PANEL_WIDTH, DEFAULT_TAB_STATUS, ERROR_ICON, EXEC_POLL_MS, GLOBAL_POLL_MS, HIDE_ICON, HIDE_TAB_TERMINAL_ICON, ICliEnvironment_TOKEN, ICliPingServerService_TOKEN, ICliScriptRunner_TOKEN, JsFallbackAccelerator, LIBRARY_VERSION, MAXIMIZE_ICON, MIN_PANEL_SIZE, MIN_PANE_WIDTH_PERCENT, OverlayAddon, PANEL_LABELS, PANEL_POSITIONS, ProcessExitedError, RESTORE_ICON, SERVER_NAME_PATTERN, SERVICES_ICON, SUCCESS_ICON, SVG_COMMON_ATTRS, SVG_VIEW_BOX, ScriptLoaderService, SyntaxHighlighterRegistry_TOKEN, TERMINAL_ICON, UPTIME_ICON, appendOutputToFile, appendStderrToFile, applyEnvironmentChange, builtinProcessors, capitalize, checkServerUrl, clampPanelSize, cliScriptRunner, collapseChevronIcon, computeDiff, computeGlobalStatus, computeTabStatus, contextGlobalParameter, contextMenuItems, contextMenuStyle, createCliEngine, createServerModule, createTokenWithPassword, defaultFontSize, describeShellClose, deviceName, distributePaneWidths, dropdownAnchorStyle, executeOnServer, expandBraces, expandEnvironmentVars, expandGlobs, formatDiff, formatUptime, getAccelerator, getCliNameArt, getGreetingBasedOnTime, getTerminalOptions, glowLineClass, greetingModule, groupBy, handleRenameKey, helpGlobalParameter, hideTabChevronIcon, hotkeysInfo, initWasmAccelerator, initializeServices, initializeTerminal, interruptCommand, isHorizontalPosition, isPrivateHost, isWasmAccelerated, joinClasses, killProcess, linkedServerConfig, linkedServersOf, maskToken, matchGlob, mergeCliOptions, miscProcessors, nextRowsCommand, normalizePaneWidths, normalizeServerUrl, openLink, openStatusDropdown, paneClass, paneStyle, panelBranding, panelTabClass, panelTabDotClass, panelWrapperClass, panelWrapperStyle, panesContainerClass, panesContainerWidth, parseAssignments, parseScript, plainText, pollLink, positionDropdownItemClass, positionIcon, positionOptions, probeServer, reconcileArgs, redactSecrets, renderServerResponse, renderSingleOutput, requestLink, resizePaneWidths, resizedPanelSize, resolveCliBranding, resolveCliHostConfig, restoreLinkedServers, runContextMenuAction, runScript, secretStoreOf, splitWords, statusIndicators, substituteCommands, substituteVars, suggestServerName, svgAttrs, systemProcessors, tabDotClass, themeInfos, themes, tryExecuteScript, userServersAllow, userServersEnabled, versionGlobalParameter, waitForLayout, welcomeModule, writeOutputToFile, writeStderrToFile };
4357
+ export type { AnchorRect, CdnSourceName, CliBootLogOptions, CliEngineOptions, CliEnvironmentChange, CliEnvironmentProfile, CliEnvironmentScope, CliEnvironmentSnapshot, CliEnvironmentSource, CliExecutionContextDeps, CliFetch, CliHiddenServerCommand, CliHostConfig, CliLinkPoll, CliLinkRequest, CliLinkedServer, CliPanelCallbacks, CliPanelContextMenu, CliPanelControlledState, CliPanelControllerOptions, CliPanelExecutionState, CliPanelGlobalStatus, CliPanelPane, CliPanelServerDetail, CliPanelServerState, CliPanelServiceDetail, CliPanelSnapshot, CliPanelStatusTrackerListener, CliPanelTab, CliPanelTabStatus, CliPanelViewport, CliServerProbe, CliServerUrlCheck, CliTestResult, CliWelcomeMessageConfig, CommandParserOutput, CommandPart, ConfigureState, CreateCliEngineConfig, DefaultServerProvider, DiffLine, DiffType, ICliEnvironment, ICliExecutionHost, ICliScriptRunOptions, ICliScriptRunner, ICliStateStoreManager, ICliWasmAccelerator, InitializeServicesOptions, InitializeServicesResult, MultiProxyEntry, PanelContextMenuAction, PanelContextMenuItem, PanelDropdownRow, PanelPositionOption, PanelStatusDropdown, PanelStatusIndicator, ParsedArg, ParsedToken, ResolvedCliBranding, SvgIcon, SvgShape, TerminalSetupResult, ThemeState };
package/public-api.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ICliCommandProcessor, ICliCommandParameterDescriptor as ICliCommandParameterDescriptor$1, ICliCommandProcessorRegistry, ICliCommandChildProcessor, CliProcessorMetadata, CliStateConfiguration, ICliExecutionContext, CliProcessCommand, ICliCommandAuthor, ICliCommandControls, CliThemeInfo, ICliExecutionProcess, ICliUserSession, ICliSpinner, ICliPercentageProgressBar, ICliTextAnimator, ICliTerminalWriter, ICliCommandExecutorService, ICliClipboard, ICliStateStore, CliOptions, ICliLogger, ICliServiceProvider, ICliTranslationService, ICliInputReader, ICliBackgroundServiceRegistry, ICliHttpClient, ICliNotifier, ICliManagedInterval, ICliManagedTimer, ICliEventBus, ICliKeyValueStore, CliStateStoreOptions, ICliCompletionProvider, ICliFilePickerProvider, CliFullScreenOptions, ICliProcessRegistry, ICliBackgroundService, ICliServiceContext, ICliBackgroundServiceInfo, ICliServiceLogEntry, CliServiceEventHandler, ICliGlobalParameterHandler, CliForegroundColor, CliBackgroundColor, CliToken, 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, CliBranding, CliState, CliEngineSnapshot, CliEvent, CliEventType, CliEventMap, CliEmitOptions, CustomEventType, CliEventHandler, CliServerConfig, ICliServerAuthService, CliServerCommandDescriptor, CliServerCapabilities, CliServerResponse, CliServerOutput, CliPanelPosition, CliPanelConfig, CliPanelHideAlignment, ICliPanelRef, CliPanelThemeInput, CliPanelState } from '@qodalis/cli-core';
1
+ import { ICliCommandProcessor, ICliCommandParameterDescriptor as ICliCommandParameterDescriptor$1, ICliCommandProcessorRegistry, ICliCommandChildProcessor, CliProcessorMetadata, CliStateConfiguration, ICliExecutionContext, CliProcessCommand, ICliCommandAuthor, ICliCommandControls, CliThemeInfo, ICliExecutionProcess, ICliUserSession, ICliSpinner, ICliPercentageProgressBar, ICliTextAnimator, ICliTerminalWriter, ICliCommandExecutorService, ICliClipboard, ICliStateStore, CliOptions, ICliLogger, ICliServiceProvider, ICliTranslationService, ICliInputReader, ICliBackgroundServiceRegistry, ICliHttpClient, ICliNotifier, ICliManagedInterval, ICliManagedTimer, ICliEventBus, ICliKeyValueStore, CliStateStoreOptions, ICliCompletionProvider, ICliFilePickerProvider, CliFullScreenOptions, ICliProcessRegistry, ICliBackgroundService, ICliServiceContext, ICliBackgroundServiceInfo, ICliServiceLogEntry, CliServiceEventHandler, ICliGlobalParameterHandler, CliForegroundColor, CliBackgroundColor, CliToken, 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, CliBranding, CliState, CliEngineSnapshot, CliEvent, CliEventType, CliEventMap, CliEmitOptions, CustomEventType, CliEventHandler, CliServerConfig, ICliServerAuthService, CliServerCommandDescriptor, CliServerCapabilities, CliServerResponse, CliServerOutput, ICliSecretStore, CliPanelPosition, CliPanelConfig, CliPanelHideAlignment, ICliPanelRef, CliPanelThemeInput, CliPanelState } from '@qodalis/cli-core';
2
2
  export { ICliUserSessionService_TOKEN, ICliUsersStoreService_TOKEN } from '@qodalis/cli-core';
3
3
  import { ITheme, Terminal, ITerminalAddon, ITerminalOptions, ITerminalInitOnlyOptions } from '@xterm/xterm';
4
4
  import * as rxjs from 'rxjs';
@@ -165,7 +165,7 @@ declare const CliKeyValueStore_TOKEN: any;
165
165
  */
166
166
  declare const SyntaxHighlighterRegistry_TOKEN: any;
167
167
 
168
- declare const LIBRARY_VERSION = "2.4.2";
168
+ declare const LIBRARY_VERSION = "2.5.0";
169
169
  declare const API_VERSION = 2;
170
170
 
171
171
  declare class CliAliasCommandProcessor implements ICliCommandProcessor {
@@ -2953,7 +2953,10 @@ declare class CliEngine {
2953
2953
  private beginBootReport;
2954
2954
  /** 4. Environment variables, background services, server auth and manager. */
2955
2955
  private registerRuntimeServices;
2956
- /** 4. Connect to the configured servers, one boot step each. */
2956
+ /**
2957
+ * 4. Connect to the configured servers, one boot step each, then to the
2958
+ * servers the user linked (`server add`).
2959
+ */
2957
2960
  private connectServers;
2958
2961
  /**
2959
2962
  * 5. Built-in welcome and server modules, the app's modules, and the
@@ -3275,6 +3278,7 @@ declare class CliServerProxyProcessor implements ICliCommandProcessor {
3275
3278
  parameters?: ICliCommandParameterDescriptor$1[];
3276
3279
  processors?: ICliCommandProcessor[];
3277
3280
  acceptsRawInput?: boolean;
3281
+ writeDescription?: (context: ICliExecutionContext) => void;
3278
3282
  /** Full command path from root to this processor (e.g. ["aws", "lambda", "list"]) */
3279
3283
  private readonly commandPath;
3280
3284
  constructor(connection: CliServerConnection, descriptor: CliServerCommandDescriptor, serverName: string, isNested?: boolean, parentPath?: string[]);
@@ -3299,7 +3303,9 @@ declare class CliServerMultiProxyProcessor implements ICliCommandProcessor {
3299
3303
  private readonly entries;
3300
3304
  private readonly provider;
3301
3305
  command: string;
3306
+ aliases?: string[];
3302
3307
  description?: string;
3308
+ writeDescription?: (context: ICliExecutionContext) => void;
3303
3309
  metadata?: CliProcessorMetadata;
3304
3310
  parameters?: ICliCommandParameterDescriptor$1[];
3305
3311
  processors?: ICliCommandProcessor[];
@@ -3332,16 +3338,42 @@ declare class CliServerManager implements DefaultServerProvider {
3332
3338
  private readonly _bareAliases;
3333
3339
  private _backgroundServices?;
3334
3340
  private _hidden;
3341
+ /** Servers the user linked (`server add`), as opposed to the host's */
3342
+ private readonly _linked;
3335
3343
  /** `server:command` pairs already warned about, so each warns once */
3336
3344
  private readonly _warnedHidden;
3337
3345
  constructor(registry: ICliCommandProcessorRegistry, authService?: ICliServerAuthService, events?: ICliEventBus);
3346
+ /** Whether the user linked this server (`server add`): only those can be removed or edited. */
3347
+ isLinked(name: string): boolean;
3338
3348
  get defaultServer(): string | null;
3339
3349
  preferredServer(): string | null;
3340
3350
  setDefaultServer(name: string | null): void;
3351
+ /** Where connections report and run (set once at boot, before any server connects). */
3352
+ configure(logger?: {
3353
+ warn(msg: string): void;
3354
+ info(msg: string): void;
3355
+ }, backgroundServices?: ICliBackgroundServiceRegistry, cliLogger?: ICliLogger): void;
3341
3356
  connectAll(servers: CliServerConfig[], logger?: {
3342
3357
  warn(msg: string): void;
3343
3358
  info(msg: string): void;
3344
3359
  }, backgroundServices?: ICliBackgroundServiceRegistry, cliLogger?: ICliLogger): Promise<void>;
3360
+ /**
3361
+ * Connects one server and registers its commands (without the bare
3362
+ * aliases: callers refresh them once every server is connected).
3363
+ */
3364
+ private connectServer;
3365
+ /**
3366
+ * Connects a server added while the terminal runs (`server add`): its
3367
+ * commands are available at once. Throws when the name is taken.
3368
+ */
3369
+ addServer(config: CliServerConfig, options?: {
3370
+ linked?: boolean;
3371
+ }): Promise<CliServerConnection>;
3372
+ /**
3373
+ * Disconnects a server and forgets it (`server remove`): its commands go
3374
+ * away. False when there is no such server.
3375
+ */
3376
+ removeServer(name: string): boolean;
3345
3377
  reconnect(name: string): Promise<{
3346
3378
  success: boolean;
3347
3379
  commandCount: number;
@@ -3358,6 +3390,11 @@ declare class CliServerManager implements DefaultServerProvider {
3358
3390
  private unregisterBareAliases;
3359
3391
  private registerProxyProcessors;
3360
3392
  private registerBareAliases;
3393
+ /**
3394
+ * The server's aliases of a command that no registered command answers
3395
+ * to yet: a local command (or an earlier server alias) keeps its name.
3396
+ */
3397
+ private freeAliases;
3361
3398
  private recordHidden;
3362
3399
  }
3363
3400
 
@@ -3419,6 +3456,151 @@ declare function describeShellClose(event: {
3419
3456
  reason?: string;
3420
3457
  }, serverName: string): string | null;
3421
3458
 
3459
+ /** A server linked with `server add` (its token is kept apart, in the secret store). */
3460
+ interface CliLinkedServer {
3461
+ name: string;
3462
+ url: string;
3463
+ /** Epoch milliseconds. */
3464
+ addedAt: number;
3465
+ }
3466
+ /** Server names: a letter or digit, then letters, digits, `-` and `_` (at most 32). */
3467
+ declare const SERVER_NAME_PATTERN: RegExp;
3468
+ /** `https://` added when no scheme is given; trailing slashes dropped. Null for anything but http(s). */
3469
+ declare function normalizeServerUrl(input: string): string | null;
3470
+ /** Loopback, private (RFC 1918, link-local, ULA) or `.local` host names: http is allowed for them. */
3471
+ declare function isPrivateHost(hostname: string): boolean;
3472
+ /** What `server add` must check about a URL before using it. */
3473
+ interface CliServerUrlCheck {
3474
+ url: string;
3475
+ /** http to a private host: allowed after a confirmation. */
3476
+ insecure: boolean;
3477
+ /** An http server from an https page: the browser blocks the requests. */
3478
+ mixedContent: boolean;
3479
+ }
3480
+ /**
3481
+ * Normalises and checks a server URL: https anywhere, http only to private
3482
+ * hosts. Returns the reason as a string when refused.
3483
+ */
3484
+ declare function checkServerUrl(input: string, pageProtocol?: string): CliServerUrlCheck | string;
3485
+ /** Whether host options allow linking this URL (`userServers`). */
3486
+ declare function userServersAllow(options: CliOptions | undefined, url: string): boolean;
3487
+ /** Whether linking is switched on at all. */
3488
+ declare function userServersEnabled(options: CliOptions | undefined): boolean;
3489
+ /** A name from the URL's host: `api.example.com` → `api`, `localhost:8047` → `localhost-8047`. */
3490
+ declare function suggestServerName(url: string, taken: (name: string) => boolean): string;
3491
+ /** `qcli_pat_…abcd` → `••••abcd`. */
3492
+ declare function maskToken(token: string | undefined): string;
3493
+ /**
3494
+ * The command as kept in the history: values of `--token` and `--password`
3495
+ * replaced by `***`.
3496
+ */
3497
+ declare function redactSecrets(command: string): string;
3498
+ /**
3499
+ * The linked servers and their tokens: the list in the key-value store, each
3500
+ * token in the secret store.
3501
+ */
3502
+ declare class CliLinkedServers {
3503
+ private readonly kv;
3504
+ private readonly secrets;
3505
+ constructor(kv: ICliKeyValueStore, secrets: ICliSecretStore);
3506
+ list(): Promise<CliLinkedServer[]>;
3507
+ get(name: string): Promise<CliLinkedServer | undefined>;
3508
+ /** Saves a server (replacing one with the same name) and its token (none: deleted). */
3509
+ save(server: CliLinkedServer, token: string | undefined): Promise<void>;
3510
+ setToken(name: string, token: string): Promise<void>;
3511
+ token(name: string): Promise<string | undefined>;
3512
+ remove(name: string): Promise<boolean>;
3513
+ /** Removes every linked server and every secret. */
3514
+ clear(): Promise<void>;
3515
+ }
3516
+ /**
3517
+ * The connection config of a linked server: the token (kept in memory once
3518
+ * read) sent as a bearer header; sockets use the users plugin's tickets.
3519
+ */
3520
+ declare function linkedServerConfig(server: CliLinkedServer, token: string | undefined): CliServerConfig;
3521
+
3522
+ /**
3523
+ * The default {@link ICliSecretStore}: each secret encrypted with AES-GCM (own
3524
+ * random IV) by a 256-bit key that Web Crypto never exports, both kept in the
3525
+ * key-value store (IndexedDB). Reading the database gives ciphertext only; the
3526
+ * key cannot be read out, only used by this origin.
3527
+ */
3528
+ declare class CliWebCryptoSecretStore implements ICliSecretStore {
3529
+ private readonly kv;
3530
+ /** Null: no Web Crypto (an insecure page). */
3531
+ private readonly crypto;
3532
+ private keyPromise;
3533
+ constructor(kv: ICliKeyValueStore,
3534
+ /** Null: no Web Crypto (an insecure page). */
3535
+ crypto?: Crypto | null);
3536
+ isAvailable(): boolean;
3537
+ get(key: string): Promise<string | undefined>;
3538
+ set(key: string, value: string): Promise<void>;
3539
+ delete(key: string): Promise<void>;
3540
+ clear(): Promise<void>;
3541
+ /** The saved key, or a new one (created once, even for parallel calls). */
3542
+ private key;
3543
+ }
3544
+
3545
+ type CliFetch = (input: string, init?: RequestInit) => Promise<Response>;
3546
+ /** What `server add` shows about a server before linking it. */
3547
+ interface CliServerProbe {
3548
+ /** The server's version (capabilities), when it says. */
3549
+ version?: string;
3550
+ capabilities: CliServerCapabilities | null;
3551
+ /** Whether the commands need a sign-in (401/403 without a token). */
3552
+ needsSignIn: boolean;
3553
+ }
3554
+ /** A link request: the code to compare and the page where the user approves it. */
3555
+ interface CliLinkRequest {
3556
+ linkId: string;
3557
+ userCode: string;
3558
+ /** Absolute (resolved against the server URL). */
3559
+ verificationUrl: string;
3560
+ expiresIn: number;
3561
+ interval: number;
3562
+ }
3563
+ type CliLinkPoll = {
3564
+ status: 'pending';
3565
+ } | {
3566
+ status: 'denied';
3567
+ } | {
3568
+ status: 'expired';
3569
+ } | {
3570
+ status: 'approved';
3571
+ token: string;
3572
+ userName?: string;
3573
+ };
3574
+ /** Text from a server, safe to print: control characters (terminal escapes) dropped. */
3575
+ declare function plainText(value: unknown): string;
3576
+ /**
3577
+ * Whether `url` is a Qodalis CLI server: `GET /api/qcli/versions` answers with
3578
+ * its supported versions. Throws with the reason when not.
3579
+ */
3580
+ declare function probeServer(fetchFn: CliFetch, url: string): Promise<CliServerProbe>;
3581
+ /** Starts a link request; null when the server has no link endpoint (older servers, no users plugin). */
3582
+ declare function requestLink(fetchFn: CliFetch, url: string, client: string): Promise<CliLinkRequest | null>;
3583
+ /** One poll of a link request. */
3584
+ declare function pollLink(fetchFn: CliFetch, url: string, linkId: string): Promise<CliLinkPoll>;
3585
+ /**
3586
+ * Signs in with a password, creates an API token named `tokenName` with that
3587
+ * session, then ends the session: only the token is kept.
3588
+ */
3589
+ declare function createTokenWithPassword(fetchFn: CliFetch, url: string, username: string, password: string, tokenName: string): Promise<string>;
3590
+ /** "Qodalis CLI on <platform>" for link requests and token names (`[A-Za-z0-9._ -]` only). */
3591
+ declare function deviceName(appName?: string): string;
3592
+
3593
+ /** The secret store: the host's ({@link ICliSecretStore_TOKEN}) or the Web Crypto one. */
3594
+ declare function secretStoreOf(context: Pick<ICliExecutionContext, 'services'>): ICliSecretStore;
3595
+ /** The linked servers of this terminal. */
3596
+ declare function linkedServersOf(context: Pick<ICliExecutionContext, 'services'>): CliLinkedServers;
3597
+ /**
3598
+ * Connects the servers linked with `server add` (boot, after the host's
3599
+ * servers). Host servers win a name clash; servers the host options no longer
3600
+ * allow are skipped.
3601
+ */
3602
+ declare function restoreLinkedServers(context: Pick<ICliExecutionContext, 'services' | 'options'>, manager: CliServerManager, warn: (message: string) => void): Promise<void>;
3603
+
3422
3604
  /**
3423
3605
  * Result of executing a command through the test harness.
3424
3606
  */
@@ -4171,5 +4353,5 @@ interface PanelStatusDropdown {
4171
4353
  /** The open services or servers dropdown, or null when neither is open. */
4172
4354
  declare function openStatusDropdown(s: CliPanelSnapshot): PanelStatusDropdown | null;
4173
4355
 
4174
- export { API_VERSION, CLI_ENV_GLOBAL_PERMISSION, CLI_FRAMEWORK_SERVICE, CLOSE_GLYPH, CLOSE_ICON, CapturingTerminalWriter, CliAliasCommandProcessor, CliArgsParser, CliBackgroundServiceRegistry_TOKEN, CliBoot, CliBootLog, CliBootLog_TOKEN, CliCalCommandProcessor, CliCaptureCommandProcessor, CliClearCommandProcessor, CliClipboard, CliClipboardCommandProcessor, CliColorCommandProcessor, CliCommandExecutionContext, CliCommandExecutor, CliCommandHistory, CliCommandHistory_TOKEN, CliCommandProcessorRegistry, CliConfigureCommandProcessor, CliConvertCommandProcessor, CliDebugCommandProcessor, CliDefaultPingServerService, CliDiffCommandProcessor, CliDragDropService, CliEchoCommandProcessor, CliEngine, CliEnvCommandProcessor, CliEnvironment, CliEvalCommandProcessor, CliEventsCommandProcessor, CliExecutionContext, CliExecutionProcess, CliExportCommandProcessor, CliFalseCommandProcessor, 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, CliPanelController, CliPanelStatusTracker, CliPermissionRegistry, CliPingCommandProcessor, CliProcessRegistry, CliProcessRegistry_TOKEN, CliProcessorsRegistry_TOKEN, CliPsCommandProcessor, CliRandomCommandProcessor, CliScreenCommandProcessor, CliScriptSyntaxError, CliSeqCommandProcessor, CliServerCommandProcessor, CliServerConnection, CliServerManager, CliServerManager_TOKEN, CliServerMultiProxyProcessor, CliServerProxyProcessor, CliServiceContainer, CliServicesCommandProcessor, CliSleepCommandProcessor, CliSnippetCommandProcessor, CliSshCommandProcessor, CliStateStore, CliStateStoreManager, CliStateStoreManager_TOKEN, CliTerminalProgressBar, CliTerminalSpinner, CliTerminalTextAnimator, CliTerminalWriter, CliTestCommandProcessor, CliTestHarness, CliThemeCommandProcessor, CliTimeCommandProcessor, CliTimerManager, CliTimestampCommandProcessor, CliTrueCommandProcessor, CliUnAliasCommandProcessor, CliUnameCommandProcessor, CliUnsetCommandProcessor, CliUptimeCommandProcessor, CliVersionCommandProcessor, CliYesCommandProcessor, CommandParser, DEFAULT_CLI_NAME, DEFAULT_GLOBAL_STATUS, DEFAULT_PANEL_HEIGHT, DEFAULT_PANEL_WIDTH, DEFAULT_TAB_STATUS, ERROR_ICON, EXEC_POLL_MS, GLOBAL_POLL_MS, HIDE_ICON, HIDE_TAB_TERMINAL_ICON, ICliEnvironment_TOKEN, ICliPingServerService_TOKEN, ICliScriptRunner_TOKEN, JsFallbackAccelerator, LIBRARY_VERSION, MAXIMIZE_ICON, MIN_PANEL_SIZE, MIN_PANE_WIDTH_PERCENT, OverlayAddon, PANEL_LABELS, PANEL_POSITIONS, ProcessExitedError, RESTORE_ICON, SERVICES_ICON, SUCCESS_ICON, SVG_COMMON_ATTRS, SVG_VIEW_BOX, ScriptLoaderService, SyntaxHighlighterRegistry_TOKEN, TERMINAL_ICON, UPTIME_ICON, appendOutputToFile, appendStderrToFile, applyEnvironmentChange, builtinProcessors, capitalize, clampPanelSize, cliScriptRunner, collapseChevronIcon, computeDiff, computeGlobalStatus, computeTabStatus, contextGlobalParameter, contextMenuItems, contextMenuStyle, createCliEngine, createServerModule, defaultFontSize, describeShellClose, distributePaneWidths, dropdownAnchorStyle, executeOnServer, expandBraces, expandEnvironmentVars, expandGlobs, formatDiff, formatUptime, getAccelerator, getCliNameArt, getGreetingBasedOnTime, getTerminalOptions, glowLineClass, greetingModule, groupBy, handleRenameKey, helpGlobalParameter, hideTabChevronIcon, hotkeysInfo, initWasmAccelerator, initializeServices, initializeTerminal, interruptCommand, isHorizontalPosition, isWasmAccelerated, joinClasses, killProcess, matchGlob, mergeCliOptions, miscProcessors, nextRowsCommand, normalizePaneWidths, openLink, openStatusDropdown, paneClass, paneStyle, panelBranding, panelTabClass, panelTabDotClass, panelWrapperClass, panelWrapperStyle, panesContainerClass, panesContainerWidth, parseAssignments, parseScript, positionDropdownItemClass, positionIcon, positionOptions, reconcileArgs, renderServerResponse, renderSingleOutput, resizePaneWidths, resizedPanelSize, resolveCliBranding, resolveCliHostConfig, runContextMenuAction, runScript, splitWords, statusIndicators, substituteCommands, substituteVars, svgAttrs, systemProcessors, tabDotClass, themeInfos, themes, tryExecuteScript, versionGlobalParameter, waitForLayout, welcomeModule, writeOutputToFile, writeStderrToFile };
4175
- export type { AnchorRect, CdnSourceName, CliBootLogOptions, CliEngineOptions, CliEnvironmentChange, CliEnvironmentProfile, CliEnvironmentScope, CliEnvironmentSnapshot, CliEnvironmentSource, CliExecutionContextDeps, CliHiddenServerCommand, CliHostConfig, CliPanelCallbacks, CliPanelContextMenu, CliPanelControlledState, CliPanelControllerOptions, CliPanelExecutionState, CliPanelGlobalStatus, CliPanelPane, CliPanelServerDetail, CliPanelServerState, CliPanelServiceDetail, CliPanelSnapshot, CliPanelStatusTrackerListener, CliPanelTab, CliPanelTabStatus, CliPanelViewport, CliTestResult, CliWelcomeMessageConfig, CommandParserOutput, CommandPart, ConfigureState, CreateCliEngineConfig, DefaultServerProvider, DiffLine, DiffType, ICliEnvironment, ICliExecutionHost, ICliScriptRunOptions, ICliScriptRunner, ICliStateStoreManager, ICliWasmAccelerator, InitializeServicesOptions, InitializeServicesResult, MultiProxyEntry, PanelContextMenuAction, PanelContextMenuItem, PanelDropdownRow, PanelPositionOption, PanelStatusDropdown, PanelStatusIndicator, ParsedArg, ParsedToken, ResolvedCliBranding, SvgIcon, SvgShape, TerminalSetupResult, ThemeState };
4356
+ export { API_VERSION, CLI_ENV_GLOBAL_PERMISSION, CLI_FRAMEWORK_SERVICE, CLOSE_GLYPH, CLOSE_ICON, CapturingTerminalWriter, CliAliasCommandProcessor, CliArgsParser, CliBackgroundServiceRegistry_TOKEN, CliBoot, CliBootLog, CliBootLog_TOKEN, CliCalCommandProcessor, CliCaptureCommandProcessor, CliClearCommandProcessor, CliClipboard, CliClipboardCommandProcessor, CliColorCommandProcessor, CliCommandExecutionContext, CliCommandExecutor, CliCommandHistory, CliCommandHistory_TOKEN, CliCommandProcessorRegistry, CliConfigureCommandProcessor, CliConvertCommandProcessor, CliDebugCommandProcessor, CliDefaultPingServerService, CliDiffCommandProcessor, CliDragDropService, CliEchoCommandProcessor, CliEngine, CliEnvCommandProcessor, CliEnvironment, CliEvalCommandProcessor, CliEventsCommandProcessor, CliExecutionContext, CliExecutionProcess, CliExportCommandProcessor, CliFalseCommandProcessor, CliFeedbackCommandProcessor, CliFontSizeCommandProcessor, CliFullScreenManager, CliHelpCommandProcessor, CliHistoryCommandProcessor, CliHotKeysCommandProcessor, CliHtopCommandProcessor, CliHttpClient, CliInputReader, CliJsonCommandProcessor, CliKeyValueStore, CliKeyValueStore_TOKEN, CliKillCommandProcessor, CliLinkedServers, CliLogger, CliLoremCommandProcessor, CliModuleRegistry_TOKEN, CliNanoCommandProcessor, CliNotifier, CliOpenCommandProcessor, CliPackageManagerService, CliPackageManagerService_TOKEN, CliPackagesCommandProcessor, CliPanelController, CliPanelStatusTracker, CliPermissionRegistry, CliPingCommandProcessor, CliProcessRegistry, CliProcessRegistry_TOKEN, CliProcessorsRegistry_TOKEN, CliPsCommandProcessor, CliRandomCommandProcessor, CliScreenCommandProcessor, CliScriptSyntaxError, CliSeqCommandProcessor, CliServerCommandProcessor, CliServerConnection, CliServerManager, CliServerManager_TOKEN, CliServerMultiProxyProcessor, CliServerProxyProcessor, CliServiceContainer, CliServicesCommandProcessor, CliSleepCommandProcessor, CliSnippetCommandProcessor, CliSshCommandProcessor, CliStateStore, CliStateStoreManager, CliStateStoreManager_TOKEN, CliTerminalProgressBar, CliTerminalSpinner, CliTerminalTextAnimator, CliTerminalWriter, CliTestCommandProcessor, CliTestHarness, CliThemeCommandProcessor, CliTimeCommandProcessor, CliTimerManager, CliTimestampCommandProcessor, CliTrueCommandProcessor, CliUnAliasCommandProcessor, CliUnameCommandProcessor, CliUnsetCommandProcessor, CliUptimeCommandProcessor, CliVersionCommandProcessor, CliWebCryptoSecretStore, CliYesCommandProcessor, CommandParser, DEFAULT_CLI_NAME, DEFAULT_GLOBAL_STATUS, DEFAULT_PANEL_HEIGHT, DEFAULT_PANEL_WIDTH, DEFAULT_TAB_STATUS, ERROR_ICON, EXEC_POLL_MS, GLOBAL_POLL_MS, HIDE_ICON, HIDE_TAB_TERMINAL_ICON, ICliEnvironment_TOKEN, ICliPingServerService_TOKEN, ICliScriptRunner_TOKEN, JsFallbackAccelerator, LIBRARY_VERSION, MAXIMIZE_ICON, MIN_PANEL_SIZE, MIN_PANE_WIDTH_PERCENT, OverlayAddon, PANEL_LABELS, PANEL_POSITIONS, ProcessExitedError, RESTORE_ICON, SERVER_NAME_PATTERN, SERVICES_ICON, SUCCESS_ICON, SVG_COMMON_ATTRS, SVG_VIEW_BOX, ScriptLoaderService, SyntaxHighlighterRegistry_TOKEN, TERMINAL_ICON, UPTIME_ICON, appendOutputToFile, appendStderrToFile, applyEnvironmentChange, builtinProcessors, capitalize, checkServerUrl, clampPanelSize, cliScriptRunner, collapseChevronIcon, computeDiff, computeGlobalStatus, computeTabStatus, contextGlobalParameter, contextMenuItems, contextMenuStyle, createCliEngine, createServerModule, createTokenWithPassword, defaultFontSize, describeShellClose, deviceName, distributePaneWidths, dropdownAnchorStyle, executeOnServer, expandBraces, expandEnvironmentVars, expandGlobs, formatDiff, formatUptime, getAccelerator, getCliNameArt, getGreetingBasedOnTime, getTerminalOptions, glowLineClass, greetingModule, groupBy, handleRenameKey, helpGlobalParameter, hideTabChevronIcon, hotkeysInfo, initWasmAccelerator, initializeServices, initializeTerminal, interruptCommand, isHorizontalPosition, isPrivateHost, isWasmAccelerated, joinClasses, killProcess, linkedServerConfig, linkedServersOf, maskToken, matchGlob, mergeCliOptions, miscProcessors, nextRowsCommand, normalizePaneWidths, normalizeServerUrl, openLink, openStatusDropdown, paneClass, paneStyle, panelBranding, panelTabClass, panelTabDotClass, panelWrapperClass, panelWrapperStyle, panesContainerClass, panesContainerWidth, parseAssignments, parseScript, plainText, pollLink, positionDropdownItemClass, positionIcon, positionOptions, probeServer, reconcileArgs, redactSecrets, renderServerResponse, renderSingleOutput, requestLink, resizePaneWidths, resizedPanelSize, resolveCliBranding, resolveCliHostConfig, restoreLinkedServers, runContextMenuAction, runScript, secretStoreOf, splitWords, statusIndicators, substituteCommands, substituteVars, suggestServerName, svgAttrs, systemProcessors, tabDotClass, themeInfos, themes, tryExecuteScript, userServersAllow, userServersEnabled, versionGlobalParameter, waitForLayout, welcomeModule, writeOutputToFile, writeStderrToFile };
4357
+ export type { AnchorRect, CdnSourceName, CliBootLogOptions, CliEngineOptions, CliEnvironmentChange, CliEnvironmentProfile, CliEnvironmentScope, CliEnvironmentSnapshot, CliEnvironmentSource, CliExecutionContextDeps, CliFetch, CliHiddenServerCommand, CliHostConfig, CliLinkPoll, CliLinkRequest, CliLinkedServer, CliPanelCallbacks, CliPanelContextMenu, CliPanelControlledState, CliPanelControllerOptions, CliPanelExecutionState, CliPanelGlobalStatus, CliPanelPane, CliPanelServerDetail, CliPanelServerState, CliPanelServiceDetail, CliPanelSnapshot, CliPanelStatusTrackerListener, CliPanelTab, CliPanelTabStatus, CliPanelViewport, CliServerProbe, CliServerUrlCheck, CliTestResult, CliWelcomeMessageConfig, CommandParserOutput, CommandPart, ConfigureState, CreateCliEngineConfig, DefaultServerProvider, DiffLine, DiffType, ICliEnvironment, ICliExecutionHost, ICliScriptRunOptions, ICliScriptRunner, ICliStateStoreManager, ICliWasmAccelerator, InitializeServicesOptions, InitializeServicesResult, MultiProxyEntry, PanelContextMenuAction, PanelContextMenuItem, PanelDropdownRow, PanelPositionOption, PanelStatusDropdown, PanelStatusIndicator, ParsedArg, ParsedToken, ResolvedCliBranding, SvgIcon, SvgShape, TerminalSetupResult, ThemeState };