@wichayutdew/pi-workflows 2.2.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/README.md +17 -0
- package/agents/step.md +8 -0
- package/dist/index.js +20 -0
- package/package.json +1 -1
- package/src/prompt/step-sections.ts +30 -0
- package/src/prompt/step-task.ts +2 -0
package/README.md
CHANGED
|
@@ -9,6 +9,23 @@ tools, prompts, approvals, and outcomes in YAML; it provides bounded execution,
|
|
|
9
9
|
durable checkpoints, isolated subagent work, and a live status view without
|
|
10
10
|
dictating your language, framework, or delivery process.
|
|
11
11
|
|
|
12
|
+
## See it in action
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="https://raw.githubusercontent.com/wichayutdew/pi-workflows/main/assets/video.mp4">
|
|
16
|
+
<img src="https://raw.githubusercontent.com/wichayutdew/pi-workflows/main/assets/demo.gif" alt="Animated terminal demonstration of a Pi workflow" width="960">
|
|
17
|
+
</a>
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
<p align="center"><em>Animated preview — select it to download the full 73-second MP4.</em></p>
|
|
21
|
+
|
|
22
|
+
## At a glance
|
|
23
|
+
|
|
24
|
+
| Summary and status | Workflow details |
|
|
25
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
26
|
+
| <img src="https://raw.githubusercontent.com/wichayutdew/pi-workflows/main/assets/Summary.png" alt="Pi Workflows summary and status view" width="100%"> | <img src="https://raw.githubusercontent.com/wichayutdew/pi-workflows/main/assets/Details.png" alt="Pi Workflows detailed workflow view" width="100%"> |
|
|
27
|
+
| See progress, approvals, and outcome at a glance. | Inspect each workflow step and its execution details. |
|
|
28
|
+
|
|
12
29
|
## Why Pi Workflows
|
|
13
30
|
|
|
14
31
|
- Turn multi-step agent work into clear, reviewable workflow definitions.
|
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
|
@@ -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
|
+
}
|
package/src/prompt/step-task.ts
CHANGED
|
@@ -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');
|