pi-agent-flow 1.2.0 → 1.2.2
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 +1 -1
- package/agents/audit.md +2 -27
- package/agents/build.md +2 -27
- package/agents/craft.md +2 -26
- package/agents/debug.md +0 -26
- package/agents/ideas.md +2 -25
- package/agents/scout.md +3 -28
- package/package.json +1 -1
- package/src/ambient.d.ts +1 -1
- package/src/batch.ts +445 -17
- package/src/config.ts +5 -0
- package/src/flow.ts +54 -3
- package/src/index.ts +162 -2
- package/src/render.ts +39 -0
- package/src/structured-output.ts +97 -0
- package/src/types.ts +98 -0
package/README.md
CHANGED
|
@@ -213,7 +213,7 @@ The core delegation tool. Accepts an array of flow tasks and runs them in parall
|
|
|
213
213
|
When **tool optimization** is enabled (default), the separate `read` / `write` / `edit` tools are replaced by:
|
|
214
214
|
|
|
215
215
|
- **`batch`** — sequential read, write, edit, and delete operations in one call. Edits use fuzzy matching and preserve line endings.
|
|
216
|
-
- **`batch_read`** — read-only variant
|
|
216
|
+
- **`batch_read`** — read-only variant for multiple reads. Small full-file reads return raw content; large full-file reads return code/infra context maps or total line counts, and oversized targeted reads are capped with continuation guidance.
|
|
217
217
|
|
|
218
218
|
### `web` — search and fetch
|
|
219
219
|
|
package/agents/audit.md
CHANGED
|
@@ -27,30 +27,5 @@ During this audit flow — your mission is to verify and remediate quality, secu
|
|
|
27
27
|
- If a fix requires broader redesign, recommend [craft] in [Next Steps].
|
|
28
28
|
- If root cause is unclear, recommend [debug] rather than guessing.
|
|
29
29
|
|
|
30
|
-
##
|
|
31
|
-
|
|
32
|
-
- Recommend [build] when remaining issues have clear implementation fixes.
|
|
33
|
-
- Recommend [debug] when failures or risks need root-cause investigation.
|
|
34
|
-
- Recommend [craft] when remediation requires redesign or architectural decisions.
|
|
35
|
-
- Recommend [scout] when more repository context is needed for a confident audit.
|
|
36
|
-
- Recommend [ideas] when several remediation strategies need comparison.
|
|
37
|
-
|
|
38
|
-
## Output Format
|
|
39
|
-
|
|
40
|
-
When accomplished, end your response with:
|
|
41
|
-
|
|
42
|
-
flow [audit] accomplished
|
|
43
|
-
|
|
44
|
-
[Summary]
|
|
45
|
-
- What was audited, what was fixed, and the overall assessment in 2–4 concise sentences.
|
|
46
|
-
|
|
47
|
-
[Done]
|
|
48
|
-
- Issues found with file:line references, severity, and impact.
|
|
49
|
-
- Fixes applied with file:line references.
|
|
50
|
-
- Tests or checks run, including command results.
|
|
51
|
-
|
|
52
|
-
[Not Done]
|
|
53
|
-
- Areas not covered, unfixed risks, unsafe fixes deferred, or verification skipped.
|
|
54
|
-
|
|
55
|
-
[Next Steps]
|
|
56
|
-
- Specific remaining issues, follow-up audits, or recommended next flow.
|
|
30
|
+
## Note
|
|
31
|
+
Treat this as a clean-slate system rewrite, unless explicitly mentioned in the requirements. Perform a comprehensive migration with zero requirements for backwards compatibility. You must ensure that all residual code, variable names, test suites, and documentation are fully refactored and perfectly aligned with the new architecture.
|
package/agents/build.md
CHANGED
|
@@ -31,30 +31,5 @@ During this build flow — your mission is to implement and verify changes. Be a
|
|
|
31
31
|
- If CI/CD fails, diagnose, fix, commit, push, and repeat until green.
|
|
32
32
|
- If an unexpected error or trace is needed, recommend [debug] rather than guessing.
|
|
33
33
|
|
|
34
|
-
##
|
|
35
|
-
|
|
36
|
-
- Recommend [audit] after implementation is complete and needs verification or remediation review.
|
|
37
|
-
- Recommend [debug] when tests fail, behavior is unexplained, or root cause is unclear.
|
|
38
|
-
- Recommend [craft] when implementation exposes a design or architecture decision.
|
|
39
|
-
- Recommend [scout] when more repository context is needed before editing.
|
|
40
|
-
- Recommend [ideas] when multiple implementation directions remain plausible.
|
|
41
|
-
|
|
42
|
-
## Output Format
|
|
43
|
-
|
|
44
|
-
When accomplished, end your response with:
|
|
45
|
-
|
|
46
|
-
flow [build] accomplished
|
|
47
|
-
|
|
48
|
-
[Summary]
|
|
49
|
-
- What was built or fixed and current verification status in 2–4 concise sentences.
|
|
50
|
-
|
|
51
|
-
[Done]
|
|
52
|
-
- Changes made with file:line references.
|
|
53
|
-
- Tests written or run, including command results.
|
|
54
|
-
- Commit, push, and CI/CD status when applicable.
|
|
55
|
-
|
|
56
|
-
[Not Done]
|
|
57
|
-
- Incomplete items, blockers, skipped verification, or reasons work was deferred.
|
|
58
|
-
|
|
59
|
-
[Next Steps]
|
|
60
|
-
- Specific recommended follow-up actions or next flow.
|
|
34
|
+
## Note
|
|
35
|
+
Treat this as a clean-slate system rewrite, unless explicitly mentioned in the requirements. Perform a comprehensive migration with zero requirements for backwards compatibility. You must ensure that all residual code, variable names, test suites, and documentation are fully refactored and perfectly aligned with the new architecture.
|
package/agents/craft.md
CHANGED
|
@@ -25,29 +25,5 @@ During this craft flow — your mission is to design a clear plan. Be conservati
|
|
|
25
25
|
- Prefer explicit assumptions and constraints over hidden decisions.
|
|
26
26
|
- Do not implement changes from this flow unless explicitly requested.
|
|
27
27
|
|
|
28
|
-
##
|
|
29
|
-
|
|
30
|
-
- Recommend [build] when the plan is ready to implement.
|
|
31
|
-
- Recommend [scout] when more codebase discovery is needed.
|
|
32
|
-
- Recommend [ideas] when the direction is still uncertain or needs alternatives.
|
|
33
|
-
- Recommend [debug] when design depends on unexplained failures or root cause analysis.
|
|
34
|
-
- Recommend [audit] when the design or completed work needs quality, security, or correctness review.
|
|
35
|
-
|
|
36
|
-
## Output Format
|
|
37
|
-
|
|
38
|
-
When accomplished, end your response with:
|
|
39
|
-
|
|
40
|
-
flow [craft] accomplished
|
|
41
|
-
|
|
42
|
-
[Summary]
|
|
43
|
-
- What was designed, why it fits, and major trade-offs in 2–4 concise sentences.
|
|
44
|
-
|
|
45
|
-
[Done]
|
|
46
|
-
- Analysis completed with key evidence or constraints.
|
|
47
|
-
- Plan produced with ordered task breakdown and test strategy.
|
|
48
|
-
|
|
49
|
-
[Not Done]
|
|
50
|
-
- Areas needing more exploration, decisions not made, or unresolved risks.
|
|
51
|
-
|
|
52
|
-
[Next Steps]
|
|
53
|
-
- Specific implementation tasks in order and recommended next flow.
|
|
28
|
+
## Note
|
|
29
|
+
Treat this as a clean-slate system rewrite, unless explicitly mentioned in the requirements. Perform a comprehensive migration with zero requirements for backwards compatibility. You must ensure that all residual code, variable names, test suites, and documentation are fully refactored and perfectly aligned with the new architecture.
|
package/agents/debug.md
CHANGED
|
@@ -24,29 +24,3 @@ During this debug flow — your mission is to investigate root cause. Be forensi
|
|
|
24
24
|
- Use `batch` with `o: "read"`, `s: <offset>`, and `l: <limit>` for targeted file reading instead of bash `sed`/`head`/`tail`.
|
|
25
25
|
- Do not suggest fixes until root cause is confirmed.
|
|
26
26
|
- Do not implement changes from this flow unless explicitly requested.
|
|
27
|
-
|
|
28
|
-
## Handoff Guidance
|
|
29
|
-
|
|
30
|
-
- Recommend [build] when root cause is known and the fix is clear.
|
|
31
|
-
- Recommend [scout] when broader repository discovery is needed.
|
|
32
|
-
- Recommend [craft] when the fix requires redesign or architectural trade-offs.
|
|
33
|
-
- Recommend [audit] when the suspected issue needs security, quality, or correctness review.
|
|
34
|
-
- Recommend [ideas] when several remediation strategies are plausible.
|
|
35
|
-
|
|
36
|
-
## Output Format
|
|
37
|
-
|
|
38
|
-
When accomplished, end your response with:
|
|
39
|
-
|
|
40
|
-
flow [debug] accomplished
|
|
41
|
-
|
|
42
|
-
[Summary]
|
|
43
|
-
- What was investigated and the confirmed or likely root cause in 2–4 concise sentences.
|
|
44
|
-
|
|
45
|
-
[Done]
|
|
46
|
-
- Evidence collected with file:line references, command output, logs, or reproduction details.
|
|
47
|
-
|
|
48
|
-
[Not Done]
|
|
49
|
-
- Items that could not be investigated, missing evidence, or remaining uncertainty.
|
|
50
|
-
|
|
51
|
-
[Next Steps]
|
|
52
|
-
- Specific recommended fix, follow-up investigation, or next flow.
|
package/agents/ideas.md
CHANGED
|
@@ -24,28 +24,5 @@ During this ideas flow — your mission is to generate and compare possible dire
|
|
|
24
24
|
- If file context is needed, use `batch` with `o: "read"`, `s: <offset>`, and `l: <limit>` for targeted reading instead of bash `sed`/`head`/`tail`.
|
|
25
25
|
- Do not implement changes from this flow.
|
|
26
26
|
|
|
27
|
-
##
|
|
28
|
-
|
|
29
|
-
- Recommend [craft] when the best option should become a concrete design or plan.
|
|
30
|
-
- Recommend [scout] when more repository evidence is needed before choosing.
|
|
31
|
-
- Recommend [build] only when the chosen option is simple and ready to implement.
|
|
32
|
-
- Recommend [audit] when an option needs quality, security, or correctness review.
|
|
33
|
-
- Recommend [debug] when uncertainty comes from broken or unexplained behavior.
|
|
34
|
-
|
|
35
|
-
## Output Format
|
|
36
|
-
|
|
37
|
-
When accomplished, end your response with:
|
|
38
|
-
|
|
39
|
-
flow [ideas] accomplished
|
|
40
|
-
|
|
41
|
-
[Summary]
|
|
42
|
-
- What was explored and the recommended direction in 2–4 concise sentences.
|
|
43
|
-
|
|
44
|
-
[Done]
|
|
45
|
-
- Ideas generated, trade-offs considered, and recommendation rationale.
|
|
46
|
-
|
|
47
|
-
[Not Done]
|
|
48
|
-
- Incomplete items, unresolved assumptions, or reasons work was deferred.
|
|
49
|
-
|
|
50
|
-
[Next Steps]
|
|
51
|
-
- Specific recommended follow-up actions or next flow.
|
|
27
|
+
## Note
|
|
28
|
+
Treat this as a clean-slate system rewrite, unless explicitly mentioned in the requirements. Perform a comprehensive migration with zero requirements for backwards compatibility. You must ensure that all residual code, variable names, test suites, and documentation are fully refactored and perfectly aligned with the new architecture.
|
package/agents/scout.md
CHANGED
|
@@ -13,8 +13,9 @@ During this scout flow — your mission is to discover relevant context. Move fa
|
|
|
13
13
|
|
|
14
14
|
1. Survey — use `ls`, `find`, and `grep` to locate relevant files and symbols before reading whole files.
|
|
15
15
|
2. Inspect — use `batch_read` with `o: "read"`, `s: <offset>`, and `l: <limit>` for targeted file reading instead of bash `sed`/`head`/`tail`.
|
|
16
|
-
3.
|
|
17
|
-
4.
|
|
16
|
+
3. If `batch_read` returns a context map for a large code/infra file, do not retry the full-file read; use the reported line ranges for targeted follow-up reads.
|
|
17
|
+
4. Trace — follow code paths, dependencies, configuration, and tests that explain the requested area.
|
|
18
|
+
5. Report — cite concrete evidence and stop when the requested context is mapped.
|
|
18
19
|
|
|
19
20
|
## Rules
|
|
20
21
|
|
|
@@ -23,29 +24,3 @@ During this scout flow — your mission is to discover relevant context. Move fa
|
|
|
23
24
|
- Include relevant snippets or evidence inline so citations are verifiable.
|
|
24
25
|
- Show actual code/data, not excessive summaries.
|
|
25
26
|
- If something is not found, say so directly — do not guess.
|
|
26
|
-
|
|
27
|
-
## Handoff Guidance
|
|
28
|
-
|
|
29
|
-
- Recommend [craft] when findings need to become a design or implementation plan.
|
|
30
|
-
- Recommend [build] when the change is obvious, localized, and ready to implement.
|
|
31
|
-
- Recommend [debug] when evidence points to a defect or unexplained behavior.
|
|
32
|
-
- Recommend [ideas] when multiple viable directions need exploration.
|
|
33
|
-
- Recommend [audit] when discovered code needs quality, security, or correctness verification.
|
|
34
|
-
|
|
35
|
-
## Output Format
|
|
36
|
-
|
|
37
|
-
When accomplished, end your response with:
|
|
38
|
-
|
|
39
|
-
flow [scout] accomplished
|
|
40
|
-
|
|
41
|
-
[Summary]
|
|
42
|
-
- What was investigated and the outcome in 2–4 concise sentences.
|
|
43
|
-
|
|
44
|
-
[Done]
|
|
45
|
-
- Completed discovery items with file:line references and inline evidence snippets.
|
|
46
|
-
|
|
47
|
-
[Not Done]
|
|
48
|
-
- Incomplete items and reasons, or "All objectives met."
|
|
49
|
-
|
|
50
|
-
[Next Steps]
|
|
51
|
-
- Specific recommended follow-up actions or next flow.
|
package/package.json
CHANGED
package/src/ambient.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ declare module "@mariozechner/pi-coding-agent" {
|
|
|
21
21
|
cwd: string;
|
|
22
22
|
hasUI: boolean;
|
|
23
23
|
ui: { confirm: (title: string, body: string) => Promise<boolean> };
|
|
24
|
-
sessionManager: { getSessionDir(): string };
|
|
24
|
+
sessionManager: { getSessionDir(): string; getHeader(): unknown; getBranch(): unknown[] };
|
|
25
25
|
}
|
|
26
26
|
export function parseFrontmatter<T extends Record<string, unknown>>(content: string): { frontmatter: T; body: string };
|
|
27
27
|
export function getMarkdownTheme(): any;
|