@danypops/pi-papyrus 0.45.2 → 0.45.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.
|
@@ -16,6 +16,8 @@ import { readDiscussionExtra } from "@danypops/papyrus";
|
|
|
16
16
|
import type { PiVehicleInteractiveFollowUp } from "@danypops/vehicle-client-pi";
|
|
17
17
|
import { askQuestion } from "./discuss-ask-view.ts";
|
|
18
18
|
|
|
19
|
+
const LIVE_REPLY_PERMISSIONS = ["discuss:read", "discuss:write"] as const;
|
|
20
|
+
|
|
19
21
|
export const discussLiveFollowUp: PiVehicleInteractiveFollowUp = async (request, output, client) => {
|
|
20
22
|
const live = (request.input as { live?: unknown } | undefined)?.live === true;
|
|
21
23
|
if (!live || !request.context.hasUI) return undefined;
|
|
@@ -52,13 +54,22 @@ export const discussLiveFollowUp: PiVehicleInteractiveFollowUp = async (request,
|
|
|
52
54
|
});
|
|
53
55
|
if (!answer) return undefined; // canceled, or no UI capable of answering -- default content/details stand
|
|
54
56
|
|
|
55
|
-
const answered = (await client.invoke(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
const answered = (await client.invoke(
|
|
58
|
+
"discuss.reply",
|
|
59
|
+
1,
|
|
60
|
+
{
|
|
61
|
+
id: result.discussion.id,
|
|
62
|
+
actor: "human",
|
|
63
|
+
content: answer.content,
|
|
64
|
+
...(answer.selected ? { selected: answer.selected } : {}),
|
|
65
|
+
source: "discuss-live",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
permissions: LIVE_REPLY_PERMISSIONS,
|
|
69
|
+
principal: { id: "pi-papyrus" },
|
|
70
|
+
signal: request.signal,
|
|
71
|
+
},
|
|
72
|
+
)) as DiscussionAndRounds;
|
|
62
73
|
return {
|
|
63
74
|
content: [{ type: "text", text: `"${answered.discussion.title}": ${answer.content}` }],
|
|
64
75
|
output: answered,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { pickIdentityArgument } from "@danypops/vehicle-client-pi/vehicle-render";
|
|
1
2
|
import type { AgentToolResult, Theme, ToolRenderResultOptions } from "@earendil-works/pi-coding-agent";
|
|
2
3
|
import { type Component, Text } from "@earendil-works/pi-tui";
|
|
3
4
|
import { ArtifactCard } from "./artifact-card.ts";
|
|
@@ -6,25 +7,18 @@ import { type PapyrusToolDetails, parsePapyrusToolDetails } from "./render-model
|
|
|
6
7
|
|
|
7
8
|
const CALL_VALUE_MAX_CHARACTERS = 80;
|
|
8
9
|
|
|
10
|
+
/** name/title before id: a caller that already knows the name shouldn't have the raw id echoed back at it. */
|
|
11
|
+
const IDENTITY_ARG_KEYS = ["name", "title", "id", "text", "query", "kind", "template_id"];
|
|
12
|
+
|
|
9
13
|
export interface PapyrusToolRenderContext {
|
|
10
14
|
lastComponent: Component | undefined;
|
|
11
15
|
isError: boolean;
|
|
12
16
|
}
|
|
13
17
|
|
|
14
|
-
function primaryArgument(args: Record<string, unknown>): string | undefined {
|
|
15
|
-
// name/title before id: a caller that already knows the name shouldn't have the raw id echoed
|
|
16
|
-
// back at it; id only surfaces here when it's genuinely the only identifying argument given.
|
|
17
|
-
for (const key of ["name", "title", "id", "text", "query", "kind", "template_id"]) {
|
|
18
|
-
const value = args[key];
|
|
19
|
-
if (typeof value === "string" && value.trim()) return value.slice(0, CALL_VALUE_MAX_CHARACTERS);
|
|
20
|
-
}
|
|
21
|
-
return undefined;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
18
|
/** Compact native call header that never echoes bodies or structured payloads. */
|
|
25
19
|
export function renderPapyrusToolCall(label: string, args: Record<string, unknown>, theme: Theme): Component {
|
|
26
20
|
const action = typeof args.action === "string" ? args.action : "call";
|
|
27
|
-
const primary =
|
|
21
|
+
const primary = pickIdentityArgument(args, IDENTITY_ARG_KEYS, CALL_VALUE_MAX_CHARACTERS);
|
|
28
22
|
const text = [
|
|
29
23
|
theme.fg("toolTitle", theme.bold(label)),
|
|
30
24
|
theme.fg("muted", action),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danypops/pi-papyrus",
|
|
3
|
-
"version": "0.45.
|
|
3
|
+
"version": "0.45.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.44.0",
|
|
22
22
|
"@danypops/vehicle-client": "^0.5.0",
|
|
23
|
-
"@danypops/vehicle-client-pi": "^0.16.
|
|
23
|
+
"@danypops/vehicle-client-pi": "^0.16.7",
|
|
24
24
|
"@danypops/vehicle-core": "^0.10.0",
|
|
25
25
|
"@danypops/vehicle-server": "^0.13.0",
|
|
26
26
|
"beautiful-mermaid": "1.1.3",
|