@phi-code-admin/phi-code 0.70.0 → 0.71.1
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/review.md +2 -2
- package/extensions/phi/orchestrator.ts +49 -11
- package/package.json +1 -1
package/agents/review.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: review
|
|
3
3
|
description: Senior code reviewer. Audits quality, security, performance, and correctness.
|
|
4
|
-
tools: read, write, grep, find, ls, bash, memory_search, memory_write, ontology_add
|
|
4
|
+
tools: read, write, edit, grep, find, ls, bash, memory_search, memory_write, ontology_add
|
|
5
5
|
model: default
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -31,7 +31,7 @@ Focus your review on the files mentioned in previous task results. Don't audit t
|
|
|
31
31
|
- **Specific references**: File path, line number, exact code snippet. Generic advice is useless
|
|
32
32
|
- **Severity levels**: Critical (must fix before deploy), High (fix soon), Medium (improve), Low (nice-to-have)
|
|
33
33
|
- **Actionable suggestions**: Don't just say "this is bad" — show the fix
|
|
34
|
-
- **
|
|
34
|
+
- **Fix what you find**: When you discover bugs, fix them using `edit` (preferred for surgical changes) or `write` (for larger rewrites). Don't just report — act
|
|
35
35
|
- **Focused scope**: Review what was changed, not the entire project
|
|
36
36
|
|
|
37
37
|
## File Writing
|
|
@@ -877,20 +877,58 @@ Tag the note with relevant keywords for vector search.`,
|
|
|
877
877
|
pi.on("agent_end", async (event, ctx) => {
|
|
878
878
|
if (!orchestrationActive || !phasePending) return;
|
|
879
879
|
|
|
880
|
-
//
|
|
880
|
+
// Build a structured summary of what happened in this phase
|
|
881
|
+
// Instead of raw LLM text, extract concrete actions: files created/modified,
|
|
882
|
+
// errors encountered, test results. This gives the next phase actionable context.
|
|
881
883
|
const messages = event.messages || [];
|
|
882
|
-
const
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
884
|
+
const filesWritten: string[] = [];
|
|
885
|
+
const filesEdited: string[] = [];
|
|
886
|
+
const errorsHit: string[] = [];
|
|
887
|
+
const testResults: string[] = [];
|
|
888
|
+
let toolCallCount = 0;
|
|
889
|
+
|
|
890
|
+
for (const msg of messages) {
|
|
891
|
+
if (msg.role === 'tool' || msg.role === 'function') {
|
|
892
|
+
toolCallCount++;
|
|
893
|
+
const content = Array.isArray(msg.content)
|
|
894
|
+
? msg.content.map((c: any) => c.text || '').join('')
|
|
895
|
+
: String(msg.content || '');
|
|
896
|
+
const name = (msg as any).name || '';
|
|
897
|
+
// Track writes
|
|
898
|
+
if (name === 'write' && content.includes('Successfully wrote')) {
|
|
899
|
+
const match = content.match(/wrote \d+ bytes to (.+)/);
|
|
900
|
+
if (match) filesWritten.push(match[1]);
|
|
901
|
+
}
|
|
902
|
+
// Track edits
|
|
903
|
+
if (name === 'edit' && !content.includes('ERR')) {
|
|
904
|
+
const match = content.match(/edited (.+)/) || content.match(/in (.+)/);
|
|
905
|
+
if (match) filesEdited.push(match[1]);
|
|
906
|
+
}
|
|
907
|
+
// Track errors
|
|
908
|
+
if (content.includes('ERR:') || content.includes('Error:') || content.includes('FAIL')) {
|
|
909
|
+
const preview = content.slice(0, 150).replace(/\n/g, ' ');
|
|
910
|
+
errorsHit.push(`${name}: ${preview}`);
|
|
911
|
+
}
|
|
912
|
+
// Track test results
|
|
913
|
+
if (content.includes('PASS') || content.includes('✅') || content.includes('✗') || content.includes('❌')) {
|
|
914
|
+
const lines = content.split('\n').filter(l => /PASS|FAIL|✅|❌|✗/.test(l));
|
|
915
|
+
testResults.push(...lines.slice(0, 10));
|
|
916
|
+
}
|
|
917
|
+
}
|
|
889
918
|
}
|
|
890
919
|
|
|
891
|
-
//
|
|
892
|
-
|
|
893
|
-
|
|
920
|
+
// Build the summary
|
|
921
|
+
const summaryParts: string[] = [];
|
|
922
|
+
summaryParts.push(`Tool calls: ${toolCallCount}`);
|
|
923
|
+
if (filesWritten.length > 0) summaryParts.push(`Files created/written: ${filesWritten.join(', ')}`);
|
|
924
|
+
if (filesEdited.length > 0) summaryParts.push(`Files edited: ${filesEdited.join(', ')}`);
|
|
925
|
+
if (testResults.length > 0) summaryParts.push(`Test results:\n${testResults.join('\n')}`);
|
|
926
|
+
if (errorsHit.length > 0) summaryParts.push(`Errors encountered: ${errorsHit.length}\n${errorsHit.slice(0, 5).join('\n')}`);
|
|
927
|
+
const phaseSummary = summaryParts.join('\n');
|
|
928
|
+
|
|
929
|
+
// Inject structured summary into next phase
|
|
930
|
+
if (phaseSummary && phaseQueue.length > 0) {
|
|
931
|
+
phaseQueue[0].instruction += `\n\n**Previous phase summary:**\n${phaseSummary}`;
|
|
894
932
|
}
|
|
895
933
|
|
|
896
934
|
// Phase complete — chain to next
|