@danypops/papyrus 0.21.3 → 0.21.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.
@@ -304,10 +304,13 @@ export function registerDomainTools(pi: ExtensionAPI): void {
304
304
  return text(output, createPreviewDetails("tasks.complete", "Task completion", output));
305
305
  }
306
306
  if (action === "run_gates") {
307
- const gates = await callService<Record<string, unknown>, GateResult[]>("tasks.run_gates", request);
307
+ const [gates, task] = await Promise.all([
308
+ callService<Record<string, unknown>, GateResult[]>("tasks.run_gates", request),
309
+ callService<Record<string, unknown>, Artifact>("tasks.show", { id: params.id }),
310
+ ]);
308
311
  return text(
309
312
  gates.map((gate) => `${gate.passed ? "✓" : "✗"} ${gate.gate.type}: ${gate.gate.target} — ${gate.output}`).join("\n") || "No gates configured.",
310
- createGateRunDetails("tasks.run_gates", (params.id as string | undefined) ?? "", gates.map((gate) => ({
313
+ createGateRunDetails("tasks.run_gates", (params.id as string | undefined) ?? "", task.title, gates.map((gate) => ({
311
314
  passed: gate.passed, type: gate.gate.type, target: gate.gate.target, output: gate.output,
312
315
  }))),
313
316
  );
@@ -16,7 +16,9 @@ export interface PapyrusToolRenderContext {
16
16
  }
17
17
 
18
18
  function primaryArgument(args: Record<string, unknown>): string | undefined {
19
- for (const key of ["id", "title", "text", "query", "kind", "template_id"]) {
19
+ // name/title before id: a caller that already knows the name shouldn't have the raw id echoed
20
+ // back at it; id only surfaces here when it's genuinely the only identifying argument given.
21
+ for (const key of ["name", "title", "id", "text", "query", "kind", "template_id"]) {
20
22
  const value = args[key];
21
23
  if (typeof value === "string" && value.trim()) return value.slice(0, CALL_VALUE_MAX_CHARACTERS);
22
24
  }
@@ -45,11 +47,11 @@ function textContent(result: AgentToolResult<unknown>): string {
45
47
  function simpleDetailsText(details: Exclude<PapyrusToolDetails, { kind: "artifact" | "artifact-list" | "graph" }>): string {
46
48
  switch (details.kind) {
47
49
  case "transition":
48
- return `✓ ${details.artifact.id} ${details.fromStatus} → ${details.toStatus}\n${details.artifact.title}`;
50
+ return `✓ ${details.fromStatus} → ${details.toStatus}\n${details.artifact.title}`;
49
51
  case "gate-run": {
50
52
  const passed = details.gates.filter((gate) => gate.passed).length;
51
53
  return [
52
- `${passed}/${details.gates.length} gates passed for ${details.artifactId}`,
54
+ `${passed}/${details.gates.length} gates passed for "${details.artifactTitle}"`,
53
55
  ...details.gates.map((gate) => `${gate.passed ? "✓" : "✗"} ${gate.type}: ${gate.target}${gate.output ? ` — ${gate.output}` : ""}`),
54
56
  ].join("\n");
55
57
  }
@@ -81,6 +81,7 @@ export interface ToolGateRow {
81
81
  export interface GateRunToolDetails extends ToolDetailsBase {
82
82
  kind: "gate-run";
83
83
  artifactId: string;
84
+ artifactTitle: string;
84
85
  gates: ToolGateRow[];
85
86
  completeness: ResultCompleteness;
86
87
  }
@@ -218,6 +219,7 @@ export function createGraphDetails(
218
219
  export function createGateRunDetails(
219
220
  operation: string,
220
221
  artifactId: string,
222
+ artifactTitle: string,
221
223
  gates: readonly ToolGateRow[],
222
224
  ): GateRunToolDetails {
223
225
  const boundedGates = gates.slice(0, TOOL_DETAILS_MAX_ITEMS).map((gate) => ({
@@ -229,6 +231,7 @@ export function createGateRunDetails(
229
231
  kind: "gate-run",
230
232
  operation,
231
233
  artifactId,
234
+ artifactTitle,
232
235
  gates: boundedGates,
233
236
  completeness: completeness(gates.length, boundedGates.length),
234
237
  };
@@ -383,6 +386,7 @@ export function parsePapyrusToolDetails(value: unknown): PapyrusToolDetails | un
383
386
  ? value as unknown as GraphToolDetails : undefined;
384
387
  case "gate-run":
385
388
  return isBoundedString(value.artifactId)
389
+ && isBoundedString(value.artifactTitle)
386
390
  && isBoundedArray(value.gates, TOOL_DETAILS_MAX_ITEMS, isGateRow)
387
391
  && isCompleteness(value.completeness)
388
392
  ? value as unknown as GateRunToolDetails : undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danypops/papyrus",
3
- "version": "0.21.3",
3
+ "version": "0.21.4",
4
4
  "description": "Daemon-backed graph artifacts, evidence-bearing tasks, rules, skills, and native TUI workflows for Pi",
5
5
  "type": "module",
6
6
  "keywords": ["pi-package"],