pi-crew 0.11.1 → 0.11.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/CHANGELOG.md +39 -9
- package/README.md +161 -1036
- package/agents/verifier.md +18 -7
- package/dist/index.mjs +744 -91462
- package/docs/README.md +57 -46
- package/docs/architecture.md +87 -33
- package/docs/commands-reference.md +9 -5
- package/docs/troubleshooting.md +3 -2
- package/package.json +1 -3
- package/schema.json +29 -0
- package/skills/real-test-pi-crew/SKILL.md +193 -36
- package/src/agents/agent-config.ts +1 -1
- package/src/agents/discover-agents.ts +1 -1
- package/src/config/config-validation.ts +15 -0
- package/src/config/config.ts +47 -13
- package/src/config/env-vars.ts +35 -0
- package/src/config/types.ts +19 -0
- package/src/errors.ts +2 -2
- package/src/extension/async-notifier.ts +23 -0
- package/src/extension/help.ts +21 -10
- package/src/extension/knowledge-injection.ts +2 -1
- package/src/extension/management.ts +8 -3
- package/src/extension/notification-sink.ts +17 -0
- package/src/extension/registration/command-utils.ts +28 -2
- package/src/extension/registration/commands/dashboard.ts +11 -1
- package/src/extension/registration/commands/manage.ts +31 -15
- package/src/extension/registration/commands/run.ts +24 -2
- package/src/extension/registration/commands/shared.ts +23 -0
- package/src/extension/registration/commands/status.ts +25 -2
- package/src/extension/registration/context-builder.ts +8 -2
- package/src/extension/registration/health-notify-policy.ts +100 -0
- package/src/extension/registration/lazy-configurers.ts +35 -0
- package/src/extension/registration/lifecycle-handlers.ts +91 -30
- package/src/extension/registration/lifecycle.ts +75 -10
- package/src/extension/registration/observability.ts +98 -35
- package/src/extension/registration/registration-types.ts +7 -5
- package/src/extension/registration/runtime-cleanup.ts +9 -3
- package/src/extension/registration/subagent-helpers.ts +38 -0
- package/src/extension/registration/wire-cross-extension.ts +28 -0
- package/src/extension/run-compare.ts +220 -0
- package/src/extension/run-export.ts +37 -5
- package/src/extension/run-maintenance.ts +155 -5
- package/src/extension/team-tool/dispatch/index.ts +3 -2
- package/src/extension/team-tool/dispatch/manage.ts +5 -2
- package/src/extension/team-tool/goal.ts +4 -1
- package/src/extension/team-tool/handle-settings.ts +19 -2
- package/src/extension/team-tool/health-monitor.ts +21 -7
- package/src/extension/team-tool/lifecycle-actions.ts +49 -1
- package/src/extension/team-tool/plan.ts +10 -0
- package/src/extension/team-tool/routing-hint.ts +63 -0
- package/src/extension/team-tool/status.ts +4 -0
- package/src/extension/team-tool.ts +52 -6
- package/src/extension/webhook-notify.ts +382 -0
- package/src/observability/metric-sink.ts +12 -2
- package/src/prompt/prompt-runtime.ts +82 -31
- package/src/prompt/worker-events-channel.ts +12 -0
- package/src/runtime/README.md +1 -1
- package/src/runtime/async-runner.ts +87 -1
- package/src/runtime/background-runner.ts +313 -234
- package/src/runtime/broker/crew-broker.ts +17 -11
- package/src/runtime/broker/delegate/shadow-lifecycle.ts +92 -0
- package/src/runtime/broker/wait-status-cache.ts +1 -1
- package/src/runtime/child-pi/child-pi-timers.ts +1 -1
- package/src/runtime/child-pi/mock-fixtures.ts +48 -0
- package/src/runtime/crew-agent-records.ts +337 -45
- package/src/runtime/deadletter.ts +43 -1
- package/src/runtime/delegate-spawn.ts +5 -1
- package/src/runtime/dispatch-batch.ts +72 -5
- package/src/runtime/goal-workflow/goal-loop-runner.ts +73 -4
- package/src/runtime/heartbeat/heartbeat-watcher.ts +7 -0
- package/src/runtime/model/model-fallback.ts +21 -1
- package/src/runtime/model/pi-args.ts +8 -10
- package/src/runtime/recovery/crash-recovery.ts +25 -1
- package/src/runtime/run-worker.ts +12 -1
- package/src/runtime/scheduling/global-worker-cap.ts +13 -6
- package/src/runtime/scheduling/run-coalesced-task-group.ts +27 -1
- package/src/runtime/scheduling/scheduler.ts +49 -13
- package/src/runtime/scheduling/semaphore.ts +148 -20
- package/src/runtime/scratchpad/README.md +1 -1
- package/src/runtime/scratchpad/protocol.ts +1 -1
- package/src/runtime/settings-store.ts +1 -1
- package/src/runtime/skill-instructions.ts +22 -0
- package/src/runtime/stale-reconciler.ts +85 -13
- package/src/runtime/task-runner/pre-execution.ts +26 -2
- package/src/runtime/task-runner/prompt-builder.ts +142 -45
- package/src/runtime/task-runner.ts +21 -1
- package/src/runtime/team-runner.ts +38 -1
- package/src/runtime/workspace-lock.ts +4 -1
- package/src/schema/config-schema.ts +14 -0
- package/src/schema/team-tool-schema.ts +17 -0
- package/src/state/atomic-write.ts +53 -0
- package/src/state/contracts.ts +109 -0
- package/src/state/coordination/locks.ts +191 -33
- package/src/state/coordination/mailbox.ts +140 -15
- package/src/state/crew-init.ts +87 -12
- package/src/state/event-log/cursor.ts +37 -1
- package/src/state/event-log/event-log-rotation.ts +72 -7
- package/src/state/stores/active-run-registry.ts +13 -1
- package/src/state/stores/state-store.ts +112 -22
- package/src/state/types.ts +4 -0
- package/src/ui/dashboard-panes/agents-pane.ts +11 -2
- package/src/ui/heartbeat-aggregator.ts +34 -0
- package/src/ui/keybinding-map.ts +22 -4
- package/src/ui/live-conversation-overlay.ts +6 -3
- package/src/ui/run-dashboard.ts +98 -5
- package/src/ui/run-snapshot-cache.ts +18 -1
- package/src/ui/spinner.ts +26 -2
- package/src/ui/tool-progress-formatter.ts +2 -1
- package/src/ui/tool-renderers/brief-mode.ts +2 -1
- package/src/ui/tool-renderers/index.ts +3 -3
- package/src/utils/incremental-reader.ts +11 -3
- package/src/utils/paths.ts +94 -12
- package/src/utils/project-markers.ts +40 -0
- package/src/worktree/worktree-manager.ts +206 -26
- package/workflows/distill.workflow.md +3 -3
- package/workflows/fast-fix.workflow.md +1 -1
- package/workflows/plan-execute.workflow.md +1 -1
- package/workflows/review.workflow.md +1 -1
- package/workflows/strict-fast-fix.workflow.md +1 -1
- package/docs/migration-v0.4-v0.5.md +0 -208
- package/docs/runtime-flow.md +0 -148
package/docs/runtime-flow.md
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
# pi-crew Runtime Flow
|
|
2
|
-
|
|
3
|
-
This document is a compact map of the runtime paths used by `pi-crew`.
|
|
4
|
-
|
|
5
|
-
## Main sequence
|
|
6
|
-
|
|
7
|
-
```text
|
|
8
|
-
User / model
|
|
9
|
-
│ calls team({ action: "run", ... }) or /team-run
|
|
10
|
-
▼
|
|
11
|
-
handleTeamTool()
|
|
12
|
-
│ validates schema and routes action
|
|
13
|
-
▼
|
|
14
|
-
handleRun()
|
|
15
|
-
├─ discoverTeams/discoverWorkflows/discoverAgents
|
|
16
|
-
├─ validateWorkflowForTeam
|
|
17
|
-
├─ expandParallelResearchWorkflow when applicable
|
|
18
|
-
├─ createRunManifest + tasks.json + goal artifact
|
|
19
|
-
├─ if async=true ─────────────────────────────────────────────┐
|
|
20
|
-
│ spawnBackgroundTeamRun() │
|
|
21
|
-
│ ├─ resolve jiti-register.mjs │
|
|
22
|
-
│ ├─ fail-fast if jiti missing │
|
|
23
|
-
│ ├─ node --import jiti-register.mjs background-runner.ts │
|
|
24
|
-
│ └─ parent schedules early-exit guard │
|
|
25
|
-
│ ▼
|
|
26
|
-
│ background-runner.ts
|
|
27
|
-
│ ├─ append async.started
|
|
28
|
-
│ ├─ write async.pid startup marker
|
|
29
|
-
│ ├─ rediscover team/workflow/agents
|
|
30
|
-
│ └─ executeTeamRun()
|
|
31
|
-
│
|
|
32
|
-
└─ if foreground/default
|
|
33
|
-
├─ startForegroundRun schedules session-bound run, or
|
|
34
|
-
└─ executeTeamRun inline for scaffold/non-scheduled paths
|
|
35
|
-
|
|
36
|
-
executeTeamRun()
|
|
37
|
-
├─ write run.running
|
|
38
|
-
├─ materialize queued/running agent records lazily
|
|
39
|
-
├─ build task graph index
|
|
40
|
-
├─ while queued tasks exist
|
|
41
|
-
│ ├─ taskGraphSnapshot
|
|
42
|
-
│ ├─ resolveBatchConcurrency
|
|
43
|
-
│ ├─ getReadyTasks
|
|
44
|
-
│ ├─ append task.progress batch event
|
|
45
|
-
│ ├─ mapConcurrent ready batch
|
|
46
|
-
│ │ └─ runTeamTask()
|
|
47
|
-
│ │ ├─ prepare workspace/worktree
|
|
48
|
-
│ │ ├─ build task packet
|
|
49
|
-
│ │ ├─ render prompt + dependency context
|
|
50
|
-
│ │ ├─ choose model candidates from Pi config
|
|
51
|
-
│ │ ├─ spawn child Pi process
|
|
52
|
-
│ │ ├─ ChildPiLineObserver parses stdout/stderr
|
|
53
|
-
│ │ ├─ append per-agent events/output
|
|
54
|
-
│ │ ├─ update agent progress/task state
|
|
55
|
-
│ │ ├─ parse final JSONL/session usage
|
|
56
|
-
│ │ └─ write result/log/transcript/metadata artifacts
|
|
57
|
-
│ ├─ merge task updates monotonically
|
|
58
|
-
│ ├─ optional adaptive plan injection
|
|
59
|
-
│ ├─ save tasks/agents/progress
|
|
60
|
-
│ └─ write batch artifact
|
|
61
|
-
├─ policy closeout
|
|
62
|
-
└─ run.completed / run.failed / run.blocked / run.cancelled
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Action router
|
|
66
|
-
|
|
67
|
-
| Action | Handler | Purpose |
|
|
68
|
-
|---|---|---|
|
|
69
|
-
| `run` | `team-tool/run.ts` | Create and execute a run, foreground or async. |
|
|
70
|
-
| `status` | `team-tool.ts` | Show manifest/tasks/agents/events and mark stale async runs failed. |
|
|
71
|
-
| `summary` | `session-summary.ts`/summary handler | Write/read run summary artifact. |
|
|
72
|
-
| `events` | `team-tool.ts` | Tail durable run events. |
|
|
73
|
-
| `artifacts` | `team-tool.ts` | List run artifacts. |
|
|
74
|
-
| `resume` | `team-tool.ts` | Requeue failed/cancelled/skipped/running tasks. |
|
|
75
|
-
| `cancel` | `team-tool.ts` | Mark queued/running tasks cancelled and request foreground interrupt. |
|
|
76
|
-
| `forget` | `run-maintenance.ts` | Delete run state/artifacts with confirmation. |
|
|
77
|
-
| `prune` | `run-maintenance.ts` | Remove old finished runs with confirmation. |
|
|
78
|
-
| `export` | `run-export.ts` | Create portable run bundle. |
|
|
79
|
-
| `import` / `imports` | `run-import.ts` / `import-index.ts` | Store/list imported bundles. |
|
|
80
|
-
| `config` | `config.ts` + config action | Show/update user/project config. |
|
|
81
|
-
| `doctor` | `team-tool/doctor.ts` | Platform/resource/runtime diagnostics. |
|
|
82
|
-
| `validate` | `validate-resources.ts` | Validate agents/teams/workflows. |
|
|
83
|
-
| `recommend` | `team-recommendation.ts` | Suggest team/workflow/action for a goal. |
|
|
84
|
-
| management | `management.ts` | Create/update/delete/rename teams, agents, workflows. |
|
|
85
|
-
| API | `team-tool/api.ts` | File-backed observability/control/mailbox API. |
|
|
86
|
-
|
|
87
|
-
## Worker modes
|
|
88
|
-
|
|
89
|
-
| Mode | Behavior |
|
|
90
|
-
|---|---|
|
|
91
|
-
| `child-process` | Default. Launches real child `pi` processes per task. |
|
|
92
|
-
| `scaffold` | Explicit dry-run. No child Pi worker execution. |
|
|
93
|
-
| `live-session` | Experimental/gated in-process/live agent path. |
|
|
94
|
-
| `auto` | Resolves to child-process unless config/env requests otherwise. |
|
|
95
|
-
|
|
96
|
-
## Important files
|
|
97
|
-
|
|
98
|
-
```text
|
|
99
|
-
src/extension/register.ts Pi extension entry/wiring
|
|
100
|
-
src/extension/team-tool/run.ts run creation and foreground/async split
|
|
101
|
-
src/runtime/background-runner.ts detached async entrypoint
|
|
102
|
-
src/runtime/async-runner.ts background spawn command/options
|
|
103
|
-
src/runtime/team-runner.ts workflow/task graph scheduler
|
|
104
|
-
src/runtime/task-runner.ts single task execution
|
|
105
|
-
src/runtime/child-pi.ts child Pi process and output observer
|
|
106
|
-
src/runtime/model-fallback.ts configured model candidates/routing
|
|
107
|
-
src/runtime/concurrency.ts batch concurrency decisions
|
|
108
|
-
src/runtime/process-status.ts pid/liveness/stale detection
|
|
109
|
-
src/state/state-store.ts manifest/tasks persistence
|
|
110
|
-
src/state/event-log.ts JSONL run events
|
|
111
|
-
src/runtime/crew-agent-records.ts aggregate + per-agent status files
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
## Environment variables
|
|
115
|
-
|
|
116
|
-
| Env | Effect |
|
|
117
|
-
|---|---|
|
|
118
|
-
| `PI_CREW_EXECUTE_WORKERS=0` | Disable real workers, use scaffold behavior. |
|
|
119
|
-
| `PI_TEAMS_EXECUTE_WORKERS=0` | Legacy alias for worker disable. |
|
|
120
|
-
| `PI_CREW_ENABLE_EXPERIMENTAL_LIVE_SESSION=1` | Allow experimental live-session runtime. |
|
|
121
|
-
| `PI_CREW_MOCK_LIVE_SESSION=success` | Test hook for live-session mock. |
|
|
122
|
-
| `PI_TEAMS_MOCK_CHILD_PI` | Test hook for mocked child Pi execution. |
|
|
123
|
-
| `PI_CREW_DEPTH`, `PI_CREW_MAX_DEPTH` | Canonical subagent recursion guard. |
|
|
124
|
-
| `PI_TEAMS_DEPTH`, `PI_TEAMS_MAX_DEPTH` | Legacy recursion guard aliases. |
|
|
125
|
-
| `PI_TEAMS_HOME` | Override user config/state home in tests. |
|
|
126
|
-
| `PI_TEAMS_PI_BIN` | Override child `pi` executable. |
|
|
127
|
-
| `PI_CODING_AGENT_DIR` | Override Pi settings/models directory for model discovery. |
|
|
128
|
-
| `PI_CREW_ASYNC_EARLY_EXIT_GUARD=0` | Disable 3s background early-exit guard. |
|
|
129
|
-
|
|
130
|
-
## State transition summary
|
|
131
|
-
|
|
132
|
-
```text
|
|
133
|
-
queued/planning/running ── completed
|
|
134
|
-
├─ failed
|
|
135
|
-
├─ blocked
|
|
136
|
-
└─ cancelled
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
Task states follow the same durable contract plus `skipped`. Terminal states are monotonic during parallel merge.
|
|
140
|
-
|
|
141
|
-
## Observability tips
|
|
142
|
-
|
|
143
|
-
- Use `/team-dashboard` for a UI overview.
|
|
144
|
-
- Use `team status runId=...` for canonical state and stale async detection.
|
|
145
|
-
- Read `background.log` for early import/spawn errors.
|
|
146
|
-
- Read `events.jsonl` for event chronology.
|
|
147
|
-
- Read `agents/{taskId}/status.json` for per-agent model/progress/tool status.
|
|
148
|
-
- Read `artifacts/{runId}/transcripts/{taskId}.jsonl` for raw child Pi transcript.
|