pi-crew 0.5.21 → 0.5.23
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 -0
- package/README.md +9 -5
- package/docs/TEST_MATRIX.md +1 -1
- package/docs/architecture.md +1 -1
- package/docs/deep-review-report.md +1 -1
- package/docs/migration-v0.4-v0.5.md +1 -1
- package/docs/pi-crew-bugs.md +2 -1
- package/package.json +1 -1
- package/src/config/config.ts +7 -1
- package/src/config/defaults.ts +11 -1
- package/src/extension/register.ts +2 -0
- package/src/extension/team-tool.ts +5 -0
- package/src/hooks/registry.ts +3 -0
- package/src/state/mailbox.ts +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.5.22] — Remaining Issues from Ultimate Sweep (2026-06-03)
|
|
4
|
+
|
|
5
|
+
### Highlights
|
|
6
|
+
- `DEFAULT_CHILD_PI` frozen with `Readonly<>` type (prevents mutation)
|
|
7
|
+
- `parseWithSchema` logs validation failures with context
|
|
8
|
+
- Global registry cleanup (`uninstallCrewGlobalRegistry`)
|
|
9
|
+
- Mailbox sender auth and cross-workspace hooks documented
|
|
10
|
+
|
|
11
|
+
### Fixes
|
|
12
|
+
- `defaults.ts`: `DEFAULT_CHILD_PI` wrapped in `Readonly<{...}>` to prevent mutation via module injection
|
|
13
|
+
- `config.ts`: `parseWithSchema` logs validation failures when context provided
|
|
14
|
+
- `team-tool.ts`: Added `uninstallCrewGlobalRegistry()` paired with install
|
|
15
|
+
- `register.ts`: Calls `uninstallCrewGlobalRegistry()` in `cleanupRuntime()`
|
|
16
|
+
- `mailbox.ts`: Security documentation for sender authentication
|
|
17
|
+
- `hooks/registry.ts`: Security documentation for cross-workspace hook behavior
|
|
18
|
+
|
|
19
|
+
### Stats
|
|
20
|
+
- Test suite: 2703 pass + 1 skip, 0 fail
|
|
21
|
+
- TypeScript: 0 errors
|
|
22
|
+
|
|
3
23
|
## [0.5.21] — Ultimate Final Sweep: HIGH Security + Correctness Fixes (2026-06-03)
|
|
4
24
|
|
|
5
25
|
### Highlights
|
|
@@ -1362,3 +1382,22 @@ correctness+error-handling, and performance+architecture audits across 77 source
|
|
|
1362
1382
|
|
|
1363
1383
|
- Initial scaffold for `pi-crew`.
|
|
1364
1384
|
- Added Pi package manifest, extension entry, minimal team tool, slash commands, builtin resources, and documentation placeholders.
|
|
1385
|
+
|
|
1386
|
+
## [0.5.23] — Documentation & CI Update (2026-06-03)
|
|
1387
|
+
|
|
1388
|
+
### Highlights
|
|
1389
|
+
- **CI typecheck re-enabled** — was disabled with stale comment about tsconfig errors
|
|
1390
|
+
- All docs updated to v0.5.22 references
|
|
1391
|
+
|
|
1392
|
+
### Documentation
|
|
1393
|
+
- README.md: version stamp v0.5.22, updated security highlights (12 items)
|
|
1394
|
+
- SECURITY-ISSUES.md: added v0.5.17–v0.5.22 security fix summary
|
|
1395
|
+
- SECURITY-AUDIT.md: scope updated to v0.5.22
|
|
1396
|
+
- docs/architecture.md: v0.5.22, 38 rounds of review
|
|
1397
|
+
- docs/pi-crew-bugs.md: v0.5.22 + historical note
|
|
1398
|
+
- docs/TEST_MATRIX.md: test count updated to 2703
|
|
1399
|
+
- docs/deep-review-report.md: marked historical
|
|
1400
|
+
- docs/migration-v0.4-v0.5.md: drop-in replacement note
|
|
1401
|
+
|
|
1402
|
+
### CI
|
|
1403
|
+
- `.github/workflows/ci.yml`: typecheck step re-enabled (was disabled since v0.3.x)
|
package/README.md
CHANGED
|
@@ -9,18 +9,22 @@ npm: pi-crew
|
|
|
9
9
|
repo: https://github.com/baphuongna/pi-crew
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
**v0.5.
|
|
12
|
+
**v0.5.22**: See [CHANGELOG.md](CHANGELOG.md).
|
|
13
13
|
|
|
14
|
-
### Security highlights (v0.5.
|
|
14
|
+
### Security highlights (v0.5.22)
|
|
15
15
|
|
|
16
16
|
- **ReDoS-free secret redaction** — linear-time scanning in `redaction.ts`; no catastrophic backtracking
|
|
17
17
|
- **v8.deserialize hardened** — `BINARY_MAGIC` header guards on registry binaries prevent untrusted-file RCE
|
|
18
18
|
- **Cache lock protection** — `withFileLockSync` and atomic writes across `run-cache.ts` and `state-store.ts`
|
|
19
|
-
- **Shell injection prevented** —
|
|
19
|
+
- **Shell injection prevented** — `execFileSync` with array args everywhere (no shell-interpreted strings)
|
|
20
|
+
- **Safe-bash line-continuation hardening** — `$\n(evil)` command substitution bypass blocked
|
|
21
|
+
- **Sandbox prototype isolation** — `Object.freeze` scoped to VM context (not host process)
|
|
22
|
+
- **Path traversal mitigated** — `resolveContainedPath`/`resolveRealContainedPath` across all file ops
|
|
20
23
|
- **TOCTOU-free file ops** — atomic `mkdirSync` in `crew-init.ts`; `realpath`-based path validation
|
|
21
|
-
- **Memory leaks capped** —
|
|
24
|
+
- **Memory leaks capped** — Maps, Sets, arrays bounded with eviction across all modules
|
|
22
25
|
- **Inline secret detection** — `token=`, `api_key=`, `password=` patterns redacted at event/mailbox boundaries
|
|
23
|
-
- **
|
|
26
|
+
- **CI exit code enforced** — `test-runner.mjs` wrapper ensures non-zero exit on failures
|
|
27
|
+
- **38 audit rounds, 160+ issues fixed** — 3 CRITICAL + 6 HIGH + 3 MEDIUM security issues resolved
|
|
24
28
|
|
|
25
29
|
See [SECURITY-ISSUES.md](SECURITY-ISSUES.md) for the full list (SEC-001 – SEC-007 all marked fixed).
|
|
26
30
|
|
package/docs/TEST_MATRIX.md
CHANGED
|
@@ -16,7 +16,7 @@ Maps pi-crew behavior to proof. Every row must have real validation evidence.
|
|
|
16
16
|
|
|
17
17
|
| Story | Contract | Unit | Integration | CI | Status | Evidence |
|
|
18
18
|
|-------|----------|------|-------------|-----|--------|----------|
|
|
19
|
-
| Core team run | `docs/product/team-run.md` | yes | yes | yes 3/3 | implemented |
|
|
19
|
+
| Core team run | `docs/product/team-run.md` | yes | yes | yes 3/3 | implemented | 2703 tests pass (133 suites) |
|
|
20
20
|
| Child process runner | `docs/product/child-process.md` | yes | yes | yes 3/3 | implemented | child-pi-pool.test.ts, child-pi-timeout.test.ts, mock-child-run.test.ts |
|
|
21
21
|
| Async runner | `docs/product/async-runner.md` | yes | yes | yes 3/3 | implemented | async-runner.test.ts, async-restart-recovery.test.ts |
|
|
22
22
|
| Live session | `docs/product/live-session.md` | yes | no | yes 3/3 | implemented | live-session-context.test.ts, live-session-runtime.test.ts |
|
package/docs/architecture.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
`pi-crew` is a Pi package for coordinated multi-agent work. It is intentionally durable-first: every run is represented on disk, every task has a state record, and child workers stream progress into JSONL/status files so foreground sessions, background jobs, dashboards, and later restarts all read the same source of truth.
|
|
4
4
|
|
|
5
|
-
**Current version:** v0.5.
|
|
5
|
+
**Current version:** v0.5.22 — 38 rounds of code review hardening (see [CHANGELOG.md](../CHANGELOG.md)).
|
|
6
6
|
|
|
7
7
|
## Layers
|
|
8
8
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# pi-crew Deep Review Report
|
|
2
2
|
|
|
3
3
|
**Project:** pi-crew
|
|
4
|
-
**Version:** v0.5.2
|
|
4
|
+
**Version:** v0.5.2 *(historical — current version is v0.5.22)*
|
|
5
5
|
**Review Date:** 2026-05-28
|
|
6
6
|
**Updated:** 2026-05-29
|
|
7
7
|
**Reviewers:** Security Reviewer, Code Reviewer, Documentation Reviewer
|
package/docs/pi-crew-bugs.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Historical Bug Reports (v0.2.x)
|
|
2
2
|
|
|
3
|
-
> **Current version: v0.5.
|
|
3
|
+
> **Current version: v0.5.22** — See [CHANGELOG.md](../CHANGELOG.md) for all bug fixes.
|
|
4
|
+
> This page tracks historical bugs from v0.2.x. All listed bugs are fixed.
|
|
4
5
|
|
|
5
6
|
---
|
|
6
7
|
|
package/package.json
CHANGED
package/src/config/config.ts
CHANGED
|
@@ -520,8 +520,14 @@ function asRecord(value: unknown): Record<string, unknown> | undefined {
|
|
|
520
520
|
function parseWithSchema<T extends TSchema>(
|
|
521
521
|
schema: T,
|
|
522
522
|
value: unknown,
|
|
523
|
+
context?: string,
|
|
523
524
|
): Static<T> | undefined {
|
|
524
|
-
if (!Value.Check(schema, value))
|
|
525
|
+
if (!Value.Check(schema, value)) {
|
|
526
|
+
if (context) {
|
|
527
|
+
logInternalError("config.parseWithSchema", undefined, `${context}: schema validation failed`);
|
|
528
|
+
}
|
|
529
|
+
return undefined;
|
|
530
|
+
}
|
|
525
531
|
return Value.Decode(schema, value);
|
|
526
532
|
}
|
|
527
533
|
|
package/src/config/defaults.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
export const DEFAULT_CHILD_PI
|
|
1
|
+
export const DEFAULT_CHILD_PI: Readonly<{
|
|
2
|
+
postExitStdioGuardMs: number;
|
|
3
|
+
finalDrainMs: number;
|
|
4
|
+
hardKillMs: number;
|
|
5
|
+
responseTimeoutMs: number;
|
|
6
|
+
maxCaptureBytes: number;
|
|
7
|
+
maxAssistantTextChars: number;
|
|
8
|
+
maxToolResultChars: number;
|
|
9
|
+
maxToolInputChars: number;
|
|
10
|
+
maxCompactContentChars: number;
|
|
11
|
+
}> = {
|
|
2
12
|
postExitStdioGuardMs: 3000,
|
|
3
13
|
finalDrainMs: 5000,
|
|
4
14
|
hardKillMs: 3000,
|
|
@@ -20,6 +20,7 @@ import { registerAutonomousPolicy } from "./autonomous-policy.ts";
|
|
|
20
20
|
import { registerCleanupHandler } from "./crew-cleanup.ts";
|
|
21
21
|
import type { ScheduledJob } from "../runtime/scheduler.ts";
|
|
22
22
|
import { clearHooks } from "../hooks/registry.ts";
|
|
23
|
+
import { uninstallCrewGlobalRegistry } from "./team-tool.ts";
|
|
23
24
|
import { notifyActiveRuns } from "./session-summary.ts";
|
|
24
25
|
|
|
25
26
|
let _cachedLiveRunSidebar: typeof LiveRunSidebarType | undefined;
|
|
@@ -1112,6 +1113,7 @@ export function registerPiTeams(pi: ExtensionAPI): void {
|
|
|
1112
1113
|
metricRegistry = undefined;
|
|
1113
1114
|
deliveryCoordinator?.dispose();
|
|
1114
1115
|
clearHooks();
|
|
1116
|
+
uninstallCrewGlobalRegistry();
|
|
1115
1117
|
overflowTracker?.dispose();
|
|
1116
1118
|
deliveryCoordinator = undefined;
|
|
1117
1119
|
overflowTracker = undefined;
|
|
@@ -1278,3 +1278,8 @@ export function installCrewGlobalRegistry(): void {
|
|
|
1278
1278
|
listDynamicAgents,
|
|
1279
1279
|
});
|
|
1280
1280
|
}
|
|
1281
|
+
|
|
1282
|
+
/** Remove the global CrewRegistry singleton. Call during session cleanup. */
|
|
1283
|
+
export function uninstallCrewGlobalRegistry(): void {
|
|
1284
|
+
delete (globalThis as Record<symbol | string, unknown>)[CREW_REGISTRY_KEY];
|
|
1285
|
+
}
|
package/src/hooks/registry.ts
CHANGED
|
@@ -30,6 +30,9 @@ export async function executeHook(name: HookName, ctx: HookContext): Promise<Hoo
|
|
|
30
30
|
// SECURITY: If ctx contains a workspaceId, filter hooks to only those scoped to
|
|
31
31
|
// this workspace. This prevents globally-registered hooks from operating on runs
|
|
32
32
|
// they weren't designed for.
|
|
33
|
+
// SECURITY: Hooks without workspaceId match ALL workspaces. This is intentional
|
|
34
|
+
// for globally-applicable hooks (e.g., logging, metrics). For multi-tenant
|
|
35
|
+
// environments, all hooks should set workspaceId to prevent cross-workspace access.
|
|
33
36
|
const scopedHooks = hooks.filter((h) => !h.workspaceId || h.workspaceId === ctx.workspaceId);
|
|
34
37
|
if (scopedHooks.length === 0) return { hookName: name, outcome: "allow", durationMs: 0 };
|
|
35
38
|
const start = Date.now();
|
package/src/state/mailbox.ts
CHANGED
|
@@ -327,6 +327,18 @@ function writeDeliveryState(manifest: TeamRunManifest, state: MailboxDeliverySta
|
|
|
327
327
|
atomicWriteFile(deliveryFile(manifest, true), `${JSON.stringify(redactSecrets(state), null, 2)}\n`);
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
+
/**
|
|
331
|
+
* Append a message to a run's or task's mailbox.
|
|
332
|
+
*
|
|
333
|
+
* SECURITY NOTE: The `from` field is caller-declared — there is no cryptographic
|
|
334
|
+
* sender authentication. This is acceptable because `appendMailboxMessage` is an
|
|
335
|
+
* internal API only callable from within the pi-crew process (no external input).
|
|
336
|
+
* All callers (handleSteer, handleRespond, handleFollowUp) derive `from` from
|
|
337
|
+
* authenticated context (session role, task assignment).
|
|
338
|
+
*
|
|
339
|
+
* If pi-crew ever exposes mailbox writes to external/untrusted input, sender
|
|
340
|
+
* authentication (HMAC or session key) must be added.
|
|
341
|
+
*/
|
|
330
342
|
export function appendMailboxMessage(manifest: TeamRunManifest, message: Omit<MailboxMessage, "id" | "runId" | "createdAt" | "status"> & { id?: string; status?: MailboxMessageStatus }): MailboxMessage {
|
|
331
343
|
if (message.taskId) ensureTaskMailbox(manifest, message.taskId);
|
|
332
344
|
else ensureRunMailbox(manifest);
|