@danypops/pi-packed 0.27.13 → 0.27.14

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,14 +1,30 @@
1
1
  /**
2
- * doctor.run's own curated presenter -- its DoctorReport output shape (five array fields, several
3
- * with nested arrays/objects per row: duplicateDependencies' own locations array, extensions'
4
- * own registrations object) defeats every heuristic in vehicle-render's generic shape-probing
5
- * chain, so without this it fell all the way through to a raw JSON.stringify dump -- a real, live
6
- * incident, not a hypothetical. Reuses formatDoctorReport, the exact same human-readable text the
7
- * CLI's own `packed doctor` (non-JSON) path already renders, so the tool and the CLI never drift
8
- * into two different descriptions of the same report.
2
+ * doctor.run's own curated renderResult -- its DoctorReport output shape (five array fields,
3
+ * several with nested arrays/objects per row: duplicateDependencies' own locations array,
4
+ * extensions' own registrations object) defeats every heuristic in vehicle-render's generic
5
+ * shape-probing chain, so without this it fell all the way through to a raw JSON.stringify dump
6
+ * -- a real, live incident, not a hypothetical.
7
+ *
8
+ * A FULL renderResult override via registerVehicleTools' `renderers` option, deliberately NOT
9
+ * `renderPresenters`: without any presentations/renderers override at all, EVERY real doctor.run
10
+ * invocation gets a generic vehicle.tool-details/v1 "json"-view presentation projected and
11
+ * PERSISTED at invocation time (createTool's own default presentationProjector), and that
12
+ * projected presentation always wins ahead of a renderPresenters entry -- renderPresenters only
13
+ * ever customizes the output-to-Component step for the non-projected branch, never overriding an
14
+ * already-successful projection (see vehicle-render/result-rendering.ts's own renderVehicleResult:
15
+ * `if (projected) return renderProjectedPresentation(...)` runs before presenters are ever
16
+ * consulted). A real, live incident: wiring this as renderPresenters first left the raw JSON view
17
+ * rendering completely unchanged after release. `renderers.renderResult` sets
18
+ * presentationProjector to undefined for this one operation (see tool-creation.ts's own
19
+ * presentationProjector selection), so this function is now responsible for the operation's every
20
+ * result shape -- it delegates to the shared generic renderer (renderVehicleResult) for anything
21
+ * that isn't a real, complete DoctorReport (a partial/error state, a historical session row, or a
22
+ * future field addition), rather than re-implementing that handling here.
9
23
  */
10
24
  import { type DoctorReport, formatDoctorReport } from "@danypops/pi-packed/doctor-format";
11
- import type { VehiclePresenter } from "@danypops/vehicle-client-pi/vehicle-render";
25
+ import { renderVehicleResult } from "@danypops/vehicle-client-pi/vehicle-render";
26
+ import type { VehicleOperationDescriptor } from "@danypops/vehicle-core";
27
+ import type { ToolDefinition } from "@earendil-works/pi-coding-agent";
12
28
  import { asciiTextMeasure, CollapsibleText } from "malevich-tui-components";
13
29
 
14
30
  const DOCTOR_REPORT_COLLAPSED_LINES = 12;
@@ -19,14 +35,22 @@ function isDoctorReport(value: unknown): value is DoctorReport {
19
35
  return typeof candidate.ok === "boolean" && Array.isArray(candidate.conflicts) && Array.isArray(candidate.extensions);
20
36
  }
21
37
 
22
- export const renderDoctorRunResult: VehiclePresenter = (output, options, theme) => {
23
- if (!isDoctorReport(output)) return undefined;
24
- const collapsible = new CollapsibleText({
25
- text: theme.fg("text", formatDoctorReport(output, false)),
26
- collapsedLines: DOCTOR_REPORT_COLLAPSED_LINES,
27
- headerStyle: (s) => theme.fg("dim", s),
28
- measure: asciiTextMeasure,
29
- });
30
- if (options.expanded) collapsible.expand();
31
- return collapsible;
32
- };
38
+ export function createDoctorRunRenderResult(descriptor: VehicleOperationDescriptor): NonNullable<ToolDefinition["renderResult"]> {
39
+ return (result, options, theme, context) => {
40
+ if (!context.isError && !options.isPartial) {
41
+ const details = result.details as { output?: unknown } | undefined;
42
+ const output = details && Object.hasOwn(details, "output") ? details.output : undefined;
43
+ if (isDoctorReport(output)) {
44
+ const collapsible = new CollapsibleText({
45
+ text: theme.fg("text", formatDoctorReport(output, false)),
46
+ collapsedLines: DOCTOR_REPORT_COLLAPSED_LINES,
47
+ headerStyle: (s) => theme.fg("dim", s),
48
+ measure: asciiTextMeasure,
49
+ });
50
+ if (options.expanded) collapsible.expand();
51
+ return collapsible;
52
+ }
53
+ }
54
+ return renderVehicleResult(descriptor, result, options, theme, context);
55
+ };
56
+ }
@@ -35,7 +35,7 @@ import { RemoteVehicleClient } from "@danypops/vehicle-client/http";
35
35
  import { registerVehicleTools } from "@danypops/vehicle-client-pi";
36
36
  import type { VehicleClient, VehicleManifest } from "@danypops/vehicle-core";
37
37
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
38
- import { renderDoctorRunResult } from "./doctor-render.js";
38
+ import { createDoctorRunRenderResult } from "./doctor-render.js";
39
39
  import { currentVehicleClientTarget } from "./vehicle-target.js";
40
40
 
41
41
  /** Already covered by their own dedicated, approval-aware tools in tools.ts -- see this file's own doc comment. */
@@ -98,7 +98,7 @@ export async function registerPackedVehicle(pi: ExtensionAPI): Promise<void> {
98
98
  // ensureVehicleShellHandle) -- no ownVehicleName/broker option needed here anymore; every
99
99
  // vehicle in the process (including packed's own) is discovered and namespaced uniformly.
100
100
  shell: { coreOperations: CORE_OPERATIONS },
101
- renderPresenters: { "doctor.run": renderDoctorRunResult },
101
+ renderers: (descriptor) => (descriptor.name === "doctor.run" ? { renderResult: createDoctorRunRenderResult(descriptor) } : undefined),
102
102
  renderCoverage: { operations: REVIEWED_OPERATIONS },
103
103
  });
104
104
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danypops/pi-packed",
3
- "version": "0.27.13",
3
+ "version": "0.27.14",
4
4
  "description": "Pi package lifecycle, validation, daemon, tools, profiles, and TUI",
5
5
  "type": "module",
6
6
  "bin": {