@wichayutdew/pi-workflows 2.3.0 → 2.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.
package/agents/step.md CHANGED
@@ -22,3 +22,11 @@ pi-subagents' `structured_output`; `workflow_complete_step` belongs to
22
22
  main-agent workflow steps. Never call `contact_supervisor`,
23
23
  `subagent_supervisor`, or `intercom`. The workflow prompt defines artifact
24
24
  content and format, acceptance criteria, and the meaning of every outcome.
25
+
26
+ For a non-success outcome, treat `summary` as an operator handoff, not a
27
+ diagnostic transcript: lead with a plain-language decision, list each
28
+ independent issue with its decisive evidence and the concrete action/owner, and
29
+ end with the safe next move. Omit policy narration, raw logs, successful-check
30
+ or clean-state notes, and assertions that the child lacks authority; state the
31
+ prerequisite that would unblock it. Mention a passed check only when it directly
32
+ explains the remaining issue.
package/dist/index.js CHANGED
@@ -7000,6 +7000,25 @@ function buildDelegatedCompletionInstructions() {
7000
7000
  "Stay within the configured permissions and do not broaden mutation targets or external side effects."
7001
7001
  ];
7002
7002
  }
7003
+ function buildNonSuccessSummaryInstructions(outcomes) {
7004
+ const nonSuccessOutcomes = outcomes.filter((outcome) => ["blocked", "failed", "retry"].includes(outcome));
7005
+ if (nonSuccessOutcomes.length === 0)
7006
+ return [];
7007
+ return [
7008
+ "## Human-readable non-success results",
7009
+ "",
7010
+ `For ${nonSuccessOutcomes.map((outcome) => `\`${outcome}\``).join(", ")}, write a decision-first summary. It is shown verbatim to the operator and handed to a fresh child. Use this format:`,
7011
+ "",
7012
+ "# <Failed | Blocked | Retry>: <one-sentence plain-language decision>",
7013
+ "1. **<short issue>** — <only the decisive evidence, including an exact command/error, path, or identifier when it enables action>.",
7014
+ " **Action:** <the specific owner or role> must <the concrete evidence, decision, or change needed>.",
7015
+ "2. Repeat only for other independent issues (at most three total).",
7016
+ "**Next:** <the exact safe next move, such as provide the listed evidence and run `/workflow-resume`>.",
7017
+ "",
7018
+ "Do not include a process narrative, raw logs, repeated policy constraints, successful checks, clean-state notes, or statements that merely say the child lacks authority. Mention a passed check only when it directly explains the remaining issue. Name the missing prerequisite and who can supply it. Keep only details needed to make the decision or complete the next action.",
7019
+ ""
7020
+ ];
7021
+ }
7003
7022
 
7004
7023
  // src/prompt/template.ts
7005
7024
  function currentStepHandoff(run) {
@@ -7131,6 +7150,7 @@ function buildStepTask(options) {
7131
7150
  ...contract.workspaceLines,
7132
7151
  "",
7133
7152
  "Put a self-contained compact handoff in `summary`; this is the only step context passed to the next fresh child.",
7153
+ ...buildNonSuccessSummaryInstructions(contract.outcomes),
7134
7154
  ...isDelegated ? buildDelegatedCompletionInstructions() : [],
7135
7155
  "Do not call the completion tool alongside other tool calls."
7136
7156
  ].join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wichayutdew/pi-workflows",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "A declarative, pauseable workflow harness for Pi",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -85,3 +85,33 @@ export function buildDelegatedCompletionInstructions(): ReadonlyArray<string> {
85
85
  'Stay within the configured permissions and do not broaden mutation targets or external side effects.',
86
86
  ];
87
87
  }
88
+
89
+ /**
90
+ * Builds the shared operator-facing format for non-successful step results.
91
+ *
92
+ * The summary is posted verbatim to chat and is the only context available to
93
+ * a fresh child, so it must remain actionable without becoming a transcript.
94
+ */
95
+ export function buildNonSuccessSummaryInstructions(
96
+ outcomes: ReadonlyArray<string>,
97
+ ): ReadonlyArray<string> {
98
+ const nonSuccessOutcomes = outcomes.filter((outcome) =>
99
+ ['blocked', 'failed', 'retry'].includes(outcome),
100
+ );
101
+ if (nonSuccessOutcomes.length === 0) return [];
102
+
103
+ return [
104
+ '## Human-readable non-success results',
105
+ '',
106
+ `For ${nonSuccessOutcomes.map((outcome) => `\`${outcome}\``).join(', ')}, write a decision-first summary. It is shown verbatim to the operator and handed to a fresh child. Use this format:`,
107
+ '',
108
+ '# <Failed | Blocked | Retry>: <one-sentence plain-language decision>',
109
+ '1. **<short issue>** — <only the decisive evidence, including an exact command/error, path, or identifier when it enables action>.',
110
+ ' **Action:** <the specific owner or role> must <the concrete evidence, decision, or change needed>.',
111
+ '2. Repeat only for other independent issues (at most three total).',
112
+ '**Next:** <the exact safe next move, such as provide the listed evidence and run `/workflow-resume`>.',
113
+ '',
114
+ 'Do not include a process narrative, raw logs, repeated policy constraints, successful checks, clean-state notes, or statements that merely say the child lacks authority. Mention a passed check only when it directly explains the remaining issue. Name the missing prerequisite and who can supply it. Keep only details needed to make the decision or complete the next action.',
115
+ '',
116
+ ];
117
+ }
@@ -4,6 +4,7 @@ import { createStepContract } from './step-contract.ts';
4
4
  import {
5
5
  buildDelegatedCompletionInstructions,
6
6
  buildDelegatedHandoffSection,
7
+ buildNonSuccessSummaryInstructions,
7
8
  buildRestartWorkspaceSection,
8
9
  buildResourceSection,
9
10
  } from './step-sections.ts';
@@ -149,6 +150,7 @@ export function buildStepTask(options: BuildStepTaskOptions): string {
149
150
  ...contract.workspaceLines,
150
151
  '',
151
152
  'Put a self-contained compact handoff in `summary`; this is the only step context passed to the next fresh child.',
153
+ ...buildNonSuccessSummaryInstructions(contract.outcomes),
152
154
  ...(isDelegated ? buildDelegatedCompletionInstructions() : []),
153
155
  'Do not call the completion tool alongside other tool calls.',
154
156
  ].join('\n');