@qodalis/cli 2.0.0-beta.12 → 2.0.0-beta.13
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/assets/cli-panel.css +78 -1
- package/package.json +2 -2
- package/public-api.d.mts +121 -16
- package/public-api.d.ts +121 -16
- package/public-api.js +551 -329
- package/public-api.js.map +1 -1
- package/public-api.mjs +549 -331
- package/public-api.mjs.map +1 -1
- package/wasm/qodalis_cli_wasm_bg.wasm +0 -0
package/public-api.js
CHANGED
|
@@ -409,9 +409,11 @@ var ICliPingServerService_TOKEN = "cli-ping-server-service";
|
|
|
409
409
|
var CliModuleRegistry_TOKEN = "cli-module-registry";
|
|
410
410
|
var CliBackgroundServiceRegistry_TOKEN = "cli-background-service-registry";
|
|
411
411
|
var CliPackageManagerService_TOKEN = "cli-package-manager-service";
|
|
412
|
+
var CliKeyValueStore_TOKEN = "cli-key-value-store";
|
|
413
|
+
var SyntaxHighlighterRegistry_TOKEN = "syntax-highlighter-registry";
|
|
412
414
|
|
|
413
415
|
// src/lib/version.ts
|
|
414
|
-
var LIBRARY_VERSION = "2.0.0-beta.
|
|
416
|
+
var LIBRARY_VERSION = "2.0.0-beta.13";
|
|
415
417
|
var API_VERSION = 2;
|
|
416
418
|
var CliAliasCommandProcessor = class {
|
|
417
419
|
constructor() {
|
|
@@ -474,7 +476,7 @@ var CliAliasCommandProcessor = class {
|
|
|
474
476
|
);
|
|
475
477
|
}
|
|
476
478
|
async processCommand(command2, context2) {
|
|
477
|
-
const registry = context2.services.
|
|
479
|
+
const registry = context2.services.getRequired(
|
|
478
480
|
CliProcessorsRegistry_TOKEN
|
|
479
481
|
);
|
|
480
482
|
const { writer } = context2;
|
|
@@ -2814,7 +2816,7 @@ var CliConfigureCommandProcessor = class _CliConfigureCommandProcessor {
|
|
|
2814
2816
|
];
|
|
2815
2817
|
}
|
|
2816
2818
|
async processCommand(command2, context2) {
|
|
2817
|
-
const registry = context2.services.
|
|
2819
|
+
const registry = context2.services.getRequired(
|
|
2818
2820
|
CliProcessorsRegistry_TOKEN
|
|
2819
2821
|
);
|
|
2820
2822
|
const pluginCategories = cliCore.resolveConfigurationCategories(registry);
|
|
@@ -2911,10 +2913,10 @@ var CliConfigureCommandProcessor = class _CliConfigureCommandProcessor {
|
|
|
2911
2913
|
if (stateKey === "system") {
|
|
2912
2914
|
const langOption = options.find((o) => o.key === "language");
|
|
2913
2915
|
if (langOption) {
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2916
|
+
const translator = context2.services.get(
|
|
2917
|
+
cliCore.ICliTranslationService_TOKEN
|
|
2918
|
+
);
|
|
2919
|
+
if (translator) {
|
|
2918
2920
|
const locales = translator.getAvailableLocales();
|
|
2919
2921
|
if (locales.length > 0) {
|
|
2920
2922
|
langOption.options = locales.map((l) => ({
|
|
@@ -2922,7 +2924,6 @@ var CliConfigureCommandProcessor = class _CliConfigureCommandProcessor {
|
|
|
2922
2924
|
value: l
|
|
2923
2925
|
}));
|
|
2924
2926
|
}
|
|
2925
|
-
} catch {
|
|
2926
2927
|
}
|
|
2927
2928
|
}
|
|
2928
2929
|
}
|
|
@@ -3067,13 +3068,10 @@ var CliConfigureCommandProcessor = class _CliConfigureCommandProcessor {
|
|
|
3067
3068
|
}
|
|
3068
3069
|
}
|
|
3069
3070
|
if (settings["language"]) {
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
translator.setLocale(settings["language"]);
|
|
3075
|
-
} catch {
|
|
3076
|
-
}
|
|
3071
|
+
const translator = context2.services.get(
|
|
3072
|
+
cliCore.ICliTranslationService_TOKEN
|
|
3073
|
+
);
|
|
3074
|
+
translator?.setLocale(settings["language"]);
|
|
3077
3075
|
}
|
|
3078
3076
|
if (context2.terminal?.options) {
|
|
3079
3077
|
if (settings["cursorBlink"] !== void 0) {
|
|
@@ -3103,7 +3101,7 @@ var CliConfigureCommandProcessor = class _CliConfigureCommandProcessor {
|
|
|
3103
3101
|
aliases: ["ls"],
|
|
3104
3102
|
description: "List all configuration options and their current values",
|
|
3105
3103
|
processCommand: async (_, context2) => {
|
|
3106
|
-
const registry = context2.services.
|
|
3104
|
+
const registry = context2.services.getRequired(
|
|
3107
3105
|
CliProcessorsRegistry_TOKEN
|
|
3108
3106
|
);
|
|
3109
3107
|
const allOptions = this.getAllOptions(registry);
|
|
@@ -3165,7 +3163,7 @@ var CliConfigureCommandProcessor = class _CliConfigureCommandProcessor {
|
|
|
3165
3163
|
}
|
|
3166
3164
|
const category = path.substring(0, dotIndex);
|
|
3167
3165
|
const key = path.substring(dotIndex + 1);
|
|
3168
|
-
const registry = context2.services.
|
|
3166
|
+
const registry = context2.services.getRequired(
|
|
3169
3167
|
CliProcessorsRegistry_TOKEN
|
|
3170
3168
|
);
|
|
3171
3169
|
const allOptions = this.getAllOptions(registry);
|
|
@@ -3217,7 +3215,7 @@ var CliConfigureCommandProcessor = class _CliConfigureCommandProcessor {
|
|
|
3217
3215
|
}
|
|
3218
3216
|
const category = path.substring(0, dotIndex);
|
|
3219
3217
|
const key = path.substring(dotIndex + 1);
|
|
3220
|
-
const registry = context2.services.
|
|
3218
|
+
const registry = context2.services.getRequired(
|
|
3221
3219
|
CliProcessorsRegistry_TOKEN
|
|
3222
3220
|
);
|
|
3223
3221
|
const allOptions = this.getAllOptions(registry);
|
|
@@ -3277,7 +3275,7 @@ var CliConfigureCommandProcessor = class _CliConfigureCommandProcessor {
|
|
|
3277
3275
|
t.t("cli.configure.system_reset", "System configuration reset to defaults")
|
|
3278
3276
|
);
|
|
3279
3277
|
} else {
|
|
3280
|
-
const registry = context2.services.
|
|
3278
|
+
const registry = context2.services.getRequired(
|
|
3281
3279
|
CliProcessorsRegistry_TOKEN
|
|
3282
3280
|
);
|
|
3283
3281
|
const categories2 = cliCore.resolveConfigurationCategories(registry);
|
|
@@ -3673,7 +3671,7 @@ var CliHelpCommandProcessor = class {
|
|
|
3673
3671
|
async processCommand(command2, context2) {
|
|
3674
3672
|
const { writer } = context2;
|
|
3675
3673
|
const t = context2.translator;
|
|
3676
|
-
const registry = context2.services.
|
|
3674
|
+
const registry = context2.services.getRequired(
|
|
3677
3675
|
CliProcessorsRegistry_TOKEN
|
|
3678
3676
|
);
|
|
3679
3677
|
const [_, ...commandsToHelp] = command2.command.split(" ");
|
|
@@ -3773,24 +3771,23 @@ var CliHelpCommandProcessor = class {
|
|
|
3773
3771
|
writeProcessorDescription(processor, context2) {
|
|
3774
3772
|
const { writer } = context2;
|
|
3775
3773
|
const t = context2.translator;
|
|
3776
|
-
const icon = processor.metadata?.icon || "";
|
|
3777
|
-
const name = `${BOLD}${writer.wrapInColor(processor.command, cliCore.CliForegroundColor.Cyan)}${RESET}`;
|
|
3778
3774
|
const version = `${DIM}v${processor.version || "1.0.0"}${RESET}`;
|
|
3779
|
-
|
|
3780
|
-
writer.writeln(` ${icon}${icon ? " " : ""}${name} ${version}`);
|
|
3775
|
+
const headerLines = [];
|
|
3781
3776
|
if (processor.description) {
|
|
3782
|
-
|
|
3783
|
-
processor.description,
|
|
3784
|
-
processor.command,
|
|
3785
|
-
context2
|
|
3777
|
+
headerLines.push(
|
|
3778
|
+
this.translateDescription(processor.description, processor.command, context2)
|
|
3786
3779
|
);
|
|
3787
|
-
writer.writeln(` ${desc}`);
|
|
3788
3780
|
}
|
|
3789
3781
|
if (processor.aliases?.length) {
|
|
3790
|
-
|
|
3791
|
-
|
|
3782
|
+
headerLines.push(
|
|
3783
|
+
`${DIM}${t.t("cli.help.aliases", "Aliases:")}${RESET} ${processor.aliases.map((a) => writer.wrapInColor(a, cliCore.CliForegroundColor.Magenta)).join(", ")}`
|
|
3792
3784
|
);
|
|
3793
3785
|
}
|
|
3786
|
+
writer.writeln();
|
|
3787
|
+
writer.writeBox(headerLines, {
|
|
3788
|
+
title: `${writer.wrapInColor(processor.command, cliCore.CliForegroundColor.Cyan)} ${version}`,
|
|
3789
|
+
borderColor: cliCore.CliForegroundColor.White
|
|
3790
|
+
});
|
|
3794
3791
|
if (processor.originalProcessor) {
|
|
3795
3792
|
writer.writeln();
|
|
3796
3793
|
writer.writeln(
|
|
@@ -3956,20 +3953,13 @@ var CliVersionCommandProcessor = class {
|
|
|
3956
3953
|
writer.writeln(
|
|
3957
3954
|
writer.wrapInColor(getCliNameArt(context2.terminal.cols), cliCore.CliForegroundColor.Cyan)
|
|
3958
3955
|
);
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
}
|
|
3967
|
-
writer.writeln(
|
|
3968
|
-
` ${DIM2}Framework${RESET2} ${writer.wrapInColor(framework, cliCore.CliForegroundColor.Cyan)}`
|
|
3969
|
-
);
|
|
3970
|
-
writer.writeln(
|
|
3971
|
-
` ${DIM2}Docs${RESET2} ${writer.wrapInColor("https://cli.qodalis.com/docs/", cliCore.CliForegroundColor.Blue)}`
|
|
3972
|
-
);
|
|
3956
|
+
const framework = context2.services.get("cli-framework") ?? "vanilla";
|
|
3957
|
+
writer.writeBox([
|
|
3958
|
+
`${DIM2}CLI${RESET2} ${writer.wrapInColor(`v${LIBRARY_VERSION}`, cliCore.CliForegroundColor.Green)}`,
|
|
3959
|
+
`${DIM2}Core${RESET2} ${writer.wrapInColor(`v${cliCore.LIBRARY_VERSION}`, cliCore.CliForegroundColor.Green)}`,
|
|
3960
|
+
`${DIM2}Framework${RESET2} ${writer.wrapInColor(framework, cliCore.CliForegroundColor.Cyan)}`,
|
|
3961
|
+
`${DIM2}Docs${RESET2} ${writer.wrapInColor("https://cli.qodalis.com/docs/", cliCore.CliForegroundColor.Blue)}`
|
|
3962
|
+
], { borderColor: cliCore.CliForegroundColor.White });
|
|
3973
3963
|
writer.writeln();
|
|
3974
3964
|
}
|
|
3975
3965
|
writeDescription(context2) {
|
|
@@ -4027,11 +4017,7 @@ function collectSystemInfo(context2) {
|
|
|
4027
4017
|
const lines = [];
|
|
4028
4018
|
lines.push(`- **CLI Version:** ${LIBRARY_VERSION}`);
|
|
4029
4019
|
lines.push(`- **Core Version:** ${cliCore.LIBRARY_VERSION}`);
|
|
4030
|
-
|
|
4031
|
-
try {
|
|
4032
|
-
framework = context2.services.get("cli-framework");
|
|
4033
|
-
} catch {
|
|
4034
|
-
}
|
|
4020
|
+
const framework = context2.services.get("cli-framework") ?? "vanilla";
|
|
4035
4021
|
lines.push(`- **Framework:** ${framework}`);
|
|
4036
4022
|
lines.push(`- **Terminal:** ${context2.terminal.cols}x${context2.terminal.rows}`);
|
|
4037
4023
|
if (typeof navigator !== "undefined") {
|
|
@@ -4103,12 +4089,8 @@ async function runInteractiveFlow(type, initialTitle, context2) {
|
|
|
4103
4089
|
`${writer.wrapInColor("\u2500\u2500 System Info (auto-attached) \u2500\u2500", cliCore.CliForegroundColor.Cyan)}`
|
|
4104
4090
|
);
|
|
4105
4091
|
writer.writeln(` CLI: ${LIBRARY_VERSION} Core: ${cliCore.LIBRARY_VERSION}`);
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
framework = context2.services.get("cli-framework");
|
|
4109
|
-
} catch {
|
|
4110
|
-
}
|
|
4111
|
-
writer.writeln(` Framework: ${framework} Terminal: ${context2.terminal.cols}x${context2.terminal.rows}`);
|
|
4092
|
+
const previewFramework = context2.services.get("cli-framework") ?? "vanilla";
|
|
4093
|
+
writer.writeln(` Framework: ${previewFramework} Terminal: ${context2.terminal.cols}x${context2.terminal.rows}`);
|
|
4112
4094
|
if (typeof navigator !== "undefined") {
|
|
4113
4095
|
writer.writeln(` Platform: ${navigator.platform} Language: ${navigator.language}`);
|
|
4114
4096
|
}
|
|
@@ -4250,7 +4232,7 @@ var CliHistoryCommandProcessor = class {
|
|
|
4250
4232
|
command: "clear",
|
|
4251
4233
|
description: "Clears the command history",
|
|
4252
4234
|
processCommand: async (_, context2) => {
|
|
4253
|
-
const commandHistory = context2.services.
|
|
4235
|
+
const commandHistory = context2.services.getRequired(
|
|
4254
4236
|
CliCommandHistory_TOKEN
|
|
4255
4237
|
);
|
|
4256
4238
|
await commandHistory.clearHistory();
|
|
@@ -4273,7 +4255,7 @@ var CliHistoryCommandProcessor = class {
|
|
|
4273
4255
|
description: "Search command history for a pattern",
|
|
4274
4256
|
parameters: searchParameters,
|
|
4275
4257
|
processCommand: async (cmd, context2) => {
|
|
4276
|
-
const commandHistory = context2.services.
|
|
4258
|
+
const commandHistory = context2.services.getRequired(
|
|
4277
4259
|
CliCommandHistory_TOKEN
|
|
4278
4260
|
);
|
|
4279
4261
|
const query = (cmd.value ?? "").trim();
|
|
@@ -4327,7 +4309,7 @@ var CliHistoryCommandProcessor = class {
|
|
|
4327
4309
|
}
|
|
4328
4310
|
async processCommand(_, context2) {
|
|
4329
4311
|
const { writer } = context2;
|
|
4330
|
-
const commandHistory = context2.services.
|
|
4312
|
+
const commandHistory = context2.services.getRequired(
|
|
4331
4313
|
CliCommandHistory_TOKEN
|
|
4332
4314
|
);
|
|
4333
4315
|
const history = commandHistory.getHistory();
|
|
@@ -4774,7 +4756,7 @@ var CliPackagesCommandProcessor = class {
|
|
|
4774
4756
|
const { progressBar, writer } = context2;
|
|
4775
4757
|
const { signal, cleanup } = scope.createAbortSignal(context2);
|
|
4776
4758
|
progressBar.show();
|
|
4777
|
-
context2.
|
|
4759
|
+
context2.notifier.info("Browsing packages");
|
|
4778
4760
|
const prefix = packagesManager.QODALIS_COMMAND_PREFIX;
|
|
4779
4761
|
const knownShortNames = [
|
|
4780
4762
|
"browser-storage",
|
|
@@ -4967,7 +4949,7 @@ var CliPackagesCommandProcessor = class {
|
|
|
4967
4949
|
const packages = command2.value.split(" ");
|
|
4968
4950
|
for (const pkg of packages) {
|
|
4969
4951
|
if (signal.aborted) break;
|
|
4970
|
-
context2.
|
|
4952
|
+
context2.notifier.info(`Installing ${pkg}`);
|
|
4971
4953
|
await scope.addPackage(pkg, context2, signal);
|
|
4972
4954
|
}
|
|
4973
4955
|
cleanup();
|
|
@@ -5008,7 +4990,7 @@ var CliPackagesCommandProcessor = class {
|
|
|
5008
4990
|
const packages = command2.value.split(" ");
|
|
5009
4991
|
for (const pkg of packages) {
|
|
5010
4992
|
if (signal.aborted) break;
|
|
5011
|
-
context2.
|
|
4993
|
+
context2.notifier.info(`Removing ${pkg}`);
|
|
5012
4994
|
await scope.removePackage(pkg, context2);
|
|
5013
4995
|
}
|
|
5014
4996
|
cleanup();
|
|
@@ -5044,7 +5026,7 @@ var CliPackagesCommandProcessor = class {
|
|
|
5044
5026
|
const fullName = name.startsWith(prefix) ? name : `${prefix}${name}`;
|
|
5045
5027
|
progressBar.show();
|
|
5046
5028
|
progressBar.setText(`Fetching versions for ${name}`);
|
|
5047
|
-
context2.
|
|
5029
|
+
context2.notifier.info(`Fetching versions for ${name}`);
|
|
5048
5030
|
try {
|
|
5049
5031
|
const response = await scriptsLoader.getScript(
|
|
5050
5032
|
`https://registry.npmjs.org/${encodeURIComponent(fullName)}`,
|
|
@@ -5508,11 +5490,11 @@ var CliPackagesCommandProcessor = class {
|
|
|
5508
5490
|
);
|
|
5509
5491
|
}
|
|
5510
5492
|
async initialize(context2) {
|
|
5511
|
-
this.registry = context2.services.
|
|
5493
|
+
this.registry = context2.services.getRequired(
|
|
5512
5494
|
CliProcessorsRegistry_TOKEN
|
|
5513
5495
|
);
|
|
5514
|
-
const store = context2.services.
|
|
5515
|
-
|
|
5496
|
+
const store = context2.services.getRequired(
|
|
5497
|
+
CliKeyValueStore_TOKEN
|
|
5516
5498
|
);
|
|
5517
5499
|
this.packagesManager.setStore(store);
|
|
5518
5500
|
context2.services.set([{
|
|
@@ -5778,10 +5760,11 @@ var CliPackagesCommandProcessor = class {
|
|
|
5778
5760
|
}
|
|
5779
5761
|
};
|
|
5780
5762
|
var CliServerConnection = class _CliServerConnection {
|
|
5781
|
-
constructor(_config, _backgroundServices, _logger) {
|
|
5763
|
+
constructor(_config, _backgroundServices, _logger, _authService) {
|
|
5782
5764
|
this._config = _config;
|
|
5783
5765
|
this._backgroundServices = _backgroundServices;
|
|
5784
5766
|
this._logger = _logger;
|
|
5767
|
+
this._authService = _authService;
|
|
5785
5768
|
this._connected = false;
|
|
5786
5769
|
this._commands = [];
|
|
5787
5770
|
this._capabilities = null;
|
|
@@ -5820,10 +5803,21 @@ var CliServerConnection = class _CliServerConnection {
|
|
|
5820
5803
|
get apiVersion() {
|
|
5821
5804
|
return this._apiVersion;
|
|
5822
5805
|
}
|
|
5806
|
+
/**
|
|
5807
|
+
* Resolve auth headers for this server connection.
|
|
5808
|
+
* Uses the auth service (which merges config headers with registered
|
|
5809
|
+
* ICliServerAuthTokenProviders), or falls back to config headers directly.
|
|
5810
|
+
*/
|
|
5811
|
+
resolveAuthHeaders() {
|
|
5812
|
+
if (this._authService) {
|
|
5813
|
+
return this._authService.getHeaders(this._config.name, this._config.headers);
|
|
5814
|
+
}
|
|
5815
|
+
return cliCore.resolveHeaders(this._config.headers);
|
|
5816
|
+
}
|
|
5823
5817
|
async connect() {
|
|
5824
5818
|
try {
|
|
5825
5819
|
const baseUrl = this.normalizeUrl(this._config.url);
|
|
5826
|
-
const negotiated = await cliCore.ServerVersionNegotiator.discover(baseUrl);
|
|
5820
|
+
const negotiated = await cliCore.ServerVersionNegotiator.discover(baseUrl, () => this.resolveAuthHeaders());
|
|
5827
5821
|
if (negotiated) {
|
|
5828
5822
|
this._apiVersion = negotiated.apiVersion;
|
|
5829
5823
|
this._basePath = negotiated.basePath;
|
|
@@ -6018,7 +6012,10 @@ var CliServerConnection = class _CliServerConnection {
|
|
|
6018
6012
|
type: "daemon",
|
|
6019
6013
|
onStart: async (ctx) => {
|
|
6020
6014
|
const baseUrl = this.normalizeUrl(this._config.url);
|
|
6021
|
-
const wsUrl =
|
|
6015
|
+
const wsUrl = cliCore.buildAuthenticatedWebSocketUrl(
|
|
6016
|
+
this.toWebSocketUrl(baseUrl) + "/ws/v1/qcli/events",
|
|
6017
|
+
() => this.resolveAuthHeaders()
|
|
6018
|
+
);
|
|
6022
6019
|
ctx.log(`Connecting to ${wsUrl}`);
|
|
6023
6020
|
this._eventSocket = new WebSocket(wsUrl);
|
|
6024
6021
|
this._eventSocket.onopen = () => {
|
|
@@ -6068,7 +6065,10 @@ var CliServerConnection = class _CliServerConnection {
|
|
|
6068
6065
|
connectEventSocketDirect() {
|
|
6069
6066
|
try {
|
|
6070
6067
|
const baseUrl = this.normalizeUrl(this._config.url);
|
|
6071
|
-
const wsUrl =
|
|
6068
|
+
const wsUrl = cliCore.buildAuthenticatedWebSocketUrl(
|
|
6069
|
+
this.toWebSocketUrl(baseUrl) + "/ws/v1/qcli/events",
|
|
6070
|
+
() => this.resolveAuthHeaders()
|
|
6071
|
+
);
|
|
6072
6072
|
this._eventSocket = new WebSocket(wsUrl);
|
|
6073
6073
|
this._eventSocket.onopen = () => {
|
|
6074
6074
|
this._wsReconnectAttempts = 0;
|
|
@@ -6171,7 +6171,7 @@ var CliServerConnection = class _CliServerConnection {
|
|
|
6171
6171
|
const controller = new AbortController();
|
|
6172
6172
|
const timer = setTimeout(() => controller.abort(), timeout);
|
|
6173
6173
|
const headers = {
|
|
6174
|
-
...this.
|
|
6174
|
+
...this.resolveAuthHeaders(),
|
|
6175
6175
|
...init?.headers ?? {}
|
|
6176
6176
|
};
|
|
6177
6177
|
return fetch(url, {
|
|
@@ -6252,7 +6252,7 @@ async function executeOnServer(connection, serverName, descriptor, command2, con
|
|
|
6252
6252
|
chainCommands: commandPath && commandPath.length > 1 ? commandPath.slice(1) : []
|
|
6253
6253
|
};
|
|
6254
6254
|
const cmdLabel = commandPath && commandPath.length > 0 ? commandPath.join(" ") : descriptor.command;
|
|
6255
|
-
context2.
|
|
6255
|
+
context2.notifier.info(`executing command: ${cmdLabel} on server ${serverName}`);
|
|
6256
6256
|
try {
|
|
6257
6257
|
if (connection.capabilities?.streaming) {
|
|
6258
6258
|
const result = await connection.executeStream(
|
|
@@ -6440,8 +6440,9 @@ var CliServerMultiProxyProcessor = class _CliServerMultiProxyProcessor {
|
|
|
6440
6440
|
// src/lib/server/cli-server-manager.ts
|
|
6441
6441
|
var CliServerManager_TOKEN = "cli-server-manager";
|
|
6442
6442
|
var CliServerManager = class {
|
|
6443
|
-
constructor(registry) {
|
|
6443
|
+
constructor(registry, authService) {
|
|
6444
6444
|
this.registry = registry;
|
|
6445
|
+
this.authService = authService;
|
|
6445
6446
|
this.connections = /* @__PURE__ */ new Map();
|
|
6446
6447
|
this._defaultServer = null;
|
|
6447
6448
|
}
|
|
@@ -6462,7 +6463,7 @@ var CliServerManager = class {
|
|
|
6462
6463
|
this._backgroundServices = backgroundServices;
|
|
6463
6464
|
for (const config of servers) {
|
|
6464
6465
|
if (config.enabled === false) continue;
|
|
6465
|
-
const connection = new CliServerConnection(config, backgroundServices, cliLogger);
|
|
6466
|
+
const connection = new CliServerConnection(config, backgroundServices, cliLogger, this.authService);
|
|
6466
6467
|
this.connections.set(config.name, connection);
|
|
6467
6468
|
connection.onDisconnect = () => {
|
|
6468
6469
|
this.handleDisconnect(config.name);
|
|
@@ -7013,7 +7014,7 @@ var CliDebugCommandProcessor = class {
|
|
|
7013
7014
|
metadata: { icon: cliCore.CliIcon.Extension, module: "system" },
|
|
7014
7015
|
processCommand: async (_, context2) => {
|
|
7015
7016
|
const { writer } = context2;
|
|
7016
|
-
const registry = context2.services.
|
|
7017
|
+
const registry = context2.services.getRequired(
|
|
7017
7018
|
CliProcessorsRegistry_TOKEN
|
|
7018
7019
|
);
|
|
7019
7020
|
writer.writeln(
|
|
@@ -7064,12 +7065,10 @@ var CliDebugCommandProcessor = class {
|
|
|
7064
7065
|
metadata: { icon: cliCore.CliIcon.Module, module: "system" },
|
|
7065
7066
|
processCommand: async (_, context2) => {
|
|
7066
7067
|
const { writer } = context2;
|
|
7067
|
-
|
|
7068
|
-
|
|
7069
|
-
|
|
7070
|
-
|
|
7071
|
-
);
|
|
7072
|
-
} catch {
|
|
7068
|
+
const moduleRegistry = context2.services.get(
|
|
7069
|
+
CliModuleRegistry_TOKEN
|
|
7070
|
+
);
|
|
7071
|
+
if (!moduleRegistry) {
|
|
7073
7072
|
writer.writeError("Module registry not available.");
|
|
7074
7073
|
return;
|
|
7075
7074
|
}
|
|
@@ -7110,7 +7109,7 @@ var CliDebugCommandProcessor = class {
|
|
|
7110
7109
|
metadata: { icon: cliCore.CliIcon.Database, module: "system" },
|
|
7111
7110
|
processCommand: async (_, context2) => {
|
|
7112
7111
|
const { writer } = context2;
|
|
7113
|
-
const storeManager = context2.services.
|
|
7112
|
+
const storeManager = context2.services.getRequired(
|
|
7114
7113
|
CliStateStoreManager_TOKEN
|
|
7115
7114
|
);
|
|
7116
7115
|
const entries = storeManager.getStoreEntries();
|
|
@@ -7189,11 +7188,7 @@ var CliDebugCommandProcessor = class {
|
|
|
7189
7188
|
writer.writeln(
|
|
7190
7189
|
` ${writer.wrapInColor("CLI Version:", cliCore.CliForegroundColor.Cyan)} ${LIBRARY_VERSION}`
|
|
7191
7190
|
);
|
|
7192
|
-
|
|
7193
|
-
try {
|
|
7194
|
-
framework = context2.services.get("cli-framework");
|
|
7195
|
-
} catch {
|
|
7196
|
-
}
|
|
7191
|
+
const framework = context2.services.get("cli-framework") ?? "vanilla";
|
|
7197
7192
|
writer.writeln(
|
|
7198
7193
|
` ${writer.wrapInColor("Framework:", cliCore.CliForegroundColor.Cyan)} ${framework}`
|
|
7199
7194
|
);
|
|
@@ -7234,7 +7229,7 @@ var CliDebugCommandProcessor = class {
|
|
|
7234
7229
|
metadata: { icon: cliCore.CliIcon.Logs, module: "system" },
|
|
7235
7230
|
processCommand: async (_, context2) => {
|
|
7236
7231
|
const { writer } = context2;
|
|
7237
|
-
const history = context2.services.
|
|
7232
|
+
const history = context2.services.getRequired(
|
|
7238
7233
|
CliCommandHistory_TOKEN
|
|
7239
7234
|
);
|
|
7240
7235
|
const commands = history.getHistory();
|
|
@@ -7323,14 +7318,14 @@ var CliDebugCommandProcessor = class {
|
|
|
7323
7318
|
writer.writeln(
|
|
7324
7319
|
` ${online ? cliCore.CliIcon.CheckIcon : cliCore.CliIcon.CrossIcon} Network: ${online ? "online" : "offline"}`
|
|
7325
7320
|
);
|
|
7326
|
-
const registry = context2.services.
|
|
7321
|
+
const registry = context2.services.getRequired(
|
|
7327
7322
|
CliProcessorsRegistry_TOKEN
|
|
7328
7323
|
);
|
|
7329
7324
|
writer.writeln(
|
|
7330
7325
|
` ${cliCore.CliIcon.CheckIcon} Processors: ${registry.processors.length} loaded`
|
|
7331
7326
|
);
|
|
7332
7327
|
try {
|
|
7333
|
-
const moduleRegistry = context2.services.
|
|
7328
|
+
const moduleRegistry = context2.services.getRequired(
|
|
7334
7329
|
CliModuleRegistry_TOKEN
|
|
7335
7330
|
);
|
|
7336
7331
|
const modules = moduleRegistry.getAll();
|
|
@@ -7346,7 +7341,7 @@ var CliDebugCommandProcessor = class {
|
|
|
7346
7341
|
writer.writeln(
|
|
7347
7342
|
` ${wasmActive ? cliCore.CliIcon.CheckIcon : cliCore.CliIcon.WarningIcon} WASM Accelerator: ${wasmActive ? "loaded" : "using JS fallback"}`
|
|
7348
7343
|
);
|
|
7349
|
-
const historyService = context2.services.
|
|
7344
|
+
const historyService = context2.services.getRequired(
|
|
7350
7345
|
CliCommandHistory_TOKEN
|
|
7351
7346
|
);
|
|
7352
7347
|
writer.writeln(
|
|
@@ -7360,13 +7355,13 @@ var CliDebugCommandProcessor = class {
|
|
|
7360
7355
|
metadata: { icon: cliCore.CliIcon.Save, module: "system" },
|
|
7361
7356
|
processCommand: async (_, context2) => {
|
|
7362
7357
|
const { writer } = context2;
|
|
7363
|
-
const registry = context2.services.
|
|
7358
|
+
const registry = context2.services.getRequired(
|
|
7364
7359
|
CliProcessorsRegistry_TOKEN
|
|
7365
7360
|
);
|
|
7366
|
-
const history = context2.services.
|
|
7361
|
+
const history = context2.services.getRequired(
|
|
7367
7362
|
CliCommandHistory_TOKEN
|
|
7368
7363
|
);
|
|
7369
|
-
const storeManager = context2.services.
|
|
7364
|
+
const storeManager = context2.services.getRequired(
|
|
7370
7365
|
CliStateStoreManager_TOKEN
|
|
7371
7366
|
);
|
|
7372
7367
|
const report = {
|
|
@@ -7399,7 +7394,7 @@ var CliDebugCommandProcessor = class {
|
|
|
7399
7394
|
state: storeManager.getStoreEntries()
|
|
7400
7395
|
};
|
|
7401
7396
|
try {
|
|
7402
|
-
const moduleRegistry = context2.services.
|
|
7397
|
+
const moduleRegistry = context2.services.getRequired(
|
|
7403
7398
|
CliModuleRegistry_TOKEN
|
|
7404
7399
|
);
|
|
7405
7400
|
report["modules"] = moduleRegistry.getAll().map((m) => ({
|
|
@@ -7417,7 +7412,7 @@ var CliDebugCommandProcessor = class {
|
|
|
7417
7412
|
report["services"] = container.getRegisteredTokens();
|
|
7418
7413
|
}
|
|
7419
7414
|
try {
|
|
7420
|
-
const serverManager = context2.services.
|
|
7415
|
+
const serverManager = context2.services.getRequired(
|
|
7421
7416
|
CliServerManager_TOKEN
|
|
7422
7417
|
);
|
|
7423
7418
|
if (serverManager && serverManager.connections.size > 0) {
|
|
@@ -7441,13 +7436,9 @@ var CliDebugCommandProcessor = class {
|
|
|
7441
7436
|
metadata: { icon: cliCore.CliIcon.Server, module: "system" },
|
|
7442
7437
|
processCommand: async (_, context2) => {
|
|
7443
7438
|
const { writer } = context2;
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
CliServerManager_TOKEN
|
|
7448
|
-
);
|
|
7449
|
-
} catch {
|
|
7450
|
-
}
|
|
7439
|
+
const manager = context2.services.get(
|
|
7440
|
+
CliServerManager_TOKEN
|
|
7441
|
+
);
|
|
7451
7442
|
if (!manager || manager.connections.size === 0) {
|
|
7452
7443
|
writer.writeInfo("No servers configured.");
|
|
7453
7444
|
return;
|
|
@@ -7487,70 +7478,48 @@ var CliDebugCommandProcessor = class {
|
|
|
7487
7478
|
}
|
|
7488
7479
|
async processCommand(_, context2) {
|
|
7489
7480
|
const { writer } = context2;
|
|
7490
|
-
const registry = context2.services.
|
|
7481
|
+
const registry = context2.services.getRequired(
|
|
7491
7482
|
CliProcessorsRegistry_TOKEN
|
|
7492
7483
|
);
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
cliCore.CliForegroundColor.Yellow
|
|
7497
|
-
)
|
|
7498
|
-
);
|
|
7499
|
-
writer.writeDivider({ char: "=" });
|
|
7500
|
-
writer.writeln(
|
|
7501
|
-
` ${writer.wrapInColor("Core Version:", cliCore.CliForegroundColor.Cyan)} ${cliCore.LIBRARY_VERSION}`
|
|
7502
|
-
);
|
|
7503
|
-
writer.writeln(
|
|
7504
|
-
` ${writer.wrapInColor("CLI Version:", cliCore.CliForegroundColor.Cyan)} ${LIBRARY_VERSION}`
|
|
7484
|
+
const summaryFramework = context2.services.get("cli-framework") ?? "vanilla";
|
|
7485
|
+
const summaryModuleRegistry = context2.services.get(
|
|
7486
|
+
CliModuleRegistry_TOKEN
|
|
7505
7487
|
);
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
framework = context2.services.get("cli-framework");
|
|
7509
|
-
} catch {
|
|
7510
|
-
}
|
|
7511
|
-
writer.writeln(
|
|
7512
|
-
` ${writer.wrapInColor("Framework:", cliCore.CliForegroundColor.Cyan)} ${framework}`
|
|
7513
|
-
);
|
|
7514
|
-
writer.writeln(
|
|
7515
|
-
` ${writer.wrapInColor("Terminal:", cliCore.CliForegroundColor.Cyan)} ${context2.terminal.cols}x${context2.terminal.rows}`
|
|
7488
|
+
const summaryServerManager = context2.services.get(
|
|
7489
|
+
CliServerManager_TOKEN
|
|
7516
7490
|
);
|
|
7517
|
-
|
|
7518
|
-
|
|
7491
|
+
const history = context2.services.getRequired(
|
|
7492
|
+
CliCommandHistory_TOKEN
|
|
7519
7493
|
);
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
)
|
|
7524
|
-
writer.
|
|
7525
|
-
|
|
7494
|
+
const wasmStatus = isWasmAccelerated() ? "active" : "inactive (JS fallback)";
|
|
7495
|
+
const lines = [
|
|
7496
|
+
`${writer.wrapInColor("Core Version:", cliCore.CliForegroundColor.Cyan)} ${cliCore.LIBRARY_VERSION}`,
|
|
7497
|
+
`${writer.wrapInColor("CLI Version:", cliCore.CliForegroundColor.Cyan)} ${LIBRARY_VERSION}`,
|
|
7498
|
+
`${writer.wrapInColor("Framework:", cliCore.CliForegroundColor.Cyan)} ${summaryFramework}`,
|
|
7499
|
+
`${writer.wrapInColor("Terminal:", cliCore.CliForegroundColor.Cyan)} ${context2.terminal.cols}x${context2.terminal.rows}`,
|
|
7500
|
+
`${writer.wrapInColor("Processors:", cliCore.CliForegroundColor.Cyan)} ${registry.processors.length}`
|
|
7501
|
+
];
|
|
7502
|
+
if (summaryModuleRegistry) {
|
|
7503
|
+
lines.push(
|
|
7504
|
+
`${writer.wrapInColor("Modules:", cliCore.CliForegroundColor.Cyan)} ${summaryModuleRegistry.getAll().length}`
|
|
7526
7505
|
);
|
|
7527
|
-
} catch {
|
|
7528
7506
|
}
|
|
7529
|
-
|
|
7530
|
-
const
|
|
7531
|
-
|
|
7507
|
+
if (summaryServerManager && summaryServerManager.connections.size > 0) {
|
|
7508
|
+
const connected = Array.from(
|
|
7509
|
+
summaryServerManager.connections.values()
|
|
7510
|
+
).filter((c) => c.connected).length;
|
|
7511
|
+
lines.push(
|
|
7512
|
+
`${writer.wrapInColor("Servers:", cliCore.CliForegroundColor.Cyan)} ${connected}/${summaryServerManager.connections.size} connected`
|
|
7532
7513
|
);
|
|
7533
|
-
if (serverManager && serverManager.connections.size > 0) {
|
|
7534
|
-
const connected = Array.from(
|
|
7535
|
-
serverManager.connections.values()
|
|
7536
|
-
).filter((c) => c.connected).length;
|
|
7537
|
-
writer.writeln(
|
|
7538
|
-
` ${writer.wrapInColor("Servers:", cliCore.CliForegroundColor.Cyan)} ${connected}/${serverManager.connections.size} connected`
|
|
7539
|
-
);
|
|
7540
|
-
}
|
|
7541
|
-
} catch {
|
|
7542
7514
|
}
|
|
7543
|
-
|
|
7544
|
-
|
|
7545
|
-
|
|
7546
|
-
writer.writeln(
|
|
7547
|
-
` ${writer.wrapInColor("History:", cliCore.CliForegroundColor.Cyan)} ${history.getHistory().length} commands`
|
|
7548
|
-
);
|
|
7549
|
-
const wasmStatus = isWasmAccelerated() ? "active" : "inactive (JS fallback)";
|
|
7550
|
-
writer.writeln(
|
|
7551
|
-
` ${writer.wrapInColor("WASM Accelerator:", cliCore.CliForegroundColor.Cyan)} ${wasmStatus}`
|
|
7515
|
+
lines.push(
|
|
7516
|
+
`${writer.wrapInColor("History:", cliCore.CliForegroundColor.Cyan)} ${history.getHistory().length} commands`,
|
|
7517
|
+
`${writer.wrapInColor("WASM Accelerator:", cliCore.CliForegroundColor.Cyan)} ${wasmStatus}`
|
|
7552
7518
|
);
|
|
7553
|
-
writer.
|
|
7519
|
+
writer.writeBox(lines, {
|
|
7520
|
+
title: "CLI Debug Info",
|
|
7521
|
+
borderColor: cliCore.CliForegroundColor.Yellow
|
|
7522
|
+
});
|
|
7554
7523
|
writer.writeln();
|
|
7555
7524
|
writer.writeln(`${cliCore.CliIcon.Light} Subcommands:`);
|
|
7556
7525
|
for (const sub of this.processors || []) {
|
|
@@ -8136,7 +8105,7 @@ var CliNanoCommandProcessor = class {
|
|
|
8136
8105
|
this.replaceWith = "";
|
|
8137
8106
|
this.statusMessage = void 0;
|
|
8138
8107
|
try {
|
|
8139
|
-
this.fs = context2.services.
|
|
8108
|
+
this.fs = context2.services.getRequired(FS_TOKEN);
|
|
8140
8109
|
} catch {
|
|
8141
8110
|
this.fs = null;
|
|
8142
8111
|
}
|
|
@@ -8475,8 +8444,8 @@ var CliNanoCommandProcessor = class {
|
|
|
8475
8444
|
return;
|
|
8476
8445
|
}
|
|
8477
8446
|
try {
|
|
8478
|
-
const registry = this.context.services.
|
|
8479
|
-
|
|
8447
|
+
const registry = this.context.services.getRequired(
|
|
8448
|
+
SyntaxHighlighterRegistry_TOKEN
|
|
8480
8449
|
);
|
|
8481
8450
|
const ext = "." + filePath.split(".").pop()?.toLowerCase();
|
|
8482
8451
|
const highlighter = registry.getByExtension(ext);
|
|
@@ -9113,7 +9082,7 @@ var CliPsCommandProcessor = class {
|
|
|
9113
9082
|
async processCommand(_command, context2) {
|
|
9114
9083
|
let registry;
|
|
9115
9084
|
try {
|
|
9116
|
-
registry = context2.services.
|
|
9085
|
+
registry = context2.services.getRequired(
|
|
9117
9086
|
CliProcessRegistry_TOKEN
|
|
9118
9087
|
);
|
|
9119
9088
|
} catch {
|
|
@@ -9152,7 +9121,7 @@ var CliKillCommandProcessor = class {
|
|
|
9152
9121
|
async processCommand(command2, context2) {
|
|
9153
9122
|
let registry;
|
|
9154
9123
|
try {
|
|
9155
|
-
registry = context2.services.
|
|
9124
|
+
registry = context2.services.getRequired(
|
|
9156
9125
|
CliProcessRegistry_TOKEN
|
|
9157
9126
|
);
|
|
9158
9127
|
} catch {
|
|
@@ -9267,11 +9236,10 @@ var CliHtopCommandProcessor = class {
|
|
|
9267
9236
|
this.errorTimeout = null;
|
|
9268
9237
|
}
|
|
9269
9238
|
async processCommand(_command, context2) {
|
|
9270
|
-
|
|
9271
|
-
|
|
9272
|
-
|
|
9273
|
-
|
|
9274
|
-
} catch {
|
|
9239
|
+
this.registry = context2.services.get(
|
|
9240
|
+
CliProcessRegistry_TOKEN
|
|
9241
|
+
) ?? null;
|
|
9242
|
+
if (!this.registry) {
|
|
9275
9243
|
context2.writer.writeError("Process registry not available");
|
|
9276
9244
|
return;
|
|
9277
9245
|
}
|
|
@@ -10411,7 +10379,7 @@ var CliPingCommandProcessor = class {
|
|
|
10411
10379
|
context2.writer.writeln(
|
|
10412
10380
|
`PING ${host} (${url}):`
|
|
10413
10381
|
);
|
|
10414
|
-
context2.
|
|
10382
|
+
context2.notifier.info(`ping ${host}`);
|
|
10415
10383
|
const times = [];
|
|
10416
10384
|
let transmitted = 0;
|
|
10417
10385
|
let received = 0;
|
|
@@ -10426,18 +10394,17 @@ var CliPingCommandProcessor = class {
|
|
|
10426
10394
|
transmitted++;
|
|
10427
10395
|
const start = performance.now();
|
|
10428
10396
|
try {
|
|
10429
|
-
const response = await fetch(url, {
|
|
10397
|
+
const response = await context2.http.fetch(url, {
|
|
10430
10398
|
method: "HEAD",
|
|
10431
10399
|
mode: "no-cors",
|
|
10432
|
-
cache: "no-store"
|
|
10433
|
-
signal: context2.signal
|
|
10400
|
+
cache: "no-store"
|
|
10434
10401
|
});
|
|
10435
10402
|
const elapsed = performance.now() - start;
|
|
10436
10403
|
const ms = elapsed.toFixed(1);
|
|
10437
10404
|
received++;
|
|
10438
10405
|
times.push(elapsed);
|
|
10439
10406
|
const status = response.type === "opaque" ? "ok" : `status=${response.status}`;
|
|
10440
|
-
context2.
|
|
10407
|
+
context2.notifier.info(`ping ${host}: seq=${seq} time=${ms}ms`);
|
|
10441
10408
|
context2.writer.writeln(
|
|
10442
10409
|
`${url}: seq=${seq} ${status} time=${ms} ms`
|
|
10443
10410
|
);
|
|
@@ -10571,7 +10538,7 @@ var CliExportCommandProcessor = class {
|
|
|
10571
10538
|
this.metadata = { icon: "\u{1F4E6}", module: "system" };
|
|
10572
10539
|
}
|
|
10573
10540
|
async processCommand(command2, context2) {
|
|
10574
|
-
const env = context2.services.
|
|
10541
|
+
const env = context2.services.getRequired(
|
|
10575
10542
|
ICliEnvironment_TOKEN
|
|
10576
10543
|
);
|
|
10577
10544
|
const raw = (command2.value || "").trim();
|
|
@@ -10625,7 +10592,7 @@ var CliUnsetCommandProcessor = class {
|
|
|
10625
10592
|
this.metadata = { icon: "\u{1F5D1}\uFE0F", module: "system" };
|
|
10626
10593
|
}
|
|
10627
10594
|
async processCommand(command2, context2) {
|
|
10628
|
-
const env = context2.services.
|
|
10595
|
+
const env = context2.services.getRequired(
|
|
10629
10596
|
ICliEnvironment_TOKEN
|
|
10630
10597
|
);
|
|
10631
10598
|
const varName = (command2.value || "").trim();
|
|
@@ -10659,7 +10626,7 @@ var CliEnvCommandProcessor = class {
|
|
|
10659
10626
|
this.metadata = { icon: "\u{1F30D}", module: "system" };
|
|
10660
10627
|
}
|
|
10661
10628
|
async processCommand(command2, context2) {
|
|
10662
|
-
const env = context2.services.
|
|
10629
|
+
const env = context2.services.getRequired(
|
|
10663
10630
|
ICliEnvironment_TOKEN
|
|
10664
10631
|
);
|
|
10665
10632
|
const varName = (command2.value || "").trim();
|
|
@@ -10907,16 +10874,9 @@ var CliCommandExecutionContext = class {
|
|
|
10907
10874
|
this.createInterval = (cb, ms) => context2.createInterval(cb, ms);
|
|
10908
10875
|
this.createTimeout = (cb, ms) => context2.createTimeout(cb, ms);
|
|
10909
10876
|
this.backgroundServices = context2.backgroundServices;
|
|
10910
|
-
this.
|
|
10911
|
-
|
|
10912
|
-
|
|
10913
|
-
this.context.setStatusText(text);
|
|
10914
|
-
}
|
|
10915
|
-
clearStatusText() {
|
|
10916
|
-
this.context.clearStatusText();
|
|
10917
|
-
}
|
|
10918
|
-
getStatusText() {
|
|
10919
|
-
return this.context.getStatusText();
|
|
10877
|
+
this.http = context2.http;
|
|
10878
|
+
this.notifier = context2.notifier;
|
|
10879
|
+
this.state = context2.services.getRequired(CliStateStoreManager_TOKEN).getProcessorStateStore(processor);
|
|
10920
10880
|
}
|
|
10921
10881
|
get promptLength() {
|
|
10922
10882
|
return this.context.promptLength;
|
|
@@ -11467,6 +11427,172 @@ var CliBackgroundServiceRegistry = class {
|
|
|
11467
11427
|
}
|
|
11468
11428
|
};
|
|
11469
11429
|
|
|
11430
|
+
// src/lib/services/cli-http-client.ts
|
|
11431
|
+
var CliHttpClient = class {
|
|
11432
|
+
constructor(signal) {
|
|
11433
|
+
this.signal = signal;
|
|
11434
|
+
}
|
|
11435
|
+
async fetch(url, init) {
|
|
11436
|
+
return fetch(url, {
|
|
11437
|
+
...init,
|
|
11438
|
+
signal: this.mergeSignal(init?.signal)
|
|
11439
|
+
});
|
|
11440
|
+
}
|
|
11441
|
+
async get(url, options) {
|
|
11442
|
+
return this.jsonRequest("GET", url, void 0, options);
|
|
11443
|
+
}
|
|
11444
|
+
async post(url, body, options) {
|
|
11445
|
+
return this.jsonRequest("POST", url, body, options);
|
|
11446
|
+
}
|
|
11447
|
+
async put(url, body, options) {
|
|
11448
|
+
return this.jsonRequest("PUT", url, body, options);
|
|
11449
|
+
}
|
|
11450
|
+
async patch(url, body, options) {
|
|
11451
|
+
return this.jsonRequest("PATCH", url, body, options);
|
|
11452
|
+
}
|
|
11453
|
+
async delete(url, options) {
|
|
11454
|
+
return this.jsonRequest("DELETE", url, void 0, options);
|
|
11455
|
+
}
|
|
11456
|
+
async head(url, options) {
|
|
11457
|
+
const { timeout, signal: callerSignal, ...fetchOptions } = options ?? {};
|
|
11458
|
+
let timeoutController;
|
|
11459
|
+
let timeoutId;
|
|
11460
|
+
if (timeout) {
|
|
11461
|
+
timeoutController = new AbortController();
|
|
11462
|
+
timeoutId = setTimeout(() => timeoutController.abort(), timeout);
|
|
11463
|
+
}
|
|
11464
|
+
try {
|
|
11465
|
+
return await fetch(url, {
|
|
11466
|
+
...fetchOptions,
|
|
11467
|
+
method: "HEAD",
|
|
11468
|
+
signal: this.mergeSignal(callerSignal, timeoutController?.signal)
|
|
11469
|
+
});
|
|
11470
|
+
} finally {
|
|
11471
|
+
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
11472
|
+
}
|
|
11473
|
+
}
|
|
11474
|
+
async options(url, options) {
|
|
11475
|
+
return this.jsonRequest("OPTIONS", url, void 0, options);
|
|
11476
|
+
}
|
|
11477
|
+
// ── Internals ────────────────────────────────────────────────────
|
|
11478
|
+
async jsonRequest(method, url, body, options) {
|
|
11479
|
+
const { timeout, ...fetchOptions } = options ?? {};
|
|
11480
|
+
const headers = {
|
|
11481
|
+
...fetchOptions.headers ?? {}
|
|
11482
|
+
};
|
|
11483
|
+
let resolvedBody;
|
|
11484
|
+
if (body !== void 0 && body !== null) {
|
|
11485
|
+
if (this.isRawBody(body)) {
|
|
11486
|
+
resolvedBody = body;
|
|
11487
|
+
} else {
|
|
11488
|
+
resolvedBody = JSON.stringify(body);
|
|
11489
|
+
if (!headers["Content-Type"]) {
|
|
11490
|
+
headers["Content-Type"] = "application/json";
|
|
11491
|
+
}
|
|
11492
|
+
}
|
|
11493
|
+
}
|
|
11494
|
+
let timeoutId;
|
|
11495
|
+
let timeoutController;
|
|
11496
|
+
if (timeout) {
|
|
11497
|
+
timeoutController = new AbortController();
|
|
11498
|
+
timeoutId = setTimeout(() => timeoutController.abort(), timeout);
|
|
11499
|
+
}
|
|
11500
|
+
const signal = this.mergeSignal(
|
|
11501
|
+
fetchOptions.signal,
|
|
11502
|
+
timeoutController?.signal
|
|
11503
|
+
);
|
|
11504
|
+
try {
|
|
11505
|
+
const response = await fetch(url, {
|
|
11506
|
+
...fetchOptions,
|
|
11507
|
+
method,
|
|
11508
|
+
headers,
|
|
11509
|
+
body: resolvedBody,
|
|
11510
|
+
signal
|
|
11511
|
+
});
|
|
11512
|
+
if (!response.ok) {
|
|
11513
|
+
let errorMessage = `${response.status} ${response.statusText}`;
|
|
11514
|
+
try {
|
|
11515
|
+
const errorBody = await response.json();
|
|
11516
|
+
if (errorBody.error) {
|
|
11517
|
+
errorMessage = errorBody.error;
|
|
11518
|
+
} else if (errorBody.message) {
|
|
11519
|
+
errorMessage = errorBody.message;
|
|
11520
|
+
}
|
|
11521
|
+
} catch {
|
|
11522
|
+
}
|
|
11523
|
+
throw new Error(errorMessage);
|
|
11524
|
+
}
|
|
11525
|
+
const text = await response.text();
|
|
11526
|
+
if (!text) {
|
|
11527
|
+
return void 0;
|
|
11528
|
+
}
|
|
11529
|
+
return JSON.parse(text);
|
|
11530
|
+
} finally {
|
|
11531
|
+
if (timeoutId !== void 0) {
|
|
11532
|
+
clearTimeout(timeoutId);
|
|
11533
|
+
}
|
|
11534
|
+
}
|
|
11535
|
+
}
|
|
11536
|
+
isRawBody(body) {
|
|
11537
|
+
return typeof body === "string" || body instanceof FormData || body instanceof Blob || body instanceof ArrayBuffer || body instanceof URLSearchParams || body instanceof ReadableStream;
|
|
11538
|
+
}
|
|
11539
|
+
/**
|
|
11540
|
+
* Merge the command signal with any additional signals (caller, timeout).
|
|
11541
|
+
* Uses AbortSignal.any() when available, falls back to a manual composite
|
|
11542
|
+
* controller for older browsers (pre-Chrome 116 / Safari 17.4).
|
|
11543
|
+
*/
|
|
11544
|
+
mergeSignal(...additional) {
|
|
11545
|
+
const signals = [];
|
|
11546
|
+
if (this.signal) signals.push(this.signal);
|
|
11547
|
+
for (const s of additional) {
|
|
11548
|
+
if (s) signals.push(s);
|
|
11549
|
+
}
|
|
11550
|
+
if (signals.length === 0) return void 0;
|
|
11551
|
+
if (signals.length === 1) return signals[0];
|
|
11552
|
+
if (typeof AbortSignal.any === "function") {
|
|
11553
|
+
return AbortSignal.any(signals);
|
|
11554
|
+
}
|
|
11555
|
+
const controller = new AbortController();
|
|
11556
|
+
for (const s of signals) {
|
|
11557
|
+
if (s.aborted) {
|
|
11558
|
+
controller.abort(s.reason);
|
|
11559
|
+
return controller.signal;
|
|
11560
|
+
}
|
|
11561
|
+
s.addEventListener("abort", () => controller.abort(s.reason), { once: true });
|
|
11562
|
+
}
|
|
11563
|
+
return controller.signal;
|
|
11564
|
+
}
|
|
11565
|
+
};
|
|
11566
|
+
var CliNotifier = class {
|
|
11567
|
+
constructor() {
|
|
11568
|
+
this._change$ = new rxjs.Subject();
|
|
11569
|
+
this.change$ = this._change$.asObservable();
|
|
11570
|
+
}
|
|
11571
|
+
get current() {
|
|
11572
|
+
return this._current;
|
|
11573
|
+
}
|
|
11574
|
+
info(message) {
|
|
11575
|
+
this.set("info", message);
|
|
11576
|
+
}
|
|
11577
|
+
success(message) {
|
|
11578
|
+
this.set("success", message);
|
|
11579
|
+
}
|
|
11580
|
+
warn(message) {
|
|
11581
|
+
this.set("warn", message);
|
|
11582
|
+
}
|
|
11583
|
+
error(message) {
|
|
11584
|
+
this.set("error", message);
|
|
11585
|
+
}
|
|
11586
|
+
clear() {
|
|
11587
|
+
this._current = void 0;
|
|
11588
|
+
this._change$.next(void 0);
|
|
11589
|
+
}
|
|
11590
|
+
set(level, message) {
|
|
11591
|
+
this._current = { level, message, timestamp: Date.now() };
|
|
11592
|
+
this._change$.next(this._current);
|
|
11593
|
+
}
|
|
11594
|
+
};
|
|
11595
|
+
|
|
11470
11596
|
// src/lib/context/cli-fullscreen-manager.ts
|
|
11471
11597
|
var CliFullScreenManager = class {
|
|
11472
11598
|
constructor(terminal, backgroundServices) {
|
|
@@ -14489,7 +14615,6 @@ var CliExecutionContext = class {
|
|
|
14489
14615
|
* Set by the command executor at start/end of executeCommand().
|
|
14490
14616
|
*/
|
|
14491
14617
|
this.isExecuting = false;
|
|
14492
|
-
this.statusTextChange$ = new rxjs.Subject();
|
|
14493
14618
|
this.lineBuffer = new CliLineBuffer();
|
|
14494
14619
|
this.modeStack = [];
|
|
14495
14620
|
this.timerManager = new CliTimerManager();
|
|
@@ -14534,6 +14659,8 @@ var CliExecutionContext = class {
|
|
|
14534
14659
|
this.logger.setCliLogLevel(cliOptions?.logLevel || cliCore.CliLogLevel.ERROR);
|
|
14535
14660
|
this.commandHistory = deps.commandHistory;
|
|
14536
14661
|
this.lineRenderer = new CliTerminalLineRenderer(terminal, this.writer);
|
|
14662
|
+
this.http = new CliHttpClient();
|
|
14663
|
+
this.notifier = new CliNotifier();
|
|
14537
14664
|
this.backgroundServices = new CliBackgroundServiceRegistry(
|
|
14538
14665
|
this.state,
|
|
14539
14666
|
deps.services,
|
|
@@ -14544,17 +14671,6 @@ var CliExecutionContext = class {
|
|
|
14544
14671
|
this.backgroundServices
|
|
14545
14672
|
);
|
|
14546
14673
|
}
|
|
14547
|
-
setStatusText(text) {
|
|
14548
|
-
this._statusText = text;
|
|
14549
|
-
this.statusTextChange$.next(text);
|
|
14550
|
-
}
|
|
14551
|
-
clearStatusText() {
|
|
14552
|
-
this._statusText = void 0;
|
|
14553
|
-
this.statusTextChange$.next(void 0);
|
|
14554
|
-
}
|
|
14555
|
-
getStatusText() {
|
|
14556
|
-
return this._statusText;
|
|
14557
|
-
}
|
|
14558
14674
|
// -- Public API (ICliExecutionContext) --
|
|
14559
14675
|
writeToTerminal(text) {
|
|
14560
14676
|
this.terminal.write(text);
|
|
@@ -14748,12 +14864,8 @@ var CliExecutionContext = class {
|
|
|
14748
14864
|
}
|
|
14749
14865
|
// -- CommandLineModeHost interface --
|
|
14750
14866
|
getPromptOptions() {
|
|
14751
|
-
|
|
14752
|
-
|
|
14753
|
-
const config = this.services.get("cli-users-module-config");
|
|
14754
|
-
hideUserName = config?.hideUserName ?? false;
|
|
14755
|
-
} catch {
|
|
14756
|
-
}
|
|
14867
|
+
const usersConfig = this.services.get("cli-users-module-config");
|
|
14868
|
+
const hideUserName = usersConfig?.hideUserName ?? false;
|
|
14757
14869
|
return {
|
|
14758
14870
|
userName: this.userSession?.displayName,
|
|
14759
14871
|
hideUserName,
|
|
@@ -15001,10 +15113,8 @@ var contextGlobalParameter = {
|
|
|
15001
15113
|
// src/lib/executor/cli-io-redirect-handler.ts
|
|
15002
15114
|
var FS_TOKEN2 = "cli-file-system-service";
|
|
15003
15115
|
async function writeOutputToFile(filePath, context2) {
|
|
15004
|
-
|
|
15005
|
-
|
|
15006
|
-
fs = context2.services.get(FS_TOKEN2);
|
|
15007
|
-
} catch {
|
|
15116
|
+
const fs = context2.services.get(FS_TOKEN2);
|
|
15117
|
+
if (!fs) {
|
|
15008
15118
|
context2.writer.writeError(
|
|
15009
15119
|
"> redirect requires @qodalis/cli-files plugin"
|
|
15010
15120
|
);
|
|
@@ -15028,10 +15138,8 @@ async function writeOutputToFile(filePath, context2) {
|
|
|
15028
15138
|
}
|
|
15029
15139
|
}
|
|
15030
15140
|
async function appendOutputToFile(filePath, context2) {
|
|
15031
|
-
|
|
15032
|
-
|
|
15033
|
-
fs = context2.services.get(FS_TOKEN2);
|
|
15034
|
-
} catch {
|
|
15141
|
+
const fs = context2.services.get(FS_TOKEN2);
|
|
15142
|
+
if (!fs) {
|
|
15035
15143
|
context2.writer.writeError(
|
|
15036
15144
|
">> redirect requires @qodalis/cli-files plugin"
|
|
15037
15145
|
);
|
|
@@ -15057,10 +15165,8 @@ async function appendOutputToFile(filePath, context2) {
|
|
|
15057
15165
|
async function writeStderrToFile(filePath, context2, capturingWriter) {
|
|
15058
15166
|
const stderr = capturingWriter?.getCapturedStderr();
|
|
15059
15167
|
if (!stderr) return;
|
|
15060
|
-
|
|
15061
|
-
|
|
15062
|
-
fs = context2.services.get(FS_TOKEN2);
|
|
15063
|
-
} catch {
|
|
15168
|
+
const fs = context2.services.get(FS_TOKEN2);
|
|
15169
|
+
if (!fs) {
|
|
15064
15170
|
context2.writer.writeError(
|
|
15065
15171
|
"2> redirect requires @qodalis/cli-files plugin"
|
|
15066
15172
|
);
|
|
@@ -15081,10 +15187,8 @@ async function writeStderrToFile(filePath, context2, capturingWriter) {
|
|
|
15081
15187
|
async function appendStderrToFile(filePath, context2, capturingWriter) {
|
|
15082
15188
|
const stderr = capturingWriter?.getCapturedStderr();
|
|
15083
15189
|
if (!stderr) return;
|
|
15084
|
-
|
|
15085
|
-
|
|
15086
|
-
fs = context2.services.get(FS_TOKEN2);
|
|
15087
|
-
} catch {
|
|
15190
|
+
const fs = context2.services.get(FS_TOKEN2);
|
|
15191
|
+
if (!fs) {
|
|
15088
15192
|
context2.writer.writeError(
|
|
15089
15193
|
"2>> redirect requires @qodalis/cli-files plugin"
|
|
15090
15194
|
);
|
|
@@ -15104,10 +15208,8 @@ async function appendStderrToFile(filePath, context2, capturingWriter) {
|
|
|
15104
15208
|
}
|
|
15105
15209
|
async function tryExecuteScript(filePath, context2, executeCommand) {
|
|
15106
15210
|
const FS_TOKEN3 = "cli-file-system-service";
|
|
15107
|
-
|
|
15108
|
-
|
|
15109
|
-
fs = context2.services.get(FS_TOKEN3);
|
|
15110
|
-
} catch {
|
|
15211
|
+
const fs = context2.services.get(FS_TOKEN3);
|
|
15212
|
+
if (!fs) {
|
|
15111
15213
|
return false;
|
|
15112
15214
|
}
|
|
15113
15215
|
const resolved = fs.resolvePath(filePath);
|
|
@@ -15184,10 +15286,8 @@ function substituteVars(input, variables) {
|
|
|
15184
15286
|
return result;
|
|
15185
15287
|
}
|
|
15186
15288
|
function expandEnvironmentVars(command2, context2) {
|
|
15187
|
-
|
|
15188
|
-
|
|
15189
|
-
env = context2.services.get(ICliEnvironment_TOKEN);
|
|
15190
|
-
} catch {
|
|
15289
|
+
const env = context2.services.get(ICliEnvironment_TOKEN);
|
|
15290
|
+
if (!env) {
|
|
15191
15291
|
return command2;
|
|
15192
15292
|
}
|
|
15193
15293
|
const parts = command2.split("'");
|
|
@@ -15332,7 +15432,7 @@ var CliCommandExecutor = class {
|
|
|
15332
15432
|
}
|
|
15333
15433
|
} finally {
|
|
15334
15434
|
rootContext.isExecuting = false;
|
|
15335
|
-
rootContext.
|
|
15435
|
+
rootContext.notifier?.clear();
|
|
15336
15436
|
}
|
|
15337
15437
|
}
|
|
15338
15438
|
async executeSingleCommand(command2, data, context2) {
|
|
@@ -15340,8 +15440,8 @@ var CliCommandExecutor = class {
|
|
|
15340
15440
|
command2 = expandEnvironmentVars(command2, context2);
|
|
15341
15441
|
const assignMatch = command2.match(/^([A-Za-z_][A-Za-z0-9_]*)=(.*)$/);
|
|
15342
15442
|
if (assignMatch) {
|
|
15343
|
-
|
|
15344
|
-
|
|
15443
|
+
const env = context2.services.get(ICliEnvironment_TOKEN);
|
|
15444
|
+
if (env) {
|
|
15345
15445
|
let val = assignMatch[2];
|
|
15346
15446
|
if (val.startsWith('"') && val.endsWith('"') || val.startsWith("'") && val.endsWith("'")) {
|
|
15347
15447
|
val = val.slice(1, -1);
|
|
@@ -15350,15 +15450,13 @@ var CliCommandExecutor = class {
|
|
|
15350
15450
|
process.start();
|
|
15351
15451
|
process.end();
|
|
15352
15452
|
return;
|
|
15353
|
-
} catch {
|
|
15354
15453
|
}
|
|
15355
15454
|
}
|
|
15356
15455
|
process.start();
|
|
15357
15456
|
let processEntry;
|
|
15358
|
-
|
|
15359
|
-
|
|
15457
|
+
const procRegistry = context2.services.get(CliProcessRegistry_TOKEN);
|
|
15458
|
+
if (procRegistry) {
|
|
15360
15459
|
processEntry = procRegistry.register(command2);
|
|
15361
|
-
} catch {
|
|
15362
15460
|
}
|
|
15363
15461
|
const parsed = this.commandParser.parse(command2);
|
|
15364
15462
|
let { commandName } = parsed;
|
|
@@ -15471,6 +15569,7 @@ var CliCommandExecutor = class {
|
|
|
15471
15569
|
);
|
|
15472
15570
|
const commandAbortController = new AbortController();
|
|
15473
15571
|
commandContext.signal = commandAbortController.signal;
|
|
15572
|
+
commandContext.http = new CliHttpClient(commandAbortController.signal);
|
|
15474
15573
|
const abortSub = context2.onAbort.subscribe(() => {
|
|
15475
15574
|
commandAbortController.abort();
|
|
15476
15575
|
});
|
|
@@ -15535,19 +15634,13 @@ var CliCommandExecutor = class {
|
|
|
15535
15634
|
}
|
|
15536
15635
|
completeProcess(processEntry, context2, exitCode) {
|
|
15537
15636
|
if (!processEntry) return;
|
|
15538
|
-
|
|
15539
|
-
|
|
15540
|
-
procRegistry.complete(processEntry.pid, exitCode);
|
|
15541
|
-
} catch {
|
|
15542
|
-
}
|
|
15637
|
+
const procRegistry = context2.services.get(CliProcessRegistry_TOKEN);
|
|
15638
|
+
procRegistry?.complete(processEntry.pid, exitCode);
|
|
15543
15639
|
}
|
|
15544
15640
|
failProcess(processEntry, context2) {
|
|
15545
15641
|
if (!processEntry) return;
|
|
15546
|
-
|
|
15547
|
-
|
|
15548
|
-
procRegistry.fail(processEntry.pid);
|
|
15549
|
-
} catch {
|
|
15550
|
-
}
|
|
15642
|
+
const failRegistry = context2.services.get(CliProcessRegistry_TOKEN);
|
|
15643
|
+
failRegistry?.fail(processEntry.pid);
|
|
15551
15644
|
}
|
|
15552
15645
|
async showHelp(command2, context2) {
|
|
15553
15646
|
try {
|
|
@@ -15629,29 +15722,94 @@ var CliCommandExecutor = class {
|
|
|
15629
15722
|
// src/lib/services/cli-service-container.ts
|
|
15630
15723
|
var CliServiceContainer = class {
|
|
15631
15724
|
constructor() {
|
|
15632
|
-
/** Stores single-value providers (resolved
|
|
15725
|
+
/** Stores single-value providers (resolved singletons). */
|
|
15633
15726
|
this.services = /* @__PURE__ */ new Map();
|
|
15634
15727
|
/** Stores multi-provider arrays. */
|
|
15635
15728
|
this.multiServices = /* @__PURE__ */ new Map();
|
|
15729
|
+
/** Tokens that cannot be overwritten by subsequent `set()` calls. */
|
|
15730
|
+
this.sealedTokens = /* @__PURE__ */ new Set();
|
|
15731
|
+
/** Stores provider recipes for transient tokens (re-resolved on every get). */
|
|
15732
|
+
this.transientRecipes = /* @__PURE__ */ new Map();
|
|
15636
15733
|
}
|
|
15637
15734
|
/**
|
|
15638
15735
|
* Retrieve a service by its token.
|
|
15736
|
+
* Returns `undefined` when no provider is registered for the token.
|
|
15737
|
+
* For multi-provider tokens, returns the last registered value (use `getAll` for the full array).
|
|
15639
15738
|
*
|
|
15640
15739
|
* @param token The token used to register the service.
|
|
15641
|
-
* @returns The resolved service instance
|
|
15642
|
-
* @throws Error if the token has not been registered.
|
|
15740
|
+
* @returns The resolved service instance, or `undefined` if not registered.
|
|
15643
15741
|
*/
|
|
15644
15742
|
get(token) {
|
|
15743
|
+
if (this.transientRecipes.has(token)) {
|
|
15744
|
+
return this.resolveProvider(this.transientRecipes.get(token));
|
|
15745
|
+
}
|
|
15645
15746
|
if (this.multiServices.has(token)) {
|
|
15646
|
-
|
|
15747
|
+
const arr = this.multiServices.get(token);
|
|
15748
|
+
return arr[arr.length - 1];
|
|
15647
15749
|
}
|
|
15648
15750
|
if (this.services.has(token)) {
|
|
15649
15751
|
return this.services.get(token);
|
|
15650
15752
|
}
|
|
15651
|
-
|
|
15652
|
-
|
|
15653
|
-
|
|
15654
|
-
|
|
15753
|
+
return void 0;
|
|
15754
|
+
}
|
|
15755
|
+
/**
|
|
15756
|
+
* Retrieve all registered services for a multi-provider token.
|
|
15757
|
+
* Returns an empty array when no provider is registered for the token.
|
|
15758
|
+
*
|
|
15759
|
+
* @param token The token used to register the service.
|
|
15760
|
+
* @returns Array of all resolved service instances.
|
|
15761
|
+
*/
|
|
15762
|
+
getAll(token) {
|
|
15763
|
+
if (this.multiServices.has(token)) {
|
|
15764
|
+
return this.multiServices.get(token);
|
|
15765
|
+
}
|
|
15766
|
+
const single = this.get(token);
|
|
15767
|
+
return single !== void 0 ? [single] : [];
|
|
15768
|
+
}
|
|
15769
|
+
/**
|
|
15770
|
+
* Retrieve a service by its token, throwing if not registered.
|
|
15771
|
+
* Use this when the service is required and its absence is a programming error.
|
|
15772
|
+
* For multi-provider tokens, returns the last registered value (use `getAll` for the full array).
|
|
15773
|
+
*
|
|
15774
|
+
* @param token The token used to register the service.
|
|
15775
|
+
* @returns The resolved service instance.
|
|
15776
|
+
* @throws Error if the token has not been registered.
|
|
15777
|
+
*/
|
|
15778
|
+
getRequired(token) {
|
|
15779
|
+
const value = this.get(token);
|
|
15780
|
+
if (value === void 0 && !this.has(token)) {
|
|
15781
|
+
throw new Error(
|
|
15782
|
+
`CliServiceContainer: No provider found for token "${this.tokenToString(token)}".`
|
|
15783
|
+
);
|
|
15784
|
+
}
|
|
15785
|
+
return value;
|
|
15786
|
+
}
|
|
15787
|
+
/**
|
|
15788
|
+
* Check whether a service is registered for the given token.
|
|
15789
|
+
*/
|
|
15790
|
+
has(token) {
|
|
15791
|
+
return this.services.has(token) || this.multiServices.has(token) || this.transientRecipes.has(token);
|
|
15792
|
+
}
|
|
15793
|
+
/**
|
|
15794
|
+
* Mark a token as sealed so it cannot be overwritten by future `set()` calls.
|
|
15795
|
+
* Only available on the concrete container — not exposed on `ICliServiceProvider`.
|
|
15796
|
+
*/
|
|
15797
|
+
seal(token) {
|
|
15798
|
+
this.sealedTokens.add(token);
|
|
15799
|
+
}
|
|
15800
|
+
/**
|
|
15801
|
+
* Mark multiple tokens as sealed at once.
|
|
15802
|
+
*/
|
|
15803
|
+
sealAll(tokens) {
|
|
15804
|
+
for (const token of tokens) {
|
|
15805
|
+
this.sealedTokens.add(token);
|
|
15806
|
+
}
|
|
15807
|
+
}
|
|
15808
|
+
/**
|
|
15809
|
+
* Check whether a token is sealed.
|
|
15810
|
+
*/
|
|
15811
|
+
isSealed(token) {
|
|
15812
|
+
return this.sealedTokens.has(token);
|
|
15655
15813
|
}
|
|
15656
15814
|
/**
|
|
15657
15815
|
* Register one or more providers.
|
|
@@ -15673,13 +15831,13 @@ var CliServiceContainer = class {
|
|
|
15673
15831
|
getRegisteredTokens() {
|
|
15674
15832
|
const tokens = [];
|
|
15675
15833
|
for (const key of this.services.keys()) {
|
|
15676
|
-
tokens.push(
|
|
15677
|
-
|
|
15678
|
-
|
|
15834
|
+
tokens.push(this.tokenToString(key));
|
|
15835
|
+
}
|
|
15836
|
+
for (const key of this.transientRecipes.keys()) {
|
|
15837
|
+
tokens.push(`${this.tokenToString(key)} (transient)`);
|
|
15679
15838
|
}
|
|
15680
15839
|
for (const key of this.multiServices.keys()) {
|
|
15681
|
-
|
|
15682
|
-
tokens.push(`${name} (multi)`);
|
|
15840
|
+
tokens.push(`${this.tokenToString(key)} (multi)`);
|
|
15683
15841
|
}
|
|
15684
15842
|
return tokens;
|
|
15685
15843
|
}
|
|
@@ -15690,20 +15848,34 @@ var CliServiceContainer = class {
|
|
|
15690
15848
|
const details = [];
|
|
15691
15849
|
for (const [key, value] of this.services.entries()) {
|
|
15692
15850
|
details.push({
|
|
15693
|
-
token:
|
|
15851
|
+
token: this.tokenToString(key),
|
|
15694
15852
|
type: this.describeValue(value),
|
|
15695
15853
|
multi: false
|
|
15696
15854
|
});
|
|
15697
15855
|
}
|
|
15856
|
+
for (const [key, provider] of this.transientRecipes.entries()) {
|
|
15857
|
+
const className = provider["useClass"]?.name ?? provider["useFactory"]?.name ?? "transient";
|
|
15858
|
+
details.push({
|
|
15859
|
+
token: this.tokenToString(key),
|
|
15860
|
+
type: `transient(${className})`,
|
|
15861
|
+
multi: false
|
|
15862
|
+
});
|
|
15863
|
+
}
|
|
15698
15864
|
for (const [key, values] of this.multiServices.entries()) {
|
|
15699
15865
|
details.push({
|
|
15700
|
-
token:
|
|
15866
|
+
token: this.tokenToString(key),
|
|
15701
15867
|
type: `[${values.map((v) => this.describeValue(v)).join(", ")}]`,
|
|
15702
15868
|
multi: true
|
|
15703
15869
|
});
|
|
15704
15870
|
}
|
|
15705
15871
|
return details;
|
|
15706
15872
|
}
|
|
15873
|
+
/**
|
|
15874
|
+
* Convert a token to a human-readable string for diagnostics/errors.
|
|
15875
|
+
*/
|
|
15876
|
+
tokenToString(token) {
|
|
15877
|
+
return typeof token === "string" ? token : typeof token === "function" ? token.name : String(token);
|
|
15878
|
+
}
|
|
15707
15879
|
/**
|
|
15708
15880
|
* Describe a resolved value for diagnostic display.
|
|
15709
15881
|
*/
|
|
@@ -15723,27 +15895,45 @@ var CliServiceContainer = class {
|
|
|
15723
15895
|
* Register a single provider.
|
|
15724
15896
|
*/
|
|
15725
15897
|
registerProvider(provider) {
|
|
15726
|
-
|
|
15727
|
-
|
|
15728
|
-
|
|
15729
|
-
|
|
15730
|
-
|
|
15898
|
+
if (!provider.multi && this.sealedTokens.has(provider.provide)) {
|
|
15899
|
+
throw new Error(
|
|
15900
|
+
`CliServiceContainer: Cannot override sealed service "${this.tokenToString(provider.provide)}".`
|
|
15901
|
+
);
|
|
15902
|
+
}
|
|
15903
|
+
if (provider["transient"] && !provider.multi) {
|
|
15904
|
+
this.transientRecipes.set(provider.provide, provider);
|
|
15905
|
+
this.services.delete(provider.provide);
|
|
15731
15906
|
} else {
|
|
15732
|
-
this.
|
|
15907
|
+
const value = this.resolveProvider(provider);
|
|
15908
|
+
if (provider.multi) {
|
|
15909
|
+
const existing = this.multiServices.get(provider.provide) ?? [];
|
|
15910
|
+
existing.push(value);
|
|
15911
|
+
this.multiServices.set(provider.provide, existing);
|
|
15912
|
+
} else {
|
|
15913
|
+
this.services.set(provider.provide, value);
|
|
15914
|
+
this.transientRecipes.delete(provider.provide);
|
|
15915
|
+
}
|
|
15916
|
+
}
|
|
15917
|
+
if (provider.sealed) {
|
|
15918
|
+
this.sealedTokens.add(provider.provide);
|
|
15733
15919
|
}
|
|
15734
15920
|
}
|
|
15735
15921
|
/**
|
|
15736
15922
|
* Resolve a provider definition to a concrete value.
|
|
15923
|
+
*
|
|
15924
|
+
* Note: `deps` are resolved eagerly at registration time, so
|
|
15925
|
+
* dependency tokens must be registered before the provider that needs them.
|
|
15737
15926
|
*/
|
|
15738
15927
|
resolveProvider(provider) {
|
|
15739
15928
|
if ("useValue" in provider) {
|
|
15740
15929
|
return provider.useValue;
|
|
15741
15930
|
}
|
|
15931
|
+
const deps = (provider["deps"] ?? []).map((dep) => this.getRequired(dep));
|
|
15742
15932
|
if ("useFactory" in provider) {
|
|
15743
|
-
return provider.useFactory();
|
|
15933
|
+
return provider.useFactory(...deps);
|
|
15744
15934
|
}
|
|
15745
15935
|
if ("useClass" in provider) {
|
|
15746
|
-
return new provider.useClass();
|
|
15936
|
+
return new provider.useClass(...deps);
|
|
15747
15937
|
}
|
|
15748
15938
|
throw new Error(
|
|
15749
15939
|
"CliServiceContainer: Provider must specify useValue, useFactory, or useClass."
|
|
@@ -15884,10 +16074,10 @@ var welcomeModule = {
|
|
|
15884
16074
|
async onAfterBoot(context2) {
|
|
15885
16075
|
const config = this.config || {};
|
|
15886
16076
|
let showOption = config.show;
|
|
15887
|
-
|
|
15888
|
-
|
|
15889
|
-
|
|
15890
|
-
|
|
16077
|
+
const storeManager = context2.services.get(
|
|
16078
|
+
CliStateStoreManager_TOKEN
|
|
16079
|
+
);
|
|
16080
|
+
if (storeManager) {
|
|
15891
16081
|
const configureStore = storeManager.getStateStore(
|
|
15892
16082
|
cliCore.CLI_CONFIGURE_STORE_NAME
|
|
15893
16083
|
);
|
|
@@ -15896,7 +16086,6 @@ var welcomeModule = {
|
|
|
15896
16086
|
if (state?.["system"]?.["welcomeMessage"]) {
|
|
15897
16087
|
showOption = state["system"]["welcomeMessage"];
|
|
15898
16088
|
}
|
|
15899
|
-
} catch {
|
|
15900
16089
|
}
|
|
15901
16090
|
if (showOption) {
|
|
15902
16091
|
if (!shouldDisplayWelcomeMessage(showOption)) {
|
|
@@ -15924,11 +16113,11 @@ var welcomeModule = {
|
|
|
15924
16113
|
recordWelcomeMessageDisplay();
|
|
15925
16114
|
context2.showPrompt();
|
|
15926
16115
|
let showGreeting = true;
|
|
15927
|
-
|
|
15928
|
-
|
|
15929
|
-
|
|
15930
|
-
|
|
15931
|
-
const configureStore =
|
|
16116
|
+
const greetingStoreManager = context2.services.get(
|
|
16117
|
+
CliStateStoreManager_TOKEN
|
|
16118
|
+
);
|
|
16119
|
+
if (greetingStoreManager) {
|
|
16120
|
+
const configureStore = greetingStoreManager.getStateStore(
|
|
15932
16121
|
cliCore.CLI_CONFIGURE_STORE_NAME
|
|
15933
16122
|
);
|
|
15934
16123
|
await configureStore.initialize();
|
|
@@ -15936,7 +16125,6 @@ var welcomeModule = {
|
|
|
15936
16125
|
if (configState?.["system"]?.["greeting"] === false) {
|
|
15937
16126
|
showGreeting = false;
|
|
15938
16127
|
}
|
|
15939
|
-
} catch {
|
|
15940
16128
|
}
|
|
15941
16129
|
if (showGreeting) {
|
|
15942
16130
|
await context2.textAnimator?.showText(getGreetingBasedOnTime(), {
|
|
@@ -16056,8 +16244,8 @@ var CliBoot = class {
|
|
|
16056
16244
|
}
|
|
16057
16245
|
}
|
|
16058
16246
|
if (module.onSetup) {
|
|
16059
|
-
const kvStore = context2.services.
|
|
16060
|
-
|
|
16247
|
+
const kvStore = context2.services.getRequired(
|
|
16248
|
+
CliKeyValueStore_TOKEN
|
|
16061
16249
|
);
|
|
16062
16250
|
const setupKey = `cli-module-setup:${module.name}`;
|
|
16063
16251
|
const setupState = await kvStore.get(setupKey);
|
|
@@ -16437,16 +16625,19 @@ var CliStateStore = class {
|
|
|
16437
16625
|
this.state$.next(this.initialState);
|
|
16438
16626
|
}
|
|
16439
16627
|
async persist() {
|
|
16440
|
-
const keyValueStore = this.services.
|
|
16441
|
-
|
|
16628
|
+
const keyValueStore = this.services.getRequired(
|
|
16629
|
+
CliKeyValueStore_TOKEN
|
|
16442
16630
|
);
|
|
16443
16631
|
await keyValueStore.set(this.storageKey, this.getState());
|
|
16444
16632
|
}
|
|
16445
16633
|
async initialize() {
|
|
16634
|
+
const keyValueStore = this.services.get(
|
|
16635
|
+
CliKeyValueStore_TOKEN
|
|
16636
|
+
);
|
|
16637
|
+
if (!keyValueStore) {
|
|
16638
|
+
return;
|
|
16639
|
+
}
|
|
16446
16640
|
try {
|
|
16447
|
-
const keyValueStore = this.services.get(
|
|
16448
|
-
"cli-key-value-store"
|
|
16449
|
-
);
|
|
16450
16641
|
const state = await keyValueStore.get(this.storageKey);
|
|
16451
16642
|
if (state) {
|
|
16452
16643
|
this.state$.next(state);
|
|
@@ -16513,6 +16704,23 @@ var CliStateStoreManager = class {
|
|
|
16513
16704
|
this.stores.clear();
|
|
16514
16705
|
}
|
|
16515
16706
|
};
|
|
16707
|
+
var CliServerAuthService = class {
|
|
16708
|
+
constructor(services) {
|
|
16709
|
+
this.services = services;
|
|
16710
|
+
}
|
|
16711
|
+
getHeaders(serverName, configHeaders) {
|
|
16712
|
+
const merged = {
|
|
16713
|
+
...cliCore.resolveHeaders(configHeaders)
|
|
16714
|
+
};
|
|
16715
|
+
const providers = this.services.getAll(
|
|
16716
|
+
cliCore.ICliServerAuthTokenProvider_TOKEN
|
|
16717
|
+
);
|
|
16718
|
+
for (const provider of providers) {
|
|
16719
|
+
Object.assign(merged, provider.getHeaders(serverName));
|
|
16720
|
+
}
|
|
16721
|
+
return merged;
|
|
16722
|
+
}
|
|
16723
|
+
};
|
|
16516
16724
|
|
|
16517
16725
|
// src/lib/completion/cli-command-completion-provider.ts
|
|
16518
16726
|
var CliCommandCompletionProvider = class {
|
|
@@ -16660,12 +16868,10 @@ var CliPackageNameCompletionProvider = class {
|
|
|
16660
16868
|
if (!INSTALLED_PKG_SUBCOMMANDS.has(subCommand)) {
|
|
16661
16869
|
return [];
|
|
16662
16870
|
}
|
|
16663
|
-
|
|
16664
|
-
|
|
16665
|
-
|
|
16666
|
-
|
|
16667
|
-
);
|
|
16668
|
-
} catch {
|
|
16871
|
+
const manager = this.services.get(
|
|
16872
|
+
CliPackageManagerService_TOKEN
|
|
16873
|
+
);
|
|
16874
|
+
if (!manager) {
|
|
16669
16875
|
return [];
|
|
16670
16876
|
}
|
|
16671
16877
|
const packages = await manager.getPackages();
|
|
@@ -16868,7 +17074,7 @@ var ServerListProcessor = class {
|
|
|
16868
17074
|
this.description = "Show configured servers and their connection status";
|
|
16869
17075
|
}
|
|
16870
17076
|
async processCommand(_command, context2) {
|
|
16871
|
-
const manager = context2.services.
|
|
17077
|
+
const manager = context2.services.getRequired(
|
|
16872
17078
|
CliServerManager_TOKEN
|
|
16873
17079
|
);
|
|
16874
17080
|
if (!manager || manager.connections.size === 0) {
|
|
@@ -16907,7 +17113,7 @@ var ServerStatusProcessor = class {
|
|
|
16907
17113
|
context2.process.exit(1);
|
|
16908
17114
|
return;
|
|
16909
17115
|
}
|
|
16910
|
-
const manager = context2.services.
|
|
17116
|
+
const manager = context2.services.getRequired(
|
|
16911
17117
|
CliServerManager_TOKEN
|
|
16912
17118
|
);
|
|
16913
17119
|
const connection = manager?.getConnection(serverName);
|
|
@@ -16917,7 +17123,7 @@ var ServerStatusProcessor = class {
|
|
|
16917
17123
|
return;
|
|
16918
17124
|
}
|
|
16919
17125
|
context2.spinner?.show(`Pinging ${serverName}...`);
|
|
16920
|
-
context2.
|
|
17126
|
+
context2.notifier.info(`Pinging ${serverName}`);
|
|
16921
17127
|
const reachable = await connection.ping();
|
|
16922
17128
|
context2.spinner?.hide();
|
|
16923
17129
|
if (reachable) {
|
|
@@ -16948,7 +17154,7 @@ var ServerReconnectProcessor = class {
|
|
|
16948
17154
|
context2.process.exit(1);
|
|
16949
17155
|
return;
|
|
16950
17156
|
}
|
|
16951
|
-
const manager = context2.services.
|
|
17157
|
+
const manager = context2.services.getRequired(
|
|
16952
17158
|
CliServerManager_TOKEN
|
|
16953
17159
|
);
|
|
16954
17160
|
if (!manager) {
|
|
@@ -16957,7 +17163,7 @@ var ServerReconnectProcessor = class {
|
|
|
16957
17163
|
return;
|
|
16958
17164
|
}
|
|
16959
17165
|
context2.spinner?.show(`Reconnecting to ${serverName}...`);
|
|
16960
|
-
context2.
|
|
17166
|
+
context2.notifier.info(`Reconnecting to ${serverName}`);
|
|
16961
17167
|
const result = await manager.reconnect(serverName);
|
|
16962
17168
|
context2.spinner?.hide();
|
|
16963
17169
|
if (result.success) {
|
|
@@ -16987,7 +17193,7 @@ var ServerDefaultProcessor = class {
|
|
|
16987
17193
|
];
|
|
16988
17194
|
}
|
|
16989
17195
|
async processCommand(command2, context2) {
|
|
16990
|
-
const manager = context2.services.
|
|
17196
|
+
const manager = context2.services.getRequired(
|
|
16991
17197
|
CliServerManager_TOKEN
|
|
16992
17198
|
);
|
|
16993
17199
|
if (!manager) {
|
|
@@ -17023,8 +17229,6 @@ var ServerDefaultProcessor = class {
|
|
|
17023
17229
|
}
|
|
17024
17230
|
}
|
|
17025
17231
|
};
|
|
17026
|
-
|
|
17027
|
-
// src/lib/server/cli-ssh-command-processor.ts
|
|
17028
17232
|
var CliSshCommandProcessor = class {
|
|
17029
17233
|
constructor() {
|
|
17030
17234
|
this.command = "ssh";
|
|
@@ -17048,7 +17252,7 @@ var CliSshCommandProcessor = class {
|
|
|
17048
17252
|
this.resolved = false;
|
|
17049
17253
|
}
|
|
17050
17254
|
async processCommand(command2, context2) {
|
|
17051
|
-
const manager = context2.services.
|
|
17255
|
+
const manager = context2.services.getRequired(
|
|
17052
17256
|
CliServerManager_TOKEN
|
|
17053
17257
|
);
|
|
17054
17258
|
if (!manager) {
|
|
@@ -17142,7 +17346,7 @@ var CliSshCommandProcessor = class {
|
|
|
17142
17346
|
connection: shellServers[0].connection
|
|
17143
17347
|
};
|
|
17144
17348
|
}
|
|
17145
|
-
const manager = context2.services.
|
|
17349
|
+
const manager = context2.services.getRequired(
|
|
17146
17350
|
CliServerManager_TOKEN
|
|
17147
17351
|
);
|
|
17148
17352
|
if (manager?.defaultServer) {
|
|
@@ -17335,7 +17539,10 @@ var CliSshCommandProcessor = class {
|
|
|
17335
17539
|
if (cmd) {
|
|
17336
17540
|
url += `&cmd=${encodeURIComponent(cmd)}`;
|
|
17337
17541
|
}
|
|
17338
|
-
return
|
|
17542
|
+
return cliCore.buildAuthenticatedWebSocketUrl(
|
|
17543
|
+
url,
|
|
17544
|
+
() => connection.resolveAuthHeaders()
|
|
17545
|
+
);
|
|
17339
17546
|
}
|
|
17340
17547
|
cleanup() {
|
|
17341
17548
|
if (this.socket) {
|
|
@@ -17384,6 +17591,11 @@ function initializeTerminal(container, opts) {
|
|
|
17384
17591
|
terminal.open(container);
|
|
17385
17592
|
fitAddon.fit();
|
|
17386
17593
|
requestAnimationFrame(() => fitAddon.fit());
|
|
17594
|
+
if (document.fonts?.ready) {
|
|
17595
|
+
document.fonts.ready.then(() => {
|
|
17596
|
+
requestAnimationFrame(() => fitAddon.fit());
|
|
17597
|
+
});
|
|
17598
|
+
}
|
|
17387
17599
|
container.classList.add("terminal-container");
|
|
17388
17600
|
container.style.background = opts.theme?.background ?? "#000";
|
|
17389
17601
|
const wheelListener = (e) => e.preventDefault();
|
|
@@ -17626,19 +17838,21 @@ async function initializeServices(options) {
|
|
|
17626
17838
|
const logger = new CliLogger();
|
|
17627
17839
|
const commandHistory = new CliCommandHistory(store);
|
|
17628
17840
|
await commandHistory.initialize();
|
|
17629
|
-
services.set([{ provide:
|
|
17841
|
+
services.set([{ provide: CliKeyValueStore_TOKEN, useValue: store, sealed: true }]);
|
|
17630
17842
|
const stateStoreManager = new CliStateStoreManager(services, registry);
|
|
17631
17843
|
const processRegistry = new CliProcessRegistry();
|
|
17632
17844
|
services.set([
|
|
17633
17845
|
{
|
|
17634
17846
|
provide: CliStateStoreManager_TOKEN,
|
|
17635
|
-
useValue: stateStoreManager
|
|
17847
|
+
useValue: stateStoreManager,
|
|
17848
|
+
sealed: true
|
|
17636
17849
|
},
|
|
17637
|
-
{ provide: CliProcessorsRegistry_TOKEN, useValue: registry },
|
|
17638
|
-
{ provide: CliCommandHistory_TOKEN, useValue: commandHistory },
|
|
17850
|
+
{ provide: CliProcessorsRegistry_TOKEN, useValue: registry, sealed: true },
|
|
17851
|
+
{ provide: CliCommandHistory_TOKEN, useValue: commandHistory, sealed: true },
|
|
17639
17852
|
{
|
|
17640
17853
|
provide: CliProcessRegistry_TOKEN,
|
|
17641
|
-
useValue: processRegistry
|
|
17854
|
+
useValue: processRegistry,
|
|
17855
|
+
sealed: true
|
|
17642
17856
|
}
|
|
17643
17857
|
]);
|
|
17644
17858
|
if (pendingServices.length > 0) {
|
|
@@ -17649,7 +17863,8 @@ async function initializeServices(options) {
|
|
|
17649
17863
|
services.set([
|
|
17650
17864
|
{
|
|
17651
17865
|
provide: ICliPingServerService_TOKEN,
|
|
17652
|
-
|
|
17866
|
+
useClass: CliDefaultPingServerService,
|
|
17867
|
+
sealed: true
|
|
17653
17868
|
}
|
|
17654
17869
|
]);
|
|
17655
17870
|
}
|
|
@@ -17659,25 +17874,27 @@ async function initializeServices(options) {
|
|
|
17659
17874
|
syntaxRegistry.register(new MarkdownHighlighter());
|
|
17660
17875
|
syntaxRegistry.register(new YamlHighlighter());
|
|
17661
17876
|
services.set([
|
|
17662
|
-
{ provide:
|
|
17877
|
+
{ provide: SyntaxHighlighterRegistry_TOKEN, useValue: syntaxRegistry, sealed: true }
|
|
17663
17878
|
]);
|
|
17664
17879
|
if (!pendingTokens.has(ICliEnvironment_TOKEN)) {
|
|
17665
17880
|
services.set([
|
|
17666
17881
|
{
|
|
17667
17882
|
provide: ICliEnvironment_TOKEN,
|
|
17668
|
-
|
|
17883
|
+
useClass: CliEnvironment,
|
|
17884
|
+
sealed: true
|
|
17669
17885
|
}
|
|
17670
17886
|
]);
|
|
17671
17887
|
}
|
|
17672
17888
|
services.set([
|
|
17673
17889
|
{
|
|
17674
17890
|
provide: cliCore.ICliDragDropService_TOKEN,
|
|
17675
|
-
useValue: dragDropService
|
|
17891
|
+
useValue: dragDropService,
|
|
17892
|
+
sealed: true
|
|
17676
17893
|
}
|
|
17677
17894
|
]);
|
|
17678
17895
|
const translator = new CliTranslationService();
|
|
17679
17896
|
services.set([
|
|
17680
|
-
{ provide: cliCore.ICliTranslationService_TOKEN, useValue: translator }
|
|
17897
|
+
{ provide: cliCore.ICliTranslationService_TOKEN, useValue: translator, sealed: true }
|
|
17681
17898
|
]);
|
|
17682
17899
|
return {
|
|
17683
17900
|
services,
|
|
@@ -17789,10 +18006,18 @@ var CliEngine = class {
|
|
|
17789
18006
|
provide: CliBackgroundServiceRegistry_TOKEN,
|
|
17790
18007
|
useValue: this.executionContext.backgroundServices
|
|
17791
18008
|
}]);
|
|
17792
|
-
const
|
|
18009
|
+
const serverAuthService = new CliServerAuthService(services);
|
|
18010
|
+
services.set([
|
|
18011
|
+
{ provide: cliCore.ICliServerAuthService_TOKEN, useValue: serverAuthService, sealed: true }
|
|
18012
|
+
]);
|
|
17793
18013
|
services.set([
|
|
17794
|
-
{
|
|
18014
|
+
{
|
|
18015
|
+
provide: CliServerManager_TOKEN,
|
|
18016
|
+
useClass: CliServerManager,
|
|
18017
|
+
deps: [CliProcessorsRegistry_TOKEN, cliCore.ICliServerAuthService_TOKEN]
|
|
18018
|
+
}
|
|
17795
18019
|
]);
|
|
18020
|
+
const serverManager = services.getRequired(CliServerManager_TOKEN);
|
|
17796
18021
|
if (this.options?.servers && this.options.servers.length > 0) {
|
|
17797
18022
|
await serverManager.connectAll(this.options.servers, {
|
|
17798
18023
|
warn: (msg) => this.executionContext.logger.warn(msg),
|
|
@@ -17812,13 +18037,9 @@ var CliEngine = class {
|
|
|
17812
18037
|
new CliCommandCompletionProvider(this.registry),
|
|
17813
18038
|
new CliParameterCompletionProvider(this.registry, executor)
|
|
17814
18039
|
];
|
|
17815
|
-
|
|
17816
|
-
|
|
17817
|
-
|
|
17818
|
-
cliCore.ICliCompletionProvider_TOKEN
|
|
17819
|
-
) ?? [];
|
|
17820
|
-
} catch {
|
|
17821
|
-
}
|
|
18040
|
+
const pluginProviders = services.getAll(
|
|
18041
|
+
cliCore.ICliCompletionProvider_TOKEN
|
|
18042
|
+
);
|
|
17822
18043
|
this.executionContext.completionEngine.setProviders([
|
|
17823
18044
|
...pluginProviders,
|
|
17824
18045
|
...defaultProviders
|
|
@@ -17926,7 +18147,7 @@ var CliEngine = class {
|
|
|
17926
18147
|
if (!this.executionContext) {
|
|
17927
18148
|
throw new Error("Cannot snapshot before engine has started");
|
|
17928
18149
|
}
|
|
17929
|
-
const stateStoreManager = this.executionContext.services.
|
|
18150
|
+
const stateStoreManager = this.executionContext.services.getRequired(
|
|
17930
18151
|
CliStateStoreManager_TOKEN
|
|
17931
18152
|
);
|
|
17932
18153
|
return {
|
|
@@ -17953,7 +18174,7 @@ var CliEngine = class {
|
|
|
17953
18174
|
});
|
|
17954
18175
|
}
|
|
17955
18176
|
await this.executionContext.commandHistory.setHistory(snap.commandHistory);
|
|
17956
|
-
const stateStoreManager = this.executionContext.services.
|
|
18177
|
+
const stateStoreManager = this.executionContext.services.getRequired(
|
|
17957
18178
|
CliStateStoreManager_TOKEN
|
|
17958
18179
|
);
|
|
17959
18180
|
for (const entry of snap.stateStores) {
|
|
@@ -18013,7 +18234,7 @@ var CliTestHarness = class {
|
|
|
18013
18234
|
this.services = new CliServiceContainer();
|
|
18014
18235
|
this.processRegistry = new CliProcessRegistry();
|
|
18015
18236
|
this.services.set({
|
|
18016
|
-
provide:
|
|
18237
|
+
provide: CliKeyValueStore_TOKEN,
|
|
18017
18238
|
useValue: createInMemoryKvStore()
|
|
18018
18239
|
});
|
|
18019
18240
|
this.services.set({
|
|
@@ -18123,6 +18344,7 @@ var CliTestHarness = class {
|
|
|
18123
18344
|
userSession: this.userSession,
|
|
18124
18345
|
state: this.stateStoreManager.getStateStore("shared"),
|
|
18125
18346
|
backgroundServices: createNoopBackgroundServices(),
|
|
18347
|
+
http: new CliHttpClient(),
|
|
18126
18348
|
promptLength: 0,
|
|
18127
18349
|
currentLine: "",
|
|
18128
18350
|
cursorPosition: 0,
|
|
@@ -18145,11 +18367,7 @@ var CliTestHarness = class {
|
|
|
18145
18367
|
submitCommand: async (command2) => {
|
|
18146
18368
|
await this.executor.executeCommand(command2, context2);
|
|
18147
18369
|
},
|
|
18148
|
-
|
|
18149
|
-
},
|
|
18150
|
-
clearStatusText: () => {
|
|
18151
|
-
},
|
|
18152
|
-
getStatusText: () => void 0,
|
|
18370
|
+
notifier: new CliNotifier(),
|
|
18153
18371
|
createInterval: (cb, ms) => {
|
|
18154
18372
|
const id = setInterval(cb, ms);
|
|
18155
18373
|
return {
|
|
@@ -18402,14 +18620,17 @@ exports.CliHelpCommandProcessor = CliHelpCommandProcessor;
|
|
|
18402
18620
|
exports.CliHistoryCommandProcessor = CliHistoryCommandProcessor;
|
|
18403
18621
|
exports.CliHotKeysCommandProcessor = CliHotKeysCommandProcessor;
|
|
18404
18622
|
exports.CliHtopCommandProcessor = CliHtopCommandProcessor;
|
|
18623
|
+
exports.CliHttpClient = CliHttpClient;
|
|
18405
18624
|
exports.CliInputReader = CliInputReader;
|
|
18406
18625
|
exports.CliJsonCommandProcessor = CliJsonCommandProcessor;
|
|
18407
18626
|
exports.CliKeyValueStore = CliKeyValueStore;
|
|
18627
|
+
exports.CliKeyValueStore_TOKEN = CliKeyValueStore_TOKEN;
|
|
18408
18628
|
exports.CliKillCommandProcessor = CliKillCommandProcessor;
|
|
18409
18629
|
exports.CliLogger = CliLogger;
|
|
18410
18630
|
exports.CliLoremCommandProcessor = CliLoremCommandProcessor;
|
|
18411
18631
|
exports.CliModuleRegistry_TOKEN = CliModuleRegistry_TOKEN;
|
|
18412
18632
|
exports.CliNanoCommandProcessor = CliNanoCommandProcessor;
|
|
18633
|
+
exports.CliNotifier = CliNotifier;
|
|
18413
18634
|
exports.CliOpenCommandProcessor = CliOpenCommandProcessor;
|
|
18414
18635
|
exports.CliPackageManagerService = CliPackageManagerService;
|
|
18415
18636
|
exports.CliPackageManagerService_TOKEN = CliPackageManagerService_TOKEN;
|
|
@@ -18459,6 +18680,7 @@ exports.LIBRARY_VERSION = LIBRARY_VERSION;
|
|
|
18459
18680
|
exports.OverlayAddon = OverlayAddon;
|
|
18460
18681
|
exports.ProcessExitedError = ProcessExitedError;
|
|
18461
18682
|
exports.ScriptLoaderService = ScriptLoaderService;
|
|
18683
|
+
exports.SyntaxHighlighterRegistry_TOKEN = SyntaxHighlighterRegistry_TOKEN;
|
|
18462
18684
|
exports.appendOutputToFile = appendOutputToFile;
|
|
18463
18685
|
exports.appendStderrToFile = appendStderrToFile;
|
|
18464
18686
|
exports.builtinProcessors = builtinProcessors;
|