pi-crew 0.6.1 → 0.6.4
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 +194 -0
- package/README.md +81 -33
- package/docs/issue-29-analysis.md +189 -0
- package/docs/superpowers/plans/2026-06-09-fallow-patterns-adoption.md +1268 -0
- package/docs/ui-optimization-plan.md +447 -0
- package/package.json +2 -2
- package/src/config/config.ts +106 -15
- package/src/errors.ts +107 -0
- package/src/extension/async-notifier.ts +6 -2
- package/src/extension/crew-cleanup.ts +8 -5
- package/src/extension/management.ts +464 -109
- package/src/extension/register.ts +213 -35
- package/src/extension/registration/brief-tool-overrides.ts +400 -0
- package/src/extension/registration/commands.ts +27 -2
- package/src/extension/registration/subagent-helpers.ts +2 -2
- package/src/extension/registration/subagent-tools.ts +9 -4
- package/src/extension/registration/team-tool.ts +17 -10
- package/src/extension/registration/viewers.ts +2 -2
- package/src/extension/team-tool/api.ts +3 -3
- package/src/extension/team-tool/cancel.ts +3 -3
- package/src/extension/team-tool/explain.ts +1 -1
- package/src/extension/team-tool/handle-schedule.ts +40 -0
- package/src/extension/team-tool/inspect.ts +3 -3
- package/src/extension/team-tool/lifecycle-actions.ts +4 -4
- package/src/extension/team-tool/respond.ts +2 -2
- package/src/extension/team-tool/run.ts +64 -14
- package/src/extension/team-tool/status.ts +1 -1
- package/src/extension/team-tool-types.ts +2 -0
- package/src/extension/team-tool.ts +173 -46
- package/src/hooks/registry.ts +77 -13
- package/src/hooks/types.ts +9 -0
- package/src/plugins/plugin-define.ts +6 -0
- package/src/plugins/plugin-registry.ts +32 -0
- package/src/plugins/plugins/index.ts +3 -0
- package/src/plugins/plugins/nextjs.ts +19 -0
- package/src/plugins/plugins/vite.ts +14 -0
- package/src/plugins/plugins/vitest.ts +14 -0
- package/src/runtime/async-runner.ts +35 -7
- package/src/runtime/background-runner.ts +529 -144
- package/src/runtime/chain-parser.ts +5 -1
- package/src/runtime/chain-runner.ts +9 -3
- package/src/runtime/checkpoint.ts +262 -180
- package/src/runtime/child-pi.ts +164 -37
- package/src/runtime/crash-recovery.ts +25 -14
- package/src/runtime/crew-agent-records.ts +2 -0
- package/src/runtime/diagnostic-export.ts +1 -1
- package/src/runtime/dynamic-script-runner.ts +10 -7
- package/src/runtime/foreground-watchdog.ts +1 -1
- package/src/runtime/heartbeat-watcher.ts +19 -2
- package/src/runtime/intercom-bridge.ts +7 -0
- package/src/runtime/iteration-hooks.ts +1 -1
- package/src/runtime/manifest-cache.ts +4 -0
- package/src/runtime/orphan-worker-registry.ts +444 -0
- package/src/runtime/parent-guard.ts +70 -16
- package/src/runtime/pi-args.ts +437 -14
- package/src/runtime/pi-spawn.ts +1 -0
- package/src/runtime/post-checks.ts +1 -1
- package/src/runtime/retry-runner.ts +9 -3
- package/src/runtime/run-tracker.ts +38 -10
- package/src/runtime/sandbox.ts +17 -2
- package/src/runtime/scheduler.ts +25 -2
- package/src/runtime/skill-effectiveness.ts +105 -62
- package/src/runtime/skill-instructions.ts +110 -32
- package/src/runtime/stale-reconciler.ts +310 -69
- package/src/runtime/subagent-manager.ts +251 -57
- package/src/runtime/task-health.ts +76 -0
- package/src/runtime/task-id.ts +20 -0
- package/src/runtime/task-runner/live-executor.ts +1 -1
- package/src/runtime/task-runner/progress.ts +1 -1
- package/src/runtime/task-runner/state-helpers.ts +110 -6
- package/src/runtime/task-runner.ts +92 -70
- package/src/runtime/team-runner.ts +186 -20
- package/src/schema/team-tool-schema.ts +27 -9
- package/src/skills/discover-skills.ts +9 -3
- package/src/state/active-run-registry.ts +170 -38
- package/src/state/artifact-store.ts +25 -13
- package/src/state/atomic-write-v2.ts +86 -0
- package/src/state/atomic-write.ts +346 -55
- package/src/state/blob-store.ts +178 -10
- package/src/state/crew-init.ts +161 -28
- package/src/state/decision-ledger.ts +172 -111
- package/src/state/event-log-rotation.ts +82 -52
- package/src/state/event-log.ts +254 -70
- package/src/state/health-store.ts +71 -0
- package/src/state/locks.ts +102 -20
- package/src/state/mailbox.ts +45 -7
- package/src/state/observation-store.ts +4 -1
- package/src/state/run-graph.ts +141 -130
- package/src/state/run-metrics.ts +24 -8
- package/src/state/session-state-map.ts +51 -0
- package/src/state/state-store.ts +330 -43
- package/src/ui/live-run-sidebar.ts +1 -1
- package/src/ui/loaders.ts +4 -0
- package/src/ui/overlays/agent-picker-overlay.ts +1 -1
- package/src/ui/overlays/mailbox-detail-overlay.ts +1 -1
- package/src/ui/powerbar-publisher.ts +1 -1
- package/src/ui/run-action-dispatcher.ts +2 -2
- package/src/ui/run-snapshot-cache.ts +1 -1
- package/src/ui/status-colors.ts +5 -1
- package/src/ui/theme-adapter.ts +80 -1
- package/src/ui/tool-progress-formatter.ts +9 -5
- package/src/ui/tool-render.ts +4 -0
- package/src/ui/tool-renderers/brief-mode.ts +207 -0
- package/src/ui/tool-renderers/index.ts +627 -0
- package/src/ui/widget/index.ts +224 -0
- package/src/ui/widget/widget-formatters.ts +148 -0
- package/src/ui/widget/widget-model.ts +90 -0
- package/src/ui/widget/widget-renderer.ts +130 -0
- package/src/ui/widget/widget-types.ts +37 -0
- package/src/utils/env-filter.ts +66 -0
- package/src/utils/file-coalescer.ts +9 -1
- package/src/utils/guards.ts +110 -0
- package/src/utils/paths.ts +80 -5
- package/src/utils/redaction.ts +6 -1
- package/src/utils/safe-paths.ts +281 -10
- package/src/worktree/cleanup.ts +112 -24
- package/src/worktree/worktree-manager.ts +128 -15
- package/test-bugs-all.mjs +10 -6
- package/test-integration-check.ts +4 -0
|
@@ -6,6 +6,10 @@ import { fileURLToPath, pathToFileURL } from "node:url";
|
|
|
6
6
|
import { logInternalError } from "../utils/internal-error.ts";
|
|
7
7
|
import { appendEvent } from "../state/event-log.ts";
|
|
8
8
|
import { sanitizeEnvSecrets } from "../utils/env-filter.ts";
|
|
9
|
+
import {
|
|
10
|
+
registerWorker,
|
|
11
|
+
unregisterWorker,
|
|
12
|
+
} from "./orphan-worker-registry.ts";
|
|
9
13
|
import type { TeamRunManifest } from "../state/types.ts";
|
|
10
14
|
|
|
11
15
|
|
|
@@ -179,15 +183,24 @@ export async function spawnBackgroundTeamRun(manifest: TeamRunManifest): Promise
|
|
|
179
183
|
"NPM_CONFIG_REGISTRY",
|
|
180
184
|
"NPM_CONFIG_USERCONFIG",
|
|
181
185
|
"NPM_CONFIG_GLOBALCONFIG",
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
"
|
|
186
|
+
// FIX: explicit list matches child-pi.ts to prevent regression.
|
|
187
|
+
// PI_CREW_PARENT_PID is needed for parent-guard (liveness check).
|
|
188
|
+
"PI_CREW_DEPTH",
|
|
189
|
+
"PI_CREW_MAX_DEPTH",
|
|
190
|
+
"PI_CREW_INHERIT_PROJECT_CONTEXT",
|
|
191
|
+
"PI_CREW_INHERIT_SKILLS",
|
|
192
|
+
"PI_CREW_PARENT_PID",
|
|
193
|
+
"PI_TEAMS_DEPTH",
|
|
194
|
+
"PI_TEAMS_MAX_DEPTH",
|
|
195
|
+
"PI_TEAMS_INHERIT_PROJECT_CONTEXT",
|
|
196
|
+
"PI_TEAMS_INHERIT_SKILLS",
|
|
197
|
+
"PI_TEAMS_PI_BIN",
|
|
198
|
+
"PI_TEAMS_MOCK_CHILD_PI",
|
|
199
|
+
"PI_CREW_ALLOW_MOCK",
|
|
185
200
|
],
|
|
186
201
|
});
|
|
187
|
-
//
|
|
188
|
-
|
|
189
|
-
delete filteredEnv.PI_CREW_EXECUTE_WORKERS;
|
|
190
|
-
delete filteredEnv.PI_TEAMS_EXECUTE_WORKERS;
|
|
202
|
+
// FIX: removed delete workarounds — with explicit allowlist, these vars
|
|
203
|
+
// are no longer auto-leaked. Matches child-pi.ts.
|
|
191
204
|
|
|
192
205
|
const loader = resolveTypeScriptLoader();
|
|
193
206
|
if (!loader) {
|
|
@@ -223,6 +236,21 @@ export async function spawnBackgroundTeamRun(manifest: TeamRunManifest): Promise
|
|
|
223
236
|
});
|
|
224
237
|
child.unref();
|
|
225
238
|
|
|
239
|
+
// Track this worker in the orphan registry so it can be killed on
|
|
240
|
+
// session_start of a future session if the parent pi process is killed.
|
|
241
|
+
if (child.pid) {
|
|
242
|
+
registerWorker(
|
|
243
|
+
child.pid,
|
|
244
|
+
manifest.ownerSessionId ?? "unknown",
|
|
245
|
+
manifest.runId,
|
|
246
|
+
process.pid, // parentPid — used by cleanup to verify session is dead
|
|
247
|
+
);
|
|
248
|
+
// Best-effort: unregister when child exits. Background-runner writes
|
|
249
|
+
// the marker file before it dies, so we unregister on the next
|
|
250
|
+
// cleanup tick. But the child "exit" event won't fire because we
|
|
251
|
+
// unref'd and the stdio is piped + ignored.
|
|
252
|
+
}
|
|
253
|
+
|
|
226
254
|
return { pid: child.pid, logPath };
|
|
227
255
|
}
|
|
228
256
|
|