pi-crew 0.1.45 → 0.1.49
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 +97 -0
- package/README.md +5 -5
- package/agents/analyst.md +11 -11
- package/agents/critic.md +11 -11
- package/agents/executor.md +11 -11
- package/agents/explorer.md +11 -11
- package/agents/planner.md +11 -11
- package/agents/reviewer.md +11 -11
- package/agents/security-reviewer.md +11 -11
- package/agents/test-engineer.md +11 -11
- package/agents/verifier.md +11 -11
- package/agents/writer.md +11 -11
- package/docs/next-upgrade-roadmap.md +808 -0
- package/docs/research/AGENT-EXECUTION-ARCHITECTURE.md +261 -0
- package/docs/research/AGENT-LIFECYCLE-COMPARISON.md +111 -0
- package/docs/research/AUDIT_OH_MY_PI.md +261 -0
- package/docs/research/AUDIT_PI_CREW.md +457 -0
- package/docs/research/CAVEMAN-DEEP-RESEARCH.md +281 -0
- package/docs/research/COMPARISON_OH_MY_PI_VS_PI_CREW.md +264 -0
- package/docs/research/DEEP-RESEARCH-PI-POWERBAR.md +343 -0
- package/docs/research/DEEP_RESEARCH_SUBAGENT_ARCHITECTURE.md +480 -0
- package/docs/research/GAP_CLOSURE_IMPLEMENTATION_PLAN.md +354 -0
- package/docs/research/IMPLEMENTATION_PLAN.md +385 -0
- package/docs/research/LIVE-SESSION-PRODUCTION-READY-PLAN.md +502 -0
- package/docs/research/OH-MY-PI-DEEP-RESEARCH-v14.7.6.md +266 -0
- package/docs/research/REMAINING-GAPS-PLAN.md +363 -0
- package/docs/research/SESSION-SUMMARY-2026-05-08.md +146 -0
- package/docs/research/UI-RESPONSIVENESS-AUDIT.md +173 -0
- package/docs/research-awesome-agent-skills-distillation.md +100 -0
- package/docs/research-oh-my-pi-distillation.md +369 -0
- package/docs/source-runtime-refactor-map.md +24 -0
- package/docs/usage.md +3 -3
- package/install.mjs +52 -8
- package/package.json +99 -98
- package/schema.json +10 -1
- package/skills/async-worker-recovery/SKILL.md +42 -0
- package/skills/context-artifact-hygiene/SKILL.md +52 -0
- package/skills/delegation-patterns/SKILL.md +54 -0
- package/skills/mailbox-interactive/SKILL.md +40 -0
- package/skills/model-routing-context/SKILL.md +39 -0
- package/skills/multi-perspective-review/SKILL.md +58 -0
- package/skills/observability-reliability/SKILL.md +41 -0
- package/skills/orchestration/SKILL.md +157 -0
- package/skills/ownership-session-security/SKILL.md +41 -0
- package/skills/pi-extension-lifecycle/SKILL.md +39 -0
- package/skills/requirements-to-task-packet/SKILL.md +63 -0
- package/skills/resource-discovery-config/SKILL.md +41 -0
- package/skills/runtime-state-reader/SKILL.md +44 -0
- package/skills/secure-agent-orchestration-review/SKILL.md +45 -0
- package/skills/state-mutation-locking/SKILL.md +42 -0
- package/skills/systematic-debugging/SKILL.md +67 -0
- package/skills/ui-render-performance/SKILL.md +39 -0
- package/skills/verification-before-done/SKILL.md +57 -0
- package/skills/worktree-isolation/SKILL.md +39 -0
- package/src/agents/agent-config.ts +6 -0
- package/src/agents/agent-search.ts +98 -0
- package/src/agents/agent-serializer.ts +38 -34
- package/src/agents/discover-agents.ts +29 -15
- package/src/config/config.ts +72 -24
- package/src/config/defaults.ts +25 -0
- package/src/extension/autonomous-policy.ts +26 -33
- package/src/extension/help.ts +1 -0
- package/src/extension/management.ts +5 -0
- package/src/extension/project-init.ts +62 -2
- package/src/extension/register.ts +69 -22
- package/src/extension/registration/commands.ts +64 -25
- package/src/extension/registration/compaction-guard.ts +1 -1
- package/src/extension/registration/subagent-helpers.ts +8 -0
- package/src/extension/registration/subagent-tools.ts +149 -148
- package/src/extension/registration/team-tool.ts +14 -10
- package/src/extension/run-index.ts +35 -21
- package/src/extension/run-maintenance.ts +30 -5
- package/src/extension/team-tool/api.ts +47 -9
- package/src/extension/team-tool/cancel.ts +109 -5
- package/src/extension/team-tool/context.ts +8 -0
- package/src/extension/team-tool/intent-policy.ts +42 -0
- package/src/extension/team-tool/lifecycle-actions.ts +120 -79
- package/src/extension/team-tool/parallel-dispatch.ts +156 -0
- package/src/extension/team-tool/respond.ts +46 -18
- package/src/extension/team-tool/run.ts +55 -12
- package/src/extension/team-tool/status.ts +13 -2
- package/src/extension/team-tool-types.ts +3 -0
- package/src/extension/team-tool.ts +45 -14
- package/src/hooks/registry.ts +61 -0
- package/src/hooks/types.ts +41 -0
- package/src/observability/event-to-metric.ts +8 -1
- package/src/runtime/agent-control.ts +169 -63
- package/src/runtime/async-runner.ts +3 -1
- package/src/runtime/background-runner.ts +78 -53
- package/src/runtime/cancellation-token.ts +89 -0
- package/src/runtime/cancellation.ts +61 -0
- package/src/runtime/capability-inventory.ts +116 -0
- package/src/runtime/child-pi.ts +458 -444
- package/src/runtime/code-summary.ts +247 -0
- package/src/runtime/crash-recovery.ts +182 -0
- package/src/runtime/crew-agent-records.ts +70 -10
- package/src/runtime/crew-agent-runtime.ts +1 -0
- package/src/runtime/custom-tools/irc-tool.ts +201 -0
- package/src/runtime/custom-tools/submit-result-tool.ts +90 -0
- package/src/runtime/deadletter.ts +1 -0
- package/src/runtime/delivery-coordinator.ts +48 -25
- package/src/runtime/effectiveness.ts +81 -0
- package/src/runtime/event-stream-bridge.ts +90 -0
- package/src/runtime/live-agent-control.ts +2 -1
- package/src/runtime/live-agent-manager.ts +179 -85
- package/src/runtime/live-control-realtime.ts +1 -1
- package/src/runtime/live-extension-bridge.ts +150 -0
- package/src/runtime/live-irc.ts +92 -0
- package/src/runtime/live-session-health.ts +100 -0
- package/src/runtime/live-session-runtime.ts +599 -305
- package/src/runtime/manifest-cache.ts +17 -2
- package/src/runtime/mcp-proxy.ts +113 -0
- package/src/runtime/model-fallback.ts +6 -4
- package/src/runtime/notebook-helpers.ts +90 -0
- package/src/runtime/orphan-sentinel.ts +7 -0
- package/src/runtime/output-validator.ts +187 -0
- package/src/runtime/parallel-utils.ts +57 -0
- package/src/runtime/parent-guard.ts +80 -0
- package/src/runtime/pi-args.ts +18 -3
- package/src/runtime/process-status.ts +5 -1
- package/src/runtime/prose-compressor.ts +164 -0
- package/src/runtime/result-extractor.ts +121 -0
- package/src/runtime/retry-executor.ts +81 -64
- package/src/runtime/runtime-resolver.ts +23 -10
- package/src/runtime/semaphore.ts +131 -0
- package/src/runtime/sensitive-paths.ts +92 -0
- package/src/runtime/skill-instructions.ts +222 -0
- package/src/runtime/stale-reconciler.ts +4 -14
- package/src/runtime/stream-preview.ts +177 -0
- package/src/runtime/subagent-manager.ts +6 -2
- package/src/runtime/subprocess-tool-registry.ts +67 -0
- package/src/runtime/task-output-context.ts +177 -127
- package/src/runtime/task-runner/capabilities.ts +78 -0
- package/src/runtime/task-runner/live-executor.ts +107 -101
- package/src/runtime/task-runner/prompt-builder.ts +72 -8
- package/src/runtime/task-runner/prompt-pipeline.ts +64 -0
- package/src/runtime/task-runner/run-projection.ts +104 -0
- package/src/runtime/task-runner.ts +115 -5
- package/src/runtime/team-runner.ts +134 -19
- package/src/runtime/workspace-tree.ts +298 -0
- package/src/runtime/yield-handler.ts +189 -0
- package/src/schema/config-schema.ts +7 -0
- package/src/schema/team-tool-schema.ts +14 -4
- package/src/skills/discover-skills.ts +67 -0
- package/src/state/active-run-registry.ts +167 -0
- package/src/state/artifact-store.ts +4 -1
- package/src/state/atomic-write.ts +50 -1
- package/src/state/blob-store.ts +117 -0
- package/src/state/contracts.ts +2 -1
- package/src/state/event-log-rotation.ts +158 -0
- package/src/state/event-log.ts +52 -2
- package/src/state/mailbox.ts +129 -9
- package/src/state/state-store.ts +32 -5
- package/src/state/types.ts +64 -2
- package/src/teams/team-config.ts +1 -0
- package/src/ui/agent-management-overlay.ts +144 -0
- package/src/ui/crew-widget.ts +15 -5
- package/src/ui/dashboard-panes/cancellation-pane.ts +43 -0
- package/src/ui/dashboard-panes/capability-pane.ts +60 -0
- package/src/ui/dashboard-panes/mailbox-pane.ts +35 -11
- package/src/ui/dashboard-panes/progress-pane.ts +2 -0
- package/src/ui/live-run-sidebar.ts +4 -0
- package/src/ui/powerbar-publisher.ts +77 -15
- package/src/ui/render-coalescer.ts +51 -0
- package/src/ui/run-dashboard.ts +4 -0
- package/src/ui/run-event-bus.ts +209 -0
- package/src/ui/run-snapshot-cache.ts +78 -18
- package/src/ui/snapshot-types.ts +10 -0
- package/src/ui/transcript-entries.ts +258 -0
- package/src/utils/ids.ts +5 -0
- package/src/utils/incremental-reader.ts +104 -0
- package/src/utils/paths.ts +4 -2
- package/src/utils/scan-cache.ts +137 -0
- package/src/utils/sse-parser.ts +134 -0
- package/src/utils/task-name-generator.ts +337 -0
- package/src/utils/visual.ts +33 -2
- package/src/workflows/workflow-config.ts +1 -0
- package/src/worktree/cleanup.ts +2 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { OperationTerminalEvidence } from "../state/types.ts";
|
|
2
|
+
|
|
3
|
+
export type CancellationReasonCode = "caller_cancelled" | "leader_interrupted" | "provider_timeout" | "worker_timeout" | "tool_timeout" | "shutdown" | "unknown";
|
|
4
|
+
|
|
5
|
+
export interface CancellationReason {
|
|
6
|
+
code: CancellationReasonCode;
|
|
7
|
+
message: string;
|
|
8
|
+
cause?: unknown;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function buildSyntheticTerminalEvidence(
|
|
12
|
+
operation: "worker" | "tool" | "model",
|
|
13
|
+
reason: CancellationReason,
|
|
14
|
+
startedAt?: string,
|
|
15
|
+
): OperationTerminalEvidence {
|
|
16
|
+
return { operation, status: "cancelled", startedAt, finishedAt: new Date().toISOString(), reason };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const KNOWN_CODES: ReadonlySet<string> = new Set(["caller_cancelled", "leader_interrupted", "provider_timeout", "worker_timeout", "tool_timeout", "shutdown", "unknown"]);
|
|
20
|
+
|
|
21
|
+
export class CrewCancellationError extends Error {
|
|
22
|
+
readonly reason: CancellationReason;
|
|
23
|
+
|
|
24
|
+
constructor(reason: CancellationReason) {
|
|
25
|
+
super(reason.message);
|
|
26
|
+
this.name = "CrewCancellationError";
|
|
27
|
+
this.reason = reason;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function reasonFromString(value: string): CancellationReason {
|
|
32
|
+
const trimmed = value.trim();
|
|
33
|
+
if (KNOWN_CODES.has(trimmed)) return { code: trimmed as CancellationReasonCode, message: `Cancelled: ${trimmed}` };
|
|
34
|
+
return { code: "caller_cancelled", message: trimmed || "Cancelled by caller." };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function cancellationReasonFromUnknown(value: unknown): CancellationReason {
|
|
38
|
+
if (value instanceof CrewCancellationError) return value.reason;
|
|
39
|
+
if (value instanceof Error) return { code: "caller_cancelled", message: value.message || "Cancelled by caller.", cause: value };
|
|
40
|
+
if (typeof value === "string") return reasonFromString(value);
|
|
41
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
42
|
+
const record = value as { code?: unknown; reason?: unknown; message?: unknown; cause?: unknown };
|
|
43
|
+
const rawCode = typeof record.code === "string" ? record.code : typeof record.reason === "string" ? record.reason : undefined;
|
|
44
|
+
const code = rawCode && KNOWN_CODES.has(rawCode) ? rawCode as CancellationReasonCode : "caller_cancelled";
|
|
45
|
+
const message = typeof record.message === "string" && record.message.trim() ? record.message.trim() : `Cancelled: ${code}`;
|
|
46
|
+
return { code, message, cause: record.cause ?? value };
|
|
47
|
+
}
|
|
48
|
+
return { code: "caller_cancelled", message: "Cancelled by caller." };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function cancellationReasonFromSignal(signal: AbortSignal | undefined): CancellationReason {
|
|
52
|
+
return cancellationReasonFromUnknown(signal?.reason);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function cancellationErrorFromSignal(signal: AbortSignal | undefined): CrewCancellationError {
|
|
56
|
+
return new CrewCancellationError(cancellationReasonFromSignal(signal));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function throwIfCancelled(signal: AbortSignal | undefined): void {
|
|
60
|
+
if (signal?.aborted) throw cancellationErrorFromSignal(signal);
|
|
61
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { AgentConfig, ResourceSource } from "../agents/agent-config.ts";
|
|
2
|
+
import { discoverAgents } from "../agents/discover-agents.ts";
|
|
3
|
+
import { discoverTeams } from "../teams/discover-teams.ts";
|
|
4
|
+
import { discoverWorkflows } from "../workflows/discover-workflows.ts";
|
|
5
|
+
import { discoverSkills } from "../skills/discover-skills.ts";
|
|
6
|
+
import type { PiTeamsConfig } from "../config/config.ts";
|
|
7
|
+
|
|
8
|
+
export type CapabilityKind = "team" | "workflow" | "agent" | "skill" | "tool" | "runtime";
|
|
9
|
+
export type CapabilitySource = "builtin" | "project" | "user" | "package" | "git";
|
|
10
|
+
export type CapabilityState = "active" | "disabled" | "shadowed" | "missing";
|
|
11
|
+
|
|
12
|
+
export interface CapabilityItem {
|
|
13
|
+
id: string;
|
|
14
|
+
kind: CapabilityKind;
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
source: CapabilitySource;
|
|
18
|
+
path?: string;
|
|
19
|
+
state: CapabilityState;
|
|
20
|
+
disabledReason?: string;
|
|
21
|
+
shadowedBy?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function normalizeAgents(agents: AgentConfig[], source: CapabilitySource, disabledIds: Set<string>): CapabilityItem[] {
|
|
25
|
+
return agents.map((agent) => {
|
|
26
|
+
const id = `agent:${agent.name}`;
|
|
27
|
+
const configDisabled = disabledIds.has(id);
|
|
28
|
+
const agentDisabled = agent.disabled || configDisabled;
|
|
29
|
+
return {
|
|
30
|
+
id,
|
|
31
|
+
kind: "agent" as const,
|
|
32
|
+
name: agent.name,
|
|
33
|
+
description: agent.description,
|
|
34
|
+
source,
|
|
35
|
+
path: agent.filePath,
|
|
36
|
+
state: agentDisabled ? "disabled" : "active",
|
|
37
|
+
disabledReason: configDisabled ? "disabled by policy" : agent.disabled ? "disabled in config" : undefined,
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function normalizeSkills(cwd: string, disabledIds: Set<string>): CapabilityItem[] {
|
|
43
|
+
const skills = discoverSkills(cwd);
|
|
44
|
+
return skills.map((skill) => {
|
|
45
|
+
const id = `skill:${skill.name}`;
|
|
46
|
+
const configDisabled = disabledIds.has(id);
|
|
47
|
+
return {
|
|
48
|
+
id,
|
|
49
|
+
kind: "skill" as const,
|
|
50
|
+
name: skill.name,
|
|
51
|
+
description: skill.description,
|
|
52
|
+
source: skill.source as CapabilitySource,
|
|
53
|
+
path: skill.path,
|
|
54
|
+
state: configDisabled ? "disabled" : "active",
|
|
55
|
+
disabledReason: configDisabled ? "disabled by policy" : undefined,
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function normalizeTeams(cwd: string, disabledIds: Set<string>): CapabilityItem[] {
|
|
61
|
+
const result = discoverTeams(cwd);
|
|
62
|
+
return [...result.builtin, ...result.user, ...result.project].map((team) => {
|
|
63
|
+
const id = `team:${team.name}`;
|
|
64
|
+
const configDisabled = disabledIds.has(id);
|
|
65
|
+
return {
|
|
66
|
+
id,
|
|
67
|
+
kind: "team" as const,
|
|
68
|
+
name: team.name,
|
|
69
|
+
description: team.description,
|
|
70
|
+
source: team.source as CapabilitySource,
|
|
71
|
+
path: team.filePath,
|
|
72
|
+
state: configDisabled ? "disabled" : "active",
|
|
73
|
+
disabledReason: configDisabled ? "disabled by policy" : undefined,
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function normalizeWorkflows(cwd: string, disabledIds: Set<string>): CapabilityItem[] {
|
|
79
|
+
const result = discoverWorkflows(cwd);
|
|
80
|
+
return [...result.builtin, ...result.user, ...result.project].map((workflow) => {
|
|
81
|
+
const id = `workflow:${workflow.name}`;
|
|
82
|
+
const configDisabled = disabledIds.has(id);
|
|
83
|
+
return {
|
|
84
|
+
id,
|
|
85
|
+
kind: "workflow" as const,
|
|
86
|
+
name: workflow.name,
|
|
87
|
+
description: workflow.description,
|
|
88
|
+
source: workflow.source as CapabilitySource,
|
|
89
|
+
path: workflow.filePath,
|
|
90
|
+
state: configDisabled ? "disabled" : "active",
|
|
91
|
+
disabledReason: configDisabled ? "disabled by policy" : undefined,
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function buildCapabilityInventory(cwd: string, config?: PiTeamsConfig): CapabilityItem[] {
|
|
97
|
+
const disabledIds = new Set<string>(config?.policy?.disabledCapabilities ?? []);
|
|
98
|
+
const agents = discoverAgents(cwd);
|
|
99
|
+
const items = [
|
|
100
|
+
...normalizeTeams(cwd, disabledIds),
|
|
101
|
+
...normalizeWorkflows(cwd, disabledIds),
|
|
102
|
+
...normalizeAgents([...agents.builtin, ...agents.user, ...agents.project], "builtin", disabledIds),
|
|
103
|
+
...normalizeSkills(cwd, disabledIds),
|
|
104
|
+
];
|
|
105
|
+
|
|
106
|
+
// Mark shadowed resources: project/user items with same kind:name as a builtin
|
|
107
|
+
const builtinNames = new Set(items.filter((item) => item.source === "builtin" || item.source === "package").map((item) => `${item.kind}:${item.name}`));
|
|
108
|
+
for (const item of items) {
|
|
109
|
+
if (item.source !== "builtin" && item.source !== "package" && builtinNames.has(`${item.kind}:${item.name}`)) {
|
|
110
|
+
item.state = "shadowed";
|
|
111
|
+
item.shadowedBy = `builtin:${item.kind}:${item.name}`;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return items.sort((a, b) => a.id.localeCompare(b.id));
|
|
116
|
+
}
|