pi-crew 0.1.41 → 0.1.43

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.
Files changed (176) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +51 -0
  3. package/agents/analyst.md +11 -11
  4. package/agents/critic.md +11 -11
  5. package/agents/executor.md +11 -11
  6. package/agents/explorer.md +11 -11
  7. package/agents/planner.md +11 -11
  8. package/agents/reviewer.md +11 -11
  9. package/agents/security-reviewer.md +11 -11
  10. package/agents/test-engineer.md +11 -11
  11. package/agents/verifier.md +11 -11
  12. package/agents/writer.md +11 -11
  13. package/docs/refactor-tasks-phase3.md +394 -394
  14. package/docs/refactor-tasks-phase4.md +564 -564
  15. package/docs/refactor-tasks-phase5.md +402 -402
  16. package/docs/refactor-tasks-phase6.md +662 -662
  17. package/docs/research-extension-examples.md +297 -297
  18. package/docs/research-extension-system.md +324 -324
  19. package/docs/research-optimization-plan.md +548 -548
  20. package/docs/research-pi-coding-agent.md +357 -357
  21. package/docs/research-source-pi-crew-reference.md +174 -174
  22. package/docs/runtime-flow.md +148 -148
  23. package/docs/source-runtime-refactor-map.md +83 -83
  24. package/index.ts +6 -6
  25. package/package.json +1 -1
  26. package/src/agents/agent-serializer.ts +34 -34
  27. package/src/agents/discover-agents.ts +4 -4
  28. package/src/config/config.ts +9 -4
  29. package/src/extension/cross-extension-rpc.ts +82 -82
  30. package/src/extension/management.ts +37 -8
  31. package/src/extension/notification-router.ts +2 -2
  32. package/src/extension/register.ts +3 -0
  33. package/src/extension/registration/commands.ts +11 -9
  34. package/src/extension/registration/compaction-guard.ts +125 -125
  35. package/src/extension/registration/subagent-tools.ts +28 -19
  36. package/src/extension/result-watcher.ts +4 -4
  37. package/src/extension/run-bundle-schema.ts +8 -4
  38. package/src/extension/run-import.ts +4 -0
  39. package/src/extension/run-index.ts +4 -1
  40. package/src/extension/run-maintenance.ts +43 -24
  41. package/src/extension/team-tool/api.ts +1 -1
  42. package/src/extension/team-tool/cancel.ts +31 -31
  43. package/src/extension/team-tool/doctor.ts +8 -1
  44. package/src/extension/team-tool/handle-settings.ts +188 -0
  45. package/src/extension/team-tool/inspect.ts +41 -41
  46. package/src/extension/team-tool/lifecycle-actions.ts +79 -79
  47. package/src/extension/team-tool/plan.ts +19 -19
  48. package/src/extension/team-tool/run.ts +4 -2
  49. package/src/extension/team-tool/status.ts +93 -93
  50. package/src/extension/team-tool.ts +3 -1
  51. package/src/i18n.ts +184 -0
  52. package/src/observability/correlation.ts +2 -2
  53. package/src/observability/event-to-metric.ts +4 -3
  54. package/src/observability/exporters/adapter.ts +7 -1
  55. package/src/observability/exporters/otlp-exporter.ts +14 -2
  56. package/src/observability/exporters/prometheus-exporter.ts +9 -2
  57. package/src/observability/metric-registry.ts +18 -3
  58. package/src/observability/metric-retention.ts +11 -3
  59. package/src/observability/metric-sink.ts +9 -4
  60. package/src/observability/metrics-primitives.ts +4 -3
  61. package/src/prompt/prompt-runtime.ts +72 -68
  62. package/src/runtime/agent-control.ts +63 -63
  63. package/src/runtime/agent-memory.ts +72 -72
  64. package/src/runtime/agent-observability.ts +114 -114
  65. package/src/runtime/async-marker.ts +26 -26
  66. package/src/runtime/attention-events.ts +28 -23
  67. package/src/runtime/background-runner.ts +53 -53
  68. package/src/runtime/child-pi.ts +4 -4
  69. package/src/runtime/completion-guard.ts +103 -99
  70. package/src/runtime/concurrency.ts +1 -1
  71. package/src/runtime/crash-recovery.ts +2 -1
  72. package/src/runtime/crew-agent-runtime.ts +58 -58
  73. package/src/runtime/deadletter.ts +14 -4
  74. package/src/runtime/direct-run.ts +35 -35
  75. package/src/runtime/foreground-control.ts +82 -82
  76. package/src/runtime/green-contract.ts +46 -46
  77. package/src/runtime/group-join.ts +106 -106
  78. package/src/runtime/heartbeat-gradient.ts +28 -28
  79. package/src/runtime/heartbeat-watcher.ts +48 -4
  80. package/src/runtime/live-agent-control.ts +87 -87
  81. package/src/runtime/live-agent-manager.ts +85 -85
  82. package/src/runtime/live-control-realtime.ts +36 -36
  83. package/src/runtime/live-session-runtime.ts +305 -305
  84. package/src/runtime/manifest-cache.ts +2 -2
  85. package/src/runtime/model-fallback.ts +269 -261
  86. package/src/runtime/parallel-research.ts +44 -44
  87. package/src/runtime/parallel-utils.ts +1 -1
  88. package/src/runtime/pi-json-output.ts +111 -111
  89. package/src/runtime/policy-engine.ts +79 -78
  90. package/src/runtime/post-exit-stdio-guard.ts +2 -2
  91. package/src/runtime/process-status.ts +56 -56
  92. package/src/runtime/progress-event-coalescer.ts +43 -43
  93. package/src/runtime/recovery-recipes.ts +74 -74
  94. package/src/runtime/retry-executor.ts +5 -0
  95. package/src/runtime/role-permission.ts +39 -39
  96. package/src/runtime/runtime-resolver.ts +1 -1
  97. package/src/runtime/session-usage.ts +79 -79
  98. package/src/runtime/sidechain-output.ts +29 -29
  99. package/src/runtime/subagent-manager.ts +3 -3
  100. package/src/runtime/task-display.ts +38 -38
  101. package/src/runtime/task-output-context.ts +127 -127
  102. package/src/runtime/task-runner/live-executor.ts +101 -101
  103. package/src/runtime/task-runner/progress.ts +119 -111
  104. package/src/runtime/task-runner/result-utils.ts +14 -14
  105. package/src/runtime/task-runner/state-helpers.ts +22 -22
  106. package/src/runtime/team-runner.ts +3 -6
  107. package/src/runtime/worker-heartbeat.ts +21 -21
  108. package/src/runtime/worker-startup.ts +57 -57
  109. package/src/schema/config-schema.ts +1 -1
  110. package/src/schema/team-tool-schema.ts +110 -109
  111. package/src/state/artifact-store.ts +4 -2
  112. package/src/state/atomic-write.ts +12 -4
  113. package/src/state/contracts.ts +105 -105
  114. package/src/state/event-log.ts +3 -4
  115. package/src/state/jsonl-writer.ts +4 -1
  116. package/src/state/locks.ts +9 -1
  117. package/src/state/task-claims.ts +44 -42
  118. package/src/state/usage.ts +29 -29
  119. package/src/subagents/async-entry.ts +1 -1
  120. package/src/subagents/index.ts +3 -3
  121. package/src/subagents/live/control.ts +1 -1
  122. package/src/subagents/live/manager.ts +1 -1
  123. package/src/subagents/live/realtime.ts +1 -1
  124. package/src/subagents/live/session-runtime.ts +1 -1
  125. package/src/subagents/manager.ts +1 -1
  126. package/src/subagents/spawn.ts +1 -1
  127. package/src/teams/discover-teams.ts +2 -2
  128. package/src/teams/team-serializer.ts +38 -38
  129. package/src/types/diff.d.ts +18 -18
  130. package/src/ui/crew-footer.ts +101 -101
  131. package/src/ui/crew-select-list.ts +111 -111
  132. package/src/ui/dashboard-panes/metrics-pane.ts +34 -34
  133. package/src/ui/dynamic-border.ts +25 -25
  134. package/src/ui/layout-primitives.ts +106 -106
  135. package/src/ui/live-run-sidebar.ts +1 -1
  136. package/src/ui/loaders.ts +158 -158
  137. package/src/ui/mascot.ts +3 -2
  138. package/src/ui/powerbar-publisher.ts +4 -3
  139. package/src/ui/render-diff.ts +119 -119
  140. package/src/ui/render-scheduler.ts +54 -14
  141. package/src/ui/run-dashboard.ts +39 -11
  142. package/src/ui/run-snapshot-cache.ts +63 -37
  143. package/src/ui/spinner.ts +17 -17
  144. package/src/ui/status-colors.ts +54 -54
  145. package/src/ui/syntax-highlight.ts +116 -116
  146. package/src/ui/theme-adapter.ts +1 -1
  147. package/src/ui/transcript-viewer.ts +7 -2
  148. package/src/utils/completion-dedupe.ts +63 -63
  149. package/src/utils/file-coalescer.ts +5 -3
  150. package/src/utils/frontmatter.ts +68 -36
  151. package/src/utils/git.ts +262 -262
  152. package/src/utils/ids.ts +12 -12
  153. package/src/utils/internal-error.ts +1 -1
  154. package/src/utils/names.ts +27 -26
  155. package/src/utils/paths.ts +1 -1
  156. package/src/utils/redaction.ts +44 -41
  157. package/src/utils/safe-paths.ts +47 -34
  158. package/src/utils/sleep.ts +2 -2
  159. package/src/utils/timings.ts +2 -0
  160. package/src/utils/visual.ts +9 -1
  161. package/src/workflows/discover-workflows.ts +4 -1
  162. package/src/workflows/validate-workflow.ts +40 -40
  163. package/src/worktree/branch-freshness.ts +45 -45
  164. package/src/worktree/worktree-manager.ts +6 -1
  165. package/teams/default.team.md +12 -12
  166. package/teams/fast-fix.team.md +11 -11
  167. package/teams/implementation.team.md +18 -18
  168. package/teams/parallel-research.team.md +14 -14
  169. package/teams/research.team.md +11 -11
  170. package/teams/review.team.md +12 -12
  171. package/workflows/default.workflow.md +29 -29
  172. package/workflows/fast-fix.workflow.md +22 -22
  173. package/workflows/implementation.workflow.md +38 -38
  174. package/workflows/parallel-research.workflow.md +46 -46
  175. package/workflows/research.workflow.md +22 -22
  176. package/workflows/review.workflow.md +30 -30
