pi-crew 0.9.56 → 0.9.57

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 (307) hide show
  1. package/AGENTS.md +1 -1
  2. package/CHANGELOG.md +29 -0
  3. package/README.md +53 -5
  4. package/dist/index.mjs +5350 -4350
  5. package/docs/README.md +54 -0
  6. package/package.json +12 -12
  7. package/skills/real-test-pi-crew/SKILL.md +93 -3
  8. package/src/agents/discover-agents.ts +68 -10
  9. package/src/benchmark/feedback-loop.ts +1 -1
  10. package/src/config/config.ts +2 -1
  11. package/src/config/types.ts +12 -0
  12. package/src/extension/action-suggestions.ts +16 -63
  13. package/src/extension/async-notifier.ts +3 -3
  14. package/src/extension/command-completions.ts +2 -2
  15. package/src/extension/crew-cleanup.ts +3 -3
  16. package/src/extension/crew-vibes/footer.ts +4 -2
  17. package/src/extension/cross-extension-rpc.ts +10 -5
  18. package/src/extension/knowledge-injection.ts +57 -10
  19. package/src/extension/register.ts +2 -2
  20. package/src/extension/registration/artifact-cleanup.ts +41 -3
  21. package/src/extension/registration/commands.ts +4 -4
  22. package/src/extension/registration/context-builder.ts +10 -10
  23. package/src/extension/registration/crash-recovery-cache.ts +3 -3
  24. package/src/extension/registration/foreground-run-controller.ts +1 -1
  25. package/src/extension/registration/lazy-configurers.ts +2 -2
  26. package/src/extension/registration/lifecycle-handlers.ts +12 -12
  27. package/src/extension/registration/lifecycle.ts +2 -2
  28. package/src/extension/registration/observability.ts +2 -2
  29. package/src/extension/registration/registration-types.ts +3 -3
  30. package/src/extension/registration/runtime-cleanup.ts +1 -1
  31. package/src/extension/registration/subagent-helpers.ts +2 -2
  32. package/src/extension/registration/subagent-manager-setup.ts +2 -2
  33. package/src/extension/registration/subagent-tools.ts +21 -16
  34. package/src/extension/registration/team-tool.ts +108 -17
  35. package/src/extension/registration/viewers.ts +3 -4
  36. package/src/extension/registration/wire-cross-extension.ts +7 -7
  37. package/src/extension/rpc-hmac.ts +3 -2
  38. package/src/extension/run-bundle-schema.ts +13 -4
  39. package/src/extension/run-export.ts +2 -2
  40. package/src/extension/run-index.ts +2 -3
  41. package/src/extension/run-maintenance.ts +57 -1
  42. package/src/extension/team-manager-command.ts +3 -1
  43. package/src/extension/team-tool/anchor.ts +8 -2
  44. package/src/extension/team-tool/api.ts +117 -39
  45. package/src/extension/team-tool/cancel.ts +23 -8
  46. package/src/extension/team-tool/chain-executor.ts +1 -1
  47. package/src/extension/team-tool/dispatch/automate.ts +17 -2
  48. package/src/extension/team-tool/dispatch/control.ts +17 -2
  49. package/src/extension/team-tool/dispatch/manage.ts +34 -2
  50. package/src/extension/team-tool/dispatch/run.ts +17 -2
  51. package/src/extension/team-tool/dispatch/status.ts +37 -5
  52. package/src/extension/team-tool/doctor.ts +2 -2
  53. package/src/extension/team-tool/explain.ts +1 -1
  54. package/src/extension/team-tool/goal-wrap.ts +5 -5
  55. package/src/extension/team-tool/goal.ts +30 -9
  56. package/src/extension/team-tool/handle-schedule.ts +37 -19
  57. package/src/extension/team-tool/inspect.ts +21 -5
  58. package/src/extension/team-tool/lifecycle-actions.ts +53 -10
  59. package/src/extension/team-tool/parallel-dispatch.ts +14 -5
  60. package/src/extension/team-tool/param-error.ts +24 -0
  61. package/src/extension/team-tool/respond.ts +20 -6
  62. package/src/extension/team-tool/run.ts +27 -17
  63. package/src/extension/team-tool/status.ts +11 -5
  64. package/src/extension/team-tool.ts +26 -19
  65. package/src/hooks/registry.ts +1 -1
  66. package/src/i18n.ts +22 -0
  67. package/src/observability/event-bus.ts +1 -1
  68. package/src/prompt/prompt-runtime.ts +2 -2
  69. package/src/runtime/README.md +35 -0
  70. package/src/runtime/agent-control.ts +1 -1
  71. package/src/runtime/anchor-manager.ts +0 -2
  72. package/src/runtime/async-runner.ts +1 -1
  73. package/src/runtime/attention-events.ts +1 -1
  74. package/src/runtime/auto-summarize.ts +0 -2
  75. package/src/runtime/background-runner.ts +103 -30
  76. package/src/runtime/{crew-broker-child.ts → broker/crew-broker-child.ts} +2 -2
  77. package/src/runtime/{crew-broker-client.ts → broker/crew-broker-client.ts} +4 -7
  78. package/src/runtime/{crew-broker.ts → broker/crew-broker.ts} +13 -21
  79. package/src/runtime/chain-runner.ts +50 -5
  80. package/src/runtime/{child-pi-constants.ts → child-pi/child-pi-constants.ts} +1 -1
  81. package/src/runtime/{child-pi-kill.ts → child-pi/child-pi-kill.ts} +3 -3
  82. package/src/runtime/{child-pi-spawn.ts → child-pi/child-pi-spawn.ts} +28 -12
  83. package/src/runtime/{child-pi-steering.ts → child-pi/child-pi-steering.ts} +1 -1
  84. package/src/runtime/{child-pi-streams.ts → child-pi/child-pi-streams.ts} +11 -4
  85. package/src/runtime/{child-pi-transcript.ts → child-pi/child-pi-transcript.ts} +6 -6
  86. package/src/runtime/{child-pi.ts → child-pi/child-pi.ts} +28 -72
  87. package/src/runtime/{compact-stages → compaction/compact-stages}/bounded-tail.ts +1 -1
  88. package/src/runtime/{compact-stages → compaction/compact-stages}/index.ts +2 -2
  89. package/src/runtime/{compaction-summary.ts → compaction/compaction-summary.ts} +3 -3
  90. package/src/runtime/{tool-output-pruner.ts → compaction/tool-output-pruner.ts} +1 -1
  91. package/src/runtime/custom-tools/irc-tool.ts +2 -2
  92. package/src/runtime/delivery-coordinator.ts +0 -3
  93. package/src/runtime/diagnostic-export.ts +3 -3
  94. package/src/runtime/foreground-control.ts +1 -1
  95. package/src/runtime/foreground-watchdog.ts +1 -1
  96. package/src/runtime/{adaptive-plan.ts → goal-workflow/adaptive-plan.ts} +8 -8
  97. package/src/runtime/{dynamic-workflow-context.ts → goal-workflow/dynamic-workflow-context.ts} +16 -16
  98. package/src/runtime/{dynamic-workflow-runner.ts → goal-workflow/dynamic-workflow-runner.ts} +10 -10
  99. package/src/runtime/{goal-achievement.ts → goal-workflow/goal-achievement.ts} +3 -3
  100. package/src/runtime/{goal-evaluator.ts → goal-workflow/goal-evaluator.ts} +8 -8
  101. package/src/runtime/{goal-loop-runner.ts → goal-workflow/goal-loop-runner.ts} +27 -25
  102. package/src/runtime/{goal-state-store.ts → goal-workflow/goal-state-store.ts} +8 -8
  103. package/src/runtime/{plan-templates.ts → goal-workflow/plan-templates.ts} +1 -1
  104. package/src/runtime/group-join.ts +3 -3
  105. package/src/runtime/handoff-manager.ts +0 -2
  106. package/src/runtime/{heartbeat-watcher.ts → heartbeat/heartbeat-watcher.ts} +7 -7
  107. package/src/runtime/iteration-hooks.ts +1 -1
  108. package/src/runtime/{live-agent-control.ts → live-session/live-agent-control.ts} +2 -2
  109. package/src/runtime/{live-agent-manager.ts → live-session/live-agent-manager.ts} +4 -4
  110. package/src/runtime/{live-session-runtime.ts → live-session/live-session-runtime.ts} +39 -41
  111. package/src/runtime/manifest-cache.ts +1 -1
  112. package/src/runtime/{model-fallback.ts → model/model-fallback.ts} +1 -1
  113. package/src/runtime/{pi-args.ts → model/pi-args.ts} +20 -5
  114. package/src/runtime/model/provider-extensions.ts +116 -0
  115. package/src/runtime/{runtime-policy.ts → model/runtime-policy.ts} +2 -2
  116. package/src/runtime/{runtime-resolver.ts → model/runtime-resolver.ts} +3 -3
  117. package/src/runtime/{runtime-warmup.ts → model/runtime-warmup.ts} +8 -8
  118. package/src/runtime/orphan-worker-registry.ts +1 -1
  119. package/src/runtime/{progress-tracker.ts → output/progress-tracker.ts} +1 -1
  120. package/src/runtime/{result-extractor.ts → output/result-extractor.ts} +4 -4
  121. package/src/runtime/{sidechain-output.ts → output/sidechain-output.ts} +2 -2
  122. package/src/runtime/{stream-preview.ts → output/stream-preview.ts} +1 -1
  123. package/src/runtime/{streaming-output.ts → output/streaming-output.ts} +2 -2
  124. package/src/runtime/{tool-progress.ts → output/tool-progress.ts} +1 -1
  125. package/src/runtime/parent-guard.ts +30 -10
  126. package/src/runtime/pipeline-runner.ts +2 -2
  127. package/src/runtime/policy-engine.ts +2 -2
  128. package/src/runtime/{cancellation.ts → process/cancellation.ts} +1 -1
  129. package/src/runtime/{post-exit-stdio-guard.ts → process/post-exit-stdio-guard.ts} +1 -1
  130. package/src/runtime/{process-lifecycle.ts → process/process-lifecycle.ts} +3 -3
  131. package/src/runtime/{checkpoint.ts → recovery/checkpoint.ts} +4 -4
  132. package/src/runtime/{crash-recovery.ts → recovery/crash-recovery.ts} +93 -21
  133. package/src/runtime/{overflow-recovery.ts → recovery/overflow-recovery.ts} +1 -1
  134. package/src/runtime/{recovery-recipes.ts → recovery/recovery-recipes.ts} +1 -1
  135. package/src/runtime/{retry-executor.ts → recovery/retry-executor.ts} +2 -2
  136. package/src/runtime/{retry-runner.ts → recovery/retry-runner.ts} +2 -8
  137. package/src/runtime/run-tracker.ts +1 -1
  138. package/src/runtime/run-worker.ts +3 -3
  139. package/src/runtime/{coalesce-tasks.ts → scheduling/coalesce-tasks.ts} +3 -3
  140. package/src/runtime/{concurrency.ts → scheduling/concurrency.ts} +1 -1
  141. package/src/runtime/{parallel-research.ts → scheduling/parallel-research.ts} +4 -2
  142. package/src/runtime/{run-coalesced-task-group.ts → scheduling/run-coalesced-task-group.ts} +95 -36
  143. package/src/runtime/{task-graph-scheduler.ts → scheduling/task-graph-scheduler.ts} +1 -1
  144. package/src/runtime/session-resources.ts +1 -1
  145. package/src/runtime/settings-store.ts +1 -1
  146. package/src/runtime/single-agent-compose.ts +1 -0
  147. package/src/runtime/stale-reconciler.ts +1 -1
  148. package/src/runtime/subagent-manager.ts +1 -1
  149. package/src/runtime/supervisor-contact.ts +1 -1
  150. package/src/runtime/task-output-context.ts +7 -5
  151. package/src/runtime/task-runner/child-executor.ts +62 -22
  152. package/src/runtime/task-runner/live-executor.ts +8 -8
  153. package/src/runtime/task-runner/post-execution.ts +12 -12
  154. package/src/runtime/task-runner/pre-execution.ts +6 -6
  155. package/src/runtime/task-runner/progress.ts +1 -1
  156. package/src/runtime/task-runner/run-projection.ts +1 -1
  157. package/src/runtime/task-runner/scaffold-executor.ts +1 -1
  158. package/src/runtime/task-runner/state-helpers.ts +2 -2
  159. package/src/runtime/task-runner.ts +4 -4
  160. package/src/runtime/team-runner.ts +380 -139
  161. package/src/runtime/{completion-guard.ts → verification/completion-guard.ts} +1 -1
  162. package/src/runtime/{green-contract.ts → verification/green-contract.ts} +1 -1
  163. package/src/runtime/{post-checks.ts → verification/post-checks.ts} +4 -4
  164. package/src/runtime/{verification-gates.ts → verification/verification-gates.ts} +5 -5
  165. package/src/runtime/{verification-integrity.ts → verification/verification-integrity.ts} +1 -1
  166. package/src/schema/config-schema.ts +1 -0
  167. package/src/schema/team-tool-schema.ts +133 -177
  168. package/src/state/README.md +44 -0
  169. package/src/state/atomic-write.ts +24 -3
  170. package/src/state/{locks.ts → coordination/locks.ts} +118 -38
  171. package/src/state/{mailbox.ts → coordination/mailbox.ts} +14 -8
  172. package/src/state/{schedule.ts → coordination/schedule.ts} +3 -3
  173. package/src/state/{task-claims.ts → coordination/task-claims.ts} +1 -1
  174. package/src/state/decision-ledger.ts +1 -1
  175. package/src/state/{event-log-rotation.ts → event-log/event-log-rotation.ts} +161 -31
  176. package/src/state/{event-log.ts → event-log/event-log.ts} +38 -26
  177. package/src/state/{jsonl-writer.ts → event-log/jsonl-writer.ts} +14 -6
  178. package/src/state/hook-instinct-bridge.ts +2 -2
  179. package/src/state/{active-run-registry.ts → stores/active-run-registry.ts} +7 -7
  180. package/src/state/{artifact-store.ts → stores/artifact-store.ts} +62 -4
  181. package/src/state/{blob-store.ts → stores/blob-store.ts} +3 -3
  182. package/src/state/{health-store.ts → stores/health-store.ts} +3 -3
  183. package/src/state/{instinct-store.ts → stores/instinct-store.ts} +3 -3
  184. package/src/state/{observation-store.ts → stores/observation-store.ts} +2 -2
  185. package/src/state/{run-cache.ts → stores/run-cache.ts} +4 -4
  186. package/src/state/{run-graph.ts → stores/run-graph.ts} +4 -4
  187. package/src/state/{run-metrics.ts → stores/run-metrics.ts} +3 -3
  188. package/src/state/{state-store.ts → stores/state-store.ts} +236 -17
  189. package/src/state/types.ts +27 -3
  190. package/src/ui/component.ts +55 -0
  191. package/src/ui/crew-select-list.ts +3 -1
  192. package/src/ui/dashboard-panes/agents-pane.ts +1 -1
  193. package/src/ui/dwf-phase-display.ts +1 -1
  194. package/src/ui/heartbeat-aggregator.ts +1 -1
  195. package/src/ui/keybinding-map.ts +179 -6
  196. package/src/ui/layout-primitives.ts +9 -5
  197. package/src/ui/live-conversation-overlay.ts +1 -1
  198. package/src/ui/live-run-sidebar.ts +1 -1
  199. package/src/ui/overlay-stack.ts +148 -0
  200. package/src/ui/overlays/agent-picker-overlay.ts +1 -1
  201. package/src/ui/overlays/mailbox-compose-overlay.ts +1 -1
  202. package/src/ui/overlays/mailbox-detail-overlay.ts +2 -2
  203. package/src/ui/powerbar-publisher.ts +1 -1
  204. package/src/ui/render-scheduler.ts +1 -1
  205. package/src/ui/run-action-dispatcher.ts +3 -3
  206. package/src/ui/run-dashboard.ts +5 -33
  207. package/src/ui/run-event-bus.ts +3 -3
  208. package/src/ui/run-snapshot-cache.ts +37 -18
  209. package/src/ui/settings-overlay.ts +13 -21
  210. package/src/ui/snapshot-types.ts +1 -1
  211. package/src/ui/status-colors.ts +0 -2
  212. package/src/ui/terminal-status.ts +1 -1
  213. package/src/ui/theme-adapter.ts +33 -13
  214. package/src/ui/tool-renderers/index.ts +8 -0
  215. package/src/ui/transcript-viewer.ts +37 -13
  216. package/src/ui/widget/index.ts +32 -9
  217. package/src/ui/widget/widget-formatters.ts +62 -4
  218. package/src/ui/widget/widget-model.ts +2 -2
  219. package/src/ui/widget/widget-renderer.ts +1 -1
  220. package/src/utils/conflict-detect.ts +58 -5
  221. package/src/utils/ndjson.ts +2 -2
  222. package/src/utils/socket-path.ts +1 -1
  223. package/src/workflows/workflow-config.ts +1 -1
  224. package/src/worktree/cleanup.ts +1 -1
  225. package/src/worktree/worktree-manager.ts +88 -39
  226. package/workflows/chain.workflow.md +2 -2
  227. package/index.bundle.ts +0 -25
  228. package/scripts/bench-check.mjs +0 -96
  229. package/scripts/bench-cold-start.mjs +0 -216
  230. package/scripts/build-bundle.mjs +0 -92
  231. package/scripts/check-all-skills.ts +0 -294
  232. package/scripts/check-bundle-size.mjs +0 -38
  233. package/scripts/check-bundle-staleness.mjs +0 -97
  234. package/scripts/check-conflict-markers.mjs +0 -91
  235. package/scripts/check-lazy-imports.mjs +0 -28
  236. package/scripts/dev-runner.mjs +0 -106
  237. package/scripts/profile-startup.mjs +0 -125
  238. package/scripts/release-smoke.mjs +0 -74
  239. package/scripts/run-bench.mjs +0 -47
  240. package/scripts/run-real-chain.ts +0 -41
  241. package/scripts/smoke-team-perf.ts +0 -43
  242. package/scripts/test-issue-29-crash.ts +0 -111
  243. package/scripts/test-issue-29-e2e.ts +0 -183
  244. package/scripts/test-issue-29-real-runtime.ts +0 -330
  245. package/scripts/test-issue-29-real-tasks.ts +0 -387
  246. package/scripts/test-issue-29-team-tool.ts +0 -105
  247. package/scripts/test-runner.mjs +0 -84
  248. package/scripts/verify-flicker-fix.ts +0 -109
  249. package/scripts/verify-skill.ts +0 -550
  250. package/scripts/watch-bundle.mjs +0 -259
  251. package/scripts/watchdog-harness.ts +0 -119
  252. package/src/adapters/claude-adapter.ts +0 -23
  253. package/src/adapters/codex-adapter.ts +0 -21
  254. package/src/adapters/cursor-adapter.ts +0 -17
  255. package/src/adapters/export-util.ts +0 -143
  256. package/src/adapters/index.ts +0 -15
  257. package/src/adapters/registry.ts +0 -18
  258. package/src/adapters/types.ts +0 -23
  259. package/src/runtime/code-summary.ts +0 -292
  260. package/src/runtime/cross-extension-rpc.ts +0 -143
  261. package/src/runtime/hidden-handoff.ts +0 -407
  262. package/src/runtime/prose-compressor.ts +0 -162
  263. package/src/subagents/async-entry.ts +0 -1
  264. package/src/subagents/index.ts +0 -3
  265. package/src/subagents/live/control.ts +0 -1
  266. package/src/subagents/live/manager.ts +0 -1
  267. package/src/subagents/live/realtime.ts +0 -1
  268. package/src/subagents/live/session-runtime.ts +0 -1
  269. package/src/subagents/manager.ts +0 -1
  270. package/src/subagents/spawn.ts +0 -1
  271. package/test-integration-check.ts +0 -118
  272. /package/src/runtime/{broker-issuer.ts → broker/broker-issuer.ts} +0 -0
  273. /package/src/runtime/{crew-broker-tokens.ts → broker/crew-broker-tokens.ts} +0 -0
  274. /package/src/runtime/{child-pi-pool.ts → child-pi/child-pi-pool.ts} +0 -0
  275. /package/src/runtime/{compact-pipeline.ts → compaction/compact-pipeline.ts} +0 -0
  276. /package/src/runtime/{compact-stages → compaction/compact-stages}/ansi-strip-stage.ts +0 -0
  277. /package/src/runtime/{compact-stages → compaction/compact-stages}/blank-collapse-stage.ts +0 -0
  278. /package/src/runtime/{compact-stages → compaction/compact-stages}/deduplicate-stage.ts +0 -0
  279. /package/src/runtime/{compact-stages → compaction/compact-stages}/head-snap-stage.ts +0 -0
  280. /package/src/runtime/{compact-stages → compaction/compact-stages}/tail-capture-stage.ts +0 -0
  281. /package/src/runtime/{compact-stages → compaction/compact-stages}/truncation-stage.ts +0 -0
  282. /package/src/runtime/{important-line-classifier.ts → compaction/important-line-classifier.ts} +0 -0
  283. /package/src/runtime/{heartbeat-gradient.ts → heartbeat/heartbeat-gradient.ts} +0 -0
  284. /package/src/runtime/{worker-heartbeat.ts → heartbeat/worker-heartbeat.ts} +0 -0
  285. /package/src/runtime/{worker-startup.ts → heartbeat/worker-startup.ts} +0 -0
  286. /package/src/runtime/{intercom-bridge.ts → live-session/intercom-bridge.ts} +0 -0
  287. /package/src/runtime/{live-control-realtime.ts → live-session/live-control-realtime.ts} +0 -0
  288. /package/src/runtime/{live-extension-bridge.ts → live-session/live-extension-bridge.ts} +0 -0
  289. /package/src/runtime/{live-irc.ts → live-session/live-irc.ts} +0 -0
  290. /package/src/runtime/{live-session-health.ts → live-session/live-session-health.ts} +0 -0
  291. /package/src/runtime/{model-resolver.ts → model/model-resolver.ts} +0 -0
  292. /package/src/runtime/{model-scope.ts → model/model-scope.ts} +0 -0
  293. /package/src/runtime/{output-validator.ts → output/output-validator.ts} +0 -0
  294. /package/src/runtime/{pi-json-output.ts → output/pi-json-output.ts} +0 -0
  295. /package/src/runtime/{progress-event-coalescer.ts → output/progress-event-coalescer.ts} +0 -0
  296. /package/src/runtime/{cancellation-token.ts → process/cancellation-token.ts} +0 -0
  297. /package/src/runtime/{zombie-scanner.ts → process/zombie-scanner.ts} +0 -0
  298. /package/src/runtime/{crash-classification.ts → recovery/crash-classification.ts} +0 -0
  299. /package/src/runtime/{batch-barrier.ts → scheduling/batch-barrier.ts} +0 -0
  300. /package/src/runtime/{global-worker-cap.ts → scheduling/global-worker-cap.ts} +0 -0
  301. /package/src/runtime/{parallel-utils.ts → scheduling/parallel-utils.ts} +0 -0
  302. /package/src/runtime/{scheduler.ts → scheduling/scheduler.ts} +0 -0
  303. /package/src/runtime/{semaphore.ts → scheduling/semaphore.ts} +0 -0
  304. /package/src/runtime/{task-graph.ts → scheduling/task-graph.ts} +0 -0
  305. /package/src/runtime/{verification-worktree.ts → verification/verification-worktree.ts} +0 -0
  306. /package/src/state/{event-reconstructor.ts → event-log/event-reconstructor.ts} +0 -0
  307. /package/src/state/{worker-atomic-writer.ts → event-log/worker-atomic-writer.ts} +0 -0
