@danypops/pi-papyrus 0.52.2 → 0.52.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { expandHint } from "@danypops/vehicle-client-pi/expand-hint";
|
|
2
|
+
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
2
3
|
import { type Component, truncateToWidth, visibleWidth, wrapTextWithAnsi } from "@earendil-works/pi-tui";
|
|
3
4
|
import { buildDetailLines, type DetailField, type DetailSection, type DetailViewTheme, type TextMeasure } from "malevich-tui-components";
|
|
4
5
|
import type { ArtifactToolDetails } from "./render-model.ts";
|
|
@@ -93,13 +94,6 @@ export function emptyState(noun: string): string {
|
|
|
93
94
|
return `No ${noun}.`;
|
|
94
95
|
}
|
|
95
96
|
|
|
96
|
-
/** Real, possibly user-remapped hotkey (defaults to ctrl+o, Pi's own "app.tools.expand"
|
|
97
|
-
* binding) -- matches every one of Pi's own built-in tools (read/write/bash/find/grep/ls),
|
|
98
|
-
* which all show their own truncation hint the same way instead of a hardcoded string. */
|
|
99
|
-
export function expandHint(): string {
|
|
100
|
-
return keyHint("app.tools.expand", "expand for details");
|
|
101
|
-
}
|
|
102
|
-
|
|
103
97
|
/** Reusable width-safe artifact card for native tool result rows. */
|
|
104
98
|
export class ArtifactCard implements Component {
|
|
105
99
|
private details: ArtifactToolDetails;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { TOOL_COLLAPSED_ROW_LIMIT } from "@danypops/papyrus";
|
|
2
|
+
import { expandHint } from "@danypops/vehicle-client-pi/expand-hint";
|
|
2
3
|
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
3
4
|
import { type Component, truncateToWidth } from "@earendil-works/pi-tui";
|
|
4
5
|
import { type TreeNode, TreeView } from "malevich-tui-components";
|
|
5
|
-
import { countSummary,
|
|
6
|
+
import { countSummary, kindGlyph, statusGlyph } from "./artifact-card.ts";
|
|
6
7
|
import type { ArtifactListToolDetails, GraphToolDetails, ToolArtifactSummary } from "./render-model.ts";
|
|
7
8
|
|
|
8
9
|
function pluralKind(rows: readonly ToolArtifactSummary[]): string {
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
import type { Artifact } from "@danypops/papyrus";
|
|
16
16
|
import { TOOL_COLLAPSED_ROW_LIMIT, TOOL_DETAILS_MAX_SERIALIZED_CHARACTERS } from "@danypops/papyrus";
|
|
17
17
|
import type { PiVehicleInvocationRequest, PiVehiclePresentationContract, VehicleToolRenderers } from "@danypops/vehicle-client-pi";
|
|
18
|
+
import { expandHint } from "@danypops/vehicle-client-pi/expand-hint";
|
|
18
19
|
import { renderVehicleCall, renderVehicleResult } from "@danypops/vehicle-client-pi/vehicle-render";
|
|
19
20
|
import type { JsonValue, VehicleOperationDescriptor } from "@danypops/vehicle-core";
|
|
20
21
|
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
@@ -28,7 +29,7 @@ import {
|
|
|
28
29
|
type DetailSection,
|
|
29
30
|
statelessComponent,
|
|
30
31
|
} from "malevich-tui-components";
|
|
31
|
-
import { ArtifactCard, detailViewTheme,
|
|
32
|
+
import { ArtifactCard, detailViewTheme, measure, statusColor, statusGlyph } from "../tool-rendering/artifact-card.ts";
|
|
32
33
|
import { ArtifactListCard } from "../tool-rendering/artifact-list.ts";
|
|
33
34
|
import {
|
|
34
35
|
type ArtifactFocusAnnotation,
|
|
@@ -46,7 +47,9 @@ import {
|
|
|
46
47
|
} from "../tool-rendering/render-model.ts";
|
|
47
48
|
import { recordRenderDiagnostic, shapeFingerprint } from "./render-diagnostics.ts";
|
|
48
49
|
|
|
49
|
-
|
|
50
|
+
/** Every field an Artifact and its lean list-default ArtifactSummary (tasks.list/docs.list/
|
|
51
|
+
* rules.list/playbooks.list without full:true -- see summarizeArtifact()) both always carry. */
|
|
52
|
+
function hasArtifactCoreFields(value: unknown): value is Omit<Artifact, "body" | "extra"> {
|
|
50
53
|
if (typeof value !== "object" || value === null) return false;
|
|
51
54
|
const row = value as Record<string, unknown>;
|
|
52
55
|
return (
|
|
@@ -55,15 +58,27 @@ function isArtifact(value: unknown): value is Artifact {
|
|
|
55
58
|
typeof row.title === "string" &&
|
|
56
59
|
typeof row.status === "string" &&
|
|
57
60
|
typeof row.subtype === "string" &&
|
|
58
|
-
typeof row.body === "string" &&
|
|
59
61
|
Array.isArray(row.labels) &&
|
|
60
62
|
typeof row.created_at === "string" &&
|
|
61
63
|
typeof row.updated_at === "string"
|
|
62
64
|
);
|
|
63
65
|
}
|
|
64
66
|
|
|
67
|
+
function isArtifact(value: unknown): value is Artifact {
|
|
68
|
+
return hasArtifactCoreFields(value) && typeof (value as Record<string, unknown>).body === "string";
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Regression (real, live-observed): tasks.list's own documented default ("Returns a lean
|
|
73
|
+
* summary (no body/extra) unless full: true is passed") returns ArtifactSummary rows, which
|
|
74
|
+
* omit body entirely. createArtifactListDetails/artifactSummary (render-model.ts) never read
|
|
75
|
+
* .body for list rendering -- only single-artifact createArtifactDetails does -- so requiring
|
|
76
|
+
* body here (matching isArtifact) silently fell every default (lean, the common case) list
|
|
77
|
+
* call for tasks.list/docs.list/rules.list/playbooks.list through to the generic raw Vehicle
|
|
78
|
+
* table renderer instead of the curated ArtifactListCard.
|
|
79
|
+
*/
|
|
65
80
|
function isArtifactArray(value: unknown): value is Artifact[] {
|
|
66
|
-
return Array.isArray(value) && value.every(
|
|
81
|
+
return Array.isArray(value) && value.every(hasArtifactCoreFields);
|
|
67
82
|
}
|
|
68
83
|
|
|
69
84
|
/** tasks.focused/tasks.pause/tasks.unpause's own wrapper shape -- an Artifact
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danypops/pi-papyrus",
|
|
3
|
-
"version": "0.52.
|
|
3
|
+
"version": "0.52.4",
|
|
4
4
|
"description": "Pi host extension for Papyrus: native tools, TUI panels, and context injection over the daemon-backed graph store",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": ["pi-package"],
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@danypops/jittor": "^0.14.0",
|
|
21
21
|
"@danypops/papyrus": "^0.52.0",
|
|
22
22
|
"@danypops/vehicle-client": "^0.7.0",
|
|
23
|
-
"@danypops/vehicle-client-pi": "^0.
|
|
23
|
+
"@danypops/vehicle-client-pi": "^0.30.0",
|
|
24
24
|
"@danypops/vehicle-core": "^0.12.3",
|
|
25
25
|
"@danypops/vehicle-server": "^0.18.1",
|
|
26
26
|
"beautiful-mermaid": "1.1.3",
|