@f5-sales-demo/xcsh 21.37.9 → 21.38.1
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/CHANGELOG.md +3 -0
- package/package.json +8 -8
- package/src/extensibility/extensions/loader.ts +34 -0
- package/src/extensibility/extensions/runner.ts +67 -0
- package/src/extensibility/extensions/types.ts +52 -0
- package/src/extensibility/extensions/wrapper.ts +42 -4
- package/src/internal-urls/build-info.generated.ts +8 -8
- package/src/modes/controllers/selector-controller.ts +1 -0
- package/src/modes/interactive-mode.ts +9 -1
- package/src/modes/types.ts +1 -1
- package/src/slash-commands/builtin-registry.ts +18 -11
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
### Added
|
|
8
8
|
|
|
9
|
+
- Added owner-scoped, capability-filtered plugin advisories that render machine-readable provenance,
|
|
10
|
+
fail open on matcher errors, and refresh with plugin lifecycle changes
|
|
11
|
+
([#4175](https://github.com/f5-sales-demo/xcsh/issues/4175)).
|
|
9
12
|
- Added deterministic `fable` and `anthropic/fable` model aliases, Fable 5/5.1 model-picker
|
|
10
13
|
support, and a source/installed OAuth/API-key UAT runner.
|
|
11
14
|
- Added capability-aware terminal hyperlinks, automatic local Vertex sign-in launch with durable
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@f5-sales-demo/xcsh",
|
|
4
|
-
"version": "21.
|
|
4
|
+
"version": "21.38.1",
|
|
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",
|
|
@@ -64,13 +64,13 @@
|
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@agentclientprotocol/sdk": "1.4.0",
|
|
67
|
-
"@f5-sales-demo/pi-agent-core": "21.
|
|
68
|
-
"@f5-sales-demo/pi-ai": "21.
|
|
69
|
-
"@f5-sales-demo/pi-natives": "21.
|
|
70
|
-
"@f5-sales-demo/pi-resource-management": "21.
|
|
71
|
-
"@f5-sales-demo/pi-tui": "21.
|
|
72
|
-
"@f5-sales-demo/pi-utils": "21.
|
|
73
|
-
"@f5-sales-demo/xcsh-stats": "21.
|
|
67
|
+
"@f5-sales-demo/pi-agent-core": "21.38.1",
|
|
68
|
+
"@f5-sales-demo/pi-ai": "21.38.1",
|
|
69
|
+
"@f5-sales-demo/pi-natives": "21.38.1",
|
|
70
|
+
"@f5-sales-demo/pi-resource-management": "21.38.1",
|
|
71
|
+
"@f5-sales-demo/pi-tui": "21.38.1",
|
|
72
|
+
"@f5-sales-demo/pi-utils": "21.38.1",
|
|
73
|
+
"@f5-sales-demo/xcsh-stats": "21.38.1",
|
|
74
74
|
"@mozilla/readability": "^0.6",
|
|
75
75
|
"@sinclair/typebox": "0.34.52",
|
|
76
76
|
"@tobilu/qmd": "2.8.3",
|
|
@@ -35,6 +35,8 @@ import type {
|
|
|
35
35
|
LoadExtensionsResult,
|
|
36
36
|
MessageRenderer,
|
|
37
37
|
RegisteredCommand,
|
|
38
|
+
RegisteredToolAdvisory,
|
|
39
|
+
ToolAdvisoryRegistration,
|
|
38
40
|
ToolDefinition,
|
|
39
41
|
} from "./types";
|
|
40
42
|
|
|
@@ -124,6 +126,7 @@ class ConcreteExtensionAPI implements ExtensionAPI, IExtensionRuntime {
|
|
|
124
126
|
}> = [];
|
|
125
127
|
readonly personProfile: ExtensionAPI["personProfile"];
|
|
126
128
|
readonly integrations: ExtensionAPI["integrations"];
|
|
129
|
+
readonly advisories: ExtensionAPI["advisories"];
|
|
127
130
|
|
|
128
131
|
constructor(
|
|
129
132
|
public readonly pi: typeof import("@f5-sales-demo/xcsh"),
|
|
@@ -184,6 +187,36 @@ class ConcreteExtensionAPI implements ExtensionAPI, IExtensionRuntime {
|
|
|
184
187
|
return true;
|
|
185
188
|
},
|
|
186
189
|
});
|
|
190
|
+
this.advisories = Object.freeze({
|
|
191
|
+
register: (registration: ToolAdvisoryRegistration): (() => void) => {
|
|
192
|
+
if (!registration || typeof registration.id !== "string" || registration.id.trim() === "") {
|
|
193
|
+
throw new Error("Advisory registration requires a non-empty id");
|
|
194
|
+
}
|
|
195
|
+
if (!Array.isArray(registration.capabilities) || registration.capabilities.length === 0) {
|
|
196
|
+
throw new Error(`Advisory '${registration.id}' requires at least one exact capability`);
|
|
197
|
+
}
|
|
198
|
+
if (
|
|
199
|
+
registration.capabilities.some(capability => typeof capability !== "string" || capability.trim() === "")
|
|
200
|
+
) {
|
|
201
|
+
throw new Error(`Advisory '${registration.id}' contains an invalid capability`);
|
|
202
|
+
}
|
|
203
|
+
if (typeof registration.match !== "function") {
|
|
204
|
+
throw new Error(`Advisory '${registration.id}' requires a matcher`);
|
|
205
|
+
}
|
|
206
|
+
const value: RegisteredToolAdvisory = {
|
|
207
|
+
...registration,
|
|
208
|
+
capabilities: [...new Set(registration.capabilities)],
|
|
209
|
+
owner: this.extension.resolvedPath,
|
|
210
|
+
};
|
|
211
|
+
this.extension.advisories.set(registration.id, value);
|
|
212
|
+
return () => {
|
|
213
|
+
if (this.extension.advisories.get(registration.id) === value) {
|
|
214
|
+
this.extension.advisories.delete(registration.id);
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
},
|
|
218
|
+
unregister: (id: string): boolean => this.extension.advisories.delete(id),
|
|
219
|
+
});
|
|
187
220
|
}
|
|
188
221
|
|
|
189
222
|
on<F extends HandlerFn>(event: string, handler: F): void {
|
|
@@ -320,6 +353,7 @@ function createExtension(extensionPath: string, resolvedPath: string): Extension
|
|
|
320
353
|
flags: new Map(),
|
|
321
354
|
shortcuts: new Map(),
|
|
322
355
|
integrations: new Map(),
|
|
356
|
+
advisories: new Map(),
|
|
323
357
|
};
|
|
324
358
|
}
|
|
325
359
|
|
|
@@ -35,6 +35,7 @@ import type {
|
|
|
35
35
|
MessageRenderer,
|
|
36
36
|
RegisteredCommand,
|
|
37
37
|
RegisteredTool,
|
|
38
|
+
RegisteredToolAdvisory,
|
|
38
39
|
ResourcesDiscoverEvent,
|
|
39
40
|
ResourcesDiscoverResult,
|
|
40
41
|
SessionBeforeBranchResult,
|
|
@@ -42,6 +43,7 @@ import type {
|
|
|
42
43
|
SessionBeforeSwitchResult,
|
|
43
44
|
SessionBeforeTreeResult,
|
|
44
45
|
SessionCompactingResult,
|
|
46
|
+
ToolAdvisoryEvaluation,
|
|
45
47
|
ToolCallEvent,
|
|
46
48
|
ToolCallEventResult,
|
|
47
49
|
ToolResultEvent,
|
|
@@ -185,6 +187,7 @@ export class ExtensionRunner {
|
|
|
185
187
|
#reloadHandler: () => Promise<void> = async () => {};
|
|
186
188
|
#shutdownHandler: ShutdownHandler = () => {};
|
|
187
189
|
#commandDiagnostics: Array<{ type: string; message: string; path: string }> = [];
|
|
190
|
+
#advisoriesByOwner = new Map<string, Map<string, RegisteredToolAdvisory>>();
|
|
188
191
|
|
|
189
192
|
constructor(
|
|
190
193
|
private readonly extensions: Extension[],
|
|
@@ -195,6 +198,7 @@ export class ExtensionRunner {
|
|
|
195
198
|
private readonly settings?: ExtensionContext["settings"],
|
|
196
199
|
) {
|
|
197
200
|
this.#uiContext = noOpUIContext;
|
|
201
|
+
this.reloadAdvisories(extensions);
|
|
198
202
|
}
|
|
199
203
|
|
|
200
204
|
initialize(
|
|
@@ -427,6 +431,69 @@ export class ExtensionRunner {
|
|
|
427
431
|
return undefined;
|
|
428
432
|
}
|
|
429
433
|
|
|
434
|
+
/** Evaluate all advisory registrations scoped to this exact tool capability. */
|
|
435
|
+
async evaluateAdvisories(event: ToolCallEvent): Promise<ToolAdvisoryEvaluation> {
|
|
436
|
+
const advisories: ToolAdvisoryEvaluation["advisories"] = [];
|
|
437
|
+
const diagnostics: ToolAdvisoryEvaluation["diagnostics"] = [];
|
|
438
|
+
const ctx = this.createContext();
|
|
439
|
+
|
|
440
|
+
for (const registrations of this.#advisoriesByOwner.values()) {
|
|
441
|
+
for (const registration of registrations.values()) {
|
|
442
|
+
if (!registration.capabilities.includes(event.toolName)) continue;
|
|
443
|
+
try {
|
|
444
|
+
const matched = await registration.match(event, ctx);
|
|
445
|
+
const findings = matched ? (Array.isArray(matched) ? matched : [matched]) : [];
|
|
446
|
+
for (const finding of findings) {
|
|
447
|
+
if (!finding || typeof finding.code !== "string" || typeof finding.message !== "string") continue;
|
|
448
|
+
advisories.push({
|
|
449
|
+
code: finding.code,
|
|
450
|
+
message: finding.message,
|
|
451
|
+
severity: finding.severity ?? "warning",
|
|
452
|
+
provenance: {
|
|
453
|
+
owner: registration.owner,
|
|
454
|
+
registrationId: registration.id,
|
|
455
|
+
capability: event.toolName,
|
|
456
|
+
},
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
} catch (error) {
|
|
460
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
461
|
+
diagnostics.push({
|
|
462
|
+
code: "advisory_matcher_failed",
|
|
463
|
+
message,
|
|
464
|
+
owner: registration.owner,
|
|
465
|
+
registrationId: registration.id,
|
|
466
|
+
capability: event.toolName,
|
|
467
|
+
});
|
|
468
|
+
this.emitError({
|
|
469
|
+
extensionPath: registration.owner,
|
|
470
|
+
event: "advisory",
|
|
471
|
+
error: message,
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
return { advisories, diagnostics };
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/** Remove all advisory registrations owned by an extension during lifecycle refresh. */
|
|
480
|
+
removeAdvisoryOwner(owner: string): number {
|
|
481
|
+
const registrations = this.#advisoriesByOwner.get(owner);
|
|
482
|
+
if (!registrations) return 0;
|
|
483
|
+
this.#advisoriesByOwner.delete(owner);
|
|
484
|
+
return registrations.size;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/** Atomically replace advisory registrations after plugin discovery changes. */
|
|
488
|
+
reloadAdvisories(extensions: readonly Extension[]): void {
|
|
489
|
+
const next = new Map<string, Map<string, RegisteredToolAdvisory>>();
|
|
490
|
+
for (const extension of extensions) {
|
|
491
|
+
if (extension.advisories.size === 0) continue;
|
|
492
|
+
next.set(extension.resolvedPath, new Map(extension.advisories));
|
|
493
|
+
}
|
|
494
|
+
this.#advisoriesByOwner = next;
|
|
495
|
+
}
|
|
496
|
+
|
|
430
497
|
createContext(): ExtensionContext {
|
|
431
498
|
const getModel = this.#getModel;
|
|
432
499
|
return {
|
|
@@ -880,6 +880,51 @@ export interface ToolCallEventResult {
|
|
|
880
880
|
reason?: string;
|
|
881
881
|
}
|
|
882
882
|
|
|
883
|
+
/** A non-blocking recommendation associated with an exact tool capability. */
|
|
884
|
+
export interface ToolAdvisory {
|
|
885
|
+
code: string;
|
|
886
|
+
message: string;
|
|
887
|
+
severity?: "info" | "warning";
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
/** Provenance attached by xcsh rather than supplied by a plugin matcher. */
|
|
891
|
+
export interface ScopedToolAdvisory extends Required<ToolAdvisory> {
|
|
892
|
+
provenance: {
|
|
893
|
+
owner: string;
|
|
894
|
+
registrationId: string;
|
|
895
|
+
capability: string;
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
/** Diagnostic emitted when advisory evaluation fails open. */
|
|
900
|
+
export interface ToolAdvisoryDiagnostic {
|
|
901
|
+
code: "advisory_matcher_failed";
|
|
902
|
+
message: string;
|
|
903
|
+
owner: string;
|
|
904
|
+
registrationId: string;
|
|
905
|
+
capability: string;
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
export interface ToolAdvisoryEvaluation {
|
|
909
|
+
advisories: ScopedToolAdvisory[];
|
|
910
|
+
diagnostics: ToolAdvisoryDiagnostic[];
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
export interface ToolAdvisoryRegistration {
|
|
914
|
+
/** Stable identifier unique within the owning extension. */
|
|
915
|
+
id: string;
|
|
916
|
+
/** Exact tool names for which the matcher may run. */
|
|
917
|
+
capabilities: readonly string[];
|
|
918
|
+
match(
|
|
919
|
+
event: ToolCallEvent,
|
|
920
|
+
ctx: ExtensionContext,
|
|
921
|
+
): ToolAdvisory | readonly ToolAdvisory[] | undefined | Promise<ToolAdvisory | readonly ToolAdvisory[] | undefined>;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
export interface RegisteredToolAdvisory extends ToolAdvisoryRegistration {
|
|
925
|
+
owner: string;
|
|
926
|
+
}
|
|
927
|
+
|
|
883
928
|
/** Result from input event handler */
|
|
884
929
|
export interface InputEventResult {
|
|
885
930
|
/** If true, the input was handled and should not continue through normal flow */
|
|
@@ -1007,6 +1052,12 @@ export interface ExtensionAPI {
|
|
|
1007
1052
|
unregister(id: string): boolean;
|
|
1008
1053
|
};
|
|
1009
1054
|
|
|
1055
|
+
/** Owner-scoped, non-blocking recommendations for exact tool capabilities. */
|
|
1056
|
+
readonly advisories: {
|
|
1057
|
+
register(registration: ToolAdvisoryRegistration): () => void;
|
|
1058
|
+
unregister(id: string): boolean;
|
|
1059
|
+
};
|
|
1060
|
+
|
|
1010
1061
|
// =========================================================================
|
|
1011
1062
|
// Event Subscription
|
|
1012
1063
|
// =========================================================================
|
|
@@ -1407,6 +1458,7 @@ export interface Extension {
|
|
|
1407
1458
|
flags: Map<string, ExtensionFlag>;
|
|
1408
1459
|
shortcuts: Map<KeyId, ExtensionShortcut>;
|
|
1409
1460
|
integrations: Map<string, import("../../integrations/types").IntegrationHandle<unknown>>;
|
|
1461
|
+
advisories: Map<string, RegisteredToolAdvisory>;
|
|
1410
1462
|
}
|
|
1411
1463
|
|
|
1412
1464
|
/** Result of loading extensions. */
|
|
@@ -14,7 +14,38 @@ import type { Theme } from "../../modes/theme/theme";
|
|
|
14
14
|
import { withToolInteraction } from "../../session/user-interactions";
|
|
15
15
|
import { applyToolProxy } from "../tool-proxy";
|
|
16
16
|
import type { ExtensionRunner } from "./runner";
|
|
17
|
-
import type { RegisteredTool, ToolCallEventResult } from "./types";
|
|
17
|
+
import type { RegisteredTool, ToolAdvisoryEvaluation, ToolCallEventResult } from "./types";
|
|
18
|
+
|
|
19
|
+
function attachAdvisories<TDetails>(
|
|
20
|
+
result: { content: (TextContent | ImageContent)[]; details?: TDetails },
|
|
21
|
+
evaluation: ToolAdvisoryEvaluation,
|
|
22
|
+
): { content: (TextContent | ImageContent)[]; details?: TDetails } {
|
|
23
|
+
if (evaluation.advisories.length === 0 && evaluation.diagnostics.length === 0) return result;
|
|
24
|
+
const notices: TextContent[] = [
|
|
25
|
+
...evaluation.advisories.map(advisory => ({
|
|
26
|
+
type: "text" as const,
|
|
27
|
+
text: `Advisory [${advisory.code}] (${advisory.provenance.owner}): ${advisory.message}`,
|
|
28
|
+
})),
|
|
29
|
+
...evaluation.diagnostics.map(diagnostic => ({
|
|
30
|
+
type: "text" as const,
|
|
31
|
+
text: `Advisory diagnostic [${diagnostic.code}] (${diagnostic.owner}): ${diagnostic.message}`,
|
|
32
|
+
})),
|
|
33
|
+
];
|
|
34
|
+
const originalDetails =
|
|
35
|
+
result.details && typeof result.details === "object" && !Array.isArray(result.details)
|
|
36
|
+
? (result.details as Record<string, unknown>)
|
|
37
|
+
: result.details === undefined
|
|
38
|
+
? {}
|
|
39
|
+
: { resultDetails: result.details };
|
|
40
|
+
return {
|
|
41
|
+
content: [...result.content, ...notices],
|
|
42
|
+
details: {
|
|
43
|
+
...originalDetails,
|
|
44
|
+
advisories: evaluation.advisories,
|
|
45
|
+
advisoryDiagnostics: evaluation.diagnostics,
|
|
46
|
+
} as TDetails,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
18
49
|
|
|
19
50
|
/**
|
|
20
51
|
* Adapts a RegisteredTool into an AgentTool.
|
|
@@ -119,6 +150,13 @@ export class ExtensionToolWrapper<TParameters extends TSchema = TSchema, TDetail
|
|
|
119
150
|
onUpdate?: AgentToolUpdateCallback<TDetails, TParameters>,
|
|
120
151
|
context?: AgentToolContext,
|
|
121
152
|
) {
|
|
153
|
+
const advisoryEvaluation = await this.runner.evaluateAdvisories({
|
|
154
|
+
type: "tool_call",
|
|
155
|
+
toolName: this.tool.name,
|
|
156
|
+
toolCallId,
|
|
157
|
+
input: params as Record<string, unknown>,
|
|
158
|
+
});
|
|
159
|
+
|
|
122
160
|
// Emit tool_call event - extensions can block execution
|
|
123
161
|
if (this.runner.hasHandlers("tool_call")) {
|
|
124
162
|
try {
|
|
@@ -185,7 +223,7 @@ export class ExtensionToolWrapper<TParameters extends TSchema = TSchema, TDetail
|
|
|
185
223
|
}
|
|
186
224
|
if (resultResult.isError === false && executionError) {
|
|
187
225
|
// Extension clears the error - return success
|
|
188
|
-
return { content: modifiedContent, details: modifiedDetails };
|
|
226
|
+
return attachAdvisories({ content: modifiedContent, details: modifiedDetails }, advisoryEvaluation);
|
|
189
227
|
}
|
|
190
228
|
|
|
191
229
|
// Error status unchanged, but content/details may be modified
|
|
@@ -197,7 +235,7 @@ export class ExtensionToolWrapper<TParameters extends TSchema = TSchema, TDetail
|
|
|
197
235
|
});
|
|
198
236
|
throw executionError;
|
|
199
237
|
}
|
|
200
|
-
return { content: modifiedContent, details: modifiedDetails };
|
|
238
|
+
return attachAdvisories({ content: modifiedContent, details: modifiedDetails }, advisoryEvaluation);
|
|
201
239
|
}
|
|
202
240
|
}
|
|
203
241
|
|
|
@@ -205,6 +243,6 @@ export class ExtensionToolWrapper<TParameters extends TSchema = TSchema, TDetail
|
|
|
205
243
|
if (executionError) {
|
|
206
244
|
throw executionError;
|
|
207
245
|
}
|
|
208
|
-
return result;
|
|
246
|
+
return attachAdvisories(result, advisoryEvaluation);
|
|
209
247
|
}
|
|
210
248
|
}
|
|
@@ -17,17 +17,17 @@ export interface BuildInfo {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export const BUILD_INFO: BuildInfo = {
|
|
20
|
-
"version": "21.
|
|
21
|
-
"commit": "
|
|
22
|
-
"shortCommit": "
|
|
20
|
+
"version": "21.38.1",
|
|
21
|
+
"commit": "4b59258ac2e302e022b5d9fbc752fc4cfd19f6b7",
|
|
22
|
+
"shortCommit": "4b59258",
|
|
23
23
|
"branch": "main",
|
|
24
|
-
"tag": "v21.
|
|
25
|
-
"commitDate": "2026-09-
|
|
26
|
-
"buildDate": "2026-09-
|
|
24
|
+
"tag": "v21.38.1",
|
|
25
|
+
"commitDate": "2026-09-22T22:14:10+00:00",
|
|
26
|
+
"buildDate": "2026-09-22T23:20:26.656Z",
|
|
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.
|
|
31
|
+
"commitUrl": "https://github.com/f5-sales-demo/xcsh/commit/4b59258ac2e302e022b5d9fbc752fc4cfd19f6b7",
|
|
32
|
+
"releaseUrl": "https://github.com/f5-sales-demo/xcsh/releases/tag/v21.38.1"
|
|
33
33
|
};
|
|
@@ -577,6 +577,7 @@ export class SelectorController {
|
|
|
577
577
|
this.showSelector(done => {
|
|
578
578
|
dashboard.onClose = () => {
|
|
579
579
|
done();
|
|
580
|
+
void this.ctx.refreshSlashCommandState(undefined, { reloadAdvisories: true });
|
|
580
581
|
this.ctx.ui.requestRender();
|
|
581
582
|
};
|
|
582
583
|
dashboard.onRequestRender = () => {
|
|
@@ -20,6 +20,7 @@ import type {
|
|
|
20
20
|
ExtensionWidgetContent,
|
|
21
21
|
ExtensionWidgetOptions,
|
|
22
22
|
} from "../extensibility/extensions";
|
|
23
|
+
import { discoverAndLoadExtensions } from "../extensibility/extensions";
|
|
23
24
|
import type { CompactOptions } from "../extensibility/extensions/types";
|
|
24
25
|
import { BUILTIN_SLASH_COMMANDS, loadSlashCommands } from "../extensibility/slash-commands";
|
|
25
26
|
import { startSessionBridge } from "../remote-control/bridge";
|
|
@@ -490,8 +491,15 @@ export class InteractiveMode implements InteractiveModeContext {
|
|
|
490
491
|
}
|
|
491
492
|
|
|
492
493
|
/** Reload slash commands and autocomplete for the provided working directory. */
|
|
493
|
-
async refreshSlashCommandState(cwd?: string): Promise<void> {
|
|
494
|
+
async refreshSlashCommandState(cwd?: string, options?: { reloadAdvisories?: boolean }): Promise<void> {
|
|
494
495
|
const basePath = cwd ?? this.sessionManager.getCwd();
|
|
496
|
+
if (options?.reloadAdvisories && this.session.extensionRunner) {
|
|
497
|
+
const result = await discoverAndLoadExtensions([], basePath);
|
|
498
|
+
this.session.extensionRunner.reloadAdvisories(result.extensions);
|
|
499
|
+
for (const error of result.errors) {
|
|
500
|
+
logger.warn("Plugin advisory reload skipped an extension", error);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
495
503
|
const fileCommands = await loadSlashCommands({ cwd: basePath });
|
|
496
504
|
this.fileSlashCommands = new Set(fileCommands.map(cmd => cmd.name));
|
|
497
505
|
const fileSlashCommands: SlashCommandDiscoveryCandidate[] = fileCommands.map(cmd => ({
|
package/src/modes/types.ts
CHANGED
|
@@ -203,7 +203,7 @@ export interface InteractiveModeContext {
|
|
|
203
203
|
executeCompaction(customInstructionsOrOptions?: string | CompactOptions, isAuto?: boolean): Promise<void>;
|
|
204
204
|
openInBrowser(urlOrPath: string): void;
|
|
205
205
|
openHttpUrl(url: string): Promise<OpenHttpUrlResult>;
|
|
206
|
-
refreshSlashCommandState(cwd?: string): Promise<void>;
|
|
206
|
+
refreshSlashCommandState(cwd?: string, options?: { reloadAdvisories?: boolean }): Promise<void>;
|
|
207
207
|
|
|
208
208
|
// Selector handling
|
|
209
209
|
showSettingsSelector(): void;
|
|
@@ -1500,9 +1500,10 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1500
1500
|
execute: target => executePluginInstall(mgr, target),
|
|
1501
1501
|
});
|
|
1502
1502
|
if (outcome === "busy") runtime.ctx.showStatus("Another reviewed action is already open.");
|
|
1503
|
-
else if (outcome === "succeeded")
|
|
1503
|
+
else if (outcome === "succeeded") {
|
|
1504
|
+
await runtime.ctx.refreshSlashCommandState(undefined, { reloadAdvisories: true });
|
|
1504
1505
|
showPluginStatus(t("commands.plugin.installed", { name, marketplace }));
|
|
1505
|
-
else if (outcome === "unresolved")
|
|
1506
|
+
} else if (outcome === "unresolved")
|
|
1506
1507
|
runtime.ctx.showError("Plugin installation remains unresolved; retry from a fresh review.");
|
|
1507
1508
|
break;
|
|
1508
1509
|
}
|
|
@@ -1526,13 +1527,14 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1526
1527
|
execute: target => mgr.uninstallPlugin(target.pluginId, target.scope),
|
|
1527
1528
|
});
|
|
1528
1529
|
if (outcome === "busy") runtime.ctx.showStatus("Another reviewed action is already open.");
|
|
1529
|
-
else if (outcome === "succeeded")
|
|
1530
|
+
else if (outcome === "succeeded") {
|
|
1531
|
+
await runtime.ctx.refreshSlashCommandState(undefined, { reloadAdvisories: true });
|
|
1530
1532
|
runtime.ctx.showStatus(
|
|
1531
1533
|
t("commands.plugin.uninstalled", {
|
|
1532
1534
|
pluginId: uninstArgs.pluginId,
|
|
1533
1535
|
}),
|
|
1534
1536
|
);
|
|
1535
|
-
else if (outcome === "unresolved")
|
|
1537
|
+
} else if (outcome === "unresolved")
|
|
1536
1538
|
runtime.ctx.showError("Plugin removal remains unresolved; retry from a fresh review.");
|
|
1537
1539
|
break;
|
|
1538
1540
|
}
|
|
@@ -1564,13 +1566,14 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1564
1566
|
execute: target => mgr.setPluginEnabled(target.pluginId, isEnable, target.scope),
|
|
1565
1567
|
});
|
|
1566
1568
|
if (outcome === "busy") runtime.ctx.showStatus("Another reviewed action is already open.");
|
|
1567
|
-
else if (outcome === "succeeded")
|
|
1569
|
+
else if (outcome === "succeeded") {
|
|
1570
|
+
await runtime.ctx.refreshSlashCommandState(undefined, { reloadAdvisories: true });
|
|
1568
1571
|
runtime.ctx.showStatus(
|
|
1569
1572
|
isEnable
|
|
1570
1573
|
? t("commands.plugin.enabled", { pluginId: parsed.pluginId })
|
|
1571
1574
|
: t("commands.plugin.disabled", { pluginId: parsed.pluginId }),
|
|
1572
1575
|
);
|
|
1573
|
-
else if (outcome === "unresolved")
|
|
1576
|
+
} else if (outcome === "unresolved")
|
|
1574
1577
|
runtime.ctx.showError(`Plugin ${sub} remains unresolved; retry from a fresh review.`);
|
|
1575
1578
|
break;
|
|
1576
1579
|
}
|
|
@@ -1599,14 +1602,15 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1599
1602
|
execute: target => executePluginUpgrade(mgr, target),
|
|
1600
1603
|
});
|
|
1601
1604
|
if (outcome === "busy") runtime.ctx.showStatus("Another reviewed action is already open.");
|
|
1602
|
-
else if (outcome === "succeeded")
|
|
1605
|
+
else if (outcome === "succeeded") {
|
|
1606
|
+
await runtime.ctx.refreshSlashCommandState(undefined, { reloadAdvisories: true });
|
|
1603
1607
|
showPluginStatus(
|
|
1604
1608
|
t("commands.plugin.upgraded", {
|
|
1605
1609
|
pluginId: upArgs.pluginId,
|
|
1606
1610
|
version: prepared.target.to,
|
|
1607
1611
|
}),
|
|
1608
1612
|
);
|
|
1609
|
-
else if (outcome === "unresolved")
|
|
1613
|
+
} else if (outcome === "unresolved")
|
|
1610
1614
|
runtime.ctx.showError("Plugin upgrade remains unresolved; retry from a fresh review.");
|
|
1611
1615
|
} else {
|
|
1612
1616
|
const prepared = await preparePluginUpgradeAll(mgr);
|
|
@@ -1629,6 +1633,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1629
1633
|
else if (outcome === "unresolved")
|
|
1630
1634
|
runtime.ctx.showError("Plugin upgrades remain unresolved; retry from a fresh review.");
|
|
1631
1635
|
else if (outcome === "succeeded" && result) {
|
|
1636
|
+
await runtime.ctx.refreshSlashCommandState(undefined, { reloadAdvisories: true });
|
|
1632
1637
|
const lines = result.completed.map(
|
|
1633
1638
|
update => ` ${update.pluginId} [${update.scope}]: ${update.from} -> ${update.to}`,
|
|
1634
1639
|
);
|
|
@@ -1806,7 +1811,9 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1806
1811
|
}
|
|
1807
1812
|
|
|
1808
1813
|
pluginMetadataRefreshes.add(runtime.ctx);
|
|
1809
|
-
runtime.ctx.showStatus(
|
|
1814
|
+
runtime.ctx.showStatus(
|
|
1815
|
+
"Refreshing plugin metadata and advisory registrations… Running plugin processes will not be restarted.",
|
|
1816
|
+
);
|
|
1810
1817
|
try {
|
|
1811
1818
|
// Invalidate the fs content cache for all registry files so
|
|
1812
1819
|
// every provider re-reads command and plugin metadata from disk.
|
|
@@ -1816,9 +1823,9 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1816
1823
|
const projectPath = await resolveActiveProjectRegistryPath(runtime.ctx.sessionManager.getCwd());
|
|
1817
1824
|
if (projectPath) invalidateFsCache(projectPath);
|
|
1818
1825
|
clearXcshPluginRootsCache();
|
|
1819
|
-
await runtime.ctx.refreshSlashCommandState();
|
|
1826
|
+
await runtime.ctx.refreshSlashCommandState(undefined, { reloadAdvisories: true });
|
|
1820
1827
|
runtime.ctx.showStatus(
|
|
1821
|
-
"Plugin metadata refreshed. Commands, skills, hooks, tools, agents, and MCP
|
|
1828
|
+
"Plugin metadata and advisory registrations refreshed. Commands, skills, hooks, tools, agents, and MCP metadata now use the latest discovered files. Running plugin processes were not restarted.",
|
|
1822
1829
|
);
|
|
1823
1830
|
} catch (error) {
|
|
1824
1831
|
const message = error instanceof Error ? error.message : String(error);
|