@@ -1,97 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * CI gate: detect stale dist/index.mjs vs src/.
4
- *
5
- * Compares the newest mtime in src/ against dist/index.mjs mtime. If
6
- * src/ is newer, the bundle is stale (someone edited source without
7
- * rebuilding). Exits non-zero in that case.
8
- *
9
- * Why: in v0.9.17 the entrypoint prefers the bundle (with strip-types
10
- * fallback). Stale bundles silently run old code — see Phase 5 H2
11
- * investigation (2026-07-01) for the regression risk.
12
- *
13
- * Skips if dist/index.mjs does not exist (the strip-types fallback path
14
- * is fine and the build:bundle automation will produce it).
15
- *
16
- * Exits:
17
- * 0 — dist is fresh OR absent
18
- * 1 — dist is stale (run `npm run build:bundle`)
19
- */
20
-
21
- import { execSync } from "node:child_process";
22
- import { existsSync, statSync } from "node:fs";
23
-
24
- const distPath = "dist/index.mjs";
25
- if (!existsSync(distPath)) {
26
- console.log("[check-bundle-staleness] dist/index.mjs absent — strip-types fallback will be used. OK.");
27
- process.exit(0);
28
- }
29
-
30
- const distMtimeMs = statSync(distPath).mtimeMs;
31
-
32
- // `git ls-files -o -- src` lists untracked files in src/. We want every
33
- // tracked file's mtime plus the newest untracked one. Cheap heuristic:
34
- // use `find` style by asking git for the full list, then statSync each.
35
- let trackedFiles;
36
- try {
37
- trackedFiles = execSync(`git ls-files src`, { encoding: "utf-8" })
38
- .split("\n")
39
- .filter(Boolean);
40
- } catch {
41
- // Not a git repo (e.g. npm pack test) — skip.
42
- console.log("[check-bundle-staleness] not a git repo; skipping staleness check.");
43
- process.exit(0);
44
- }
45
-
46
- let newestMtimeMs = 0;
47
- let newestFile = "";
48
- for (const f of trackedFiles) {
49
- try {
50
- const mt = statSync(f).mtimeMs;
51
- if (mt > newestMtimeMs) {
52
- newestMtimeMs = mt;
53
- newestFile = f;
54
- }
55
- } catch {
56
- // File listed but missing on disk — ignore.
57
- }
58
- }
59
-
60
- // Add untracked .ts files in src/ (devs editing a new file)
61
- try {
62
- const untracked = execSync(`git ls-files -o --exclude-standard src`, { encoding: "utf-8" })
63
- .split("\n")
64
- .filter(Boolean);
65
- for (const f of untracked) {
66
- if (!f.endsWith(".ts")) continue;
67
- try {
68
- const mt = statSync(f).mtimeMs;
69
- if (mt > newestMtimeMs) {
70
- newestMtimeMs = mt;
71
- newestFile = f;
72
- }
73
- } catch {
74
- // ignore
75
- }
76
- }
77
- } catch {
78
- // git may fail; ignore
79
- }
80
-
81
- if (newestMtimeMs === 0) {
82
- console.log("[check-bundle-staleness] no src/*.ts files found; skipping.");
83
- process.exit(0);
84
- }
85
-
86
- if (newestMtimeMs > distMtimeMs) {
87
- console.error(
88
- `[check-bundle-staleness] FAIL: dist/index.mjs is stale.\n` +
89
- ` Newest src file: ${newestFile} (mtime=${newestMtimeMs.toFixed(0)})\n` +
90
- ` dist/index.mjs mtime: ${distMtimeMs.toFixed(0)}\n` +
91
- ` → run \`npm run build:bundle\` to refresh.`,
92
- );
93
- process.exit(1);
94
- }
95
-
96
- const ageSec = (distMtimeMs - newestMtimeMs) / 1000;
97
- console.log(`[check-bundle-staleness] OK: dist/index.mjs is ${ageSec.toFixed(1)}s newer than newest src/ file.`);
@@ -1,91 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * CI gate: detect unresolved git merge conflict markers in source.
4
- *
5
- * Scans tracked source files for `<<<<<<<`, `=======` (lone), and
6
- * `>>>>>>>` patterns that indicate a botched merge. Fails CI if any
7
- * are found so they can't reach the bundle (which esbuild would
8
- * choke on with a parse error).
9
- *
10
- * History: 2026-07-01 CI #28498831579 (Ubuntu) failed because
11
- * src/runtime/child-pi.ts and src/extension/pi-api.ts shipped with
12
- * unresolved conflict markers left over from earlier stash/pop cycles
13
- * during Phase 2-5 implementation. The esbuild transformer in the
14
- * test runner hit `Expected identifier but found "<<"` at
15
- * src/runtime/child-pi.ts:1073 — a syntax error caused by the markers.
16
- *
17
- * Scope:
18
- * - Tracks files in src/, test/, scripts/, workflows/, teams/,
19
- * agents/, themes/ — anywhere a conflict would land.
20
- * - Excludes test/unit/conflict-detect.test.ts which INTENTIONALLY
21
- * contains `<<<<<<< HEAD` etc. as test fixtures (test the
22
- detector itself).
23
- * - Detects both conflict-style (`<<<<<<<`, `=======`, `>>>>>>>`)
24
- * and diff3-style (`|||||||`) markers.
25
- *
26
- * Exits:
27
- * 0 — clean (no markers found, or only allowed locations)
28
- * 1 — markers found (with file:line listing)
29
- */
30
-
31
- import { execSync } from "node:child_process";
32
- import { readFileSync } from "node:fs";
33
-
34
- const MARKER_PATTERNS = [
35
- /^<<<<<<< /m, // ours/incoming/conflict markers
36
- /^=======$/m, // conflict separator (lone, not bash =======)
37
- /^>>>>>>> /m, // theirs/outgoing markers
38
- /^\|\|\|\|\|\|\| /m, // diff3 base marker
39
- ];
40
-
41
- const SCAN_PATHS = ["src/", "test/", "scripts/", "workflows/", "teams/", "agents/", "themes/"];
42
- const EXCLUDE_FILES = new Set([
43
- // Intentionally contains conflict markers as test fixtures.
44
- "test/unit/conflict-detect.test.ts",
45
- ]);
46
-
47
- function listTrackedFiles() {
48
- try {
49
- const all = execSync("git ls-files", { encoding: "utf-8" });
50
- return all
51
- .split("\n")
52
- .filter(Boolean)
53
- .filter((f) => SCAN_PATHS.some((p) => f.startsWith(p) || f === p.replace(/\/$/, "")))
54
- .filter((f) => !EXCLUDE_FILES.has(f));
55
- } catch {
56
- console.error("[conflict-markers] not a git repo; skipping check.");
57
- process.exit(0);
58
- }
59
- }
60
-
61
- const files = listTrackedFiles();
62
- const offenders = [];
63
-
64
- for (const file of files) {
65
- let content;
66
- try {
67
- content = readFileSync(file, "utf-8");
68
- } catch {
69
- // File listed but unreadable — skip silently.
70
- continue;
71
- }
72
- const lines = content.split(/\r?\n/);
73
- for (let i = 0; i < lines.length; i += 1) {
74
- const line = lines[i];
75
- if (MARKER_PATTERNS.some((re) => re.test(line))) {
76
- offenders.push({ file, line: i + 1, text: line });
77
- }
78
- }
79
- }
80
-
81
- if (offenders.length === 0) {
82
- console.log(`[conflict-markers] OK: scanned ${files.length} files, no markers found.`);
83
- process.exit(0);
84
- }
85
-
86
- console.error(`[conflict-markers] FAIL: ${offenders.length} conflict marker(s) found.`);
87
- for (const o of offenders) {
88
- console.error(` ${o.file}:${o.line}: ${o.text.trim().slice(0, 80)}`);
89
- }
90
- console.error("\nResolve with: git checkout --ours|--theirs or git add ... after manual edit.");
91
- process.exit(1);
@@ -1,28 +0,0 @@
1
- import { execSync } from "node:child_process";
2
- import { readFileSync } from "node:fs";
3
-
4
- const out = execSync(
5
- `git grep -nE "await import\\(" -- "src/**/*.ts"`,
6
- { encoding: "utf-8" },
7
- );
8
-
9
- const bad = [];
10
- const fileCache = new Map();
11
-
12
- for (const line of out.split("\n").filter(Boolean)) {
13
- if (line.includes("// LAZY:")) continue;
14
- const m = line.match(/^([^:]+):(\d+):/);
15
- if (!m) continue;
16
- const [, file, lineNum] = m;
17
- if (!fileCache.has(file)) fileCache.set(file, readFileSync(file, "utf-8").split(/\r?\n/));
18
- const lines = fileCache.get(file);
19
- const prevLine = lines[Number(lineNum) - 2] ?? "";
20
- if (!prevLine.includes("// LAZY:")) bad.push(line);
21
- }
22
-
23
- if (bad.length > 0) {
24
- console.error("Dynamic imports without `// LAZY:` marker:\n" + bad.join("\n"));
25
- process.exit(1);
26
- }
27
-
28
- console.log("All dynamic imports have `// LAZY:` marker.");
@@ -1,106 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Dev runner — spawn `watch:bundle` and `test:watch` in parallel.
4
- *
5
- * Replaces the `npm-run-all --parallel watch:bundle test:watch` form that
6
- * would require an additional dev-dependency. Uses Node's stdlib
7
- * `child_process.spawn` so we keep the dev tooling dependency-free.
8
- *
9
- * Behavior:
10
- * - Spawns both child processes with stdio: inherit (the parent's TTY
11
- * sees both streams interleaved).
12
- * - Forwards Ctrl+C (SIGINT) and SIGTERM to both children so they shut
13
- * down cleanly when the user aborts.
14
- * - Exits with a non-zero code if EITHER child exits with a non-zero
15
- * status (mimics `npm-run-all --parallel` semantics).
16
- *
17
- * Usage:
18
- * npm run dev
19
- * node scripts/dev-runner.mjs
20
- */
21
-
22
- import { spawn } from "node:child_process";
23
- import process from "node:process";
24
-
25
- const tasks = [
26
- { name: "watch:bundle", script: "watch:bundle" },
27
- { name: "test:watch", script: "test:watch" },
28
- ];
29
-
30
- /**
31
- * @typedef {{name: string, child: import("node:child_process").ChildProcess, exited: boolean, code: number|null, signal: NodeJS.Signals|null}} Task
32
- */
33
-
34
- /** @type {Task[]} */
35
- const children = tasks.map((t) => ({
36
- name: t.name,
37
- child: spawnNpm(t.script),
38
- exited: false,
39
- code: null,
40
- signal: null,
41
- }));
42
-
43
- let shuttingDown = false;
44
- let exitCode = 0;
45
-
46
- function spawnNpm(script) {
47
- return spawn("npm", ["run", "--silent", script], {
48
- stdio: "inherit",
49
- env: process.env,
50
- });
51
- }
52
-
53
- function maybeExit() {
54
- if (!shuttingDown) return;
55
- if (children.some((c) => !c.exited)) return;
56
- process.exit(exitCode);
57
- }
58
-
59
- function shutdown(reason) {
60
- if (shuttingDown) return;
61
- shuttingDown = true;
62
- process.stderr.write(`\n[dev-runner] received ${reason}, forwarding to children...\n`);
63
- for (const c of children) {
64
- if (c.exited) continue;
65
- try {
66
- c.child.kill("SIGTERM");
67
- } catch {
68
- /* already dead */
69
- }
70
- }
71
- // Hard-kill grace window: if children ignore SIGTERM for 3s, send SIGKILL.
72
- setTimeout(() => {
73
- for (const c of children) {
74
- if (c.exited) continue;
75
- try {
76
- c.child.kill("SIGKILL");
77
- } catch {
78
- /* already dead */
79
- }
80
- }
81
- }, 3000).unref();
82
- maybeExit();
83
- }
84
-
85
- for (const c of children) {
86
- c.child.on("exit", (code, signal) => {
87
- c.exited = true;
88
- c.code = code;
89
- c.signal = signal;
90
- const note = signal ? `signal=${signal}` : `code=${code}`;
91
- process.stderr.write(`[dev-runner] ${c.name} exited (${note})\n`);
92
- // Non-zero is only meaningful when the child exited via code (not signal).
93
- if (signal === null && code !== 0) exitCode = exitCode || (code ?? 1);
94
- maybeExit();
95
- });
96
-
97
- c.child.on("error", (err) => {
98
- process.stderr.write(`[dev-runner] failed to spawn ${c.name}: ${err.message}\n`);
99
- c.exited = true;
100
- exitCode = exitCode || 1;
101
- maybeExit();
102
- });
103
- }
104
-
105
- process.on("SIGINT", () => shutdown("SIGINT"));
106
- process.on("SIGTERM", () => shutdown("SIGTERM"));
@@ -1,125 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Profile pi-crew register cold load.
4
- *
5
- * Usage:
6
- * node scripts/profile-startup.mjs # default 5 iters
7
- * node scripts/profile-startup.mjs --iters 10
8
- *
9
- * Outputs:
10
- * .profile/startup-<timestamp>.cpuprofile (open in Chrome DevTools)
11
- * .profile/summary.json (top frames JSON)
12
- *
13
- * Implementation note: spawns a child Node with --cpu-prof so the profile
14
- * captures only the cold-load path (no measurement noise from this driver).
15
- */
16
- import * as fs from "node:fs";
17
- import * as path from "node:path";
18
- import { execFileSync, spawnSync } from "node:child_process";
19
- import { pathToFileURL } from "node:url";
20
-
21
- const root = path.resolve(import.meta.dirname, "..");
22
- const profileDir = path.join(root, ".profile");
23
- const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
24
-
25
- const args = process.argv.slice(2);
26
- let iters = 5;
27
- for (let i = 0; i < args.length; i++) {
28
- if (args[i] === "--iters" && args[i + 1]) {
29
- iters = Number(args[i + 1]);
30
- i++;
31
- }
32
- }
33
-
34
- fs.mkdirSync(profileDir, { recursive: true });
35
-
36
- const driverPath = path.join(profileDir, `_driver-${timestamp}.mjs`);
37
- const registerImportSpec = pathToFileURL(path.join(root, "src/extension/register.ts")).href;
38
- const driverSrc = `
39
- import { performance } from "node:perf_hooks";
40
- const start = performance.now();
41
- const { registerPiTeams } = await import(${JSON.stringify(registerImportSpec)});
42
- const importMs = performance.now() - start;
43
-
44
- function createEvents() {
45
- const handlers = new Map();
46
- return {
47
- on(event, handler) {
48
- const set = handlers.get(event) ?? new Set();
49
- set.add(handler);
50
- handlers.set(event, set);
51
- return () => set.delete(handler);
52
- },
53
- emit(event, payload) {
54
- for (const h of handlers.get(event) ?? []) h(payload);
55
- },
56
- };
57
- }
58
- function createPi(events) {
59
- return {
60
- events,
61
- on(_e, _h) {},
62
- registerCommand() {},
63
- registerTool() {},
64
- appendEntry() {},
65
- getSessionName() { return undefined; },
66
- setSessionName() {},
67
- };
68
- }
69
-
70
- const samples = [];
71
- for (let i = 0; i < ${iters}; i++) {
72
- const t0 = performance.now();
73
- const events = createEvents();
74
- const pi = createPi(events);
75
- registerPiTeams(pi);
76
- samples.push(performance.now() - t0);
77
- }
78
- process.stdout.write(JSON.stringify({ importMs, samples }) + "\\n");
79
- `;
80
- fs.writeFileSync(driverPath, driverSrc, "utf-8");
81
-
82
- const cpuProfilePath = path.join(profileDir, `startup-${timestamp}.cpuprofile`);
83
- console.log(`[profile] Running ${iters} iterations with --cpu-prof...`);
84
-
85
- const result = spawnSync(process.execPath, [
86
- "--cpu-prof",
87
- `--cpu-prof-dir=${profileDir}`,
88
- `--cpu-prof-name=startup-${timestamp}.cpuprofile`,
89
- "--experimental-strip-types",
90
- "--no-warnings",
91
- driverPath,
92
- ], { encoding: "utf-8", cwd: root });
93
-
94
- fs.unlinkSync(driverPath);
95
-
96
- if (result.status !== 0) {
97
- console.error("[profile] driver failed:", result.stderr || result.stdout);
98
- process.exit(result.status ?? 1);
99
- }
100
-
101
- let parsed;
102
- try {
103
- parsed = JSON.parse(result.stdout.trim().split("\n").pop());
104
- } catch (error) {
105
- console.error("[profile] could not parse driver output:", result.stdout);
106
- process.exit(2);
107
- }
108
-
109
- const samples = parsed.samples;
110
- samples.sort((a, b) => a - b);
111
- const p = (q) => samples[Math.min(samples.length - 1, Math.floor((samples.length - 1) * q))];
112
- const summary = {
113
- timestamp,
114
- iters,
115
- importMs: round(parsed.importMs),
116
- registerMs: { min: round(samples[0]), p50: round(p(0.5)), p95: round(p(0.95)), p99: round(p(0.99)), max: round(samples[samples.length - 1]) },
117
- cpuProfile: path.relative(root, cpuProfilePath).replace(/\\/g, "/"),
118
- };
119
- fs.writeFileSync(path.join(profileDir, "summary.json"), JSON.stringify(summary, null, 2) + "\n", "utf-8");
120
-
121
- console.log("[profile] Summary:", JSON.stringify(summary, null, 2));
122
- console.log("[profile] CPU profile:", cpuProfilePath);
123
- console.log("[profile] Open in Chrome DevTools → Performance → Load profile.");
124
-
125
- function round(n) { return Math.round(n * 100) / 100; }
@@ -1,74 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Release smoke test — verifies packed tarball loads correctly in a temp project.
4
- * Run: node scripts/release-smoke.mjs
5
- */
6
- import * as fs from "node:fs";
7
- import * as os from "node:os";
8
- import * as path from "node:path";
9
- import { execSync } from "node:child_process";
10
-
11
- const root = path.resolve(import.meta.dirname, "..");
12
-
13
- function log(msg) {
14
- console.log(`[release-smoke] ${msg}`);
15
- }
16
-
17
- function run(cmd, cwd) {
18
- log(` $ ${cmd}`);
19
- execSync(cmd, { cwd, stdio: "pipe", timeout: 60_000 });
20
- }
21
-
22
- try {
23
- // 1. Read version from package.json
24
- const rootPkg = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf-8"));
25
- const version = rootPkg.version;
26
- log(`Package version: ${version}`);
27
-
28
- // 2. Pack tarball
29
- log("Packing tarball...");
30
- execSync("npm pack", { cwd: root, stdio: "pipe", timeout: 60_000 });
31
- const tarballName = `pi-crew-${version}.tgz`;
32
- const tarballPath = path.join(root, tarballName);
33
- if (!fs.existsSync(tarballPath)) throw new Error(`Tarball not found: ${tarballPath}`);
34
- log(` Tarball: ${tarballName}`);
35
-
36
- // 3. Create temp project
37
- const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-crew-smoke-"));
38
- log(`Temp project: ${tmpDir}`);
39
- try {
40
- run("npm init -y", tmpDir);
41
-
42
- // 4. Install packed tarball
43
- run(`npm install ${tarballPath}`, tmpDir);
44
-
45
- // 5. Verify extension loads
46
- const pkgPath = path.join(tmpDir, "node_modules", "pi-crew", "package.json");
47
- if (!fs.existsSync(pkgPath)) throw new Error("pi-crew package not found in node_modules");
48
- const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
49
- log(` Installed version: ${pkg.version}`);
50
-
51
- // 6. Verify key entrypoints exist
52
- const srcRegister = path.join(tmpDir, "node_modules", "pi-crew", "src", "extension", "register.ts");
53
- if (fs.existsSync(srcRegister)) {
54
- log(` Extension register entrypoint found: ${srcRegister}`);
55
- } else {
56
- throw new Error("Could not find extension register entrypoint");
57
- }
58
-
59
- // 7. Verify version consistency
60
- if (pkg.version !== version) {
61
- throw new Error(`Version mismatch: root=${version} installed=${pkg.version}`);
62
- }
63
- log(` Version consistency: OK ${pkg.version}`);
64
-
65
- log("Release smoke test PASSED!");
66
- } finally {
67
- fs.rmSync(tmpDir, { recursive: true, force: true });
68
- // Clean up tarball
69
- try { fs.unlinkSync(tarballPath); } catch {}
70
- }
71
- } catch (error) {
72
- console.error("Release smoke test FAILED:", error instanceof Error ? error.message : String(error));
73
- process.exit(1);
74
- }
@@ -1,47 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Run all benches, collect JSON output, write to test/bench/results.json.
4
- *
5
- * Each bench prints a single JSON line on stdout (NDJSON). Earlier lines may
6
- * be ignored. Failures abort the run.
7
- */
8
- import * as fs from "node:fs";
9
- import * as path from "node:path";
10
- import { spawnSync } from "node:child_process";
11
-
12
- const root = path.resolve(import.meta.dirname, "..");
13
- const benchDir = path.join(root, "test", "bench");
14
- const benches = fs.readdirSync(benchDir).filter((f) => f.endsWith(".bench.ts"));
15
-
16
- const results = {};
17
- for (const bench of benches) {
18
- const benchPath = path.join(benchDir, bench);
19
- console.log(`[bench] running ${bench}...`);
20
- const t0 = Date.now();
21
- const result = spawnSync(process.execPath, [
22
- "--experimental-strip-types",
23
- "--no-warnings",
24
- benchPath,
25
- ], { encoding: "utf-8", cwd: root, timeout: 600_000 });
26
- if (result.status !== 0) {
27
- console.error(result.stderr || result.stdout);
28
- process.exit(result.status ?? 1);
29
- }
30
- const elapsed = ((Date.now() - t0) / 1000).toFixed(1);
31
- const lines = result.stdout.trim().split("\n").filter(Boolean);
32
- let parsed;
33
- for (const line of lines.reverse()) {
34
- try { parsed = JSON.parse(line); break; } catch { /* skip non-JSON */ }
35
- }
36
- if (!parsed?.name) {
37
- console.error(`[bench] could not parse JSON output from ${bench}\n${result.stdout}`);
38
- process.exit(2);
39
- }
40
- results[parsed.name] = parsed;
41
- console.log(`[bench] ${parsed.name} done in ${elapsed}s`);
42
- }
43
-
44
- const outPath = path.join(benchDir, "results.json");
45
- const payload = { capturedAt: new Date().toISOString(), node: process.version, platform: process.platform, results };
46
- fs.writeFileSync(outPath, JSON.stringify(payload, null, 2) + "\n", "utf-8");
47
- console.log(`[bench] wrote ${outPath}`);
@@ -1,41 +0,0 @@
1
- /**
2
- * Real end-to-end chain execution test.
3
- *
4
- * Runs two ACTUAL team runs sequentially via the chain feature, with step 2's
5
- * worker receiving step 1's handoff context (including output text). Prints
6
- * both step runIds for inspection.
7
- *
8
- * Usage: npx tsx scripts/run-real-chain.ts
9
- */
10
-
11
- import type { TeamContext } from "../src/extension/team-tool/context.ts";
12
- import { handleRun } from "../src/extension/team-tool/run.ts";
13
-
14
- const chain = '"Say the numbers 1, 2, 3" -> "What was the last number in the previous step? Add 2 to it."';
15
- const ctx: TeamContext = { cwd: process.cwd() };
16
-
17
- console.log("[run-real-chain] Executing chain:", chain);
18
- console.log("[run-real-chain] Working directory:", process.cwd());
19
- console.log("[run-real-chain] This will spawn REAL team runs. Please wait...\n");
20
-
21
- const result = await handleRun({ action: "run", chain }, ctx);
22
-
23
- console.log("\n=== CHAIN RESULT (details) ===");
24
- console.log(JSON.stringify(result.details, null, 2));
25
-
26
- const text = result.content?.[0];
27
- if (text && "text" in text) {
28
- console.log("\n=== SUMMARY ===");
29
- console.log(text.text);
30
- }
31
-
32
- // Extract runIds for easy inspection.
33
- const runIds = (result.details as { data?: { runIds?: string[] } }).data?.runIds;
34
- if (runIds && runIds.length > 0) {
35
- console.log("\n=== STEP RUN IDS ===");
36
- for (let i = 0; i < runIds.length; i++) {
37
- console.log(`Step ${i + 1}: ${runIds[i]}`);
38
- }
39
- } else {
40
- console.log("\n[run-real-chain] WARNING: no runIds found in result.");
41
- }
@@ -1,43 +0,0 @@
1
- #!/usr/bin/env -S npx tsx
2
- /**
3
- * Tier 7 smoke (real-test-pi-crew): drive a REAL fast-fix team run via
4
- * handleRun() directly — bypasses the `team` tool (which the agent context
5
- * can't emit action='run' for). Exercises the live orchestration path that the
6
- * perf-batch changes touched: team-runner dispatch (Promise.all hooks,
7
- * saveCrewAgentsCoalesced, tasks.find→Map), event-log append (fsync best-effort
8
- * + F3a + rotation counter), crew-agent-records (path memo), child-pi
9
- * (BoundedTail), manifest-cache/state-store (cache-hit + resolveRunStateRoot memo).
10
- *
11
- * Usage:
12
- * npx tsx scripts/smoke-team-perf.ts # real model run
13
- * PI_TEAMS_MOCK_CHILD_PI=adaptive-plan npx tsx scripts/smoke-team-perf.ts # fast/free mock
14
- */
15
- import { handleRun } from "../src/extension/team-tool/run.ts";
16
-
17
- const goal =
18
- "Smoke test: write the text 'pi-crew perf-batch smoke OK' to /tmp/pi-crew-perf-smoke.txt, " +
19
- "confirm the file exists with that exact content, and report the file path. " +
20
- "Keep it under 90 seconds; do NOT run any test or build commands.";
21
-
22
- const ctx = { cwd: process.cwd() };
23
- console.log("[smoke-team-perf] Launching fast-fix team run (real orchestration path)...");
24
- console.log("[smoke-team-perf] cwd:", ctx.cwd);
25
- const t0 = Date.now();
26
- let result;
27
- try {
28
- result = await handleRun({ action: "run", team: "fast-fix", workflow: "fast-fix", goal }, ctx);
29
- } catch (error) {
30
- const ms = Date.now() - t0;
31
- console.error(`[smoke-team-perf] handleRun THREW after ${ms}ms:`, error);
32
- process.exit(1);
33
- }
34
- const ms = Date.now() - t0;
35
- console.log(`\n[smoke-team-perf] Completed in ${(ms / 1000).toFixed(1)}s. isError=${result.isError}`);
36
- console.log("=== RESULT details ===");
37
- console.log(JSON.stringify(result.details, null, 2));
38
- const text = result.content?.[0];
39
- if (text && "text" in text) {
40
- console.log("\n=== SUMMARY ===");
41
- console.log(text.text);
42
- }
43
- process.exit(result.isError ? 1 : 0);