@@ -1,29 +1,29 @@
1
- ---
2
- name: default
3
- description: Explore, plan, execute, and verify
4
- ---
5
-
6
- ## explore
7
- role: explorer
8
-
9
- Explore the codebase for the goal: {goal}
10
-
11
- ## plan
12
- role: planner
13
- dependsOn: explore
14
- output: plan.md
15
-
16
- Create a concise implementation plan for: {goal}
17
-
18
- ## execute
19
- role: executor
20
- dependsOn: plan
21
-
22
- Implement the plan for: {goal}
23
-
24
- ## verify
25
- role: verifier
26
- dependsOn: execute
27
- verify: true
28
-
29
- Verify completion for: {goal}
1
+ ---
2
+ name: default
3
+ description: Explore, plan, execute, and verify
4
+ ---
5
+
6
+ ## explore
7
+ role: explorer
8
+
9
+ Explore the codebase for the goal: {goal}
10
+
11
+ ## plan
12
+ role: planner
13
+ dependsOn: explore
14
+ output: plan.md
15
+
16
+ Create a concise implementation plan for: {goal}
17
+
18
+ ## execute
19
+ role: executor
20
+ dependsOn: plan
21
+
22
+ Implement the plan for: {goal}
23
+
24
+ ## verify
25
+ role: verifier
26
+ dependsOn: execute
27
+ verify: true
28
+
29
+ Verify completion for: {goal}
@@ -1,22 +1,22 @@
1
- ---
2
- name: fast-fix
3
- description: Minimal workflow for small fixes
4
- ---
5
-
6
- ## explore
7
- role: explorer
8
-
9
- Find the likely source of the issue: {goal}
10
-
11
- ## execute
12
- role: executor
13
- dependsOn: explore
14
-
15
- Make the smallest safe fix.
16
-
17
- ## verify
18
- role: verifier
19
- dependsOn: execute
20
- verify: true
21
-
22
- Verify the fix with available evidence.
1
+ ---
2
+ name: fast-fix
3
+ description: Minimal workflow for small fixes
4
+ ---
5
+
6
+ ## explore
7
+ role: explorer
8
+
9
+ Find the likely source of the issue: {goal}
10
+
11
+ ## execute
12
+ role: executor
13
+ dependsOn: explore
14
+
15
+ Make the smallest safe fix.
16
+
17
+ ## verify
18
+ role: verifier
19
+ dependsOn: execute
20
+ verify: true
21
+
22
+ Verify the fix with available evidence.
@@ -1,38 +1,38 @@
1
- ---
2
- name: implementation
3
- description: Adaptive implementation workflow where a planner agent decides the subagent fanout
4
- ---
5
-
6
- ## assess
7
- role: planner
8
- output: adaptive-plan.json
9
-
10
- Assess this task and decide how many subagents are actually needed for: {goal}
11
-
12
- You are the orchestration planner. Inspect the repository enough to choose an efficient crew; do not use a fixed template. Small/simple tasks may need one executor plus one verifier. Risky or broad tasks may need parallel explorers, specialists, implementers, reviewers, security reviewers, or test engineers.
13
-
14
- Return a concise rationale, then include exactly one JSON block between these markers:
15
-
16
- ADAPTIVE_PLAN_JSON_START
17
- {
18
- "phases": [
19
- {
20
- "name": "short-phase-name",
21
- "tasks": [
22
- {
23
- "role": "explorer|analyst|planner|critic|executor|reviewer|security-reviewer|test-engineer|verifier|writer",
24
- "title": "short task title",
25
- "task": "specific autonomous task prompt for this subagent"
26
- }
27
- ]
28
- }
29
- ]
30
- }
31
- ADAPTIVE_PLAN_JSON_END
32
-
33
- Rules:
34
- - Choose the smallest effective number of subagents.
35
- - Use parallel tasks in the same phase only when their work is independent.
36
- - Later phases depend on all tasks in the previous phase.
37
- - Include verification/review tasks when implementation is requested.
38
- - Do not include more than 12 total subagents; split or summarize oversized plans instead.
1
+ ---
2
+ name: implementation
3
+ description: Adaptive implementation workflow where a planner agent decides the subagent fanout
4
+ ---
5
+
6
+ ## assess
7
+ role: planner
8
+ output: adaptive-plan.json
9
+
10
+ Assess this task and decide how many subagents are actually needed for: {goal}
11
+
12
+ You are the orchestration planner. Inspect the repository enough to choose an efficient crew; do not use a fixed template. Small/simple tasks may need one executor plus one verifier. Risky or broad tasks may need parallel explorers, specialists, implementers, reviewers, security reviewers, or test engineers.
13
+
14
+ Return a concise rationale, then include exactly one JSON block between these markers:
15
+
16
+ ADAPTIVE_PLAN_JSON_START
17
+ {
18
+ "phases": [
19
+ {
20
+ "name": "short-phase-name",
21
+ "tasks": [
22
+ {
23
+ "role": "explorer|analyst|planner|critic|executor|reviewer|security-reviewer|test-engineer|verifier|writer",
24
+ "title": "short task title",
25
+ "task": "specific autonomous task prompt for this subagent"
26
+ }
27
+ ]
28
+ }
29
+ ]
30
+ }
31
+ ADAPTIVE_PLAN_JSON_END
32
+
33
+ Rules:
34
+ - Choose the smallest effective number of subagents.
35
+ - Use parallel tasks in the same phase only when their work is independent.
36
+ - Later phases depend on all tasks in the previous phase.
37
+ - Include verification/review tasks when implementation is requested.
38
+ - Do not include more than 12 total subagents; split or summarize oversized plans instead.
@@ -1,46 +1,46 @@
1
- ---
2
- name: parallel-research
3
- description: Parallel research with shard exploration and synthesis
4
- ---
5
-
6
- ## discover
7
- role: explorer
8
-
9
- Discover the relevant files/projects for: {goal}. Return a shard plan with paths grouped by topic. Do not deeply read every file yet; focus on routing the work.
10
-
11
- ## explore-core
12
- role: explorer
13
- parallelGroup: explore
14
-
15
- Explore the core/runtime shard from the discover output. Focus on architecture, package config, docs, and reusable patterns for: {goal}
16
-
17
- ## explore-ui
18
- role: explorer
19
- parallelGroup: explore
20
-
21
- Explore the UI/TUI/extension-interface shard from the discover output. Focus on widgets, overlays, commands, status bars, package config, docs, and reusable patterns for: {goal}
22
-
23
- ## explore-runtime
24
- role: explorer
25
- parallelGroup: explore
26
-
27
- Explore the worker/runtime/subagent/runtime-control shard from the discover output. Focus on process/session/runtime orchestration, event streams, logs, package config, docs, and reusable patterns for: {goal}
28
-
29
- ## explore-extensions
30
- role: explorer
31
- parallelGroup: explore
32
-
33
- Explore the extension bundle/small-package shard from the discover output. Focus on package config, extension registration, commands/tools, docs, and reusable patterns for: {goal}
34
-
35
- ## synthesize
36
- role: analyst
37
- dependsOn: explore-core, explore-ui, explore-runtime, explore-extensions
38
-
39
- Synthesize all shard findings. Use discover output if available, but do not require it. Identify common patterns, gaps, and concrete recommendations.
40
-
41
- ## write
42
- role: writer
43
- dependsOn: synthesize
44
- output: research-summary.md
45
-
46
- Write a concise final summary with evidence, risks, and actionable next steps.
1
+ ---
2
+ name: parallel-research
3
+ description: Parallel research with shard exploration and synthesis
4
+ ---
5
+
6
+ ## discover
7
+ role: explorer
8
+
9
+ Discover the relevant files/projects for: {goal}. Return a shard plan with paths grouped by topic. Do not deeply read every file yet; focus on routing the work.
10
+
11
+ ## explore-core
12
+ role: explorer
13
+ parallelGroup: explore
14
+
15
+ Explore the core/runtime shard from the discover output. Focus on architecture, package config, docs, and reusable patterns for: {goal}
16
+
17
+ ## explore-ui
18
+ role: explorer
19
+ parallelGroup: explore
20
+
21
+ Explore the UI/TUI/extension-interface shard from the discover output. Focus on widgets, overlays, commands, status bars, package config, docs, and reusable patterns for: {goal}
22
+
23
+ ## explore-runtime
24
+ role: explorer
25
+ parallelGroup: explore
26
+
27
+ Explore the worker/runtime/subagent/runtime-control shard from the discover output. Focus on process/session/runtime orchestration, event streams, logs, package config, docs, and reusable patterns for: {goal}
28
+
29
+ ## explore-extensions
30
+ role: explorer
31
+ parallelGroup: explore
32
+
33
+ Explore the extension bundle/small-package shard from the discover output. Focus on package config, extension registration, commands/tools, docs, and reusable patterns for: {goal}
34
+
35
+ ## synthesize
36
+ role: analyst
37
+ dependsOn: explore-core, explore-ui, explore-runtime, explore-extensions
38
+
39
+ Synthesize all shard findings. Use discover output if available, but do not require it. Identify common patterns, gaps, and concrete recommendations.
40
+
41
+ ## write
42
+ role: writer
43
+ dependsOn: synthesize
44
+ output: research-summary.md
45
+
46
+ Write a concise final summary with evidence, risks, and actionable next steps.
@@ -1,22 +1,22 @@
1
- ---
2
- name: research
3
- description: Research and write up findings
4
- ---
5
-
6
- ## explore
7
- role: explorer
8
-
9
- Gather relevant facts for: {goal}
10
-
11
- ## analyze
12
- role: analyst
13
- dependsOn: explore
14
-
15
- Analyze and organize the findings.
16
-
17
- ## write
18
- role: writer
19
- dependsOn: analyze
20
- output: research-summary.md
21
-
22
- Write a concise final summary with evidence and open questions.
1
+ ---
2
+ name: research
3
+ description: Research and write up findings
4
+ ---
5
+
6
+ ## explore
7
+ role: explorer
8
+
9
+ Gather relevant facts for: {goal}
10
+
11
+ ## analyze
12
+ role: analyst
13
+ dependsOn: explore
14
+
15
+ Analyze and organize the findings.
16
+
17
+ ## write
18
+ role: writer
19
+ dependsOn: analyze
20
+ output: research-summary.md
21
+
22
+ Write a concise final summary with evidence and open questions.
@@ -1,30 +1,30 @@
1
- ---
2
- name: review
3
- description: Review workflow for correctness and security
4
- ---
5
-
6
- ## explore
7
- role: explorer
8
-
9
- Identify changed or relevant areas for review: {goal}
10
-
11
- ## code-review
12
- role: reviewer
13
- dependsOn: explore
14
- parallelGroup: review
15
-
16
- Review correctness, maintainability, tests, and regressions.
17
-
18
- ## security-review
19
- role: security-reviewer
20
- dependsOn: explore
21
- parallelGroup: review
22
-
23
- Review security risks and trust boundaries.
24
-
25
- ## verify
26
- role: verifier
27
- dependsOn: code-review, security-review
28
- verify: true
29
-
30
- Summarize review outcome and pass/fail status.
1
+ ---
2
+ name: review
3
+ description: Review workflow for correctness and security
4
+ ---
5
+
6
+ ## explore
7
+ role: explorer
8
+
9
+ Identify changed or relevant areas for review: {goal}
10
+
11
+ ## code-review
12
+ role: reviewer
13
+ dependsOn: explore
14
+ parallelGroup: review
15
+
16
+ Review correctness, maintainability, tests, and regressions.
17
+
18
+ ## security-review
19
+ role: security-reviewer
20
+ dependsOn: explore
21
+ parallelGroup: review
22
+
23
+ Review security risks and trust boundaries.
24
+
25
+ ## verify
26
+ role: verifier
27
+ dependsOn: code-review, security-review
28
+ verify: true
29
+
30
+ Summarize review outcome and pass/fail status.