@f5-sales-demo/xcsh 23.3.3 → 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.
@@ -1,2 +1,2 @@
1
1
  // Generated by generate-terraform-documentation-index.ts from the reviewed build-time pin.
2
- export const EMBEDDED_PROVIDER_VERSION = "15.6.1";
2
+ export const EMBEDDED_PROVIDER_VERSION = "15.8.0";
@@ -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, truncateToWidth } from "../../tools/render-utils";
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
- // Check for custom tool rendering
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 mergeCallAndResult = Boolean((tool as { mergeCallAndResult?: boolean }).mergeCallAndResult);
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
- // Render call component
401
- const shouldRenderCall = !this.#result || !mergeCallAndResult;
402
- if (shouldRenderCall && tool.renderCall) {
403
- try {
404
- const callComponent = tool.renderCall(this.#getCallArgsForRender(), this.#renderState, theme);
405
- if (callComponent) {
406
- this.#contentBox.addChild(ensureInvalidate(callComponent));
407
- }
408
- } catch (err) {
409
- logger.warn("Tool renderer failed", { tool: this.#toolName, error: String(err) });
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
- // Render result component if we have a result
419
- if (this.#result && tool.renderResult) {
420
- try {
421
- const renderResult = tool.renderResult as (
422
- result: { content: Array<{ type: string; text?: string }>; details?: unknown; isError?: boolean },
423
- options: { expanded: boolean; isPartial: boolean; spinnerFrame?: number },
424
- theme: Theme,
425
- args?: unknown,
426
- ) => Component;
427
- const resultComponent = renderResult(
428
- {
429
- content: this.#result.content as any,
430
- details: this.#result.details,
431
- isError: this.#result.isError,
432
- },
433
- this.#renderState,
434
- theme,
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
- * Format a generic tool execution (fallback for tools without custom renderers).
699
- * @param width Available content width (from GutterBlock), used for truncation.
700
- */
701
- #formatToolExecution(width = 80): string {
702
- const lines: string[] = [];
703
- const contentWidth = Math.max(1, width - 2); // Text has one cell of padding on each side.
704
- const icon = this.#isPartial ? "pending" : undefined;
705
- lines.push(renderStatusLine({ icon, title: this.#toolLabel }, theme));
706
-
707
- const argsObject = this.#args && typeof this.#args === "object" ? (this.#args as Record<string, unknown>) : null;
708
- if (!this.#expanded && argsObject && Object.keys(argsObject).length > 0) {
709
- const preview = formatArgsInline(argsObject, Math.max(20, width - 10));
710
- if (preview) {
711
- lines.push(
712
- ...renderStructuredRow(
713
- theme.fg("dim", preview),
714
- ` ${theme.fg("dim", theme.tree.last)} `,
715
- " ",
716
- contentWidth,
717
- ),
718
- );
719
- }
720
- }
721
-
722
- if (this.#expanded && this.#args !== undefined) {
723
- lines.push("");
724
- lines.push(theme.fg("dim", "Args"));
725
- const tree = renderJsonTreeLines(
726
- this.#args && typeof this.#args === "object" && !Array.isArray(this.#args)
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
- if (textContent.startsWith("{") || textContent.startsWith("[")) {
752
- try {
753
- const parsed = JSON.parse(textContent);
754
- const maxDepth = this.#expanded ? JSON_TREE_MAX_DEPTH_EXPANDED : JSON_TREE_MAX_DEPTH_COLLAPSED;
755
- const maxLines = this.#expanded ? JSON_TREE_MAX_LINES_EXPANDED : JSON_TREE_MAX_LINES_COLLAPSED;
756
- const maxScalarLen = this.#expanded ? JSON_TREE_SCALAR_LEN_EXPANDED : JSON_TREE_SCALAR_LEN_COLLAPSED;
757
- const tree = renderJsonTreeLines(parsed, theme, maxDepth, maxLines, maxScalarLen);
758
-
759
- if (tree.lines.length > 0) {
760
- lines.push(...tree.lines.flatMap(line => renderStructuredTreeLine(line, contentWidth)));
761
- if (!this.#expanded) {
762
- lines.push(formatExpandHint(theme, this.#expanded, true));
763
- } else if (tree.truncated) {
764
- lines.push(theme.fg("dim", "…"));
765
- }
766
- return lines.join("\n");
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
- } catch {
769
- // Fall through to raw output
770
- }
771
- }
772
-
773
- const outputLines = textContent.split("\n");
774
- const maxOutputLines = this.#expanded ? 12 : 4;
775
- const displayLines = outputLines.slice(0, maxOutputLines);
776
-
777
- for (const line of displayLines) {
778
- lines.push(theme.fg("toolOutput", truncateToWidth(replaceTabs(line), width)));
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 {
@@ -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 (last && secondLast && last === this.ctx.lastStatusText && secondLast === this.ctx.lastStatusSpacer) {
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(new Text(theme.fg("error", `Error: ${errorMessage}`), 1, 0));
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
 
@@ -26,6 +26,8 @@ Response format:
26
26
  **Create/Update**: Returns the full resource object. TUI shows a Created/Updated summary with name, uid, timestamp.
27
27
  **Delete**: Returns `{}`. TUI shows contextual confirmation.
28
28
  **Error**: `{"code": <int>, "message": "…"}` — codes: 3=INVALID_ARGUMENT, 5=NOT_FOUND, 6=ALREADY_EXISTS, 7=PERMISSION_DENIED, 13=INTERNAL.
29
+ LB conversion: PUT with `onImmutableSelectionChange: "recreate"`, no extra approval. HTTPS is `https_auto_cert`. Explain downtime/UID/VIP changes. Resume with the same `replacementId` and corrected payload; never DELETE again or restore. Diagnose; ask for missing input. Success requires `replacement_complete`; errors never authorize DELETE.
30
+
29
31
  GET requests auto-retry once on transient errors (429/503) after 1s backoff. POST/PUT/DELETE are never retried.
30
32
  API calls to the same F5 XC tenant reuse a single TLS connection — sequential calls are faster than parallel calls.
31
33
  **Namespace discovery**: For default execution requests, when asked about resources in a namespace, you **MUST** use `paths: ["*"]` to auto-discover and batch all namespace resource types in ONE call. Do NOT enumerate types individually.