pi-crew 0.9.67 → 0.10.1
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 +172 -0
- package/agents/analyst.md +1 -1
- package/agents/cold-verifier.md +3 -1
- package/agents/critic.md +1 -1
- package/agents/executor.md +1 -1
- package/agents/explorer.md +1 -1
- package/agents/planner.md +1 -1
- package/agents/reviewer.md +1 -1
- package/agents/security-reviewer.md +1 -1
- package/agents/test-engineer.md +1 -1
- package/agents/verifier.md +1 -1
- package/agents/writer.md +1 -1
- package/dist/index.mjs +65847 -60331
- package/docs/README.md +2 -0
- package/docs/actions-reference.md +31 -0
- package/docs/commands-reference.md +17 -6
- package/docs/resource-formats.md +13 -0
- package/package.json +9 -6
- package/schema.json +15 -1
- package/scripts/resource-sampler.mjs +36 -2
- package/skills/requirements-to-task-packet/SKILL.md +26 -0
- package/skills/widget-rendering/SKILL.md +7 -7
- package/src/agents/agent-config.ts +36 -14
- package/src/agents/discover-agents.ts +23 -14
- package/src/config/config-merge.ts +183 -0
- package/src/config/config-validation.ts +681 -0
- package/src/config/config.ts +22 -864
- package/src/config/defaults.ts +35 -1
- package/src/config/drift-detector.ts +1 -1
- package/src/config/env-vars.ts +691 -0
- package/src/config/role-tools.ts +8 -8
- package/src/config/sanitize-project-config.ts +172 -0
- package/src/config/types.ts +30 -0
- package/src/extension/async-notifier.ts +25 -2
- package/src/extension/crew-vibes/config.ts +2 -1
- package/src/extension/plan-orchestrate.ts +132 -0
- package/src/extension/registration/commands/dashboard.ts +158 -0
- package/src/extension/registration/commands/index.ts +35 -0
- package/src/extension/registration/commands/manage.ts +303 -0
- package/src/extension/registration/commands/run.ts +214 -0
- package/src/extension/registration/commands/shared.ts +631 -0
- package/src/extension/registration/commands/status.ts +60 -0
- package/src/extension/registration/commands.ts +13 -1224
- package/src/extension/registration/lifecycle-handlers.ts +126 -15
- package/src/extension/registration/subagent-tools.ts +218 -9
- package/src/extension/rpc-hmac.ts +5 -3
- package/src/extension/team-tool/api/heartbeat.ts +47 -10
- package/src/extension/team-tool/api/plan-approval.ts +9 -0
- package/src/extension/team-tool/api/task-claims.ts +109 -40
- package/src/extension/team-tool/cancel.ts +84 -50
- package/src/extension/team-tool/dispatch/index.ts +1 -0
- package/src/extension/team-tool/dispatch/run.ts +4 -1
- package/src/extension/team-tool/doctor.ts +103 -1
- package/src/extension/team-tool/orchestrate.ts +66 -1
- package/src/extension/team-tool/plans.ts +192 -0
- package/src/extension/team-tool/respond.ts +197 -65
- package/src/extension/team-tool/run-deadline.ts +16 -1
- package/src/extension/team-tool/run-intent.ts +63 -0
- package/src/extension/team-tool/run.ts +48 -18
- package/src/extension/team-tool/status.ts +84 -26
- package/src/extension/team-tool.ts +11 -2
- package/src/hooks/registry.ts +1 -6
- package/src/i18n.ts +9 -0
- package/src/prompt/prompt-runtime.ts +521 -2
- package/src/prompt/worker-events-channel.ts +173 -0
- package/src/runtime/README.md +8 -8
- package/src/runtime/async-runner.ts +7 -3
- package/src/runtime/background-runner.ts +42 -14
- package/src/runtime/broker/broker-issuer.ts +9 -2
- package/src/runtime/broker/crew-broker-tokens.ts +43 -6
- package/src/runtime/broker/crew-broker.ts +838 -10
- package/src/runtime/broker/wait-status-cache.ts +157 -0
- package/src/runtime/budget-enforcement.ts +281 -0
- package/src/runtime/child-pi/child-pi-spawn.ts +60 -14
- package/src/runtime/child-pi/child-pi-timers.ts +324 -0
- package/src/runtime/child-pi/child-pi.ts +97 -201
- package/src/runtime/child-pi/mock-fixtures.ts +16 -2
- package/src/runtime/crew-agent-records.ts +259 -14
- package/src/runtime/delegate-spawn.ts +148 -0
- package/src/runtime/deterministic-ast.ts +2 -1
- package/src/runtime/dispatch-batch.ts +945 -0
- package/src/runtime/finalize-run.ts +557 -0
- package/src/runtime/goal-workflow/adaptive-plan.ts +87 -13
- package/src/runtime/goal-workflow/dynamic-workflow-runner.ts +3 -2
- package/src/runtime/goal-workflow/goal-state-store.ts +1 -1
- package/src/runtime/group-join.ts +11 -125
- package/src/runtime/live-session/live-session-runtime.ts +26 -1
- package/src/runtime/merge-gate.ts +7 -1
- package/src/runtime/merge-loop.ts +130 -0
- package/src/runtime/model/model-budget-summary.ts +53 -0
- package/src/runtime/model/model-fallback.ts +32 -2
- package/src/runtime/model/pi-args.ts +10 -0
- package/src/runtime/model/provider-extensions.ts +10 -0
- package/src/runtime/orphan-worker-registry.ts +1 -1
- package/src/runtime/output/output-validator.ts +45 -0
- package/src/runtime/parent-guard.ts +3 -1
- package/src/runtime/peer-dep.ts +2 -1
- package/src/runtime/per-write-validator.ts +0 -5
- package/src/runtime/pi-spawn.ts +61 -15
- package/src/runtime/plan-approval.ts +125 -0
- package/src/runtime/plan-replan.ts +151 -0
- package/src/runtime/recovery/checkpoint.ts +0 -18
- package/src/runtime/recovery/crash-recovery.ts +95 -46
- package/src/runtime/scheduler-context.ts +98 -0
- package/src/runtime/scheduling/coalesce-tasks.ts +5 -0
- package/src/runtime/scheduling/global-worker-cap.ts +2 -1
- package/src/runtime/scheduling/nested-slots.ts +70 -0
- package/src/runtime/scheduling/run-coalesced-task-group.ts +64 -13
- package/src/runtime/scheduling/task-graph-scheduler.ts +0 -10
- package/src/runtime/scratchpad/README.md +10 -5
- package/src/runtime/scratchpad/guest.ts +103 -2
- package/src/runtime/scratchpad/protocol.ts +13 -1
- package/src/runtime/scratchpad/transform.ts +206 -12
- package/src/runtime/settings-store.ts +219 -0
- package/src/runtime/spawn-policy.ts +217 -0
- package/src/runtime/stale-reconciler.ts +87 -6
- package/src/runtime/subagent-manager.ts +25 -1
- package/src/runtime/task-output-context.ts +230 -9
- package/src/runtime/task-packet.ts +23 -1
- package/src/runtime/task-runner/child-executor.ts +106 -7
- package/src/runtime/task-runner/post-execution.ts +125 -1
- package/src/runtime/task-runner/pre-execution.ts +39 -1
- package/src/runtime/task-runner/prompt-builder.ts +51 -1
- package/src/runtime/task-runner/retrieval-orchestrator.ts +72 -18
- package/src/runtime/task-runner/spec-evidence.ts +403 -0
- package/src/runtime/task-runner/state-helpers.ts +26 -24
- package/src/runtime/task-runner.ts +11 -0
- package/src/runtime/team-runner.ts +129 -1671
- package/src/runtime/verification/spec-sandbox.ts +255 -0
- package/src/runtime/verification/verification-gates.ts +3 -2
- package/src/runtime/verification/verification-worktree.ts +2 -1
- package/src/runtime/workflow-phase-advance.ts +100 -0
- package/src/runtime/workspace-tree.ts +9 -0
- package/src/schema/config-schema.ts +65 -25
- package/src/schema/sensitive-config-paths.ts +64 -0
- package/src/schema/team-tool-schema.ts +13 -3
- package/src/state/README.md +4 -10
- package/src/state/atomic-write.ts +20 -3
- package/src/state/contracts.ts +38 -0
- package/src/state/coordination/mailbox.ts +12 -2
- package/src/state/event-log/cursor.ts +223 -0
- package/src/state/event-log/event-log-rotation.ts +12 -4
- package/src/state/event-log/event-log.ts +152 -369
- package/src/state/event-log/sequence-cache.ts +373 -0
- package/src/state/event-log/worker-atomic-writer.ts +2 -1
- package/src/state/stores/active-run-registry.ts +3 -2
- package/src/state/stores/manifest-io.ts +237 -0
- package/src/state/stores/ownership-map.ts +162 -0
- package/src/state/stores/plan-store.ts +241 -0
- package/src/state/stores/run-cache.ts +0 -90
- package/src/state/stores/spec-store.ts +189 -0
- package/src/state/stores/state-store.ts +66 -229
- package/src/state/types.ts +197 -0
- package/src/ui/dashboard-panes/plan-pane.ts +136 -0
- package/src/ui/dashboard-panes/progress-pane.ts +6 -0
- package/src/ui/dashboard-panes/transcript-pane.ts +31 -0
- package/src/ui/heartbeat-aggregator.ts +9 -1
- package/src/ui/keybinding-map.ts +54 -13
- package/src/ui/powerbar-publisher.ts +52 -1
- package/src/ui/run-dashboard.ts +31 -5
- package/src/ui/run-snapshot-cache.ts +57 -30
- package/src/ui/snapshot-types.ts +6 -1
- package/src/ui/widget/widget-renderer.ts +9 -1
- package/src/utils/file-coalescer.ts +0 -4
- package/src/utils/fs-errno.ts +66 -0
- package/src/utils/fs-watch.ts +1 -1
- package/src/utils/internal-error.ts +3 -1
- package/src/utils/paths.ts +11 -3
- package/src/utils/task-name-generator.ts +1 -8
- package/src/workflows/discover-workflows.ts +19 -2
- package/src/workflows/validate-workflow.ts +7 -1
- package/src/workflows/workflow-config.ts +10 -0
- package/src/workflows/workflow-serializer.ts +3 -0
- package/src/worktree/worktree-manager.ts +22 -0
- package/src/agents/agent-search.ts +0 -98
- package/src/benchmark/benchmark-runner.ts +0 -313
- package/src/benchmark/feedback-loop.ts +0 -73
- package/src/config/resilient-parser.ts +0 -117
- package/src/extension/crew-vibes/cat-frames.ts +0 -18
- package/src/extension/result-watcher.ts +0 -139
- package/src/observability/exporters/prometheus-exporter.ts +0 -54
- package/src/observability/metric-retention.ts +0 -64
- package/src/runtime/compaction/compaction-summary.ts +0 -278
- package/src/runtime/errors/crew-errors.ts +0 -162
- package/src/runtime/live-session/intercom-bridge.ts +0 -187
- package/src/runtime/loop-gates.ts +0 -128
- package/src/runtime/metric-parser.ts +0 -36
- package/src/runtime/output/stream-preview.ts +0 -184
- package/src/runtime/output/tool-progress.ts +0 -278
- package/src/runtime/phase-tracker.ts +0 -385
- package/src/runtime/pipeline-runner.ts +0 -523
- package/src/runtime/process/process-lifecycle.ts +0 -491
- package/src/runtime/recovery/retry-runner.ts +0 -330
- package/src/runtime/run-drift.ts +0 -219
- package/src/runtime/scratchpad/snapshot-hmac.ts +0 -167
- package/src/runtime/task-quality.ts +0 -199
- package/src/runtime/task-runner/run-projection.ts +0 -128
- package/src/runtime/verification/post-checks.ts +0 -142
- package/src/state/coordination/schedule.ts +0 -166
- package/src/state/event-log/jsonl-writer.ts +0 -115
- package/src/state/hook-instinct-bridge.ts +0 -94
- package/src/state/hook-integrations.ts +0 -51
- package/src/state/session-state-map.ts +0 -51
- package/src/state/stores/blob-store.ts +0 -308
- package/src/state/stores/instinct-store.ts +0 -275
- package/src/state/stores/observation-store.ts +0 -176
- package/src/state/tiered-eval.ts +0 -480
- package/src/state/types-eval.ts +0 -58
- package/src/tools/safe-bash-extension.ts +0 -54
- package/src/tools/safe-bash.ts +0 -505
- package/src/ui/agent-management-overlay.ts +0 -160
- package/src/ui/crew-footer.ts +0 -102
- package/src/ui/crew-select-list.ts +0 -114
- package/src/ui/dashboard-panes/capability-pane.ts +0 -77
- package/src/ui/transcript-entries.ts +0 -256
- package/src/utils/conflict-detect.ts +0 -721
- package/src/utils/fingerprint.ts +0 -180
- package/src/utils/gh-protocol.ts +0 -556
- package/src/utils/project-detector.ts +0 -160
- package/src/utils/sse-parser.ts +0 -131
- package/src/workflows/cost-estimator.ts +0 -34
- package/src/workflows/intermediate-store.ts +0 -166
package/src/utils/fingerprint.ts
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Incremental fingerprinting — detect file changes to skip unchanged work.
|
|
3
|
-
*
|
|
4
|
-
* Pattern origin: Understand-Anything/packages/core/src/fingerprint.ts
|
|
5
|
-
* Content hash + structural signature per file. Change classifier:
|
|
6
|
-
* NONE (unchanged), COSMETIC (whitespace/comments only), STRUCTURAL (code changed).
|
|
7
|
-
* Only STRUCTURAL changes trigger re-analysis.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { createHash } from "node:crypto";
|
|
11
|
-
import { existsSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
12
|
-
import { logInternalError } from "../utils/internal-error.ts";
|
|
13
|
-
|
|
14
|
-
// ── Types ────────────────────────────────────────────────────────────────
|
|
15
|
-
|
|
16
|
-
export type ChangeClass = "NONE" | "COSMETIC" | "STRUCTURAL";
|
|
17
|
-
|
|
18
|
-
export interface FileFingerprint {
|
|
19
|
-
path: string;
|
|
20
|
-
contentHash: string;
|
|
21
|
-
structuralSignature: string;
|
|
22
|
-
lastModified: number; // mtime ms
|
|
23
|
-
changeClass: ChangeClass;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface FingerprintDelta {
|
|
27
|
-
added: string[];
|
|
28
|
-
removed: string[];
|
|
29
|
-
modified: FileFingerprint[]; // only STRUCTURAL changes
|
|
30
|
-
unchanged: number;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// ── Fingerprinting ───────────────────────────────────────────────────────
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Compute SHA-256 content hash of a file.
|
|
37
|
-
*/
|
|
38
|
-
export function computeContentHash(filePath: string): string {
|
|
39
|
-
try {
|
|
40
|
-
const content = readFileSync(filePath);
|
|
41
|
-
return createHash("sha256").update(content).digest("hex");
|
|
42
|
-
} catch {
|
|
43
|
-
return "";
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Extract a structural signature from source code.
|
|
49
|
-
*
|
|
50
|
-
* Captures function signatures, class methods, and import specifiers.
|
|
51
|
-
* Ignores whitespace, comments, and string content.
|
|
52
|
-
* Returns a hash of the structural elements.
|
|
53
|
-
*/
|
|
54
|
-
export function computeStructuralSignature(content: string, filePath: string): string {
|
|
55
|
-
const lines = content.split("\n");
|
|
56
|
-
const structural: string[] = [];
|
|
57
|
-
|
|
58
|
-
for (const line of lines) {
|
|
59
|
-
const trimmed = line.trim();
|
|
60
|
-
|
|
61
|
-
// Skip empty lines and comments
|
|
62
|
-
if (trimmed.length === 0) continue;
|
|
63
|
-
if (trimmed.startsWith("//") || trimmed.startsWith("/*") || trimmed.startsWith("*")) continue;
|
|
64
|
-
|
|
65
|
-
// Capture structural lines
|
|
66
|
-
if (
|
|
67
|
-
// Function/method declarations
|
|
68
|
-
/^(export\s+)?(async\s+)?function\s/.test(trimmed) ||
|
|
69
|
-
(/^\w+\s*\(/.test(trimmed) && !/^(if|for|while|switch|return|throw|await)/.test(trimmed)) ||
|
|
70
|
-
// Class declarations
|
|
71
|
-
/^(export\s+)?(abstract\s+)?class\s/.test(trimmed) ||
|
|
72
|
-
/^(public|private|protected|static|readonly|abstract)\s/.test(trimmed) ||
|
|
73
|
-
// Interface/type declarations
|
|
74
|
-
/^(export\s+)?(interface|type)\s/.test(trimmed) ||
|
|
75
|
-
// Import declarations
|
|
76
|
-
/^import\s/.test(trimmed) ||
|
|
77
|
-
// Export declarations
|
|
78
|
-
/^export\s+(default\s+)?(const|let|var|function|class|interface|type|enum)\s/.test(trimmed)
|
|
79
|
-
) {
|
|
80
|
-
structural.push(trimmed);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return createHash("sha256").update(structural.join("\n")).digest("hex");
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Classify the change between two fingerprints.
|
|
89
|
-
*/
|
|
90
|
-
export function classifyChange(previous: FileFingerprint | undefined, current: FileFingerprint): ChangeClass {
|
|
91
|
-
if (!previous) return "STRUCTURAL"; // New file
|
|
92
|
-
|
|
93
|
-
if (previous.contentHash === current.contentHash) return "NONE";
|
|
94
|
-
if (previous.structuralSignature === current.structuralSignature) return "COSMETIC";
|
|
95
|
-
return "STRUCTURAL";
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Compute fingerprint for a single file.
|
|
100
|
-
*/
|
|
101
|
-
export function fingerprintFile(filePath: string): FileFingerprint {
|
|
102
|
-
const content = readFileSync(filePath, "utf-8");
|
|
103
|
-
const stat = statSync(filePath);
|
|
104
|
-
|
|
105
|
-
return {
|
|
106
|
-
path: filePath,
|
|
107
|
-
contentHash: computeContentHash(filePath),
|
|
108
|
-
structuralSignature: computeStructuralSignature(content, filePath),
|
|
109
|
-
lastModified: stat.mtimeMs,
|
|
110
|
-
changeClass: "NONE", // will be classified during delta computation
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// ── Fingerprint Store ────────────────────────────────────────────────────
|
|
115
|
-
|
|
116
|
-
const MAX_FINGERPRINTS = 10000;
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Load fingerprint baseline from a JSON file.
|
|
120
|
-
*/
|
|
121
|
-
export function loadFingerprintBaseline(storePath: string): Map<string, FileFingerprint> {
|
|
122
|
-
const map = new Map<string, FileFingerprint>();
|
|
123
|
-
if (!existsSync(storePath)) return map;
|
|
124
|
-
|
|
125
|
-
try {
|
|
126
|
-
const data = JSON.parse(readFileSync(storePath, "utf-8")) as FileFingerprint[];
|
|
127
|
-
for (const fp of data) {
|
|
128
|
-
if (map.size >= MAX_FINGERPRINTS) break;
|
|
129
|
-
map.set(fp.path, fp);
|
|
130
|
-
}
|
|
131
|
-
} catch (error) {
|
|
132
|
-
logInternalError("fingerprint.load", error, `storePath=${storePath}`);
|
|
133
|
-
}
|
|
134
|
-
return map;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Save fingerprint baseline to a JSON file.
|
|
139
|
-
*/
|
|
140
|
-
export function saveFingerprintBaseline(storePath: string, fingerprints: Map<string, FileFingerprint>): void {
|
|
141
|
-
const entries = [...fingerprints.entries()].slice(0, MAX_FINGERPRINTS).map(([, fp]) => fp);
|
|
142
|
-
writeFileSync(storePath, JSON.stringify(entries, null, 2), "utf-8");
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Compute delta between baseline and current fingerprints.
|
|
147
|
-
*
|
|
148
|
-
* Only returns STRUCTURAL changes in the `modified` field.
|
|
149
|
-
*/
|
|
150
|
-
export function computeFingerprintDelta(baseline: Map<string, FileFingerprint>, current: Map<string, FileFingerprint>): FingerprintDelta {
|
|
151
|
-
const added: string[] = [];
|
|
152
|
-
const removed: string[] = [];
|
|
153
|
-
const modified: FileFingerprint[] = [];
|
|
154
|
-
let unchanged = 0;
|
|
155
|
-
|
|
156
|
-
// Find added and modified
|
|
157
|
-
for (const [path, currentFp] of current) {
|
|
158
|
-
const prev = baseline.get(path);
|
|
159
|
-
const changeClass = classifyChange(prev, currentFp);
|
|
160
|
-
|
|
161
|
-
if (!prev) {
|
|
162
|
-
added.push(path);
|
|
163
|
-
} else if (changeClass === "STRUCTURAL") {
|
|
164
|
-
modified.push({ ...currentFp, changeClass: "STRUCTURAL" });
|
|
165
|
-
} else if (changeClass === "COSMETIC") {
|
|
166
|
-
unchanged++; // cosmetic = treated as unchanged for re-analysis
|
|
167
|
-
} else {
|
|
168
|
-
unchanged++;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// Find removed
|
|
173
|
-
for (const path of baseline.keys()) {
|
|
174
|
-
if (!current.has(path)) {
|
|
175
|
-
removed.push(path);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
return { added, removed, modified, unchanged };
|
|
180
|
-
}
|