@f5-sales-demo/xcsh 21.9.2 → 21.9.4
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 +8 -8
- package/src/cli/plugin-cli.ts +31 -17
- package/src/config/model-registry.ts +5 -0
- package/src/extensibility/plugins/marketplace/index.ts +1 -0
- package/src/extensibility/plugins/marketplace/manager.ts +87 -15
- package/src/extensibility/plugins/marketplace/refresh.ts +7 -0
- package/src/internal-urls/build-info.generated.ts +8 -8
- package/src/modes/components/model-selector.ts +6 -4
- package/src/modes/components/plugins/plugin-dashboard.ts +23 -25
- package/src/modes/components/plugins/state-manager.ts +13 -1
- package/src/modes/components/plugins/types.ts +1 -0
- package/src/modes/components/welcome-checks.ts +22 -6
- package/src/modes/controllers/selector-controller.ts +18 -2
- package/src/modes/interactive-mode.ts +10 -2
- package/src/modes/rpc/rpc-mode.ts +5 -1
- package/src/slash-commands/builtin-registry.ts +35 -17
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@f5-sales-demo/xcsh",
|
|
4
|
-
"version": "21.9.
|
|
4
|
+
"version": "21.9.4",
|
|
5
5
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
6
6
|
"homepage": "https://github.com/f5-sales-demo/xcsh",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -61,13 +61,13 @@
|
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@agentclientprotocol/sdk": "1.3.0",
|
|
64
|
-
"@f5-sales-demo/pi-agent-core": "21.9.
|
|
65
|
-
"@f5-sales-demo/pi-ai": "21.9.
|
|
66
|
-
"@f5-sales-demo/pi-natives": "21.9.
|
|
67
|
-
"@f5-sales-demo/pi-resource-management": "21.9.
|
|
68
|
-
"@f5-sales-demo/pi-tui": "21.9.
|
|
69
|
-
"@f5-sales-demo/pi-utils": "21.9.
|
|
70
|
-
"@f5-sales-demo/xcsh-stats": "21.9.
|
|
64
|
+
"@f5-sales-demo/pi-agent-core": "21.9.4",
|
|
65
|
+
"@f5-sales-demo/pi-ai": "21.9.4",
|
|
66
|
+
"@f5-sales-demo/pi-natives": "21.9.4",
|
|
67
|
+
"@f5-sales-demo/pi-resource-management": "21.9.4",
|
|
68
|
+
"@f5-sales-demo/pi-tui": "21.9.4",
|
|
69
|
+
"@f5-sales-demo/pi-utils": "21.9.4",
|
|
70
|
+
"@f5-sales-demo/xcsh-stats": "21.9.4",
|
|
71
71
|
"@mozilla/readability": "^0.6",
|
|
72
72
|
"@sinclair/typebox": "^0.34",
|
|
73
73
|
"@xterm/headless": "^6.0",
|
package/src/cli/plugin-cli.ts
CHANGED
|
@@ -9,6 +9,7 @@ import chalk from "chalk";
|
|
|
9
9
|
import { resolveOrDefaultProjectRegistryPath } from "../discovery/helpers";
|
|
10
10
|
import { PluginManager, parseSettingValue, validateSetting } from "../extensibility/plugins";
|
|
11
11
|
import {
|
|
12
|
+
formatMarketplaceRefreshWarning,
|
|
12
13
|
getInstalledPluginsRegistryPath,
|
|
13
14
|
getMarketplacesCacheDir,
|
|
14
15
|
getMarketplacesRegistryPath,
|
|
@@ -246,8 +247,10 @@ async function handleMarketplace(args: string[], _flags: PluginCommandArgs["flag
|
|
|
246
247
|
await manager.updateMarketplace(name);
|
|
247
248
|
console.log(chalk.green(`${theme.status.success} Updated marketplace: ${name}`));
|
|
248
249
|
} else {
|
|
249
|
-
const
|
|
250
|
-
|
|
250
|
+
const result = await manager.refreshMarketplaces();
|
|
251
|
+
const warning = formatMarketplaceRefreshWarning(result);
|
|
252
|
+
if (warning) console.error(chalk.yellow(warning));
|
|
253
|
+
console.log(chalk.green(`${theme.status.success} Updated ${result.successful.length} marketplace(s)`));
|
|
251
254
|
}
|
|
252
255
|
} catch (err) {
|
|
253
256
|
console.error(chalk.red(`${theme.status.error} Failed to update marketplace: ${err}`));
|
|
@@ -285,6 +288,9 @@ async function handleDiscover(args: string[], _flags: PluginCommandArgs["flags"]
|
|
|
285
288
|
const marketplace = args[0];
|
|
286
289
|
const manager = await makeMarketplaceManager();
|
|
287
290
|
try {
|
|
291
|
+
const refresh = await manager.refreshMarketplaces(marketplace ? [marketplace] : undefined);
|
|
292
|
+
const warning = formatMarketplaceRefreshWarning(refresh);
|
|
293
|
+
if (warning) console.error(chalk.yellow(warning));
|
|
288
294
|
const plugins = await manager.listAvailablePlugins(marketplace);
|
|
289
295
|
|
|
290
296
|
if (plugins.length === 0) {
|
|
@@ -344,12 +350,16 @@ async function handleUpgrade(args: string[], flags: PluginCommandArgs["flags"]):
|
|
|
344
350
|
return;
|
|
345
351
|
}
|
|
346
352
|
|
|
353
|
+
const refresh = await manager.refreshMarketplaces();
|
|
354
|
+
const refreshWarning = formatMarketplaceRefreshWarning(refresh);
|
|
355
|
+
if (refreshWarning) console.error(chalk.yellow(refreshWarning));
|
|
356
|
+
|
|
347
357
|
if (pluginId) {
|
|
348
358
|
if (flags.scope) {
|
|
349
|
-
const result = await manager.upgradePlugin(pluginId, flags.scope
|
|
359
|
+
const result = await manager.upgradePlugin(pluginId, flags.scope);
|
|
350
360
|
console.log(chalk.green(`Upgraded ${pluginId} (${flags.scope}) to ${result.version}`));
|
|
351
361
|
} else {
|
|
352
|
-
const entries = await manager.upgradePluginAcrossScopes(pluginId
|
|
362
|
+
const entries = await manager.upgradePluginAcrossScopes(pluginId);
|
|
353
363
|
for (const entry of entries) {
|
|
354
364
|
console.log(chalk.green(`Upgraded ${pluginId} (${entry.scope}) to ${entry.version}`));
|
|
355
365
|
}
|
|
@@ -362,7 +372,7 @@ async function handleUpgrade(args: string[], flags: PluginCommandArgs["flags"]):
|
|
|
362
372
|
),
|
|
363
373
|
);
|
|
364
374
|
}
|
|
365
|
-
const results = await manager.upgradeAllPlugins(
|
|
375
|
+
const results = await manager.upgradeAllPlugins();
|
|
366
376
|
if (results.length === 0) {
|
|
367
377
|
console.log("All marketplace plugins are up to date.");
|
|
368
378
|
} else {
|
|
@@ -395,20 +405,24 @@ async function handleInstall(
|
|
|
395
405
|
// marketplace plugin instead of a same-named public npm package.
|
|
396
406
|
const mktMgr = await makeMarketplaceManager();
|
|
397
407
|
const marketplaces = await mktMgr.listMarketplaces();
|
|
408
|
+
const preview = flags.dryRun ? await mktMgr.previewMarketplacePlugins() : undefined;
|
|
409
|
+
const refresh = preview ?? (await mktMgr.refreshMarketplaces());
|
|
410
|
+
const refreshWarning = formatMarketplaceRefreshWarning(refresh);
|
|
411
|
+
if (refreshWarning) console.error(chalk.yellow(refreshWarning));
|
|
398
412
|
const knownMarketplaces = new Set(marketplaces.map(m => m.name));
|
|
399
413
|
const catalogIndex = new Map<string, string[]>();
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
414
|
+
const listings = preview
|
|
415
|
+
? preview.plugins
|
|
416
|
+
: await Promise.all(
|
|
417
|
+
marketplaces.map(async mp => {
|
|
418
|
+
const plugins = await mktMgr.listAvailablePlugins(mp.name).catch(() => []);
|
|
419
|
+
return plugins.map(plugin => ({ marketplace: mp.name, plugin }));
|
|
420
|
+
}),
|
|
421
|
+
).then(groups => groups.flat());
|
|
422
|
+
for (const { marketplace, plugin } of listings) {
|
|
423
|
+
const sources = catalogIndex.get(plugin.name) ?? [];
|
|
424
|
+
if (!sources.includes(marketplace)) sources.push(marketplace);
|
|
425
|
+
catalogIndex.set(plugin.name, sources);
|
|
412
426
|
}
|
|
413
427
|
|
|
414
428
|
for (const spec of packages) {
|
|
@@ -2060,6 +2060,11 @@ export class ModelRegistry {
|
|
|
2060
2060
|
return new Set(this.#configuredProviderIds);
|
|
2061
2061
|
}
|
|
2062
2062
|
|
|
2063
|
+
/** Whether this provider is explicitly or implicitly configured to run without credentials. */
|
|
2064
|
+
isProviderKeyless(provider: string): boolean {
|
|
2065
|
+
return this.#keylessProviders.has(provider);
|
|
2066
|
+
}
|
|
2067
|
+
|
|
2063
2068
|
getDiscoverableProviders(): string[] {
|
|
2064
2069
|
const disabledProviders = getDisabledProviderIdsFromSettings();
|
|
2065
2070
|
return this.#discoverableProviders
|
|
@@ -69,6 +69,15 @@ export interface PluginUpdate {
|
|
|
69
69
|
to: string;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
export interface MarketplaceRefreshResult {
|
|
73
|
+
successful: string[];
|
|
74
|
+
failed: string[];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface MarketplaceCatalogPreview extends MarketplaceRefreshResult {
|
|
78
|
+
plugins: Array<{ marketplace: string; plugin: MarketplacePluginEntry }>;
|
|
79
|
+
}
|
|
80
|
+
|
|
72
81
|
// ── Manager ──────────────────────────────────────────────────────────────────
|
|
73
82
|
|
|
74
83
|
export class MarketplaceManager {
|
|
@@ -155,16 +164,10 @@ export class MarketplaceManager {
|
|
|
155
164
|
throw new Error(`Marketplace "${name}" not found`);
|
|
156
165
|
}
|
|
157
166
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
if (Bun.env.XCSH_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE === "1") {
|
|
163
|
-
logger.debug("Marketplace fetch failed, preserving cached catalog", { name, error: String(err) });
|
|
164
|
-
return existing;
|
|
165
|
-
}
|
|
166
|
-
throw err;
|
|
167
|
-
}
|
|
167
|
+
const fetchResult: { catalog: MarketplaceCatalog; clonePath?: string } = await fetchMarketplace(
|
|
168
|
+
existing.sourceUri,
|
|
169
|
+
this.#opts.marketplacesCacheDir,
|
|
170
|
+
);
|
|
168
171
|
const { catalog, clonePath } = fetchResult;
|
|
169
172
|
|
|
170
173
|
// Guard against upstream catalog silently renaming itself — the registry
|
|
@@ -217,6 +220,71 @@ export class MarketplaceManager {
|
|
|
217
220
|
return reg.marketplaces;
|
|
218
221
|
}
|
|
219
222
|
|
|
223
|
+
/**
|
|
224
|
+
* Best-effort interactive refresh. Unlike refreshStaleMarketplaces(), this always
|
|
225
|
+
* fetches every selected marketplace and isolates failures so cached catalogs remain usable.
|
|
226
|
+
*/
|
|
227
|
+
async refreshMarketplaces(names?: readonly string[]): Promise<MarketplaceRefreshResult> {
|
|
228
|
+
const selected = names ?? (await this.listMarketplaces()).map(marketplace => marketplace.name);
|
|
229
|
+
const result: MarketplaceRefreshResult = { successful: [], failed: [] };
|
|
230
|
+
|
|
231
|
+
for (const name of new Set(selected)) {
|
|
232
|
+
try {
|
|
233
|
+
await this.updateMarketplace(name);
|
|
234
|
+
result.successful.push(name);
|
|
235
|
+
} catch (error) {
|
|
236
|
+
logger.debug("Interactive marketplace refresh failed; preserving cached catalog", {
|
|
237
|
+
name,
|
|
238
|
+
error: String(error),
|
|
239
|
+
});
|
|
240
|
+
result.failed.push(name);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return result;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/** Fetch current catalogs without mutating persistent state (used by dry-run workflows). */
|
|
248
|
+
async previewMarketplacePlugins(names?: readonly string[]): Promise<MarketplaceCatalogPreview> {
|
|
249
|
+
const reg = await readMarketplacesRegistry(this.#opts.marketplacesRegistryPath);
|
|
250
|
+
const selectedNames = names ?? reg.marketplaces.map(marketplace => marketplace.name);
|
|
251
|
+
const selected = new Map(reg.marketplaces.map(marketplace => [marketplace.name, marketplace]));
|
|
252
|
+
const previewDir = await fs.mkdtemp(path.join(os.tmpdir(), "xcsh-marketplace-preview-"));
|
|
253
|
+
const result: MarketplaceCatalogPreview = { successful: [], failed: [], plugins: [] };
|
|
254
|
+
|
|
255
|
+
try {
|
|
256
|
+
for (const name of new Set(selectedNames)) {
|
|
257
|
+
const marketplace = selected.get(name);
|
|
258
|
+
if (!marketplace) {
|
|
259
|
+
result.failed.push(name);
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
let catalog: MarketplaceCatalog | undefined;
|
|
264
|
+
try {
|
|
265
|
+
const fetched = await fetchMarketplace(marketplace.sourceUri, previewDir);
|
|
266
|
+
if (fetched.catalog.name !== name) {
|
|
267
|
+
throw new Error(`Marketplace catalog name changed from "${name}" to "${fetched.catalog.name}".`);
|
|
268
|
+
}
|
|
269
|
+
catalog = fetched.catalog;
|
|
270
|
+
result.successful.push(name);
|
|
271
|
+
} catch (error) {
|
|
272
|
+
logger.debug("Marketplace preview refresh failed; using cached catalog when available", {
|
|
273
|
+
name,
|
|
274
|
+
error: String(error),
|
|
275
|
+
});
|
|
276
|
+
result.failed.push(name);
|
|
277
|
+
catalog = await this.#readCatalog(marketplace).catch(() => undefined);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
for (const plugin of catalog?.plugins ?? []) result.plugins.push({ marketplace: name, plugin });
|
|
281
|
+
}
|
|
282
|
+
return result;
|
|
283
|
+
} finally {
|
|
284
|
+
await fs.rm(previewDir, { recursive: true, force: true });
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
220
288
|
// ── Plugin discovery ──────────────────────────────────────────────────────
|
|
221
289
|
|
|
222
290
|
async listAvailablePlugins(marketplace?: string): Promise<MarketplacePluginEntry[]> {
|
|
@@ -233,8 +301,12 @@ export class MarketplaceManager {
|
|
|
233
301
|
|
|
234
302
|
const all: MarketplacePluginEntry[] = [];
|
|
235
303
|
for (const entry of reg.marketplaces) {
|
|
236
|
-
|
|
237
|
-
|
|
304
|
+
try {
|
|
305
|
+
const catalog = await this.#readCatalog(entry);
|
|
306
|
+
all.push(...catalog.plugins);
|
|
307
|
+
} catch (error) {
|
|
308
|
+
logger.debug("Skipping unavailable marketplace catalog", { name: entry.name, error: String(error) });
|
|
309
|
+
}
|
|
238
310
|
}
|
|
239
311
|
return all;
|
|
240
312
|
}
|
|
@@ -574,7 +646,7 @@ export class MarketplaceManager {
|
|
|
574
646
|
// Explicit upgrade flows pass refresh:true to re-fetch catalogs from source before
|
|
575
647
|
// comparing, so freshly-published versions are seen. Passive callers (startup notify,
|
|
576
648
|
// dashboard poll) omit it and rely on the 24h TTL (refreshStaleMarketplaces).
|
|
577
|
-
if (opts?.refresh) await this.
|
|
649
|
+
if (opts?.refresh) await this.refreshMarketplaces();
|
|
578
650
|
const mktReg = await readMarketplacesRegistry(this.#opts.marketplacesRegistryPath);
|
|
579
651
|
return this.#collectUpdates(mktReg);
|
|
580
652
|
}
|
|
@@ -670,7 +742,7 @@ export class MarketplaceManager {
|
|
|
670
742
|
scope?: "user" | "project" | "local",
|
|
671
743
|
opts?: { refresh?: boolean },
|
|
672
744
|
): Promise<InstalledPluginEntry> {
|
|
673
|
-
if (opts?.refresh) await this.
|
|
745
|
+
if (opts?.refresh) await this.refreshMarketplaces();
|
|
674
746
|
const parsed = parsePluginId(pluginId);
|
|
675
747
|
if (!parsed) {
|
|
676
748
|
throw new Error(`Invalid plugin ID: "${pluginId}". Expected "name@marketplace".`);
|
|
@@ -707,7 +779,7 @@ export class MarketplaceManager {
|
|
|
707
779
|
// Upgrade a plugin across all scopes where it is installed.
|
|
708
780
|
// Returns one entry per scope upgraded (0–2 entries).
|
|
709
781
|
async upgradePluginAcrossScopes(pluginId: string, opts?: { refresh?: boolean }): Promise<InstalledPluginEntry[]> {
|
|
710
|
-
if (opts?.refresh) await this.
|
|
782
|
+
if (opts?.refresh) await this.refreshMarketplaces();
|
|
711
783
|
const parsed = parsePluginId(pluginId);
|
|
712
784
|
if (!parsed) {
|
|
713
785
|
throw new Error(`Invalid plugin ID: "${pluginId}". Expected "name@marketplace".`);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MarketplaceRefreshResult } from "./manager";
|
|
2
|
+
|
|
3
|
+
export function formatMarketplaceRefreshWarning(result: MarketplaceRefreshResult): string | undefined {
|
|
4
|
+
if (result.failed.length === 0) return undefined;
|
|
5
|
+
const noun = result.failed.length === 1 ? "marketplace" : "marketplaces";
|
|
6
|
+
return `Warning: Could not refresh ${noun}: ${result.failed.join(", ")}. Showing last-known catalog data where available (offline/stale).`;
|
|
7
|
+
}
|
|
@@ -17,17 +17,17 @@ export interface BuildInfo {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export const BUILD_INFO: BuildInfo = {
|
|
20
|
-
"version": "21.9.
|
|
21
|
-
"commit": "
|
|
22
|
-
"shortCommit": "
|
|
20
|
+
"version": "21.9.4",
|
|
21
|
+
"commit": "37f44eea61d5c229e87076fe92963c7f35913b47",
|
|
22
|
+
"shortCommit": "37f44ee",
|
|
23
23
|
"branch": "main",
|
|
24
|
-
"tag": "v21.9.
|
|
25
|
-
"commitDate": "2026-09-
|
|
26
|
-
"buildDate": "2026-09-
|
|
24
|
+
"tag": "v21.9.4",
|
|
25
|
+
"commitDate": "2026-09-03T15:33:15+00:00",
|
|
26
|
+
"buildDate": "2026-09-03T16:17:03.288Z",
|
|
27
27
|
"dirty": true,
|
|
28
28
|
"prNumber": "",
|
|
29
29
|
"repoUrl": "https://github.com/f5-sales-demo/xcsh",
|
|
30
30
|
"repoSlug": "f5-sales-demo/xcsh",
|
|
31
|
-
"commitUrl": "https://github.com/f5-sales-demo/xcsh/commit/
|
|
32
|
-
"releaseUrl": "https://github.com/f5-sales-demo/xcsh/releases/tag/v21.9.
|
|
31
|
+
"commitUrl": "https://github.com/f5-sales-demo/xcsh/commit/37f44eea61d5c229e87076fe92963c7f35913b47",
|
|
32
|
+
"releaseUrl": "https://github.com/f5-sales-demo/xcsh/releases/tag/v21.9.4"
|
|
33
33
|
};
|
|
@@ -244,10 +244,12 @@ export function buildProviderModelGroups(
|
|
|
244
244
|
|
|
245
245
|
const authenticated: ProviderModelGroup[] = [];
|
|
246
246
|
const localItems: ModelItem[] = [];
|
|
247
|
+
let localStale = false;
|
|
247
248
|
for (const [provider, providerItems] of byProvider) {
|
|
248
249
|
const discovery = getDiscoveryState(provider);
|
|
249
250
|
if (LOCAL_PROVIDER_IDS.has(provider)) {
|
|
250
|
-
if (discovery?.status !== "ok") continue;
|
|
251
|
+
if (discovery?.status !== "ok" && discovery?.status !== "cached") continue;
|
|
252
|
+
localStale ||= discovery.status === "cached" || discovery.stale;
|
|
251
253
|
localItems.push(...providerItems);
|
|
252
254
|
continue;
|
|
253
255
|
}
|
|
@@ -284,8 +286,8 @@ export function buildProviderModelGroups(
|
|
|
284
286
|
id: LOCAL_PROVIDERS_TAB,
|
|
285
287
|
label: "Local Providers",
|
|
286
288
|
classification: "local",
|
|
287
|
-
discoveryStatus: "ok",
|
|
288
|
-
stale:
|
|
289
|
+
discoveryStatus: localStale ? "cached" : "ok",
|
|
290
|
+
stale: localStale,
|
|
289
291
|
models: localItems,
|
|
290
292
|
};
|
|
291
293
|
if (currentProvider && LOCAL_PROVIDER_IDS.has(currentProvider)) authenticated.unshift(localGroup);
|
|
@@ -384,7 +386,7 @@ export class ModelSelectorComponent extends Container {
|
|
|
384
386
|
const hintText =
|
|
385
387
|
scopedModels.length > 0
|
|
386
388
|
? "Showing models from --models scope"
|
|
387
|
-
: "Only showing models
|
|
389
|
+
: "Only showing models from configured providers (see README for details)";
|
|
388
390
|
this.addChild(new Text(theme.fg("warning", hintText), 0, 0));
|
|
389
391
|
this.addChild(new Spacer(1));
|
|
390
392
|
|
|
@@ -16,6 +16,7 @@ import { invalidate as invalidateFsCache } from "../../../capability/fs";
|
|
|
16
16
|
import { clearXcshPluginRootsCache, resolveActiveProjectRegistryPath } from "../../../discovery/helpers";
|
|
17
17
|
import { PluginManager } from "../../../extensibility/plugins";
|
|
18
18
|
import {
|
|
19
|
+
formatMarketplaceRefreshWarning,
|
|
19
20
|
getInstalledPluginsRegistryPath,
|
|
20
21
|
getMarketplacesCacheDir,
|
|
21
22
|
getMarketplacesRegistryPath,
|
|
@@ -27,7 +28,7 @@ import { matchesAppInterrupt } from "../../utils/keybinding-matchers";
|
|
|
27
28
|
import { DynamicBorder } from "../dynamic-border";
|
|
28
29
|
import { PluginInspectorPane } from "./plugin-inspector-pane";
|
|
29
30
|
import { PluginListPane } from "./plugin-list-pane";
|
|
30
|
-
import { applySearch,
|
|
31
|
+
import { applySearch, createInitialState, filterByTab, refreshState } from "./state-manager";
|
|
31
32
|
import type { DashboardPlugin, PluginDashboardState, PluginTabId } from "./types";
|
|
32
33
|
|
|
33
34
|
const DEFAULT_MARKETPLACE = "f5-sales-demo/marketplace";
|
|
@@ -113,14 +114,16 @@ export class PluginDashboard extends Container {
|
|
|
113
114
|
// Network failure on first run is fine — continue with whatever is available
|
|
114
115
|
}
|
|
115
116
|
|
|
117
|
+
let refreshWarning: string | undefined;
|
|
116
118
|
try {
|
|
117
|
-
await this.#mgr.
|
|
118
|
-
} catch {
|
|
119
|
-
|
|
119
|
+
refreshWarning = formatMarketplaceRefreshWarning(await this.#mgr.refreshMarketplaces());
|
|
120
|
+
} catch (error) {
|
|
121
|
+
refreshWarning = `Warning: Marketplace refresh failed. Showing last-known catalog data where available (offline/stale): ${error instanceof Error ? error.message : String(error)}`;
|
|
120
122
|
}
|
|
121
123
|
|
|
122
124
|
try {
|
|
123
125
|
this.#state = await createInitialState(this.#mgr, this.#npmMgr);
|
|
126
|
+
this.#state.warning = refreshWarning ?? null;
|
|
124
127
|
} catch (error) {
|
|
125
128
|
this.#state = {
|
|
126
129
|
tabs: [{ id: "installed", label: "Installed", count: 0 }],
|
|
@@ -132,6 +135,7 @@ export class PluginDashboard extends Container {
|
|
|
132
135
|
selectedIndex: 0,
|
|
133
136
|
scrollOffset: 0,
|
|
134
137
|
notice: null,
|
|
138
|
+
warning: refreshWarning ?? null,
|
|
135
139
|
loading: false,
|
|
136
140
|
loadError: error instanceof Error ? error.message : String(error),
|
|
137
141
|
};
|
|
@@ -197,30 +201,15 @@ export class PluginDashboard extends Container {
|
|
|
197
201
|
this.#buildLayout();
|
|
198
202
|
}
|
|
199
203
|
|
|
200
|
-
async #reloadData(): Promise<void> {
|
|
204
|
+
async #reloadData(refreshRemote = false): Promise<void> {
|
|
201
205
|
this.#state.loading = true;
|
|
202
206
|
this.#state.loadError = null;
|
|
203
207
|
this.#buildLayout();
|
|
204
208
|
|
|
205
209
|
try {
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
const prevTabId = this.#activeTabId();
|
|
210
|
-
const nextTabIndex = Math.max(
|
|
211
|
-
0,
|
|
212
|
-
tabs.findIndex(t => t.id === prevTabId),
|
|
213
|
-
);
|
|
214
|
-
|
|
215
|
-
this.#state.allPlugins = allPlugins;
|
|
216
|
-
this.#state.tabs = tabs;
|
|
217
|
-
this.#state.activeTabIndex = nextTabIndex;
|
|
218
|
-
this.#applyFilters();
|
|
219
|
-
|
|
220
|
-
if (selectedId) {
|
|
221
|
-
const idx = this.#state.searchFiltered.findIndex(p => p.id === selectedId);
|
|
222
|
-
if (idx >= 0) this.#state.selectedIndex = idx;
|
|
223
|
-
}
|
|
210
|
+
const refresh = refreshRemote ? await this.#mgr.refreshMarketplaces() : undefined;
|
|
211
|
+
this.#state = await refreshState(this.#state, this.#mgr, this.#npmMgr);
|
|
212
|
+
if (refresh) this.#state.warning = formatMarketplaceRefreshWarning(refresh) ?? null;
|
|
224
213
|
this.#clampSelection();
|
|
225
214
|
} catch (error) {
|
|
226
215
|
this.#state.loadError = error instanceof Error ? error.message : String(error);
|
|
@@ -266,6 +255,8 @@ export class PluginDashboard extends Container {
|
|
|
266
255
|
this.#rebuildAndRender();
|
|
267
256
|
|
|
268
257
|
try {
|
|
258
|
+
const refresh = await this.#mgr.refreshMarketplaces([plugin.marketplace]);
|
|
259
|
+
this.#state.warning = formatMarketplaceRefreshWarning(refresh) ?? null;
|
|
269
260
|
await this.#mgr.installPlugin(plugin.name, plugin.marketplace);
|
|
270
261
|
this.#state.notice = `Installed ${plugin.name}`;
|
|
271
262
|
await this.#reloadData();
|
|
@@ -353,7 +344,9 @@ export class PluginDashboard extends Container {
|
|
|
353
344
|
this.#rebuildAndRender();
|
|
354
345
|
|
|
355
346
|
try {
|
|
356
|
-
await this.#mgr.
|
|
347
|
+
const refresh = await this.#mgr.refreshMarketplaces(plugin.marketplace ? [plugin.marketplace] : undefined);
|
|
348
|
+
this.#state.warning = formatMarketplaceRefreshWarning(refresh) ?? null;
|
|
349
|
+
await this.#mgr.upgradePlugin(plugin.id, plugin.scope);
|
|
357
350
|
this.#state.notice = t("plugins.dashboard.upgraded", { name: plugin.name });
|
|
358
351
|
await this.#reloadData();
|
|
359
352
|
} catch (error) {
|
|
@@ -409,6 +402,11 @@ export class PluginDashboard extends Container {
|
|
|
409
402
|
this.addChild(new Spacer(1));
|
|
410
403
|
}
|
|
411
404
|
|
|
405
|
+
if (this.#state.warning) {
|
|
406
|
+
this.addChild(new Text(theme.fg("warning", replaceTabs(this.#state.warning)), 0, 0));
|
|
407
|
+
this.addChild(new Spacer(1));
|
|
408
|
+
}
|
|
409
|
+
|
|
412
410
|
if (this.#state.loading) {
|
|
413
411
|
this.addChild(new Text(theme.fg("muted", "Loading plugins..."), 0, 0));
|
|
414
412
|
this.addChild(new Spacer(1));
|
|
@@ -498,7 +496,7 @@ export class PluginDashboard extends Container {
|
|
|
498
496
|
}
|
|
499
497
|
|
|
500
498
|
if (matchesKey(data, "ctrl+r")) {
|
|
501
|
-
void this.#reloadData();
|
|
499
|
+
void this.#reloadData(true);
|
|
502
500
|
return;
|
|
503
501
|
}
|
|
504
502
|
|
|
@@ -204,6 +204,7 @@ export async function refreshState(
|
|
|
204
204
|
mgr: MarketplaceManager,
|
|
205
205
|
npmMgr: PluginManager,
|
|
206
206
|
): Promise<PluginDashboardState> {
|
|
207
|
+
const selectedId = state.searchFiltered[state.selectedIndex]?.id;
|
|
207
208
|
const allPlugins = await loadAllPlugins(mgr, npmMgr);
|
|
208
209
|
const tabs = buildTabs(allPlugins);
|
|
209
210
|
const prevTabId = state.tabs[state.activeTabIndex]?.id ?? "installed";
|
|
@@ -215,7 +216,7 @@ export async function refreshState(
|
|
|
215
216
|
const tabFiltered = filterByTab(allPlugins, activeTab?.id ?? "installed");
|
|
216
217
|
const searchFiltered = applySearch(tabFiltered, state.searchQuery);
|
|
217
218
|
|
|
218
|
-
|
|
219
|
+
const nextState = {
|
|
219
220
|
...state,
|
|
220
221
|
tabs,
|
|
221
222
|
activeTabIndex: nextTabIndex,
|
|
@@ -226,4 +227,15 @@ export async function refreshState(
|
|
|
226
227
|
loading: false,
|
|
227
228
|
loadError: null,
|
|
228
229
|
};
|
|
230
|
+
if (selectedId) {
|
|
231
|
+
const selectedIndex = searchFiltered.findIndex(plugin => plugin.id === selectedId);
|
|
232
|
+
if (selectedIndex >= 0) nextState.selectedIndex = selectedIndex;
|
|
233
|
+
}
|
|
234
|
+
if (searchFiltered.length === 0) {
|
|
235
|
+
nextState.selectedIndex = 0;
|
|
236
|
+
nextState.scrollOffset = 0;
|
|
237
|
+
} else {
|
|
238
|
+
nextState.selectedIndex = Math.max(0, Math.min(nextState.selectedIndex, searchFiltered.length - 1));
|
|
239
|
+
}
|
|
240
|
+
return nextState;
|
|
229
241
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Model } from "@f5-sales-demo/pi-ai";
|
|
2
2
|
import { validateApiKeyAgainstModelsEndpoint } from "@f5-sales-demo/pi-ai/utils/oauth/api-key-validation";
|
|
3
3
|
import { logger } from "@f5-sales-demo/pi-utils";
|
|
4
|
+
import type { ModelRegistry } from "../../config/model-registry";
|
|
4
5
|
import { type AuthStatus, ContextService } from "../../services/xcsh-context";
|
|
5
6
|
import { deriveTenantFromUrl } from "../../services/xcsh-env";
|
|
6
7
|
import type { AuthStorage } from "../../session/auth-storage";
|
|
@@ -67,15 +68,25 @@ export interface WelcomeCheckResult {
|
|
|
67
68
|
/** Providers that don't store API keys (local inference servers) */
|
|
68
69
|
const KEYLESS_PROVIDERS = new Set(["ollama", "llama.cpp", "lm-studio", "llamafile", "local"]);
|
|
69
70
|
|
|
71
|
+
type KeylessProviderRegistry = Pick<ModelRegistry, "isProviderKeyless">;
|
|
72
|
+
|
|
73
|
+
function isKeylessProvider(provider: string, modelRegistry?: KeylessProviderRegistry): boolean {
|
|
74
|
+
return modelRegistry ? modelRegistry.isProviderKeyless(provider) : KEYLESS_PROVIDERS.has(provider);
|
|
75
|
+
}
|
|
76
|
+
|
|
70
77
|
/**
|
|
71
78
|
* Instant, local check for whether the session has a usable LLM provider configured.
|
|
72
79
|
* Zero network: a model must be resolved and either be keyless (local inference) or
|
|
73
80
|
* have credentials present in the auth store. Used by the startup readiness gate to
|
|
74
81
|
* decide whether natural-language input can be processed.
|
|
75
82
|
*/
|
|
76
|
-
export function hasActiveLlmProvider(
|
|
83
|
+
export function hasActiveLlmProvider(
|
|
84
|
+
model: Model | undefined,
|
|
85
|
+
authStorage: Pick<AuthStorage, "hasAuth">,
|
|
86
|
+
modelRegistry?: KeylessProviderRegistry,
|
|
87
|
+
): boolean {
|
|
77
88
|
if (!model) return false;
|
|
78
|
-
return
|
|
89
|
+
return isKeylessProvider(model.provider, modelRegistry) || authStorage.hasAuth(model.provider);
|
|
79
90
|
}
|
|
80
91
|
|
|
81
92
|
/**
|
|
@@ -85,17 +96,18 @@ export function hasActiveLlmProvider(model: Model | undefined, authStorage: Pick
|
|
|
85
96
|
export async function runWelcomeChecks(
|
|
86
97
|
model: Model | undefined,
|
|
87
98
|
authStorage: AuthStorage,
|
|
99
|
+
modelRegistry?: KeylessProviderRegistry,
|
|
88
100
|
): Promise<WelcomeCheckResult> {
|
|
89
101
|
const provider = model?.provider ?? "unknown";
|
|
90
102
|
|
|
91
103
|
// Step 1: Check model provider credentials exist
|
|
92
104
|
// Keyless local providers (ollama, llama.cpp, lm-studio, etc.) don't store credentials
|
|
93
|
-
if (!authStorage.hasAuth(provider) && !
|
|
105
|
+
if (!authStorage.hasAuth(provider) && !isKeylessProvider(provider, modelRegistry)) {
|
|
94
106
|
return { model: { state: "no_provider", provider } };
|
|
95
107
|
}
|
|
96
108
|
|
|
97
109
|
// Step 2: Live model validation — try to reach the models endpoint
|
|
98
|
-
const modelStatus = await validateModelConnection(model, authStorage);
|
|
110
|
+
const modelStatus = await validateModelConnection(model, authStorage, modelRegistry);
|
|
99
111
|
if (modelStatus.state !== "connected") {
|
|
100
112
|
return { model: modelStatus };
|
|
101
113
|
}
|
|
@@ -105,13 +117,17 @@ export async function runWelcomeChecks(
|
|
|
105
117
|
return { model: modelStatus, context: contextStatus };
|
|
106
118
|
}
|
|
107
119
|
|
|
108
|
-
async function validateModelConnection(
|
|
120
|
+
async function validateModelConnection(
|
|
121
|
+
model: Model | undefined,
|
|
122
|
+
authStorage: AuthStorage,
|
|
123
|
+
modelRegistry?: KeylessProviderRegistry,
|
|
124
|
+
): Promise<ModelStatus> {
|
|
109
125
|
const provider = model?.provider ?? "unknown";
|
|
110
126
|
try {
|
|
111
127
|
const rawApiKey = await authStorage.peekApiKey(provider);
|
|
112
128
|
if (!rawApiKey) {
|
|
113
129
|
// Keyless providers skip validation
|
|
114
|
-
if (
|
|
130
|
+
if (isKeylessProvider(provider, modelRegistry)) {
|
|
115
131
|
return { state: "connected", provider, latencyMs: 0 };
|
|
116
132
|
}
|
|
117
133
|
return { state: "auth_error", provider };
|
|
@@ -26,6 +26,7 @@ import { DebugSelectorComponent } from "../../debug";
|
|
|
26
26
|
import { disableProvider, enableProvider } from "../../discovery";
|
|
27
27
|
import { clearXcshPluginRootsCache, resolveActiveProjectRegistryPath } from "../../discovery/helpers";
|
|
28
28
|
import {
|
|
29
|
+
formatMarketplaceRefreshWarning,
|
|
29
30
|
getInstalledPluginsRegistryPath,
|
|
30
31
|
getMarketplacesCacheDir,
|
|
31
32
|
getMarketplacesRegistryPath,
|
|
@@ -645,6 +646,9 @@ export class SelectorController {
|
|
|
645
646
|
},
|
|
646
647
|
});
|
|
647
648
|
|
|
649
|
+
const refresh = mode === "install" ? await mgr.refreshMarketplaces() : undefined;
|
|
650
|
+
const refreshWarning = refresh ? formatMarketplaceRefreshWarning(refresh) : undefined;
|
|
651
|
+
if (refreshWarning) this.ctx.showStatus(refreshWarning);
|
|
648
652
|
const [marketplaces, installed] = await Promise.all([mgr.listMarketplaces(), mgr.listInstalledPlugins()]);
|
|
649
653
|
const installedIds = new Set(installed.map(p => p.id));
|
|
650
654
|
|
|
@@ -692,7 +696,15 @@ export class SelectorController {
|
|
|
692
696
|
marketplace: string;
|
|
693
697
|
}> = [];
|
|
694
698
|
for (const mkt of marketplaces) {
|
|
695
|
-
|
|
699
|
+
let plugins: Awaited<ReturnType<typeof mgr.listAvailablePlugins>>;
|
|
700
|
+
try {
|
|
701
|
+
plugins = await mgr.listAvailablePlugins(mkt.name);
|
|
702
|
+
} catch (error) {
|
|
703
|
+
this.ctx.showStatus(
|
|
704
|
+
`${refreshWarning ? `${refreshWarning}\n` : ""}Marketplace ${mkt.name} is unavailable: ${error instanceof Error ? error.message : String(error)}`,
|
|
705
|
+
);
|
|
706
|
+
continue;
|
|
707
|
+
}
|
|
696
708
|
for (const plugin of plugins) {
|
|
697
709
|
allPlugins.push({ plugin, marketplace: mkt.name });
|
|
698
710
|
}
|
|
@@ -705,9 +717,13 @@ export class SelectorController {
|
|
|
705
717
|
this.ctx.showStatus(`Installing ${name} from ${marketplace}...`);
|
|
706
718
|
this.ctx.ui.requestRender();
|
|
707
719
|
try {
|
|
720
|
+
const installRefresh = await mgr.refreshMarketplaces([marketplace]);
|
|
721
|
+
const installWarning = formatMarketplaceRefreshWarning(installRefresh);
|
|
708
722
|
const force = installedIds.has(`${name}@${marketplace}`);
|
|
709
723
|
await mgr.installPlugin(name, marketplace, { force });
|
|
710
|
-
this.ctx.showStatus(
|
|
724
|
+
this.ctx.showStatus(
|
|
725
|
+
`${installWarning ? `${installWarning}\n` : ""}Installed ${name} from ${marketplace}`,
|
|
726
|
+
);
|
|
711
727
|
} catch (err) {
|
|
712
728
|
this.ctx.showStatus(`Install failed: ${err}`);
|
|
713
729
|
}
|
|
@@ -319,7 +319,11 @@ export class InteractiveMode implements InteractiveModeContext {
|
|
|
319
319
|
// LLM readiness gate: instant, local check (no network). When no provider is
|
|
320
320
|
// configured we still initialize immediately, but warn the user to /login —
|
|
321
321
|
// natural-language input is blocked until then (enforced in input-controller).
|
|
322
|
-
const needsLogin = !hasActiveLlmProvider(
|
|
322
|
+
const needsLogin = !hasActiveLlmProvider(
|
|
323
|
+
this.session.model,
|
|
324
|
+
this.session.modelRegistry.authStorage,
|
|
325
|
+
this.session.modelRegistry,
|
|
326
|
+
);
|
|
323
327
|
|
|
324
328
|
if (!startupQuiet) {
|
|
325
329
|
this.#welcomeComponent = new WelcomeComponent(this.#version);
|
|
@@ -1097,7 +1101,11 @@ export class InteractiveMode implements InteractiveModeContext {
|
|
|
1097
1101
|
}
|
|
1098
1102
|
|
|
1099
1103
|
hasActiveLlmProvider(): boolean {
|
|
1100
|
-
return hasActiveLlmProvider(
|
|
1104
|
+
return hasActiveLlmProvider(
|
|
1105
|
+
this.session.model,
|
|
1106
|
+
this.session.modelRegistry.authStorage,
|
|
1107
|
+
this.session.modelRegistry,
|
|
1108
|
+
);
|
|
1101
1109
|
}
|
|
1102
1110
|
|
|
1103
1111
|
ensureLoadingAnimation(): void {
|
|
@@ -634,7 +634,11 @@ export async function runRpcMode(session: AgentSession): Promise<never> {
|
|
|
634
634
|
}
|
|
635
635
|
|
|
636
636
|
case "get_integrations": {
|
|
637
|
-
const welcomeResult = await runWelcomeChecks(
|
|
637
|
+
const welcomeResult = await runWelcomeChecks(
|
|
638
|
+
session.model,
|
|
639
|
+
session.modelRegistry.authStorage,
|
|
640
|
+
session.modelRegistry,
|
|
641
|
+
);
|
|
638
642
|
|
|
639
643
|
const services =
|
|
640
644
|
welcomeResult.model.state === "connected"
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
} from "../discovery/helpers.js";
|
|
14
14
|
import { PluginManager } from "../extensibility/plugins";
|
|
15
15
|
import {
|
|
16
|
+
formatMarketplaceRefreshWarning,
|
|
16
17
|
getInstalledPluginsRegistryPath,
|
|
17
18
|
getMarketplacesCacheDir,
|
|
18
19
|
getMarketplacesRegistryPath,
|
|
@@ -1008,6 +1009,13 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1008
1009
|
});
|
|
1009
1010
|
|
|
1010
1011
|
try {
|
|
1012
|
+
const showPluginStatus = (
|
|
1013
|
+
message: string,
|
|
1014
|
+
refresh?: Awaited<ReturnType<typeof mgr.refreshMarketplaces>>,
|
|
1015
|
+
) => {
|
|
1016
|
+
const warning = refresh ? formatMarketplaceRefreshWarning(refresh) : undefined;
|
|
1017
|
+
runtime.ctx.showStatus(warning ? `${warning}\n\n${message}` : message);
|
|
1018
|
+
};
|
|
1011
1019
|
switch (sub) {
|
|
1012
1020
|
// ── Marketplace management (/plugin marketplace add|remove|update|list) ──
|
|
1013
1021
|
case "marketplace": {
|
|
@@ -1039,9 +1047,10 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1039
1047
|
await mgr.updateMarketplace(mktRest);
|
|
1040
1048
|
runtime.ctx.showStatus(t("commands.plugin.marketplace.updated", { name: mktRest }));
|
|
1041
1049
|
} else {
|
|
1042
|
-
const
|
|
1043
|
-
|
|
1044
|
-
t("commands.plugin.marketplace.updatedAll", { count:
|
|
1050
|
+
const refresh = await mgr.refreshMarketplaces();
|
|
1051
|
+
showPluginStatus(
|
|
1052
|
+
t("commands.plugin.marketplace.updatedAll", { count: refresh.successful.length }),
|
|
1053
|
+
refresh,
|
|
1045
1054
|
);
|
|
1046
1055
|
}
|
|
1047
1056
|
break;
|
|
@@ -1086,27 +1095,31 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1086
1095
|
await mgr.updateMarketplace(rest);
|
|
1087
1096
|
runtime.ctx.showStatus(t("commands.plugin.marketplace.updated", { name: rest }));
|
|
1088
1097
|
} else {
|
|
1089
|
-
const
|
|
1090
|
-
|
|
1098
|
+
const refresh = await mgr.refreshMarketplaces();
|
|
1099
|
+
showPluginStatus(
|
|
1100
|
+
t("commands.plugin.marketplace.updatedAll", { count: refresh.successful.length }),
|
|
1101
|
+
refresh,
|
|
1102
|
+
);
|
|
1091
1103
|
}
|
|
1092
1104
|
break;
|
|
1093
1105
|
}
|
|
1094
1106
|
// ── Plugin discovery ──
|
|
1095
1107
|
case "discover": {
|
|
1108
|
+
const refresh = await mgr.refreshMarketplaces(rest ? [rest] : undefined);
|
|
1096
1109
|
const plugins = await mgr.listAvailablePlugins(rest || undefined);
|
|
1097
1110
|
if (plugins.length === 0) {
|
|
1098
1111
|
const marketplaces = await mgr.listMarketplaces();
|
|
1099
1112
|
if (marketplaces.length === 0) {
|
|
1100
|
-
|
|
1113
|
+
showPluginStatus(t("commands.plugin.marketplace.noneConfiguredTry"), refresh);
|
|
1101
1114
|
} else {
|
|
1102
|
-
|
|
1115
|
+
showPluginStatus(t("commands.plugin.marketplace.noPluginsAvailable"), refresh);
|
|
1103
1116
|
}
|
|
1104
1117
|
} else {
|
|
1105
1118
|
const lines = plugins.map(
|
|
1106
1119
|
p =>
|
|
1107
1120
|
` ${p.name}${p.version ? `@${p.version}` : ""}${p.description ? ` - ${p.description}` : ""}`,
|
|
1108
1121
|
);
|
|
1109
|
-
|
|
1122
|
+
showPluginStatus(`Available plugins:\n${lines.join("\n")}`, refresh);
|
|
1110
1123
|
}
|
|
1111
1124
|
break;
|
|
1112
1125
|
}
|
|
@@ -1120,8 +1133,9 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1120
1133
|
const atIdx = parsed.installSpec.lastIndexOf("@");
|
|
1121
1134
|
const name = parsed.installSpec.slice(0, atIdx);
|
|
1122
1135
|
const marketplace = parsed.installSpec.slice(atIdx + 1);
|
|
1136
|
+
const refresh = await mgr.refreshMarketplaces([marketplace]);
|
|
1123
1137
|
await mgr.installPlugin(name, marketplace, { force: parsed.force, scope: parsed.scope });
|
|
1124
|
-
|
|
1138
|
+
showPluginStatus(t("commands.plugin.installed", { name, marketplace }), refresh);
|
|
1125
1139
|
break;
|
|
1126
1140
|
}
|
|
1127
1141
|
// ── Uninstall ──
|
|
@@ -1160,6 +1174,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1160
1174
|
}
|
|
1161
1175
|
// ── Upgrade ──
|
|
1162
1176
|
case "upgrade": {
|
|
1177
|
+
const refresh = await mgr.refreshMarketplaces();
|
|
1163
1178
|
if (rest) {
|
|
1164
1179
|
const upArgs = parsePluginScopeArgs(
|
|
1165
1180
|
rest,
|
|
@@ -1169,18 +1184,20 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1169
1184
|
runtime.ctx.showStatus(upArgs.error);
|
|
1170
1185
|
return;
|
|
1171
1186
|
}
|
|
1172
|
-
const result = await mgr.upgradePlugin(upArgs.pluginId, upArgs.scope
|
|
1173
|
-
|
|
1187
|
+
const result = await mgr.upgradePlugin(upArgs.pluginId, upArgs.scope);
|
|
1188
|
+
showPluginStatus(
|
|
1174
1189
|
t("commands.plugin.upgraded", { pluginId: upArgs.pluginId, version: result.version }),
|
|
1190
|
+
refresh,
|
|
1175
1191
|
);
|
|
1176
1192
|
} else {
|
|
1177
|
-
const results = await mgr.upgradeAllPlugins(
|
|
1193
|
+
const results = await mgr.upgradeAllPlugins();
|
|
1178
1194
|
if (results.length === 0) {
|
|
1179
|
-
|
|
1195
|
+
showPluginStatus(t("commands.plugin.allUpToDate"), refresh);
|
|
1180
1196
|
} else {
|
|
1181
1197
|
const lines = results.map(r => ` ${r.pluginId}: ${r.from} -> ${r.to}`);
|
|
1182
|
-
|
|
1198
|
+
showPluginStatus(
|
|
1183
1199
|
`${t("commands.plugin.upgradedCount", { count: results.length })}:\n${lines.join("\n")}`,
|
|
1200
|
+
refresh,
|
|
1184
1201
|
);
|
|
1185
1202
|
}
|
|
1186
1203
|
}
|
|
@@ -1247,10 +1264,11 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1247
1264
|
}
|
|
1248
1265
|
// ── Setup (guided recommended plugin install) ──
|
|
1249
1266
|
case "setup": {
|
|
1267
|
+
const refresh = await mgr.refreshMarketplaces();
|
|
1250
1268
|
const allPlugins = await mgr.listAvailablePlugins();
|
|
1251
1269
|
const recommended = allPlugins.filter(p => p.recommended);
|
|
1252
1270
|
if (recommended.length === 0) {
|
|
1253
|
-
|
|
1271
|
+
showPluginStatus(t("commands.plugin.setup.noRecommended"), refresh);
|
|
1254
1272
|
break;
|
|
1255
1273
|
}
|
|
1256
1274
|
|
|
@@ -1261,7 +1279,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1261
1279
|
);
|
|
1262
1280
|
|
|
1263
1281
|
if (toSetup.length === 0) {
|
|
1264
|
-
|
|
1282
|
+
showPluginStatus(t("commands.plugin.setup.allInstalled"), refresh);
|
|
1265
1283
|
break;
|
|
1266
1284
|
}
|
|
1267
1285
|
|
|
@@ -1346,7 +1364,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1346
1364
|
if (skippedCount > 0) {
|
|
1347
1365
|
lines.push(t("commands.plugin.setup.skippedCount", { count: skippedCount }));
|
|
1348
1366
|
}
|
|
1349
|
-
|
|
1367
|
+
showPluginStatus(lines.join("\n"), refresh);
|
|
1350
1368
|
break;
|
|
1351
1369
|
}
|
|
1352
1370
|
// ── Help ──
|