pi-crew 0.9.25 → 0.9.27
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 +87 -0
- package/NOTICE.md +14 -0
- package/assets/crew-vibes.ttf +0 -0
- package/assets/runner-spritesheet.png +0 -0
- package/dist/build-meta.json +255 -40
- package/dist/index.mjs +1564 -241
- package/dist/index.mjs.map +4 -4
- package/docs/perf/optimization-plan-2026-07-verified.md +396 -0
- package/package.json +10 -3
- package/scripts/bench-check.mjs +96 -0
- package/scripts/bench-cold-start.mjs +216 -0
- package/scripts/build-bundle.mjs +84 -0
- package/scripts/build-crew-vibes-font.py +328 -0
- package/scripts/check-all-skills.ts +294 -0
- package/scripts/check-bundle-staleness.mjs +97 -0
- package/scripts/check-conflict-markers.mjs +91 -0
- package/scripts/check-lazy-imports.mjs +28 -0
- package/scripts/install-crew-vibes-font.mjs +91 -0
- package/scripts/postinstall.mjs +47 -0
- package/scripts/profile-startup.mjs +125 -0
- package/scripts/release-smoke.mjs +74 -0
- package/scripts/run-bench.mjs +47 -0
- package/scripts/run-real-chain.ts +41 -0
- package/scripts/test-issue-29-crash.ts +111 -0
- package/scripts/test-issue-29-e2e.ts +183 -0
- package/scripts/test-issue-29-real-runtime.ts +330 -0
- package/scripts/test-issue-29-real-tasks.ts +387 -0
- package/scripts/test-issue-29-team-tool.ts +105 -0
- package/scripts/test-runner.mjs +74 -0
- package/scripts/verify-flicker-fix.ts +109 -0
- package/scripts/verify-skill.ts +550 -0
- package/scripts/watch-bundle.mjs +259 -0
- package/scripts/watchdog-harness.ts +119 -0
- package/src/agents/discover-agents.ts +6 -1
- package/src/config/defaults.ts +6 -0
- package/src/extension/crew-vibes/cat-frames.ts +18 -0
- package/src/extension/crew-vibes/config.ts +195 -0
- package/src/extension/crew-vibes/figures.ts +94 -0
- package/src/extension/crew-vibes/font-detect.ts +58 -0
- package/src/extension/crew-vibes/index.ts +396 -0
- package/src/extension/crew-vibes/provider-usage.ts +330 -0
- package/src/extension/crew-vibes/render.ts +206 -0
- package/src/extension/crew-vibes/speed.ts +286 -0
- package/src/extension/knowledge-injection.ts +12 -3
- package/src/extension/management.ts +23 -3
- package/src/extension/register.ts +7 -0
- package/src/runtime/child-pi.ts +117 -10
- package/src/runtime/crew-agent-records.ts +10 -3
- package/src/runtime/retry-executor.ts +4 -1
- package/src/runtime/task-runner/state-helpers.ts +9 -30
- package/src/runtime/team-runner.ts +5 -3
- package/src/state/atomic-write.ts +153 -49
- package/src/state/event-log.ts +28 -19
- package/src/state/locks.ts +7 -8
- package/src/state/mailbox.ts +15 -4
- package/src/state/state-store.ts +39 -10
- package/src/teams/discover-teams.ts +56 -1
- package/src/utils/safe-paths.ts +2 -1
- package/src/workflows/discover-workflows.ts +72 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,92 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.9.27] — crew-vibes provider usage + animation fixes (2026-07-08)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
- **Provider rate-limit usage display**: fetches Anthropic / z.ai / Copilot quota data and shows progress bars in the status bar (5h window + weekly/monthly window with reset timers)
|
|
7
|
+
- **Space journey capacity labels**: Orbit → Cruise → Warp → Black Hole → Supernova → Big Bang
|
|
8
|
+
- **Auto-detect web terminals** (gotty, wetty) via cgroup walk — falls back to braille spinner automatically
|
|
9
|
+
- **Provider name** shown in usage bar (z.ai / Claude / Copilot)
|
|
10
|
+
- **Reset timer in days** for long windows (>48h → `30d16h`)
|
|
11
|
+
|
|
12
|
+
### Fixes
|
|
13
|
+
- **z.ai epoch ms resetAt**: `nextResetTime` is epoch milliseconds, was stored as-is → wrong timer. Now converted to ISO string.
|
|
14
|
+
- **Separate 5h/weekly reset timers**: each window has its own reset time instead of one shared
|
|
15
|
+
- **pi footer sanitizer**: collapses `/ +/g → " "`, destroying space padding. Fixed with non-breaking space (U+00A0)
|
|
16
|
+
- **postinstall.mjs**: wrap main() in try/catch — postinstall must never fail npm install (SEC-M2)
|
|
17
|
+
- **Capacity timer leak**: stopCapacityTimer() in applyConfig disabled path
|
|
18
|
+
- **Cumulative usage delta**: track `_lastUsageOutput` to avoid inflating token count
|
|
19
|
+
|
|
20
|
+
### Bundle
|
|
21
|
+
- Rebuilt dist/index.mjs with all crew-vibes changes
|
|
22
|
+
|
|
23
|
+
## [perf-plan-2026-07] — verified optimization plan shipped (Phases 0–3) (2026-07-08)
|
|
24
|
+
|
|
25
|
+
Implements `docs/perf/optimization-plan-2026-07-verified.md` end-to-end with bench-first verification on Windows + Node 22. Not a version bump — perf-only change with the existing CLI surface unchanged.
|
|
26
|
+
|
|
27
|
+
### Phase 0 — measurement infrastructure
|
|
28
|
+
- New `test/bench/discover-workflows.bench.ts` (was missing — powerbar hot path).
|
|
29
|
+
- New `test/bench/persist-single-task-update.bench.ts` (covers F2 + F4).
|
|
30
|
+
- New `test/bench/config-load.bench.ts` (regression guard for F16 cache).
|
|
31
|
+
- Extended `test/bench/event-append.bench.ts` with `nonTerminal` vs `terminal` scenarios for F3a tracking.
|
|
32
|
+
- Extended `test/bench/atomic-write.bench.ts` with `bestEffortControl` scenario for F4 control.
|
|
33
|
+
- Baseline artifacts: `test/bench/baseline-v0.9.26-pre-fix.json`, `…-post-phase2.json`, `…-post-phase3.json`.
|
|
34
|
+
|
|
35
|
+
### Phase 1 — high-confidence, low-risk
|
|
36
|
+
- **F17** `discoverWorkflows`: 5 s TTL cache + dirStamp invalidation + `invalidateWorkflowDiscoveryCache()`. Powerbar's 5 Hz scan now does 3 statSync instead of `readdirSync × 6 + N readFileSync + regex-parse`.
|
|
37
|
+
- **F15** `discoverAgents`: TTL 500 ms → 5 000 ms. `discoverTeams`: same TTL+dirStamp pattern + `invalidateTeamDiscoveryCache()`.
|
|
38
|
+
- **F17/F15** `management.ts`: `invalidateResourceCaches()` called on create/update/delete so new resources appear within the same action.
|
|
39
|
+
- **F4** `atomicWriteFile` + `atomicWriteFileAsync` + `atomicWriteJson(+Async)` + `atomicWriteJsonCoalesced` accept `WriteDurability = "full" | "best-effort"`. Skips data `fsync` + parent-dir `fsync` when `"best-effort"`; defaults to `"full"` (back-compat). Applied `best-effort` to: mailbox delivery informational writes (`mailbox.ts:writeDeliveryState`), crew-agent progress writes (`crew-agent-records.ts:saveCrewAgentsCoalesced` / `writeCrewAgentStatusCoalesced`). Terminal writes (manifest, mailbox ack/complete, agent terminal status) keep `"full"`.
|
|
40
|
+
- **F9** `ChildPiLineObserver`: `rawTextEvents` capped at 2 entries (consumer reads only the last); `intermediateFindings` capped at 32 (digest still reads last 20). Memory bound for verbose workers.
|
|
41
|
+
|
|
42
|
+
### Phase 2 — correctness-sensitive wins
|
|
43
|
+
- **F2** `persistSingleTaskUpdate` (in `task-runner/state-helpers.ts`): collapsed 3 redundant `statSync` per CAS attempt into 1. The 2 extra stats were rác (sync code, no I/O between calls). The remaining stat still protects against unlocked best-effort writers (`async-notifier.ts:54`, `crash-recovery.ts:98/416/464`).
|
|
44
|
+
- **F3a** `event-log.ts` sync `appendEvent`: `fsync` skipped for non-terminal events. Terminal events (run/task completed/failed/cancelled/...) still fsync to close the append ↔ persistSequence crash window. Async path's fsync was already removed in v0.9.26 revert (commit `414b973`); F3a's sync-path win is the meaningful delta.
|
|
45
|
+
- **F5** `atomic-write.ts:isSymlinkSafeDirCached`: 30 s TTL LRU keyed by `dirname(filePath)` for the ancestor-chain walk. Target-file lstat still runs every call. `invalidateSymlinkSafeCache(dir)` exported.
|
|
46
|
+
- **F1** `state-store.ts`: generation counter moved from global `number` to `Map<stateRoot, number>`. A write to run A no longer bumps run B's generation → cache hits for sibling runs preserved under multi-run load.
|
|
47
|
+
|
|
48
|
+
### Phase 3 — safety-tier
|
|
49
|
+
- **F12** `child-pi.ts` finalDrain: a parallel 200 ms unref'd polling watcher starts when the drain timer arms (i.e. after `isFinalAssistantEvent`). If stdout goes silent for ≥ `finalDrainQuietMs` (default 800 ms), the watcher fires the same SIGTERM/hardKill path as the 5 s ceiling. Heavy well-behaved workers exit at ~800 ms instead of up to 5 s. New `DEFAULT_CHILD_PI.finalDrainQuietMs` config (set to ≥ `finalDrainMs` to disable). New optional `reason: "stdout-quiet"` field on `ChildPiLifecycleEvent`.
|
|
50
|
+
- **F6** — NOT shipped in this change. Deferred entirely (see Deferred section).
|
|
51
|
+
|
|
52
|
+
### Bench results (Windows, Node v22.14.0, `npm run bench`, ITERS=200)
|
|
53
|
+
|
|
54
|
+
| Bench | Baseline p50 | Post p50 | Δ |
|
|
55
|
+
|---|---|---|---|
|
|
56
|
+
| `discover-workflows.firstCall` | 3.76 ms | 1.20 ms | **-68%** |
|
|
57
|
+
| `discover-workflows.subsequent` | 1.77 ms | 0.78 ms | **-56%** |
|
|
58
|
+
| `event-append.nonTerminal` | 22.6 ms | 13.84 ms | **-39%** |
|
|
59
|
+
| `event-append.serial` | 13.0 ms | 7.78 ms | -40% |
|
|
60
|
+
| `persist-single-task-update.durable` | 4.96 ms | 3.54 ms | **-29%** |
|
|
61
|
+
| `persist-single-task-update.burst10` | 5.20 ms | 5.52 ms | within noise |
|
|
62
|
+
| `atomic-write-json.cold` | 1.71 ms | 4.01 ms | high variance on tmpfs (multi-run 2.4–4.8 ms) |
|
|
63
|
+
|
|
64
|
+
### Verification
|
|
65
|
+
|
|
66
|
+
| Check | Result |
|
|
67
|
+
|---|---|
|
|
68
|
+
| `npm run typecheck` | ✅ pass |
|
|
69
|
+
| `npm run lint` | ✅ after `biome format --write` on touched files |
|
|
70
|
+
| `npm run format:check` | ✅ pass |
|
|
71
|
+
| `npm run check:lazy-imports` | ✅ pass |
|
|
72
|
+
| Targeted unit tests F17+F4+F9 (6 suites) | ✅ 61 pass |
|
|
73
|
+
| Targeted unit tests F2+F3a+F5+F1 (12 suites) | ✅ 68 pass |
|
|
74
|
+
| Targeted unit tests F12 (10 suites) | ✅ 57 pass |
|
|
75
|
+
| `npm run bench` | ✅ results.json reproducible within ±15% batch-to-batch |
|
|
76
|
+
|
|
77
|
+
### Migration / rollback
|
|
78
|
+
|
|
79
|
+
- All atomic-write callers retain `"full"` durability by default. `durability: "best-effort"` was wired only where informational-loss tolerance was verified by existing recovery paths (event-reconstructor + crash-recovery).
|
|
80
|
+
- TTL caches invalidate on real resource create/update/delete via `invalidateResourceCaches()`; engine restart clears the process-local Map.
|
|
81
|
+
- F5 symlink cache: only the *directory* ancestor-chain verdict is cached (30 s TTL); the target-file symlink check (`isTargetNotSymlink`) runs uncached on every call, so a mid-window symlink swap at the target path is still caught. `invalidateSymlinkSafeCache(dir)` exported.
|
|
82
|
+
- F12 quiet-window: behavior change ONLY when a child emits `stopReason=stop` then stops emitting stdout. Set `DEFAULT_CHILD_PI.finalDrainQuietMs >= finalDrainMs` to disable.
|
|
83
|
+
|
|
84
|
+
### Deferred (out of scope)
|
|
85
|
+
|
|
86
|
+
- **F3b** mở rộng buffering qua `appendEventAsync` — vừa revert ở `414b973` (deadlock). Cần RCA.
|
|
87
|
+
- **F6** (toàn bộ) — archive-list cache cho `mailbox.ts:safeReadMailboxFile` VÀ delivery-state append-only JSONL + compaction. Chưa implement dòng nào trong đợt này. Cần format migration + reader compat.
|
|
88
|
+
- **In-memory task state** — cần ADR riêng + cross-process invalidation protocol.
|
|
89
|
+
|
|
3
90
|
## [v0.9.22] — fix: batch buffered event-log flush (25-85x faster) (2026-07-07)
|
|
4
91
|
|
|
5
92
|
P0 follow-up to v0.9.21 event batching. The buffered flush path was calling `appendEventInsideLock` per-event, which triggered an `fsyncSync` per queued event. This defeated the entire point of batching — for 100 buffered events the flush took ~3s on tmpfs instead of the expected ~20ms.
|
package/NOTICE.md
CHANGED
|
@@ -14,3 +14,17 @@
|
|
|
14
14
|
When code is copied or substantially adapted from an MIT source, add the source path and license note here.
|
|
15
15
|
|
|
16
16
|
Current scaffold status: no substantial source files have been copied verbatim; implementation is a fresh scaffold based on documented design lessons.
|
|
17
|
+
|
|
18
|
+
## crew-vibes font assets
|
|
19
|
+
|
|
20
|
+
- `assets/runner-spritesheet.png` and the 16 runner glyphs (U+E700..U+E70F) traced
|
|
21
|
+
from it in `assets/crew-vibes.ttf` are adapted from the RunCat sprite art of
|
|
22
|
+
`pi-speeed` by somus (MIT license, https://github.com/somus/pi-speeed), which
|
|
23
|
+
itself traces inspiration to `pi-runcat` by FredySandoval. The silhouettes are
|
|
24
|
+
re-traced (bitmap -> contour) into a new Private-Use-Area font; no font binary
|
|
25
|
+
was copied verbatim.
|
|
26
|
+
- The token-speed engine in `src/extension/crew-vibes/speed.ts` is adapted from
|
|
27
|
+
`pi-speeed` (MIT license, https://github.com/somus/pi-speeed).
|
|
28
|
+
- The capacity meter concept is adapted from `pi-chonk` by somus (MIT license,
|
|
29
|
+
https://github.com/somus/pi-chonk); the boat+crew figures (U+E710..U+E715) are
|
|
30
|
+
original vector drawings.
|
|
Binary file
|
|
Binary file
|