@f5-sales-demo/xcsh 23.3.4 → 23.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/package.json +8 -8
- package/src/extensibility/custom-tools/types.ts +5 -0
- package/src/extensibility/extensions/types.ts +3 -0
- package/src/index.ts +6 -0
- package/src/integrations/setup.ts +8 -2
- package/src/internal-urls/build-info.generated.ts +9 -9
- package/src/modes/components/plugin-lifecycle.ts +31 -0
- package/src/modes/components/plugin-view.ts +167 -0
- package/src/modes/components/tool-execution.ts +117 -164
- package/src/modes/interactive-mode.ts +3 -3
- package/src/modes/types.ts +2 -2
- package/src/modes/utils/ui-helpers.ts +16 -5
- package/src/slash-commands/builtin-registry.ts +67 -68
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
### Added
|
|
14
14
|
|
|
15
|
+
- Added data-only plugin presentation descriptors, shared wrapped tables for tool and Markdown output, complete expanded fallback results, and themed plugin lifecycle messages with readable setup commands ([#4871](https://github.com/f5-sales-demo/xcsh/issues/4871)).
|
|
16
|
+
|
|
15
17
|
- Added shared host-aware software setup with live management probes, reviewed package-manager routes, checksum-verified per-user archives, and asynchronous CLI/TUI setup preparation ([#4598](https://github.com/f5-sales-demo/xcsh/issues/4598)).
|
|
16
18
|
|
|
17
19
|
- Refreshed generated internal LiteLLM configuration with seven current GPT-6/Claude models,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@f5-sales-demo/xcsh",
|
|
4
|
-
"version": "23.
|
|
4
|
+
"version": "23.4.0",
|
|
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",
|
|
@@ -68,13 +68,13 @@
|
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@agentclientprotocol/sdk": "1.4.0",
|
|
71
|
-
"@f5-sales-demo/pi-agent-core": "23.
|
|
72
|
-
"@f5-sales-demo/pi-ai": "23.
|
|
73
|
-
"@f5-sales-demo/pi-natives": "23.
|
|
74
|
-
"@f5-sales-demo/pi-resource-management": "23.
|
|
75
|
-
"@f5-sales-demo/pi-tui": "23.
|
|
76
|
-
"@f5-sales-demo/pi-utils": "23.
|
|
77
|
-
"@f5-sales-demo/xcsh-stats": "23.
|
|
71
|
+
"@f5-sales-demo/pi-agent-core": "23.4.0",
|
|
72
|
+
"@f5-sales-demo/pi-ai": "23.4.0",
|
|
73
|
+
"@f5-sales-demo/pi-natives": "23.4.0",
|
|
74
|
+
"@f5-sales-demo/pi-resource-management": "23.4.0",
|
|
75
|
+
"@f5-sales-demo/pi-tui": "23.4.0",
|
|
76
|
+
"@f5-sales-demo/pi-utils": "23.4.0",
|
|
77
|
+
"@f5-sales-demo/xcsh-stats": "23.4.0",
|
|
78
78
|
"@mozilla/readability": "^0.6",
|
|
79
79
|
"@resvg/resvg-wasm": "2.6.2",
|
|
80
80
|
"@sinclair/typebox": "0.34.52",
|
|
@@ -206,6 +206,11 @@ export interface CustomTool<TParams extends TSchema = TSchema, TDetails = any> {
|
|
|
206
206
|
/** Called on session lifecycle events - use to reconstruct state or cleanup resources */
|
|
207
207
|
onSession?: (event: CustomToolSessionEvent, ctx: CustomToolContext) => void | Promise<void>;
|
|
208
208
|
/** Custom rendering for tool call display - return a Component */
|
|
209
|
+
presentation?: import("@f5-sales-demo/pi-agent-core").PluginPresentation<
|
|
210
|
+
Static<TParams>,
|
|
211
|
+
CustomToolResult<TDetails>
|
|
212
|
+
>;
|
|
213
|
+
|
|
209
214
|
renderCall?: (args: Static<TParams>, options: RenderResultOptions, theme: Theme) => Component;
|
|
210
215
|
|
|
211
216
|
/** Custom rendering for tool result display - return a Component */
|
|
@@ -342,6 +342,9 @@ export interface ToolDefinition<TParams extends TSchema = TSchema, TDetails = un
|
|
|
342
342
|
/** Called on session lifecycle events - use to reconstruct state or cleanup resources */
|
|
343
343
|
onSession?: (event: ToolSessionEvent, ctx: ExtensionContext) => void | Promise<void>;
|
|
344
344
|
|
|
345
|
+
/** Optional data-only presentation; plugins need no runtime renderer imports. */
|
|
346
|
+
presentation?: import("@f5-sales-demo/pi-agent-core").PluginPresentation<Static<TParams>, AgentToolResult<TDetails>>;
|
|
347
|
+
|
|
345
348
|
/** Custom rendering for tool call display */
|
|
346
349
|
renderCall?: (args: Static<TParams>, options: ToolRenderResultOptions, theme: Theme) => Component;
|
|
347
350
|
|
package/src/index.ts
CHANGED
|
@@ -3,6 +3,12 @@ import { HookEditorComponent, HookInputComponent, HookSelectorComponent } from "
|
|
|
3
3
|
|
|
4
4
|
// Core session management
|
|
5
5
|
|
|
6
|
+
export type {
|
|
7
|
+
PluginPresentation,
|
|
8
|
+
PluginPresentationOptions,
|
|
9
|
+
PluginSection,
|
|
10
|
+
PluginView,
|
|
11
|
+
} from "@f5-sales-demo/pi-agent-core";
|
|
6
12
|
// TypeBox helper for string enums (convenience for custom tools)
|
|
7
13
|
// Re-export from pi-ai which uses the correct enum-based schema format
|
|
8
14
|
export { StringEnum } from "@f5-sales-demo/pi-ai";
|
|
@@ -58,6 +58,11 @@ export function describeInstallSetupOutcome(
|
|
|
58
58
|
return `${summary}\nnext: ${nextAction}`;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
/** Display exact argv as a copyable POSIX command; execution still uses the original array. */
|
|
62
|
+
export function formatSetupCommand(argv: readonly string[]): string {
|
|
63
|
+
return argv.map(arg => (/^[A-Za-z0-9_@%+=:,./-]+$/.test(arg) ? arg : `'${arg.replaceAll("'", "'\\''")}'`)).join(" ");
|
|
64
|
+
}
|
|
65
|
+
|
|
61
66
|
export function describeSetupPlan(handle: IntegrationHandle<unknown>): string {
|
|
62
67
|
const plan = handle.setupPlan;
|
|
63
68
|
if (!plan) return `${handle.name}: no setup is declared.`;
|
|
@@ -74,10 +79,11 @@ export function describeSetupPlan(handle: IntegrationHandle<unknown>): string {
|
|
|
74
79
|
lines.push(
|
|
75
80
|
"Commands:",
|
|
76
81
|
...plan.steps.map(
|
|
77
|
-
step =>
|
|
82
|
+
step =>
|
|
83
|
+
` ${step.kind}: ${step.archive ? JSON.stringify(step.archive, null, 2) : formatSetupCommand(step.argv)} (timeout ${step.timeoutMs}ms)`,
|
|
78
84
|
),
|
|
79
85
|
"Verification:",
|
|
80
|
-
...plan.verification.map(step => ` ${
|
|
86
|
+
...plan.verification.map(step => ` ${formatSetupCommand(step.argv)} (timeout ${step.timeoutMs}ms)`),
|
|
81
87
|
);
|
|
82
88
|
}
|
|
83
89
|
return lines.join("\n");
|
|
@@ -17,17 +17,17 @@ export interface BuildInfo {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export const BUILD_INFO: BuildInfo = {
|
|
20
|
-
"version": "23.
|
|
21
|
-
"commit": "
|
|
22
|
-
"shortCommit": "
|
|
23
|
-
"branch": "
|
|
24
|
-
"tag": "v23.
|
|
25
|
-
"commitDate": "2026-10-
|
|
26
|
-
"buildDate": "2026-10-
|
|
20
|
+
"version": "23.4.0",
|
|
21
|
+
"commit": "230cfd20896d077fe233aa1b0cfce61cb317e382",
|
|
22
|
+
"shortCommit": "230cfd2",
|
|
23
|
+
"branch": "main",
|
|
24
|
+
"tag": "v23.4.0",
|
|
25
|
+
"commitDate": "2026-10-14T03:55:42Z",
|
|
26
|
+
"buildDate": "2026-10-14T04:36:50.356Z",
|
|
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/v23.
|
|
31
|
+
"commitUrl": "https://github.com/f5-sales-demo/xcsh/commit/230cfd20896d077fe233aa1b0cfce61cb317e382",
|
|
32
|
+
"releaseUrl": "https://github.com/f5-sales-demo/xcsh/releases/tag/v23.4.0"
|
|
33
33
|
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Text } from "@f5-sales-demo/pi-tui";
|
|
2
|
+
import { renderOutputBlock, renderStatusLine } from "../../tui";
|
|
3
|
+
import type { State } from "../../tui/types";
|
|
4
|
+
import { theme } from "../theme/theme";
|
|
5
|
+
import { PluginViewComponent } from "./plugin-view";
|
|
6
|
+
|
|
7
|
+
/** Text-compatible status replacement retains existing progress coalescing. */
|
|
8
|
+
export class PluginLifecycleText extends Text {
|
|
9
|
+
constructor(
|
|
10
|
+
private message: string,
|
|
11
|
+
private state?: State,
|
|
12
|
+
) {
|
|
13
|
+
super(message, 0, 0);
|
|
14
|
+
}
|
|
15
|
+
override setText(message: string): void {
|
|
16
|
+
this.message = message;
|
|
17
|
+
super.setText(message);
|
|
18
|
+
}
|
|
19
|
+
override render(width: number): string[] {
|
|
20
|
+
const view = new PluginViewComponent(() => ({ sections: [{ kind: "code", text: this.message }] }), true);
|
|
21
|
+
return renderOutputBlock(
|
|
22
|
+
{
|
|
23
|
+
header: renderStatusLine({ title: this.state === "error" ? "Plugin error" : "Plugins" }, theme),
|
|
24
|
+
state: this.state,
|
|
25
|
+
width,
|
|
26
|
+
sections: [{ lines: view.render(Math.max(1, width - 3)) }],
|
|
27
|
+
},
|
|
28
|
+
theme,
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import type { PluginSection, PluginView } from "@f5-sales-demo/pi-agent-core";
|
|
2
|
+
import { sanitizeText } from "@f5-sales-demo/pi-natives";
|
|
3
|
+
import { type Component, Markdown, renderTable, visibleWidth, wrapTextWithAnsi } from "@f5-sales-demo/pi-tui";
|
|
4
|
+
import { renderStructuredRow } from "../../tui/tree-list";
|
|
5
|
+
import { getMarkdownTheme, getSymbolTheme, theme } from "../theme/theme";
|
|
6
|
+
|
|
7
|
+
export interface PresentationResult {
|
|
8
|
+
content: readonly { type: string; text?: string; mimeType?: string }[];
|
|
9
|
+
details?: unknown;
|
|
10
|
+
isError?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function valueText(value: unknown): string {
|
|
14
|
+
if (typeof value === "string") return value || '""';
|
|
15
|
+
if (value === undefined) return "undefined";
|
|
16
|
+
try {
|
|
17
|
+
return JSON.stringify(value, null, 2) ?? String(value);
|
|
18
|
+
} catch {
|
|
19
|
+
return String(value);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Flatten records into labeled sections without depth, scalar or row truncation. */
|
|
24
|
+
export function dataSections(data: unknown, title?: string): PluginSection[] {
|
|
25
|
+
if (
|
|
26
|
+
data instanceof Date ||
|
|
27
|
+
(data && typeof data === "object" && !Array.isArray(data) && Object.keys(data).length === 0)
|
|
28
|
+
)
|
|
29
|
+
return [{ kind: "code", title, text: valueText(data) }];
|
|
30
|
+
if (Array.isArray(data) && data.every(item => item !== null && typeof item === "object" && !Array.isArray(item))) {
|
|
31
|
+
const keys = [...new Set(data.flatMap(item => Object.keys(item)))];
|
|
32
|
+
if (keys.length) return [{ kind: "table", title, columns: keys.map(key => ({ key })), rows: data }];
|
|
33
|
+
}
|
|
34
|
+
if (data !== null && typeof data === "object" && !Array.isArray(data)) {
|
|
35
|
+
const fields: Record<string, unknown> = {};
|
|
36
|
+
const children: PluginSection[] = [];
|
|
37
|
+
for (const [key, value] of Object.entries(data)) {
|
|
38
|
+
if (value !== null && typeof value === "object")
|
|
39
|
+
children.push(...dataSections(value, title ? `${title}.${key}` : key));
|
|
40
|
+
else fields[key] = value;
|
|
41
|
+
}
|
|
42
|
+
return [...(Object.keys(fields).length ? [{ kind: "fields" as const, title, values: fields }] : []), ...children];
|
|
43
|
+
}
|
|
44
|
+
return [{ kind: "code", title, text: valueText(data) }];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function fallbackResultView(result: PresentationResult): PluginView {
|
|
48
|
+
const sections = result.content
|
|
49
|
+
.filter(block => block.type === "text" && Boolean(block.text?.trim()))
|
|
50
|
+
.flatMap(block => {
|
|
51
|
+
try {
|
|
52
|
+
return dataSections(JSON.parse(block.text!));
|
|
53
|
+
} catch {
|
|
54
|
+
return [{ kind: "markdown" as const, text: block.text! }];
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
if (sections.length === 0) {
|
|
58
|
+
const media = result.content.filter(block => block.type !== "text");
|
|
59
|
+
if (media.length)
|
|
60
|
+
sections.push({
|
|
61
|
+
kind: "code",
|
|
62
|
+
text: media.map(block => `${block.type} result${block.mimeType ? ` (${block.mimeType})` : ""}`).join("\n"),
|
|
63
|
+
});
|
|
64
|
+
else if (result.details !== undefined) sections.push(...dataSections(result.details, "Details"));
|
|
65
|
+
else sections.push({ kind: "markdown", text: "(no output)" });
|
|
66
|
+
}
|
|
67
|
+
return { sections };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** A render-time guard also catches components that fail after their callback returned. */
|
|
71
|
+
export function guardedComponent(factory: () => Component | undefined, fallback: Component): Component {
|
|
72
|
+
return {
|
|
73
|
+
invalidate() {
|
|
74
|
+
fallback.invalidate();
|
|
75
|
+
},
|
|
76
|
+
render(width) {
|
|
77
|
+
try {
|
|
78
|
+
const component = factory();
|
|
79
|
+
const lines = component?.render(width);
|
|
80
|
+
if (lines?.some(line => visibleWidth(sanitizeText(line).trim()) > 0)) return lines;
|
|
81
|
+
} catch {
|
|
82
|
+
/* Output must survive renderer failures. */
|
|
83
|
+
}
|
|
84
|
+
return fallback.render(width);
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Layout is resolved on each render so resize and active-theme changes reflow data. */
|
|
90
|
+
export class PluginViewComponent implements Component {
|
|
91
|
+
constructor(
|
|
92
|
+
private view: () => PluginView | undefined,
|
|
93
|
+
private expanded: boolean,
|
|
94
|
+
private complete = false,
|
|
95
|
+
private fallback?: Component,
|
|
96
|
+
) {}
|
|
97
|
+
invalidate(): void {}
|
|
98
|
+
render(width: number): string[] {
|
|
99
|
+
const view = this.view();
|
|
100
|
+
if (!view || (!view.summary && !view.warnings?.length && !view.sections?.length))
|
|
101
|
+
return this.fallback?.render(width) ?? [];
|
|
102
|
+
const lines: string[] = [];
|
|
103
|
+
const wrapped = (text: string) => wrapTextWithAnsi(text, Math.max(1, width));
|
|
104
|
+
if (view.summary) lines.push(...wrapped(theme.fg("toolTitle", theme.bold(view.summary))));
|
|
105
|
+
for (const warning of view.warnings ?? []) lines.push(...wrapped(theme.fg("warning", warning)));
|
|
106
|
+
for (const section of view.sections ?? []) {
|
|
107
|
+
if (section.title) lines.push(...wrapped(theme.fg("dim", section.title)));
|
|
108
|
+
if (section.kind === "fields") {
|
|
109
|
+
const entries = Object.entries(section.values);
|
|
110
|
+
const shown =
|
|
111
|
+
this.expanded || this.complete
|
|
112
|
+
? entries
|
|
113
|
+
: entries.filter(
|
|
114
|
+
([key], index) =>
|
|
115
|
+
index < 6 || /total|count|scope|warning|incomplete|done|hasMore|partial/i.test(key),
|
|
116
|
+
);
|
|
117
|
+
for (const [key, value] of shown)
|
|
118
|
+
lines.push(
|
|
119
|
+
...renderStructuredRow(
|
|
120
|
+
`${theme.bold(key)}: ${valueText(value)}`,
|
|
121
|
+
`${theme.tree.vertical} `,
|
|
122
|
+
`${theme.tree.vertical} `,
|
|
123
|
+
Math.max(1, width),
|
|
124
|
+
),
|
|
125
|
+
);
|
|
126
|
+
if (shown.length < entries.length)
|
|
127
|
+
lines.push(...wrapped(theme.fg("dim", `${entries.length - shown.length} more fields`)));
|
|
128
|
+
} else if (section.kind === "table") {
|
|
129
|
+
const rows = this.expanded || this.complete ? section.rows : section.rows.slice(0, 3);
|
|
130
|
+
lines.push(
|
|
131
|
+
...renderTable(
|
|
132
|
+
section.columns.map(c => c.label ?? c.key),
|
|
133
|
+
rows.map(row => section.columns.map(c => valueText(row[c.key]))),
|
|
134
|
+
width,
|
|
135
|
+
{ symbols: getSymbolTheme().table, bold: text => theme.bold(text) },
|
|
136
|
+
section.columns.map(
|
|
137
|
+
c =>
|
|
138
|
+
c.align ??
|
|
139
|
+
(section.rows.some(row => typeof row[c.key] === "number") &&
|
|
140
|
+
section.rows.every(row => row[c.key] == null || typeof row[c.key] === "number")
|
|
141
|
+
? "right"
|
|
142
|
+
: "left"),
|
|
143
|
+
),
|
|
144
|
+
),
|
|
145
|
+
);
|
|
146
|
+
if (rows.length < section.rows.length)
|
|
147
|
+
lines.push(...wrapped(theme.fg("dim", `${section.rows.length - rows.length} more rows`)));
|
|
148
|
+
if (!section.rows.length) lines.push(...wrapped(theme.fg("dim", "0 rows")));
|
|
149
|
+
} else if (section.kind === "code") {
|
|
150
|
+
lines.push(...wrapped(theme.fg("toolOutput", section.text)));
|
|
151
|
+
} else {
|
|
152
|
+
// Errors and tables retain complete semantic blocks in the collapsed preview.
|
|
153
|
+
const text =
|
|
154
|
+
this.expanded || this.complete || section.text.includes("|")
|
|
155
|
+
? section.text
|
|
156
|
+
: section.text.split("\n\n").slice(0, 2).join("\n\n");
|
|
157
|
+
lines.push(
|
|
158
|
+
...new Markdown(text, 0, 0, getMarkdownTheme(), undefined, {
|
|
159
|
+
tablePreviewRows: this.expanded || this.complete ? undefined : 3,
|
|
160
|
+
}).render(width),
|
|
161
|
+
);
|
|
162
|
+
if (text !== section.text) lines.push(...wrapped(theme.fg("dim", "more content in expanded view")));
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return lines;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentTool } from "@f5-sales-demo/pi-agent-core";
|
|
1
|
+
import type { AgentTool, PluginPresentation } from "@f5-sales-demo/pi-agent-core";
|
|
2
2
|
import { sanitizeText } from "@f5-sales-demo/pi-natives";
|
|
3
3
|
import {
|
|
4
4
|
Box,
|
|
@@ -15,28 +15,17 @@ import {
|
|
|
15
15
|
} from "@f5-sales-demo/pi-tui";
|
|
16
16
|
import { getProjectDir, logger } from "@f5-sales-demo/pi-utils";
|
|
17
17
|
import { computeEditDiff, computeHashlineDiff, computePatchDiff, type DiffError, type DiffResult } from "../../edit";
|
|
18
|
-
import type { Theme } from "../../modes/theme/theme";
|
|
19
18
|
import { theme } from "../../modes/theme/theme";
|
|
20
19
|
import { BASH_DEFAULT_PREVIEW_LINES } from "../../tools/bash";
|
|
21
|
-
import {
|
|
22
|
-
formatArgsInline,
|
|
23
|
-
JSON_TREE_MAX_DEPTH_COLLAPSED,
|
|
24
|
-
JSON_TREE_MAX_DEPTH_EXPANDED,
|
|
25
|
-
JSON_TREE_MAX_LINES_COLLAPSED,
|
|
26
|
-
JSON_TREE_MAX_LINES_EXPANDED,
|
|
27
|
-
JSON_TREE_SCALAR_LEN_COLLAPSED,
|
|
28
|
-
JSON_TREE_SCALAR_LEN_EXPANDED,
|
|
29
|
-
renderJsonTreeLines,
|
|
30
|
-
stripInternalArgs,
|
|
31
|
-
} from "../../tools/json-tree";
|
|
20
|
+
import { stripInternalArgs } from "../../tools/json-tree";
|
|
32
21
|
import { PYTHON_DEFAULT_PREVIEW_LINES } from "../../tools/python";
|
|
33
|
-
import { formatExpandHint, replaceTabs, resolveImageOptions
|
|
22
|
+
import { formatExpandHint, replaceTabs, resolveImageOptions } from "../../tools/render-utils";
|
|
34
23
|
import { toolRenderers } from "../../tools/renderers";
|
|
35
24
|
import { renderStatusLine } from "../../tui";
|
|
36
|
-
import { renderStructuredRow, renderStructuredTreeLine } from "../../tui/tree-list";
|
|
37
25
|
import { convertToPng } from "../../utils/image-convert";
|
|
38
26
|
import { sanitizeWithImagePassthrough } from "../../utils/image-passthrough";
|
|
39
27
|
import { renderDiff } from "./diff";
|
|
28
|
+
import { dataSections, fallbackResultView, guardedComponent, PluginViewComponent } from "./plugin-view";
|
|
40
29
|
|
|
41
30
|
function ensureInvalidate(component: unknown): Component {
|
|
42
31
|
const c = component as { render: Component["render"]; invalidate?: () => void };
|
|
@@ -148,7 +137,7 @@ export class ToolExecutionComponent extends Container {
|
|
|
148
137
|
|
|
149
138
|
// Use Box for custom tools or built-in tools that have renderers
|
|
150
139
|
const hasRenderer = toolName in toolRenderers;
|
|
151
|
-
const hasCustomRenderer = !!(tool?.renderCall || tool?.renderResult);
|
|
140
|
+
const hasCustomRenderer = !!(tool?.renderCall || tool?.renderResult || tool?.presentation);
|
|
152
141
|
if (hasCustomRenderer || hasRenderer) {
|
|
153
142
|
this.addChild(this.#contentBox);
|
|
154
143
|
} else {
|
|
@@ -385,72 +374,44 @@ export class ToolExecutionComponent extends Container {
|
|
|
385
374
|
this.#renderState.isPartial = this.#isPartial;
|
|
386
375
|
this.#renderState.spinnerFrame = this.#spinnerFrame;
|
|
387
376
|
|
|
388
|
-
//
|
|
389
|
-
if (this.#tool && (this.#tool.renderCall || this.#tool.renderResult)) {
|
|
377
|
+
// Explicit components, data-only presentation, then shared themed fallback.
|
|
378
|
+
if (this.#tool && (this.#tool.renderCall || this.#tool.renderResult || this.#tool.presentation)) {
|
|
390
379
|
const tool = this.#tool;
|
|
391
|
-
const
|
|
392
|
-
// Custom tools use Box for flexible component rendering
|
|
380
|
+
const merged = Boolean((tool as { mergeCallAndResult?: boolean }).mergeCallAndResult);
|
|
393
381
|
const inline = Boolean((tool as { inline?: boolean }).inline);
|
|
394
382
|
this.#contentBox.setBgFn(inline ? undefined : bgFn);
|
|
395
|
-
// Content sits flush with the gutter (no extra left indent) regardless
|
|
396
|
-
// of painted bg; bg-painted tools fill full width on both sides.
|
|
397
383
|
this.#contentBox.setPaddingX(0);
|
|
398
384
|
this.#contentBox.clear();
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
// Fall back to default on error
|
|
411
|
-
this.#contentBox.addChild(new Text(theme.fg("toolTitle", theme.bold(this.#toolLabel)), 0, 0));
|
|
412
|
-
}
|
|
413
|
-
} else {
|
|
414
|
-
// No custom renderCall, show tool name
|
|
415
|
-
this.#contentBox.addChild(new Text(theme.fg("toolTitle", theme.bold(this.#toolLabel)), 0, 0));
|
|
385
|
+
if (!this.#result || !merged) {
|
|
386
|
+
const fallback = this.#callView();
|
|
387
|
+
this.#contentBox.addChild(
|
|
388
|
+
tool.renderCall
|
|
389
|
+
? guardedComponent(
|
|
390
|
+
() =>
|
|
391
|
+
ensureInvalidate(tool.renderCall!(this.#getCallArgsForRender(), this.#renderState, theme)),
|
|
392
|
+
fallback,
|
|
393
|
+
)
|
|
394
|
+
: fallback,
|
|
395
|
+
);
|
|
416
396
|
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
this.#args,
|
|
436
|
-
);
|
|
437
|
-
if (resultComponent) {
|
|
438
|
-
this.#contentBox.addChild(ensureInvalidate(resultComponent));
|
|
439
|
-
}
|
|
440
|
-
} catch (err) {
|
|
441
|
-
logger.warn("Tool renderer failed", { tool: this.#toolName, error: String(err) });
|
|
442
|
-
// Fall back to showing raw output on error
|
|
443
|
-
const output = this.#getTextOutput();
|
|
444
|
-
if (output) {
|
|
445
|
-
this.#contentBox.addChild(new Text(theme.fg("toolOutput", replaceTabs(output)), 0, 0));
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
} else if (this.#result) {
|
|
449
|
-
// Has result but no custom renderResult
|
|
450
|
-
const output = this.#getTextOutput();
|
|
451
|
-
if (output) {
|
|
452
|
-
this.#contentBox.addChild(new Text(theme.fg("toolOutput", replaceTabs(output)), 0, 0));
|
|
453
|
-
}
|
|
397
|
+
if (this.#result) {
|
|
398
|
+
const fallback = this.#resultView();
|
|
399
|
+
this.#contentBox.addChild(
|
|
400
|
+
tool.renderResult
|
|
401
|
+
? guardedComponent(
|
|
402
|
+
() =>
|
|
403
|
+
ensureInvalidate(
|
|
404
|
+
(tool.renderResult as (...args: any[]) => Component)(
|
|
405
|
+
this.#result,
|
|
406
|
+
this.#renderState,
|
|
407
|
+
theme,
|
|
408
|
+
this.#args,
|
|
409
|
+
),
|
|
410
|
+
),
|
|
411
|
+
fallback,
|
|
412
|
+
)
|
|
413
|
+
: fallback,
|
|
414
|
+
);
|
|
454
415
|
}
|
|
455
416
|
} else if (this.#toolName in toolRenderers) {
|
|
456
417
|
// Built-in tools with renderers
|
|
@@ -694,97 +655,89 @@ export class ToolExecutionComponent extends Container {
|
|
|
694
655
|
return output;
|
|
695
656
|
}
|
|
696
657
|
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
const
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
? stripInternalArgs(this.#args as Record<string, unknown>)
|
|
728
|
-
: this.#args,
|
|
729
|
-
theme,
|
|
730
|
-
JSON_TREE_MAX_DEPTH_EXPANDED,
|
|
731
|
-
JSON_TREE_MAX_LINES_EXPANDED,
|
|
732
|
-
JSON_TREE_SCALAR_LEN_EXPANDED,
|
|
733
|
-
);
|
|
734
|
-
lines.push(...tree.lines.flatMap(line => renderStructuredTreeLine(line, contentWidth)));
|
|
735
|
-
if (tree.truncated) {
|
|
736
|
-
lines.push(theme.fg("dim", "…"));
|
|
737
|
-
}
|
|
738
|
-
lines.push("");
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
if (!this.#result) {
|
|
742
|
-
return lines.join("\n");
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
const textContent = this.#getTextOutput().trimEnd();
|
|
746
|
-
if (!textContent) {
|
|
747
|
-
lines.push(theme.fg("dim", "(no output)"));
|
|
748
|
-
return lines.join("\n");
|
|
749
|
-
}
|
|
658
|
+
#callView(): Component {
|
|
659
|
+
const args =
|
|
660
|
+
!this.#expanded && this.#args && typeof this.#args === "object" && !Array.isArray(this.#args)
|
|
661
|
+
? stripInternalArgs(this.#args)
|
|
662
|
+
: this.#args;
|
|
663
|
+
const fallback = new PluginViewComponent(
|
|
664
|
+
() => ({
|
|
665
|
+
summary: renderStatusLine({ icon: this.#isPartial ? "pending" : undefined, title: this.#toolLabel }, theme),
|
|
666
|
+
sections: dataSections(args, this.#expanded ? "Args" : undefined),
|
|
667
|
+
}),
|
|
668
|
+
this.#expanded,
|
|
669
|
+
);
|
|
670
|
+
const descriptor = this.#tool?.presentation as PluginPresentation | undefined;
|
|
671
|
+
return descriptor?.call
|
|
672
|
+
? guardedComponent(
|
|
673
|
+
() =>
|
|
674
|
+
new PluginViewComponent(
|
|
675
|
+
() =>
|
|
676
|
+
descriptor.call!(structuredClone(args), {
|
|
677
|
+
expanded: this.#expanded,
|
|
678
|
+
isPartial: this.#isPartial,
|
|
679
|
+
}),
|
|
680
|
+
this.#expanded,
|
|
681
|
+
false,
|
|
682
|
+
fallback,
|
|
683
|
+
),
|
|
684
|
+
fallback,
|
|
685
|
+
)
|
|
686
|
+
: fallback;
|
|
687
|
+
}
|
|
750
688
|
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
689
|
+
#resultView(): Component {
|
|
690
|
+
const result = this.#result!;
|
|
691
|
+
const fallback = new PluginViewComponent(
|
|
692
|
+
() => fallbackResultView(result),
|
|
693
|
+
this.#expanded,
|
|
694
|
+
Boolean(result.isError),
|
|
695
|
+
);
|
|
696
|
+
const descriptor = this.#tool?.presentation as PluginPresentation | undefined;
|
|
697
|
+
const presented = descriptor?.result
|
|
698
|
+
? guardedComponent(
|
|
699
|
+
() =>
|
|
700
|
+
new PluginViewComponent(
|
|
701
|
+
() =>
|
|
702
|
+
descriptor.result!(
|
|
703
|
+
structuredClone(result),
|
|
704
|
+
{ expanded: this.#expanded, isPartial: this.#isPartial },
|
|
705
|
+
structuredClone(this.#args),
|
|
706
|
+
),
|
|
707
|
+
this.#expanded,
|
|
708
|
+
Boolean(result.isError),
|
|
709
|
+
fallback,
|
|
710
|
+
),
|
|
711
|
+
fallback,
|
|
712
|
+
)
|
|
713
|
+
: fallback;
|
|
714
|
+
return {
|
|
715
|
+
invalidate: () => presented.invalidate(),
|
|
716
|
+
render: width => {
|
|
717
|
+
const lines = presented.render(width);
|
|
718
|
+
// Retain every source field, argument, error and advisory for transcript inspection.
|
|
719
|
+
if (descriptor?.result && this.#expanded) {
|
|
720
|
+
lines.push(...fallback.render(width));
|
|
767
721
|
}
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
if (outputLines.length > maxOutputLines) {
|
|
782
|
-
const remaining = outputLines.length - maxOutputLines;
|
|
783
|
-
lines.push(`${theme.fg("dim", `… ${remaining} more lines`)} ${formatExpandHint(theme, this.#expanded, true)}`);
|
|
784
|
-
} else if (!this.#expanded) {
|
|
785
|
-
lines.push(formatExpandHint(theme, this.#expanded, true));
|
|
786
|
-
}
|
|
722
|
+
if (this.#expanded && result.details !== undefined) {
|
|
723
|
+
lines.push(
|
|
724
|
+
...new PluginViewComponent(
|
|
725
|
+
() => ({ sections: dataSections(result.details, "Details") }),
|
|
726
|
+
true,
|
|
727
|
+
).render(width),
|
|
728
|
+
);
|
|
729
|
+
}
|
|
730
|
+
if (!this.#expanded) lines.push(formatExpandHint(theme, false, true));
|
|
731
|
+
return lines;
|
|
732
|
+
},
|
|
733
|
+
};
|
|
734
|
+
}
|
|
787
735
|
|
|
736
|
+
/** Shared fallback is measured after the Text component's padding is removed. */
|
|
737
|
+
#formatToolExecution(width = 80): string {
|
|
738
|
+
const contentWidth = Math.max(1, width - 2);
|
|
739
|
+
const lines = this.#callView().render(contentWidth);
|
|
740
|
+
if (this.#result) lines.push(...this.#resultView().render(contentWidth));
|
|
788
741
|
return lines.join("\n");
|
|
789
742
|
}
|
|
790
743
|
}
|
|
@@ -975,11 +975,11 @@ export class InteractiveMode implements InteractiveModeContext {
|
|
|
975
975
|
}
|
|
976
976
|
|
|
977
977
|
// UI helpers
|
|
978
|
-
showStatus(message: string, options?: { dim?: boolean }): void {
|
|
978
|
+
showStatus(message: string, options?: { dim?: boolean; plugin?: boolean }): void {
|
|
979
979
|
this.#uiHelpers.showStatus(message, options);
|
|
980
980
|
}
|
|
981
981
|
|
|
982
|
-
showError(message: string): void {
|
|
982
|
+
showError(message: string, options?: { plugin?: boolean }): void {
|
|
983
983
|
this.#pendingSubmittedInput = undefined;
|
|
984
984
|
this.optimisticUserMessageSignature = undefined;
|
|
985
985
|
this.#pendingWorkingMessage = undefined;
|
|
@@ -988,7 +988,7 @@ export class InteractiveMode implements InteractiveModeContext {
|
|
|
988
988
|
this.loadingAnimation = undefined;
|
|
989
989
|
this.statusContainer.clear();
|
|
990
990
|
}
|
|
991
|
-
this.#uiHelpers.showError(message);
|
|
991
|
+
this.#uiHelpers.showError(message, options);
|
|
992
992
|
}
|
|
993
993
|
|
|
994
994
|
showWarning(message: string): void {
|
package/src/modes/types.ts
CHANGED
|
@@ -134,8 +134,8 @@ export interface InteractiveModeContext {
|
|
|
134
134
|
beginBackgroundCompletionTracking(): void;
|
|
135
135
|
|
|
136
136
|
// UI helpers
|
|
137
|
-
showStatus(message: string, options?: { dim?: boolean }): void;
|
|
138
|
-
showError(message: string): void;
|
|
137
|
+
showStatus(message: string, options?: { dim?: boolean; plugin?: boolean }): void;
|
|
138
|
+
showError(message: string, options?: { plugin?: boolean }): void;
|
|
139
139
|
showWarning(message: string): void;
|
|
140
140
|
/** Instant, local check for whether a usable LLM provider is configured (no network). */
|
|
141
141
|
hasActiveLlmProvider(): boolean;
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
GutterBlock,
|
|
18
18
|
} from "../../modes/components/gutter-block";
|
|
19
19
|
import { MediaMessageComponent } from "../../modes/components/media-message";
|
|
20
|
+
import { PluginLifecycleText } from "../../modes/components/plugin-lifecycle";
|
|
20
21
|
import { PythonExecutionComponent } from "../../modes/components/python-execution";
|
|
21
22
|
import {
|
|
22
23
|
parseAsyncInputReply,
|
|
@@ -63,7 +64,7 @@ export class UiHelpers {
|
|
|
63
64
|
* If multiple status messages are emitted back-to-back (without anything else being added to the chat),
|
|
64
65
|
* we update the previous status line instead of appending new ones to avoid log spam.
|
|
65
66
|
*/
|
|
66
|
-
showStatus(message: string, options?: { dim?: boolean }): void {
|
|
67
|
+
showStatus(message: string, options?: { dim?: boolean; plugin?: boolean }): void {
|
|
67
68
|
if (this.ctx.isBackgrounded) {
|
|
68
69
|
return;
|
|
69
70
|
}
|
|
@@ -73,14 +74,20 @@ export class UiHelpers {
|
|
|
73
74
|
// User-facing results must remain legible; only explicitly secondary diagnostics are dimmed.
|
|
74
75
|
const rendered = theme.fg(options?.dim ? "dim" : "text", message);
|
|
75
76
|
|
|
76
|
-
if (
|
|
77
|
+
if (
|
|
78
|
+
last &&
|
|
79
|
+
secondLast &&
|
|
80
|
+
last === this.ctx.lastStatusText &&
|
|
81
|
+
secondLast === this.ctx.lastStatusSpacer &&
|
|
82
|
+
Boolean(options?.plugin) === last instanceof PluginLifecycleText
|
|
83
|
+
) {
|
|
77
84
|
this.ctx.lastStatusText.setText(rendered);
|
|
78
85
|
this.ctx.ui.requestRender();
|
|
79
86
|
return;
|
|
80
87
|
}
|
|
81
88
|
|
|
82
89
|
const spacer = new Spacer(1);
|
|
83
|
-
const text = new Text(rendered, 1, 0);
|
|
90
|
+
const text = options?.plugin ? new PluginLifecycleText(message) : new Text(rendered, 1, 0);
|
|
84
91
|
this.ctx.chatContainer.addChild(spacer);
|
|
85
92
|
this.ctx.chatContainer.addChild(text);
|
|
86
93
|
this.ctx.lastStatusSpacer = spacer;
|
|
@@ -592,13 +599,17 @@ export class UiHelpers {
|
|
|
592
599
|
this.ctx.ui.requestRender();
|
|
593
600
|
}
|
|
594
601
|
|
|
595
|
-
showError(errorMessage: string): void {
|
|
602
|
+
showError(errorMessage: string, options?: { plugin?: boolean }): void {
|
|
596
603
|
if (this.ctx.isBackgrounded) {
|
|
597
604
|
process.stderr.write(`Error: ${errorMessage}\n`);
|
|
598
605
|
return;
|
|
599
606
|
}
|
|
600
607
|
this.ctx.chatContainer.addChild(new Spacer(1));
|
|
601
|
-
this.ctx.chatContainer.addChild(
|
|
608
|
+
this.ctx.chatContainer.addChild(
|
|
609
|
+
options?.plugin
|
|
610
|
+
? new PluginLifecycleText(errorMessage, "error")
|
|
611
|
+
: new Text(theme.fg("error", `Error: ${errorMessage}`), 1, 0),
|
|
612
|
+
);
|
|
602
613
|
this.ctx.ui.requestRender();
|
|
603
614
|
}
|
|
604
615
|
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
describeSetupPlan,
|
|
28
28
|
executeInstallAuthorizedSetup,
|
|
29
29
|
executeReviewedSetup,
|
|
30
|
+
formatSetupCommand,
|
|
30
31
|
} from "../integrations/setup";
|
|
31
32
|
import type { IntegrationHandle, IntegrationSetupPlan } from "../integrations/types";
|
|
32
33
|
import { BorderedLoader } from "../modes/components/bordered-loader";
|
|
@@ -1203,6 +1204,8 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1203
1204
|
],
|
|
1204
1205
|
allowArgs: true,
|
|
1205
1206
|
handle: async (command, runtime) => {
|
|
1207
|
+
const pluginStatus = (message: string) => runtime.ctx.showStatus(message, { plugin: true });
|
|
1208
|
+
const pluginError = (message: string) => runtime.ctx.showError(message, { plugin: true });
|
|
1206
1209
|
runtime.ctx.editor.setText("");
|
|
1207
1210
|
const args = command.args.trim().split(/\s+/);
|
|
1208
1211
|
const sub = args[0] || "";
|
|
@@ -1219,7 +1222,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1219
1222
|
try {
|
|
1220
1223
|
runtime.ctx.showPluginDashboard("discover");
|
|
1221
1224
|
} catch (err) {
|
|
1222
|
-
|
|
1225
|
+
pluginStatus(t("commands.plugin.error", { message: String(err) }));
|
|
1223
1226
|
}
|
|
1224
1227
|
return;
|
|
1225
1228
|
}
|
|
@@ -1235,7 +1238,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1235
1238
|
try {
|
|
1236
1239
|
runtime.ctx.showPluginDashboard("installed");
|
|
1237
1240
|
} catch (err) {
|
|
1238
|
-
|
|
1241
|
+
pluginStatus(t("commands.plugin.error", { message: String(err) }));
|
|
1239
1242
|
}
|
|
1240
1243
|
return;
|
|
1241
1244
|
}
|
|
@@ -1262,7 +1265,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1262
1265
|
refresh?: Awaited<ReturnType<typeof mgr.refreshMarketplaces>>,
|
|
1263
1266
|
) => {
|
|
1264
1267
|
const warning = refresh ? formatMarketplaceRefreshWarning(refresh) : undefined;
|
|
1265
|
-
|
|
1268
|
+
pluginStatus(warning ? `${warning}\n\n${message}` : message);
|
|
1266
1269
|
};
|
|
1267
1270
|
switch (sub) {
|
|
1268
1271
|
// ── Marketplace management (/plugin marketplace add|remove|update|list) ──
|
|
@@ -1273,7 +1276,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1273
1276
|
switch (mktSub) {
|
|
1274
1277
|
case "add": {
|
|
1275
1278
|
if (!mktRest) {
|
|
1276
|
-
|
|
1279
|
+
pluginStatus(t("commands.plugin.marketplace.addUsage"));
|
|
1277
1280
|
return;
|
|
1278
1281
|
}
|
|
1279
1282
|
const prepared = await prepareMarketplaceAddition(mgr, mktRest);
|
|
@@ -1285,19 +1288,17 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1285
1288
|
},
|
|
1286
1289
|
execute: target => executeMarketplaceAddition(mgr, target),
|
|
1287
1290
|
});
|
|
1288
|
-
if (outcome === "busy")
|
|
1291
|
+
if (outcome === "busy") pluginStatus("Another reviewed action is already open.");
|
|
1289
1292
|
else if (outcome === "succeeded")
|
|
1290
|
-
|
|
1291
|
-
t("commands.plugin.marketplace.added", { name: prepared.target.name }),
|
|
1292
|
-
);
|
|
1293
|
+
pluginStatus(t("commands.plugin.marketplace.added", { name: prepared.target.name }));
|
|
1293
1294
|
else if (outcome === "unresolved")
|
|
1294
|
-
|
|
1295
|
+
pluginError("Marketplace addition remains unresolved; retry from a fresh review.");
|
|
1295
1296
|
break;
|
|
1296
1297
|
}
|
|
1297
1298
|
case "remove":
|
|
1298
1299
|
case "rm": {
|
|
1299
1300
|
if (!mktRest) {
|
|
1300
|
-
|
|
1301
|
+
pluginStatus(t("commands.plugin.marketplace.removeUsage"));
|
|
1301
1302
|
return;
|
|
1302
1303
|
}
|
|
1303
1304
|
const prepared = await prepareMarketplaceRemoval(mgr, mktRest);
|
|
@@ -1309,17 +1310,17 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1309
1310
|
},
|
|
1310
1311
|
execute: target => mgr.removeMarketplace(target.name),
|
|
1311
1312
|
});
|
|
1312
|
-
if (outcome === "busy")
|
|
1313
|
+
if (outcome === "busy") pluginStatus("Another reviewed action is already open.");
|
|
1313
1314
|
else if (outcome === "succeeded")
|
|
1314
|
-
|
|
1315
|
+
pluginStatus(t("commands.plugin.marketplace.removed", { name: mktRest }));
|
|
1315
1316
|
else if (outcome === "unresolved")
|
|
1316
|
-
|
|
1317
|
+
pluginError("Marketplace removal remains unresolved; retry from a fresh review.");
|
|
1317
1318
|
break;
|
|
1318
1319
|
}
|
|
1319
1320
|
case "update": {
|
|
1320
1321
|
if (mktRest) {
|
|
1321
1322
|
await mgr.updateMarketplace(mktRest);
|
|
1322
|
-
|
|
1323
|
+
pluginStatus(t("commands.plugin.marketplace.updated", { name: mktRest }));
|
|
1323
1324
|
} else {
|
|
1324
1325
|
const refresh = await mgr.refreshMarketplaces();
|
|
1325
1326
|
showPluginStatus(
|
|
@@ -1334,13 +1335,13 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1334
1335
|
case "enable":
|
|
1335
1336
|
case "disable": {
|
|
1336
1337
|
if (!mktRest) {
|
|
1337
|
-
|
|
1338
|
+
pluginStatus(`Usage: /plugin marketplace ${mktSub} <name>`);
|
|
1338
1339
|
return;
|
|
1339
1340
|
}
|
|
1340
1341
|
const enabled = mktSub === "enable";
|
|
1341
1342
|
const prepared = await prepareMarketplaceEnabled(mgr, mktRest, enabled);
|
|
1342
1343
|
if (!prepared) {
|
|
1343
|
-
|
|
1344
|
+
pluginStatus(`Marketplace ${mktRest} is already ${mktSub}d.`);
|
|
1344
1345
|
break;
|
|
1345
1346
|
}
|
|
1346
1347
|
const outcome = await runReviewedAction(runtime.ctx, `marketplace ${mktSub}`, {
|
|
@@ -1354,25 +1355,23 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1354
1355
|
await mgr.setMarketplaceEnabled(target.name, target.enabled);
|
|
1355
1356
|
},
|
|
1356
1357
|
});
|
|
1357
|
-
if (outcome === "busy")
|
|
1358
|
+
if (outcome === "busy") pluginStatus("Another reviewed action is already open.");
|
|
1358
1359
|
else if (outcome === "succeeded")
|
|
1359
|
-
|
|
1360
|
+
pluginStatus(`Marketplace ${mktRest} ${enabled ? "enabled" : "disabled"}.`);
|
|
1360
1361
|
else if (outcome === "unresolved")
|
|
1361
|
-
|
|
1362
|
-
`Marketplace ${mktSub} remains unresolved; retry from a fresh review.`,
|
|
1363
|
-
);
|
|
1362
|
+
pluginError(`Marketplace ${mktSub} remains unresolved; retry from a fresh review.`);
|
|
1364
1363
|
break;
|
|
1365
1364
|
}
|
|
1366
1365
|
default: {
|
|
1367
1366
|
const marketplaces = await mgr.listMarketplaces();
|
|
1368
1367
|
if (marketplaces.length === 0) {
|
|
1369
|
-
|
|
1368
|
+
pluginStatus(t("commands.plugin.marketplace.noneConfiguredGetStarted"));
|
|
1370
1369
|
} else {
|
|
1371
1370
|
const lines = marketplaces.map(
|
|
1372
1371
|
m =>
|
|
1373
1372
|
` ${m.name} ${m.enabled ? "enabled" : "disabled"} ${m.builtIn ? "built-in" : "custom"} ${m.sourceUri}`,
|
|
1374
1373
|
);
|
|
1375
|
-
|
|
1374
|
+
pluginStatus(
|
|
1376
1375
|
`Marketplaces:\n${lines.join("\n")}\n\n${t("commands.plugin.marketplace.listHint")}`,
|
|
1377
1376
|
);
|
|
1378
1377
|
}
|
|
@@ -1384,7 +1383,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1384
1383
|
// ── Legacy shorthand: /marketplace add|remove|update → /plugin marketplace ──
|
|
1385
1384
|
case "add": {
|
|
1386
1385
|
if (!rest) {
|
|
1387
|
-
|
|
1386
|
+
pluginStatus(t("commands.plugin.marketplace.addUsage"));
|
|
1388
1387
|
return;
|
|
1389
1388
|
}
|
|
1390
1389
|
const prepared = await prepareMarketplaceAddition(mgr, rest);
|
|
@@ -1396,17 +1395,17 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1396
1395
|
},
|
|
1397
1396
|
execute: target => executeMarketplaceAddition(mgr, target),
|
|
1398
1397
|
});
|
|
1399
|
-
if (outcome === "busy")
|
|
1398
|
+
if (outcome === "busy") pluginStatus("Another reviewed action is already open.");
|
|
1400
1399
|
else if (outcome === "succeeded")
|
|
1401
|
-
|
|
1400
|
+
pluginStatus(t("commands.plugin.marketplace.added", { name: prepared.target.name }));
|
|
1402
1401
|
else if (outcome === "unresolved")
|
|
1403
|
-
|
|
1402
|
+
pluginError("Marketplace addition remains unresolved; retry from a fresh review.");
|
|
1404
1403
|
break;
|
|
1405
1404
|
}
|
|
1406
1405
|
case "remove":
|
|
1407
1406
|
case "rm": {
|
|
1408
1407
|
if (!rest) {
|
|
1409
|
-
|
|
1408
|
+
pluginStatus(t("commands.plugin.marketplace.removeUsage"));
|
|
1410
1409
|
return;
|
|
1411
1410
|
}
|
|
1412
1411
|
const prepared = await prepareMarketplaceRemoval(mgr, rest);
|
|
@@ -1418,17 +1417,17 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1418
1417
|
},
|
|
1419
1418
|
execute: target => mgr.removeMarketplace(target.name),
|
|
1420
1419
|
});
|
|
1421
|
-
if (outcome === "busy")
|
|
1420
|
+
if (outcome === "busy") pluginStatus("Another reviewed action is already open.");
|
|
1422
1421
|
else if (outcome === "succeeded")
|
|
1423
|
-
|
|
1422
|
+
pluginStatus(t("commands.plugin.marketplace.removed", { name: rest }));
|
|
1424
1423
|
else if (outcome === "unresolved")
|
|
1425
|
-
|
|
1424
|
+
pluginError("Marketplace removal remains unresolved; retry from a fresh review.");
|
|
1426
1425
|
break;
|
|
1427
1426
|
}
|
|
1428
1427
|
case "update": {
|
|
1429
1428
|
if (rest) {
|
|
1430
1429
|
await mgr.updateMarketplace(rest);
|
|
1431
|
-
|
|
1430
|
+
pluginStatus(t("commands.plugin.marketplace.updated", { name: rest }));
|
|
1432
1431
|
} else {
|
|
1433
1432
|
const refresh = await mgr.refreshMarketplaces();
|
|
1434
1433
|
showPluginStatus(
|
|
@@ -1464,7 +1463,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1464
1463
|
case "install": {
|
|
1465
1464
|
const parsed = parseMarketplaceInstallArgs(rest);
|
|
1466
1465
|
if ("error" in parsed) {
|
|
1467
|
-
|
|
1466
|
+
pluginStatus(parsed.error);
|
|
1468
1467
|
return;
|
|
1469
1468
|
}
|
|
1470
1469
|
const preview = parsed.installSpec.includes("@") ? undefined : await mgr.previewMarketplacePlugins();
|
|
@@ -1473,7 +1472,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1473
1472
|
preview?.plugins.map(({ marketplace, plugin }) => ({ marketplace, name: plugin.name })) ?? [],
|
|
1474
1473
|
);
|
|
1475
1474
|
if ("error" in resolved) {
|
|
1476
|
-
|
|
1475
|
+
pluginStatus(resolved.error);
|
|
1477
1476
|
return;
|
|
1478
1477
|
}
|
|
1479
1478
|
const { name, marketplace } = resolved;
|
|
@@ -1486,7 +1485,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1486
1485
|
},
|
|
1487
1486
|
execute: target => executePluginInstall(mgr, target),
|
|
1488
1487
|
});
|
|
1489
|
-
if (outcome === "busy")
|
|
1488
|
+
if (outcome === "busy") pluginStatus("Another reviewed action is already open.");
|
|
1490
1489
|
else if (outcome === "succeeded") {
|
|
1491
1490
|
await runtime.ctx.refreshSlashCommandState(undefined, { reloadExtensions: true });
|
|
1492
1491
|
const handles = runtime.ctx.session?.extensionRunner?.getAllRegisteredIntegrations() ?? [];
|
|
@@ -1514,7 +1513,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1514
1513
|
showPluginStatus(nextAction ? `${installed}\nnext: ${nextAction}` : installed);
|
|
1515
1514
|
}
|
|
1516
1515
|
} else if (outcome === "unresolved")
|
|
1517
|
-
|
|
1516
|
+
pluginError("Plugin installation remains unresolved; retry from a fresh review.");
|
|
1518
1517
|
break;
|
|
1519
1518
|
}
|
|
1520
1519
|
// ── Uninstall ──
|
|
@@ -1524,7 +1523,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1524
1523
|
"Usage: /plugin uninstall [--scope user|project] <name[@marketplace]>",
|
|
1525
1524
|
);
|
|
1526
1525
|
if ("error" in uninstArgs) {
|
|
1527
|
-
|
|
1526
|
+
pluginStatus(uninstArgs.error);
|
|
1528
1527
|
return;
|
|
1529
1528
|
}
|
|
1530
1529
|
const prepared = await preparePluginRemoval(mgr, uninstArgs.pluginId, uninstArgs.scope);
|
|
@@ -1536,16 +1535,16 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1536
1535
|
},
|
|
1537
1536
|
execute: target => mgr.uninstallPlugin(target.pluginId, target.scope),
|
|
1538
1537
|
});
|
|
1539
|
-
if (outcome === "busy")
|
|
1538
|
+
if (outcome === "busy") pluginStatus("Another reviewed action is already open.");
|
|
1540
1539
|
else if (outcome === "succeeded") {
|
|
1541
1540
|
await runtime.ctx.refreshSlashCommandState(undefined, { reloadExtensions: true });
|
|
1542
|
-
|
|
1541
|
+
pluginStatus(
|
|
1543
1542
|
t("commands.plugin.uninstalled", {
|
|
1544
1543
|
pluginId: uninstArgs.pluginId,
|
|
1545
1544
|
}),
|
|
1546
1545
|
);
|
|
1547
1546
|
} else if (outcome === "unresolved")
|
|
1548
|
-
|
|
1547
|
+
pluginError("Plugin removal remains unresolved; retry from a fresh review.");
|
|
1549
1548
|
break;
|
|
1550
1549
|
}
|
|
1551
1550
|
// ── Enable / Disable ──
|
|
@@ -1556,13 +1555,13 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1556
1555
|
`Usage: /plugin ${sub} [--scope user|project] <name@marketplace>`,
|
|
1557
1556
|
);
|
|
1558
1557
|
if ("error" in parsed) {
|
|
1559
|
-
|
|
1558
|
+
pluginStatus(parsed.error);
|
|
1560
1559
|
return;
|
|
1561
1560
|
}
|
|
1562
1561
|
const isEnable = sub === "enable";
|
|
1563
1562
|
const prepared = await preparePluginEnabled(mgr, parsed.pluginId, parsed.scope, isEnable);
|
|
1564
1563
|
if (!prepared) {
|
|
1565
|
-
|
|
1564
|
+
pluginStatus(
|
|
1566
1565
|
`Nothing changed. Plugin ${parsed.pluginId} is already ${isEnable ? "enabled" : "disabled"}.`,
|
|
1567
1566
|
);
|
|
1568
1567
|
break;
|
|
@@ -1575,16 +1574,16 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1575
1574
|
},
|
|
1576
1575
|
execute: target => mgr.setPluginEnabled(target.pluginId, isEnable, target.scope),
|
|
1577
1576
|
});
|
|
1578
|
-
if (outcome === "busy")
|
|
1577
|
+
if (outcome === "busy") pluginStatus("Another reviewed action is already open.");
|
|
1579
1578
|
else if (outcome === "succeeded") {
|
|
1580
1579
|
await runtime.ctx.refreshSlashCommandState(undefined, { reloadExtensions: true });
|
|
1581
|
-
|
|
1580
|
+
pluginStatus(
|
|
1582
1581
|
isEnable
|
|
1583
1582
|
? t("commands.plugin.enabled", { pluginId: parsed.pluginId })
|
|
1584
1583
|
: t("commands.plugin.disabled", { pluginId: parsed.pluginId }),
|
|
1585
1584
|
);
|
|
1586
1585
|
} else if (outcome === "unresolved")
|
|
1587
|
-
|
|
1586
|
+
pluginError(`Plugin ${sub} remains unresolved; retry from a fresh review.`);
|
|
1588
1587
|
break;
|
|
1589
1588
|
}
|
|
1590
1589
|
// ── Upgrade ──
|
|
@@ -1595,12 +1594,12 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1595
1594
|
"Usage: /plugin upgrade [--scope user|project] <name@marketplace>",
|
|
1596
1595
|
);
|
|
1597
1596
|
if ("error" in upArgs) {
|
|
1598
|
-
|
|
1597
|
+
pluginStatus(upArgs.error);
|
|
1599
1598
|
return;
|
|
1600
1599
|
}
|
|
1601
1600
|
const prepared = await preparePluginUpgrade(mgr, upArgs.pluginId, upArgs.scope);
|
|
1602
1601
|
if (!prepared) {
|
|
1603
|
-
|
|
1602
|
+
pluginStatus(`Nothing changed. Plugin ${upArgs.pluginId} is already up to date.`);
|
|
1604
1603
|
break;
|
|
1605
1604
|
}
|
|
1606
1605
|
const outcome = await runReviewedAction(runtime.ctx, "plugin upgrade", {
|
|
@@ -1611,7 +1610,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1611
1610
|
},
|
|
1612
1611
|
execute: target => executePluginUpgrade(mgr, target),
|
|
1613
1612
|
});
|
|
1614
|
-
if (outcome === "busy")
|
|
1613
|
+
if (outcome === "busy") pluginStatus("Another reviewed action is already open.");
|
|
1615
1614
|
else if (outcome === "succeeded") {
|
|
1616
1615
|
await runtime.ctx.refreshSlashCommandState(undefined, { reloadExtensions: true });
|
|
1617
1616
|
showPluginStatus(
|
|
@@ -1621,7 +1620,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1621
1620
|
}),
|
|
1622
1621
|
);
|
|
1623
1622
|
} else if (outcome === "unresolved")
|
|
1624
|
-
|
|
1623
|
+
pluginError("Plugin upgrade remains unresolved; retry from a fresh review.");
|
|
1625
1624
|
} else {
|
|
1626
1625
|
const prepared = await preparePluginUpgradeAll(mgr);
|
|
1627
1626
|
if (!prepared) {
|
|
@@ -1639,9 +1638,9 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1639
1638
|
result = await executePluginUpgradeAll(mgr, target);
|
|
1640
1639
|
},
|
|
1641
1640
|
});
|
|
1642
|
-
if (outcome === "busy")
|
|
1641
|
+
if (outcome === "busy") pluginStatus("Another reviewed action is already open.");
|
|
1643
1642
|
else if (outcome === "unresolved")
|
|
1644
|
-
|
|
1643
|
+
pluginError("Plugin upgrades remain unresolved; retry from a fresh review.");
|
|
1645
1644
|
else if (outcome === "succeeded" && result) {
|
|
1646
1645
|
await runtime.ctx.refreshSlashCommandState(undefined, { reloadExtensions: true });
|
|
1647
1646
|
const lines = result.completed.map(
|
|
@@ -1651,7 +1650,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1651
1650
|
const failures = result.failed.map(
|
|
1652
1651
|
failure => ` ${failure.pluginId} [${failure.scope}]: ${failure.error}`,
|
|
1653
1652
|
);
|
|
1654
|
-
|
|
1653
|
+
pluginStatus(
|
|
1655
1654
|
`${result.completed.length} plugin scope(s) upgraded; ${result.failed.length} unresolved. Re-run /plugin upgrade to review only unresolved operations.\n${[
|
|
1656
1655
|
...lines,
|
|
1657
1656
|
...failures,
|
|
@@ -1689,9 +1688,9 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1689
1688
|
}
|
|
1690
1689
|
}
|
|
1691
1690
|
if (lines.length === 0) {
|
|
1692
|
-
|
|
1691
|
+
pluginStatus(t("commands.plugin.noneInstalled"));
|
|
1693
1692
|
} else {
|
|
1694
|
-
|
|
1693
|
+
pluginStatus(lines.join("\n"));
|
|
1695
1694
|
}
|
|
1696
1695
|
break;
|
|
1697
1696
|
}
|
|
@@ -1705,7 +1704,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1705
1704
|
const catalogContent = await readOptionalTextFile(catalogPath);
|
|
1706
1705
|
if (catalogContent !== undefined) {
|
|
1707
1706
|
const catalog = parseMarketplaceCatalog(catalogContent, catalogPath);
|
|
1708
|
-
|
|
1707
|
+
pluginStatus(
|
|
1709
1708
|
t("commands.plugin.validate.marketplaceValid", {
|
|
1710
1709
|
name: catalog.name,
|
|
1711
1710
|
count: catalog.plugins.length,
|
|
@@ -1714,11 +1713,11 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1714
1713
|
} else {
|
|
1715
1714
|
const pluginContent = await readOptionalTextFile(pluginPath);
|
|
1716
1715
|
if (pluginContent === undefined) {
|
|
1717
|
-
|
|
1716
|
+
pluginStatus(t("commands.plugin.validate.notFound", { path: targetPath }));
|
|
1718
1717
|
break;
|
|
1719
1718
|
}
|
|
1720
1719
|
const manifest = JSON.parse(pluginContent);
|
|
1721
|
-
|
|
1720
|
+
pluginStatus(
|
|
1722
1721
|
t("commands.plugin.validate.pluginValid", {
|
|
1723
1722
|
name: manifest.name ?? path.basename(targetPath),
|
|
1724
1723
|
}),
|
|
@@ -1729,7 +1728,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1729
1728
|
// ── Setup (reviewed authentication/readiness plan) ──
|
|
1730
1729
|
case "setup": {
|
|
1731
1730
|
if (!rest) {
|
|
1732
|
-
|
|
1731
|
+
pluginStatus("Usage: /plugin setup <plugin>");
|
|
1733
1732
|
break;
|
|
1734
1733
|
}
|
|
1735
1734
|
const matches = (runtime.ctx.session.extensionRunner?.getAllRegisteredIntegrations() ?? []).filter(
|
|
@@ -1738,7 +1737,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1738
1737
|
handle.setupPlan !== undefined,
|
|
1739
1738
|
);
|
|
1740
1739
|
if (matches.length !== 1) {
|
|
1741
|
-
|
|
1740
|
+
pluginError(
|
|
1742
1741
|
matches.length
|
|
1743
1742
|
? `Plugin ${rest} registers multiple setup plans; use an integration id.`
|
|
1744
1743
|
: `No setup plan is registered for ${rest}.`,
|
|
@@ -1748,7 +1747,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1748
1747
|
const handle = matches[0] as IntegrationHandle<unknown>;
|
|
1749
1748
|
let plan = handle.setupPlan;
|
|
1750
1749
|
if (!plan) {
|
|
1751
|
-
|
|
1750
|
+
pluginError(`Integration ${handle.id} does not declare setup.`);
|
|
1752
1751
|
break;
|
|
1753
1752
|
}
|
|
1754
1753
|
const current = await handle.get();
|
|
@@ -1780,7 +1779,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1780
1779
|
changes: plan.steps.map((step, index) => ({
|
|
1781
1780
|
field: `${index + 1}. ${step.kind}`,
|
|
1782
1781
|
before: "not run",
|
|
1783
|
-
after: `${JSON.stringify(step.archive
|
|
1782
|
+
after: `${step.archive ? JSON.stringify(step.archive, null, 2) : formatSetupCommand(step.argv)} (timeout ${step.timeoutMs}ms)`,
|
|
1784
1783
|
})),
|
|
1785
1784
|
consequence: describeSetupPlan(handle),
|
|
1786
1785
|
};
|
|
@@ -1796,9 +1795,9 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1796
1795
|
await personProfileService.reconcileFromCollectors(undefined, 0);
|
|
1797
1796
|
},
|
|
1798
1797
|
});
|
|
1799
|
-
if (outcome === "busy")
|
|
1798
|
+
if (outcome === "busy") pluginStatus("Another reviewed action is already open.");
|
|
1800
1799
|
else if (outcome === "unresolved")
|
|
1801
|
-
|
|
1800
|
+
pluginError(`Plugin setup for ${rest} remains unresolved; retry from a fresh review.`);
|
|
1802
1801
|
else if (outcome === "succeeded" && result) {
|
|
1803
1802
|
showPluginStatus(
|
|
1804
1803
|
`${handle.plugin ?? handle.id}: ${result.state}${result.reason ? ` (${result.reason})` : ""}`,
|
|
@@ -1807,21 +1806,21 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1807
1806
|
break;
|
|
1808
1807
|
}
|
|
1809
1808
|
case "doctor": {
|
|
1810
|
-
|
|
1809
|
+
pluginError("Plugin health checks are CLI-only; run xcsh plugin doctor.");
|
|
1811
1810
|
break;
|
|
1812
1811
|
}
|
|
1813
1812
|
// ── Help ──
|
|
1814
1813
|
case "help": {
|
|
1815
|
-
|
|
1814
|
+
pluginStatus(t("commands.plugin.help"));
|
|
1816
1815
|
break;
|
|
1817
1816
|
}
|
|
1818
1817
|
default: {
|
|
1819
1818
|
const marketplaces = await mgr.listMarketplaces();
|
|
1820
1819
|
if (marketplaces.length === 0) {
|
|
1821
|
-
|
|
1820
|
+
pluginStatus(t("commands.plugin.marketplace.noneConfiguredBrowse"));
|
|
1822
1821
|
} else {
|
|
1823
1822
|
const lines = marketplaces.map(m => ` ${m.name} ${m.sourceUri}`);
|
|
1824
|
-
|
|
1823
|
+
pluginStatus(
|
|
1825
1824
|
`Marketplaces:\n${lines.join("\n")}\n\n${t("commands.plugin.marketplace.listHintAll")}`,
|
|
1826
1825
|
);
|
|
1827
1826
|
}
|
|
@@ -1830,7 +1829,7 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<BuiltinSlashCommandSpec> = [
|
|
|
1830
1829
|
}
|
|
1831
1830
|
} catch (err) {
|
|
1832
1831
|
const msg = err instanceof Error ? err.message : String(err);
|
|
1833
|
-
|
|
1832
|
+
pluginError(t("commands.plugin.error", { message: msg }));
|
|
1834
1833
|
}
|
|
1835
1834
|
},
|
|
1836
1835
|
},
|