pi-crew 0.9.41 → 0.9.44
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 +253 -0
- package/README.md +14 -0
- package/dist/build-meta.json +6450 -12419
- package/dist/index.mjs +57998 -68417
- package/dist/index.mjs.map +4 -4
- package/docs/migration/atomic-write-v2-migration.md +2 -0
- package/docs/superpowers/plans/2026-06-09-fallow-patterns-adoption.md +2 -0
- package/package.json +4 -2
- package/scripts/README.md +6 -0
- package/scripts/build-bundle.mjs +2 -1
- package/scripts/check-all-skills.ts +3 -3
- package/scripts/dev-runner.mjs +106 -0
- package/scripts/postinstall.mjs +6 -2
- package/scripts/verify-skill.ts +2 -2
- package/src/agents/agent-config.ts +1 -1
- package/src/config/config.ts +20 -1
- package/src/config/drift-detector.ts +97 -15
- package/src/config/resilient-parser.ts +4 -4
- package/src/config/types.ts +0 -2
- package/src/extension/crew-cleanup.ts +17 -3
- package/src/extension/crew-vibes/config.ts +1 -1
- package/src/extension/crew-vibes/font-detect.ts +16 -3
- package/src/extension/crew-vibes/index.ts +1 -1
- package/src/extension/cross-extension-rpc.ts +26 -9
- package/src/extension/management.ts +6 -5
- package/src/extension/register.ts +58 -1573
- package/src/extension/registration/command-registration.ts +57 -0
- package/src/extension/registration/commands.ts +7 -2
- package/src/extension/registration/context-builder.ts +131 -0
- package/src/extension/registration/crash-recovery-cache.ts +54 -0
- package/src/extension/registration/foreground-run-controller.ts +238 -0
- package/src/extension/registration/hook-registration.ts +119 -0
- package/src/extension/registration/lazy-configurers.ts +124 -0
- package/src/extension/registration/lifecycle-handlers.ts +731 -0
- package/src/extension/registration/observability.ts +33 -4
- package/src/extension/registration/registration-types.ts +149 -0
- package/src/extension/registration/runtime-cleanup.ts +230 -0
- package/src/extension/registration/subagent-manager-setup.ts +211 -0
- package/src/extension/registration/tool-registration.ts +50 -0
- package/src/extension/registration/wire-cross-extension.ts +37 -0
- package/src/extension/rpc-hmac.ts +21 -1
- package/src/extension/run-import.ts +3 -3
- package/src/extension/team-tool/auto-summarize.ts +4 -4
- package/src/extension/team-tool/cancel.ts +5 -5
- package/src/extension/team-tool/chain-executor.ts +5 -4
- package/src/extension/team-tool/context.ts +11 -1
- package/src/extension/team-tool/doctor.ts +2 -1
- package/src/extension/team-tool/goal-wrap.ts +2 -2
- package/src/extension/team-tool/goal.ts +1 -1
- package/src/extension/team-tool/handle-schedule.ts +25 -36
- package/src/extension/team-tool/orchestrate.ts +0 -1
- package/src/extension/team-tool/parallel-dispatch.ts +5 -0
- package/src/extension/team-tool/run.ts +220 -214
- package/src/extension/team-tool/workflow-manage.ts +1 -1
- package/src/extension/team-tool.ts +69 -16
- package/src/hooks/registry.ts +7 -2
- package/src/observability/correlation.ts +4 -3
- package/src/observability/event-bus.ts +10 -1
- package/src/observability/event-to-metric.ts +8 -7
- package/src/observability/exporters/adapter.ts +6 -9
- package/src/observability/exporters/otlp-exporter.ts +81 -0
- package/src/observability/metric-retention.ts +4 -0
- package/src/observability/metric-sink.ts +14 -4
- package/src/prompt/prompt-runtime.ts +15 -0
- package/src/runtime/adaptive-plan.ts +1 -1
- package/src/runtime/async-runner.ts +13 -4
- package/src/runtime/background-runner.ts +32 -23
- package/src/runtime/capability-inventory.ts +1 -1
- package/src/runtime/chain-runner.ts +5 -5
- package/src/runtime/checkpoint.ts +6 -16
- package/src/runtime/child-pi-constants.ts +42 -0
- package/src/runtime/child-pi-kill.ts +180 -0
- package/src/runtime/child-pi-spawn.ts +234 -0
- package/src/runtime/child-pi-steering.ts +128 -0
- package/src/runtime/child-pi-streams.ts +296 -0
- package/src/runtime/child-pi-transcript.ts +169 -0
- package/src/runtime/child-pi.ts +80 -822
- package/src/runtime/coalesce-tasks.ts +1 -1
- package/src/runtime/compact-stages/tail-capture-stage.ts +1 -1
- package/src/runtime/crash-recovery.ts +63 -47
- package/src/runtime/delivery-coordinator.ts +1 -1
- package/src/runtime/deterministic-ast.ts +2 -2
- package/src/runtime/diagnostic-export.ts +2 -1
- package/src/runtime/dwf-state-store.ts +5 -0
- package/src/runtime/dynamic-workflow-context.ts +78 -18
- package/src/runtime/dynamic-workflow-runner.ts +18 -2
- package/src/runtime/foreground-control.ts +3 -2
- package/src/runtime/goal-evaluator.ts +59 -27
- package/src/runtime/goal-loop-runner.ts +46 -13
- package/src/runtime/goal-state-store.ts +1 -1
- package/src/runtime/handoff-manager.ts +0 -2
- package/src/runtime/intercom-bridge.ts +0 -2
- package/src/runtime/live-agent-manager.ts +30 -5
- package/src/runtime/live-extension-bridge.ts +0 -2
- package/src/runtime/live-session-runtime.ts +65 -57
- package/src/runtime/manifest-cache.ts +59 -0
- package/src/runtime/mcp-proxy.ts +1 -1
- package/src/runtime/orphan-worker-registry.ts +3 -3
- package/src/runtime/output-validator.ts +1 -1
- package/src/runtime/path-overlap.ts +1 -1
- package/src/runtime/pi-args.ts +3 -3
- package/src/runtime/pi-json-output.ts +4 -3
- package/src/runtime/pi-spawn.ts +7 -1
- package/src/runtime/pipeline-runner.ts +1 -4
- package/src/runtime/post-checks.ts +0 -1
- package/src/runtime/retry-runner.ts +1 -1
- package/src/runtime/run-coalesced-task-group.ts +18 -23
- package/src/runtime/scheduler.ts +2 -0
- package/src/runtime/session-resources.ts +1 -1
- package/src/runtime/settings-store.ts +31 -1
- package/src/runtime/skill-effectiveness.ts +2 -2
- package/src/runtime/stale-reconciler.ts +23 -53
- package/src/runtime/subagent-manager.ts +19 -3
- package/src/runtime/task-output-context.ts +2 -1
- package/src/runtime/task-runner/prompt-builder.ts +3 -3
- package/src/runtime/task-runner/run-projection.ts +3 -1
- package/src/runtime/task-runner/state-helpers.ts +13 -1
- package/src/runtime/task-runner.ts +31 -6
- package/src/runtime/team-runner.ts +8 -2
- package/src/runtime/verification-gates.ts +54 -5
- package/src/schema/config-schema.ts +19 -1
- package/src/schema/team-tool-schema.ts +2 -0
- package/src/skills/discover-skills.ts +25 -15
- package/src/state/active-run-registry.ts +0 -1
- package/src/state/atomic-write.ts +37 -11
- package/src/state/blob-store.ts +3 -9
- package/src/state/contracts.ts +5 -1
- package/src/state/crew-init.ts +3 -2
- package/src/state/decision-ledger.ts +2 -2
- package/src/state/event-log-rotation.ts +1 -1
- package/src/state/event-log.ts +4 -3
- package/src/state/gitignore-manager.ts +2 -1
- package/src/state/health-store.ts +5 -2
- package/src/state/instinct-store.ts +11 -2
- package/src/state/locks.ts +132 -49
- package/src/state/mailbox.ts +3 -4
- package/src/state/observation-store.ts +1 -13
- package/src/state/run-cache.ts +12 -12
- package/src/state/run-graph.ts +2 -1
- package/src/state/run-metrics.ts +1 -1
- package/src/state/schedule.ts +7 -1
- package/src/state/state-store.ts +9 -3
- package/src/state/tiered-eval.ts +1 -1
- package/src/state/worker-atomic-writer.ts +1 -0
- package/src/ui/dynamic-border.ts +13 -3
- package/src/ui/live-conversation-overlay.ts +7 -27
- package/src/ui/live-duration.ts +2 -2
- package/src/ui/live-run-sidebar.ts +56 -32
- package/src/ui/mascot.ts +19 -13
- package/src/ui/powerbar-publisher.ts +244 -178
- package/src/ui/render-coalescer.ts +44 -3
- package/src/ui/render-diff.ts +2 -2
- package/src/ui/run-dashboard.ts +122 -21
- package/src/ui/run-event-bus.ts +66 -0
- package/src/ui/run-snapshot-cache.ts +84 -81
- package/src/ui/settings-overlay.ts +3 -3
- package/src/ui/status-colors.ts +24 -0
- package/src/ui/tool-progress-formatter.ts +1 -1
- package/src/ui/tool-render.ts +3 -3
- package/src/ui/transcript-cache.ts +5 -10
- package/src/ui/transcript-entries.ts +68 -72
- package/src/ui/transcript-viewer.ts +54 -14
- package/src/ui/widget/index.ts +26 -15
- package/src/ui/widget/widget-model.ts +18 -9
- package/src/ui/widget/widget-renderer.ts +2 -5
- package/src/utils/fingerprint.ts +1 -1
- package/src/utils/paths.ts +1 -1
- package/src/utils/project-detector.ts +1 -1
- package/src/worktree/worktree-manager.ts +47 -19
- package/src/state/atomic-write-v2.ts +0 -108
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lazy lifecycle/observability configurers for pi-crew.
|
|
3
|
+
*
|
|
4
|
+
* These three small functions wire up the heavy runtime subsystems on
|
|
5
|
+
* the first session_start. They are kept as LAZY dynamic imports because:
|
|
6
|
+
* • `./registration/lifecycle.ts` pulls in notification-router + sink
|
|
7
|
+
* (~10 KB + heavy deps),
|
|
8
|
+
* • `./registration/observability.ts` pulls in HeartbeatWatcher +
|
|
9
|
+
* metric stack (~12 KB + heavy deps).
|
|
10
|
+
*
|
|
11
|
+
* Pre-loading them at register-time would force every cold start of
|
|
12
|
+
* pi-crew to pay the cost even if the user never opens a session.
|
|
13
|
+
*
|
|
14
|
+
* The orchestrator (`register.ts`) installs these via
|
|
15
|
+
* `installLazyConfigurers`, which binds them as `ctx.configureNotifications`,
|
|
16
|
+
* `ctx.configureObservability`, `ctx.configureDeliveryCoordinator`. The
|
|
17
|
+
* session_start handler invokes them via the context — see
|
|
18
|
+
* `lifecycle-handlers.ts`.
|
|
19
|
+
*/
|
|
20
|
+
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
21
|
+
import { reconcileAllStaleRuns } from "../../runtime/crash-recovery.ts";
|
|
22
|
+
import { appendDeadletter } from "../../runtime/deadletter.ts";
|
|
23
|
+
import { cleanupLegacyOrphanTempDirs, cleanupOrphanTempDirs } from "../../runtime/pi-args.ts";
|
|
24
|
+
import { reconcileOrphanedTempWorkspaces } from "../../runtime/stale-reconciler.ts";
|
|
25
|
+
import { requestPowerbarUpdate } from "../../ui/powerbar-publisher.ts";
|
|
26
|
+
import { logInternalError } from "../../utils/internal-error.ts";
|
|
27
|
+
import type { RegistrationContext } from "./registration-types.ts";
|
|
28
|
+
import { sendAgentWakeUp, sendFollowUp } from "./subagent-helpers.ts";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Bind the three lazy configurers onto the registration context. After
|
|
32
|
+
* this call:
|
|
33
|
+
* • `ctx.configureNotifications(ctx)` fires the registration/lifecycle
|
|
34
|
+
* install with the bound deps bag.
|
|
35
|
+
* • `ctx.configureObservability(ctx)` fires the registration/observability
|
|
36
|
+
* install (metric registry, OTLP exporter, heartbeat watcher).
|
|
37
|
+
* • `ctx.configureDeliveryCoordinator()` wires the delivery coordinator
|
|
38
|
+
* + overflow tracker (no dynamic import — already loaded by the
|
|
39
|
+
* registration/lifecycle module).
|
|
40
|
+
*/
|
|
41
|
+
export function installLazyConfigurers(pi: ExtensionAPI, ctx: RegistrationContext): void {
|
|
42
|
+
ctx.configureNotifications = (extCtx: ExtensionContext): void => {
|
|
43
|
+
void configureNotificationsImpl(pi, ctx, extCtx);
|
|
44
|
+
};
|
|
45
|
+
ctx.configureObservability = (extCtx: ExtensionContext): void => {
|
|
46
|
+
void configureObservabilityImpl(pi, ctx, extCtx);
|
|
47
|
+
};
|
|
48
|
+
ctx.configureDeliveryCoordinator = (): void => {
|
|
49
|
+
void configureDeliveryCoordinatorImpl(pi, ctx);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Lazy-load registration/lifecycle.ts and wire its notifications system.
|
|
55
|
+
*
|
|
56
|
+
* The deps bag is built once-per-call (cheap — just object literals) so
|
|
57
|
+
* every session_start cycle gets a fresh closure that reads the latest
|
|
58
|
+
* `ctx.currentCtx` and caches.
|
|
59
|
+
*/
|
|
60
|
+
async function configureNotificationsImpl(pi: ExtensionAPI, ctx: RegistrationContext, extCtx: ExtensionContext): Promise<void> {
|
|
61
|
+
try {
|
|
62
|
+
// LAZY: registration/lifecycle is heavy (notification-router + sink)
|
|
63
|
+
const lifecycleModule = await import("./lifecycle.ts");
|
|
64
|
+
await lifecycleModule.configureNotifications(extCtx, ctx.lifecycleState, {
|
|
65
|
+
pi,
|
|
66
|
+
widgetState: ctx.widgetState,
|
|
67
|
+
getCurrentCtx: () => ctx.currentCtx,
|
|
68
|
+
getManifestCache: ctx.getManifestCache,
|
|
69
|
+
getRunSnapshotCache: ctx.getRunSnapshotCache,
|
|
70
|
+
requestPowerbarUpdate,
|
|
71
|
+
});
|
|
72
|
+
} catch (error) {
|
|
73
|
+
logInternalError("register.configureNotifications", error);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Lazy-load registration/observability.ts and wire its metric stack.
|
|
79
|
+
*
|
|
80
|
+
* In addition to the metric registry / OTLP exporter, this is where the
|
|
81
|
+
* stale-reconcile and orphan-temp-dir timers are installed — see
|
|
82
|
+
* registration/observability.ts for details.
|
|
83
|
+
*/
|
|
84
|
+
async function configureObservabilityImpl(pi: ExtensionAPI, ctx: RegistrationContext, extCtx: ExtensionContext): Promise<void> {
|
|
85
|
+
try {
|
|
86
|
+
// LAZY: registration/observability is heavy (HeartbeatWatcher + metric stack)
|
|
87
|
+
const observabilityModule = await import("./observability.ts");
|
|
88
|
+
await observabilityModule.configureObservability(extCtx, ctx.observabilityState, {
|
|
89
|
+
pi,
|
|
90
|
+
getManifestCache: ctx.getManifestCache,
|
|
91
|
+
notifyOperator: ctx.notifyOperator,
|
|
92
|
+
isCleanedUp: () => ctx.cleanedUp,
|
|
93
|
+
reconcileStaleRuns: (cwd, cache) => reconcileAllStaleRuns(cwd, cache),
|
|
94
|
+
reconcileOrphanedTempWorkspaces: (now, opts) => reconcileOrphanedTempWorkspaces(now, opts),
|
|
95
|
+
cleanupOrphanTempDirs,
|
|
96
|
+
cleanupLegacyOrphanTempDirs,
|
|
97
|
+
appendDeadletter: (manifest, entry) => appendDeadletter(manifest, entry as Parameters<typeof appendDeadletter>[1]),
|
|
98
|
+
importCrashRecovery: ctx.importCrashRecovery,
|
|
99
|
+
});
|
|
100
|
+
} catch (error) {
|
|
101
|
+
logInternalError("register.configureObservability", error);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Wire delivery coordinator + overflow tracker. Uses the
|
|
107
|
+
* registration/lifecycle module's configureDeliveryCoordinator helper.
|
|
108
|
+
* No dynamic import needed — lifecycle is already loaded by configureNotifications.
|
|
109
|
+
*/
|
|
110
|
+
async function configureDeliveryCoordinatorImpl(pi: ExtensionAPI, ctx: RegistrationContext): Promise<void> {
|
|
111
|
+
try {
|
|
112
|
+
// LAZY: lifecycle.ts may not be loaded yet if configureNotifications hasn't fired.
|
|
113
|
+
const lifecycleModule = await import("./lifecycle.ts");
|
|
114
|
+
await lifecycleModule.configureDeliveryCoordinator(ctx.lifecycleState, {
|
|
115
|
+
pi,
|
|
116
|
+
observabilityState: ctx.observabilityState,
|
|
117
|
+
notifyOperator: ctx.notifyOperator,
|
|
118
|
+
sendFollowUp,
|
|
119
|
+
sendAgentWakeUp,
|
|
120
|
+
});
|
|
121
|
+
} catch (error) {
|
|
122
|
+
logInternalError("register.configureDeliveryCoordinator", error);
|
|
123
|
+
}
|
|
124
|
+
}
|