@narumitw/pi-subagents 0.51.0 → 0.53.0
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/README.md +129 -7
- package/package.json +1 -1
- package/src/adaptive-scheduler.ts +29 -1
- package/src/agents.ts +5 -0
- package/src/automation-contract.ts +709 -0
- package/src/automation-planner.ts +65 -0
- package/src/automation.ts +580 -0
- package/src/execution-plan.ts +1 -1
- package/src/execution.ts +291 -41
- package/src/inspect.ts +25 -0
- package/src/orchestration-metrics.ts +31 -0
- package/src/panel-execution.ts +0 -2
- package/src/params.ts +8 -1
- package/src/subagents.ts +2 -0
- package/src/verification-policy.ts +50 -0
- package/src/work-item-ledger.ts +267 -18
- package/src/work-item-persistence.ts +5 -0
- package/src/workflow-plan-compiler.ts +618 -0
- package/src/workflow-plan-patch.ts +636 -0
- package/src/workflow-planning-benchmark.ts +95 -0
- package/src/workflow-planning.ts +13 -1
- package/src/workflow-tree-identity.ts +289 -0
- package/src/workflow-ui.ts +2 -2
- package/src/workflow-verification.ts +296 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
export const AUTOMATION_BENCHMARK_VERSION = "pi-subagents:workflow-planning-benchmark:v1" as const;
|
|
2
|
+
|
|
3
|
+
export const AUTOMATION_BENCHMARK_ARMS = [
|
|
4
|
+
"strong-single-agent",
|
|
5
|
+
"one-child",
|
|
6
|
+
"caller-authored-workflow",
|
|
7
|
+
"fixed-two-child",
|
|
8
|
+
"equal-budget-best-of-n",
|
|
9
|
+
"automation-compiled",
|
|
10
|
+
] as const;
|
|
11
|
+
|
|
12
|
+
export type AutomationBenchmarkArm = (typeof AUTOMATION_BENCHMARK_ARMS)[number];
|
|
13
|
+
|
|
14
|
+
export interface AutomationBenchmarkProtocol {
|
|
15
|
+
version: typeof AUTOMATION_BENCHMARK_VERSION;
|
|
16
|
+
model: string;
|
|
17
|
+
evaluator: string;
|
|
18
|
+
taskIds: string[];
|
|
19
|
+
pairedSeeds: number[];
|
|
20
|
+
maxTokens: number;
|
|
21
|
+
maxCost: number;
|
|
22
|
+
maxWallClockMs: number;
|
|
23
|
+
maxMutatingChildren: number;
|
|
24
|
+
maxRecursiveDepth: number;
|
|
25
|
+
arms: AutomationBenchmarkArm[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface AutomationBenchmarkAdapter {
|
|
29
|
+
arm: AutomationBenchmarkArm;
|
|
30
|
+
model: string;
|
|
31
|
+
evaluator: string;
|
|
32
|
+
maxTokens: number;
|
|
33
|
+
maxCost: number;
|
|
34
|
+
maxWallClockMs: number;
|
|
35
|
+
mutatingChildren: number;
|
|
36
|
+
recursiveDepth: number;
|
|
37
|
+
informationPolicy: "identical-repository-context";
|
|
38
|
+
toolPolicy: "matched-authority-ceiling";
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface AutomationBenchmarkDryRun {
|
|
42
|
+
version: typeof AUTOMATION_BENCHMARK_VERSION;
|
|
43
|
+
pairedInstances: number;
|
|
44
|
+
arms: AutomationBenchmarkArm[];
|
|
45
|
+
valid: true;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function validateAutomationBenchmark(
|
|
49
|
+
protocol: AutomationBenchmarkProtocol,
|
|
50
|
+
adapters: AutomationBenchmarkAdapter[],
|
|
51
|
+
): AutomationBenchmarkDryRun {
|
|
52
|
+
if (protocol.version !== AUTOMATION_BENCHMARK_VERSION) {
|
|
53
|
+
throw new Error("Unsupported automation benchmark protocol");
|
|
54
|
+
}
|
|
55
|
+
if (protocol.taskIds.length < 1 || protocol.pairedSeeds.length < 2) {
|
|
56
|
+
throw new Error("Automation benchmark requires tasks and repeated paired seeds");
|
|
57
|
+
}
|
|
58
|
+
if (protocol.maxMutatingChildren !== 2 || protocol.maxRecursiveDepth !== 0) {
|
|
59
|
+
throw new Error("Automation benchmark width and depth must remain two and zero");
|
|
60
|
+
}
|
|
61
|
+
const arms = [...new Set(protocol.arms)].sort();
|
|
62
|
+
if (
|
|
63
|
+
arms.length !== AUTOMATION_BENCHMARK_ARMS.length ||
|
|
64
|
+
AUTOMATION_BENCHMARK_ARMS.some((arm) => !arms.includes(arm))
|
|
65
|
+
) {
|
|
66
|
+
throw new Error("Automation benchmark must include every frozen comparison arm");
|
|
67
|
+
}
|
|
68
|
+
for (const arm of AUTOMATION_BENCHMARK_ARMS) {
|
|
69
|
+
const adapter = adapters.find((candidate) => candidate.arm === arm);
|
|
70
|
+
if (!adapter) throw new Error(`Missing automation benchmark adapter ${arm}`);
|
|
71
|
+
if (
|
|
72
|
+
adapter.model !== protocol.model ||
|
|
73
|
+
adapter.evaluator !== protocol.evaluator ||
|
|
74
|
+
adapter.maxTokens !== protocol.maxTokens ||
|
|
75
|
+
adapter.maxCost !== protocol.maxCost ||
|
|
76
|
+
adapter.maxWallClockMs !== protocol.maxWallClockMs ||
|
|
77
|
+
adapter.informationPolicy !== "identical-repository-context" ||
|
|
78
|
+
adapter.toolPolicy !== "matched-authority-ceiling"
|
|
79
|
+
) {
|
|
80
|
+
throw new Error(`Automation benchmark adapter ${arm} violates matched resources`);
|
|
81
|
+
}
|
|
82
|
+
if (
|
|
83
|
+
adapter.mutatingChildren > protocol.maxMutatingChildren ||
|
|
84
|
+
adapter.recursiveDepth > protocol.maxRecursiveDepth
|
|
85
|
+
) {
|
|
86
|
+
throw new Error(`Automation benchmark adapter ${arm} exceeds width or depth`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
version: AUTOMATION_BENCHMARK_VERSION,
|
|
91
|
+
pairedInstances: protocol.taskIds.length * protocol.pairedSeeds.length,
|
|
92
|
+
arms: [...AUTOMATION_BENCHMARK_ARMS],
|
|
93
|
+
valid: true,
|
|
94
|
+
};
|
|
95
|
+
}
|
package/src/workflow-planning.ts
CHANGED
|
@@ -89,6 +89,18 @@ export function createBlockingWorkLedger(
|
|
|
89
89
|
const hasExplicitIntegrationOwner = resolvedWorkflowTasks.some(
|
|
90
90
|
(task) => task.integrationOwner === true,
|
|
91
91
|
);
|
|
92
|
+
let defaultIntegrationOwnerIndex = -1;
|
|
93
|
+
if (!hasExplicitIntegrationOwner) {
|
|
94
|
+
for (let index = resolvedWorkflowTasks.length - 1; index >= 0; index--) {
|
|
95
|
+
if (resolvedWorkflowTasks[index]?.verifierFor === undefined) {
|
|
96
|
+
defaultIntegrationOwnerIndex = index;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (!hasExplicitIntegrationOwner && defaultIntegrationOwnerIndex < 0) {
|
|
102
|
+
throw new Error("Workflow has no non-verifier integration owner candidate");
|
|
103
|
+
}
|
|
92
104
|
return WorkItemLedger.create({
|
|
93
105
|
workflowId: params.workflow.id ?? "blocking-workflow",
|
|
94
106
|
items: resolvedWorkflowTasks.map((task, index) =>
|
|
@@ -96,7 +108,7 @@ export function createBlockingWorkLedger(
|
|
|
96
108
|
...task,
|
|
97
109
|
integrationOwner:
|
|
98
110
|
task.integrationOwner ??
|
|
99
|
-
(!hasExplicitIntegrationOwner && index ===
|
|
111
|
+
(!hasExplicitIntegrationOwner && index === defaultIntegrationOwnerIndex),
|
|
100
112
|
}),
|
|
101
113
|
),
|
|
102
114
|
});
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { createHash, type Hash } from "node:crypto";
|
|
3
|
+
import * as fs from "node:fs";
|
|
4
|
+
import * as path from "node:path";
|
|
5
|
+
|
|
6
|
+
export const WORKFLOW_TREE_IDENTITY_VERSION = "pi-subagents:workflow-tree:v1" as const;
|
|
7
|
+
export const DEFAULT_WORKFLOW_TREE_MAX_BYTES = 1024 * 1024;
|
|
8
|
+
const MAX_UNTRACKED_FILES = 256;
|
|
9
|
+
|
|
10
|
+
export interface WorkflowTreeIdentity {
|
|
11
|
+
version: typeof WORKFLOW_TREE_IDENTITY_VERSION;
|
|
12
|
+
kind: "git-commit" | "git-dirty";
|
|
13
|
+
digest: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface CaptureWorkflowTreeIdentityOptions {
|
|
17
|
+
maxBytes?: number;
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export async function captureWorkflowTreeIdentity(
|
|
22
|
+
cwd: string,
|
|
23
|
+
options: CaptureWorkflowTreeIdentityOptions = {},
|
|
24
|
+
): Promise<WorkflowTreeIdentity> {
|
|
25
|
+
const maxBytes = options.maxBytes ?? DEFAULT_WORKFLOW_TREE_MAX_BYTES;
|
|
26
|
+
if (!Number.isSafeInteger(maxBytes) || maxBytes < 1) {
|
|
27
|
+
throw new Error("Workflow tree identity maxBytes must be a positive safe integer");
|
|
28
|
+
}
|
|
29
|
+
throwIfAborted(options.signal);
|
|
30
|
+
let canonicalCwd: string;
|
|
31
|
+
try {
|
|
32
|
+
canonicalCwd = await fs.promises.realpath(path.resolve(cwd));
|
|
33
|
+
} catch {
|
|
34
|
+
throw new Error("Workflow verification requires a readable Git repository directory");
|
|
35
|
+
}
|
|
36
|
+
const rootOutput = await git(
|
|
37
|
+
canonicalCwd,
|
|
38
|
+
["rev-parse", "--show-toplevel"],
|
|
39
|
+
64 * 1024,
|
|
40
|
+
options.signal,
|
|
41
|
+
).catch((error) => {
|
|
42
|
+
throw normalizedGitError(error, "Workflow verification requires a Git repository");
|
|
43
|
+
});
|
|
44
|
+
let repositoryRoot: string;
|
|
45
|
+
try {
|
|
46
|
+
repositoryRoot = await fs.promises.realpath(rootOutput.toString("utf8").trim());
|
|
47
|
+
} catch {
|
|
48
|
+
throw new Error("Workflow verification requires a readable Git repository root");
|
|
49
|
+
}
|
|
50
|
+
const relativeCwd = path.relative(repositoryRoot, canonicalCwd);
|
|
51
|
+
if (relativeCwd.startsWith("..") || path.isAbsolute(relativeCwd)) {
|
|
52
|
+
throw new Error("Workflow verification cwd is outside its Git repository");
|
|
53
|
+
}
|
|
54
|
+
const submodules = await git(
|
|
55
|
+
repositoryRoot,
|
|
56
|
+
["submodule", "status", "--recursive"],
|
|
57
|
+
64 * 1024,
|
|
58
|
+
options.signal,
|
|
59
|
+
).catch((error) => {
|
|
60
|
+
throw normalizedGitError(error, "Workflow tree identity could not inspect submodules");
|
|
61
|
+
});
|
|
62
|
+
if (submodules.toString("utf8").trim()) {
|
|
63
|
+
throw new Error("Workflow tree identity does not support repositories with submodules");
|
|
64
|
+
}
|
|
65
|
+
const head = (
|
|
66
|
+
await git(repositoryRoot, ["rev-parse", "HEAD"], 64 * 1024, options.signal).catch((error) => {
|
|
67
|
+
throw normalizedGitError(error, "Workflow verification requires a stable Git HEAD");
|
|
68
|
+
})
|
|
69
|
+
)
|
|
70
|
+
.toString("utf8")
|
|
71
|
+
.trim();
|
|
72
|
+
if (!/^[a-f0-9]{40,64}$/u.test(head)) {
|
|
73
|
+
throw new Error("Workflow verification requires a stable Git HEAD");
|
|
74
|
+
}
|
|
75
|
+
const commandLimit = maxBytes + 1;
|
|
76
|
+
const indexDiff = await git(
|
|
77
|
+
repositoryRoot,
|
|
78
|
+
["diff", "--binary", "--no-ext-diff", "--cached", "HEAD", "--"],
|
|
79
|
+
commandLimit,
|
|
80
|
+
options.signal,
|
|
81
|
+
).catch((error) => {
|
|
82
|
+
throw normalizedGitError(error, "Workflow tree identity exceeded its size limit");
|
|
83
|
+
});
|
|
84
|
+
const worktreeDiff = await git(
|
|
85
|
+
repositoryRoot,
|
|
86
|
+
["diff", "--binary", "--no-ext-diff", "--"],
|
|
87
|
+
commandLimit,
|
|
88
|
+
options.signal,
|
|
89
|
+
).catch((error) => {
|
|
90
|
+
throw normalizedGitError(error, "Workflow tree identity exceeded its size limit");
|
|
91
|
+
});
|
|
92
|
+
if (indexDiff.length > maxBytes || worktreeDiff.length > maxBytes) {
|
|
93
|
+
throw new Error("Workflow tree identity exceeded its size limit");
|
|
94
|
+
}
|
|
95
|
+
const untrackedOutput = await git(
|
|
96
|
+
repositoryRoot,
|
|
97
|
+
["ls-files", "--others", "--exclude-standard", "-z"],
|
|
98
|
+
commandLimit,
|
|
99
|
+
options.signal,
|
|
100
|
+
).catch((error) => {
|
|
101
|
+
throw normalizedGitError(error, "Workflow tree identity exceeded its size limit");
|
|
102
|
+
});
|
|
103
|
+
const untrackedEntries = splitNul(untrackedOutput).sort(Buffer.compare);
|
|
104
|
+
if (untrackedEntries.length > MAX_UNTRACKED_FILES) {
|
|
105
|
+
throw new Error("Workflow tree identity exceeded its untracked-file limit");
|
|
106
|
+
}
|
|
107
|
+
if (indexDiff.length === 0 && worktreeDiff.length === 0 && untrackedEntries.length === 0) {
|
|
108
|
+
return identity("git-commit", hashParts([Buffer.from("commit\0"), Buffer.from(head)]));
|
|
109
|
+
}
|
|
110
|
+
let consumed = indexDiff.length + worktreeDiff.length + untrackedOutput.length;
|
|
111
|
+
if (consumed > maxBytes) throw new Error("Workflow tree identity exceeded its size limit");
|
|
112
|
+
const hasher = createHash("sha256");
|
|
113
|
+
hasher.update("pi-subagents:workflow-tree:v1\0");
|
|
114
|
+
updateHashFrame(hasher, "head", head);
|
|
115
|
+
updateHashFrame(hasher, "index-diff", indexDiff);
|
|
116
|
+
updateHashFrame(hasher, "worktree-diff", worktreeDiff);
|
|
117
|
+
for (const rawRelativePath of untrackedEntries) {
|
|
118
|
+
throwIfAborted(options.signal);
|
|
119
|
+
const relativePath = decodeGitPath(rawRelativePath);
|
|
120
|
+
const candidate = path.resolve(repositoryRoot, relativePath);
|
|
121
|
+
const relative = path.relative(repositoryRoot, candidate);
|
|
122
|
+
if (!relative || relative.startsWith("..") || path.isAbsolute(relative)) {
|
|
123
|
+
throw new Error("Workflow tree identity encountered an unsafe untracked path");
|
|
124
|
+
}
|
|
125
|
+
let bytes: Buffer;
|
|
126
|
+
let kind: string;
|
|
127
|
+
try {
|
|
128
|
+
const stat = await fs.promises.lstat(candidate);
|
|
129
|
+
if (stat.isSymbolicLink()) {
|
|
130
|
+
kind = "symlink";
|
|
131
|
+
bytes = Buffer.from(await fs.promises.readlink(candidate), "utf8");
|
|
132
|
+
} else if (stat.isFile()) {
|
|
133
|
+
kind = "file";
|
|
134
|
+
if (stat.size > maxBytes - consumed) {
|
|
135
|
+
throw new Error("Workflow tree identity exceeded its size limit");
|
|
136
|
+
}
|
|
137
|
+
bytes = await readRegularFileNoFollow(candidate, stat, options.signal);
|
|
138
|
+
} else {
|
|
139
|
+
throw new Error("Workflow tree identity encountered an unsupported untracked file type");
|
|
140
|
+
}
|
|
141
|
+
} catch (error) {
|
|
142
|
+
if (error instanceof Error && error.name === "AbortError") throw error;
|
|
143
|
+
if (error instanceof Error && error.message.startsWith("Workflow tree identity")) {
|
|
144
|
+
throw error;
|
|
145
|
+
}
|
|
146
|
+
throw new Error("Workflow tree identity could not read an untracked entry");
|
|
147
|
+
}
|
|
148
|
+
consumed += rawRelativePath.length + bytes.length;
|
|
149
|
+
if (consumed > maxBytes) throw new Error("Workflow tree identity exceeded its size limit");
|
|
150
|
+
updateHashFrame(hasher, "untracked-kind", kind);
|
|
151
|
+
updateHashFrame(hasher, "untracked-path", rawRelativePath);
|
|
152
|
+
updateHashFrame(hasher, "untracked-content", bytes);
|
|
153
|
+
}
|
|
154
|
+
return identity("git-dirty", hasher.digest("hex"));
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export function sameWorkflowTreeIdentity(
|
|
158
|
+
left: WorkflowTreeIdentity,
|
|
159
|
+
right: WorkflowTreeIdentity,
|
|
160
|
+
): boolean {
|
|
161
|
+
return (
|
|
162
|
+
isWorkflowTreeIdentity(left) &&
|
|
163
|
+
isWorkflowTreeIdentity(right) &&
|
|
164
|
+
left.kind === right.kind &&
|
|
165
|
+
left.digest === right.digest
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export function isWorkflowTreeIdentity(value: unknown): value is WorkflowTreeIdentity {
|
|
170
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
171
|
+
const candidate = value as Partial<WorkflowTreeIdentity>;
|
|
172
|
+
if (
|
|
173
|
+
Object.keys(value as Record<string, unknown>).some(
|
|
174
|
+
(key) => !["version", "kind", "digest"].includes(key),
|
|
175
|
+
)
|
|
176
|
+
) {
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
return (
|
|
180
|
+
candidate.version === WORKFLOW_TREE_IDENTITY_VERSION &&
|
|
181
|
+
(candidate.kind === "git-commit" || candidate.kind === "git-dirty") &&
|
|
182
|
+
typeof candidate.digest === "string" &&
|
|
183
|
+
/^[a-f0-9]{64}$/u.test(candidate.digest)
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function identity(kind: WorkflowTreeIdentity["kind"], digest: string): WorkflowTreeIdentity {
|
|
188
|
+
return { version: WORKFLOW_TREE_IDENTITY_VERSION, kind, digest };
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function hashParts(parts: Buffer[]): string {
|
|
192
|
+
const hash = createHash("sha256");
|
|
193
|
+
for (const part of parts) hash.update(part);
|
|
194
|
+
return hash.digest("hex");
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function updateHashFrame(hash: Hash, label: string, value: string | Buffer): void {
|
|
198
|
+
const labelBytes = Buffer.from(label, "utf8");
|
|
199
|
+
const valueBytes = typeof value === "string" ? Buffer.from(value, "utf8") : value;
|
|
200
|
+
const header = Buffer.allocUnsafe(8);
|
|
201
|
+
header.writeUInt32BE(labelBytes.length, 0);
|
|
202
|
+
header.writeUInt32BE(valueBytes.length, 4);
|
|
203
|
+
hash.update(header);
|
|
204
|
+
hash.update(labelBytes);
|
|
205
|
+
hash.update(valueBytes);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function splitNul(value: Buffer): Buffer[] {
|
|
209
|
+
const entries: Buffer[] = [];
|
|
210
|
+
let start = 0;
|
|
211
|
+
for (let index = 0; index < value.length; index++) {
|
|
212
|
+
if (value[index] !== 0) continue;
|
|
213
|
+
if (index > start) entries.push(value.subarray(start, index));
|
|
214
|
+
start = index + 1;
|
|
215
|
+
}
|
|
216
|
+
if (start < value.length) entries.push(value.subarray(start));
|
|
217
|
+
return entries;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function decodeGitPath(value: Buffer): string {
|
|
221
|
+
const decoded = value.toString("utf8");
|
|
222
|
+
if (!decoded || decoded.includes("\0") || !Buffer.from(decoded, "utf8").equals(value)) {
|
|
223
|
+
throw new Error("Workflow tree identity encountered an unsupported Git path encoding");
|
|
224
|
+
}
|
|
225
|
+
return decoded;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
async function readRegularFileNoFollow(
|
|
229
|
+
filePath: string,
|
|
230
|
+
expected: fs.Stats,
|
|
231
|
+
signal: AbortSignal | undefined,
|
|
232
|
+
): Promise<Buffer> {
|
|
233
|
+
throwIfAborted(signal);
|
|
234
|
+
const handle = await fs.promises.open(filePath, fs.constants.O_RDONLY | fs.constants.O_NOFOLLOW);
|
|
235
|
+
try {
|
|
236
|
+
const before = await handle.stat();
|
|
237
|
+
if (!before.isFile() || before.dev !== expected.dev || before.ino !== expected.ino) {
|
|
238
|
+
throw new Error("Workflow tree identity file changed during capture");
|
|
239
|
+
}
|
|
240
|
+
const content = await handle.readFile({ signal });
|
|
241
|
+
const after = await handle.stat();
|
|
242
|
+
if (
|
|
243
|
+
after.dev !== before.dev ||
|
|
244
|
+
after.ino !== before.ino ||
|
|
245
|
+
after.size !== before.size ||
|
|
246
|
+
after.mtimeMs !== before.mtimeMs
|
|
247
|
+
) {
|
|
248
|
+
throw new Error("Workflow tree identity file changed during capture");
|
|
249
|
+
}
|
|
250
|
+
return content;
|
|
251
|
+
} finally {
|
|
252
|
+
await handle.close();
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function git(
|
|
257
|
+
cwd: string,
|
|
258
|
+
args: string[],
|
|
259
|
+
maxBuffer: number,
|
|
260
|
+
signal?: AbortSignal,
|
|
261
|
+
): Promise<Buffer> {
|
|
262
|
+
throwIfAborted(signal);
|
|
263
|
+
return new Promise((resolve, reject) => {
|
|
264
|
+
execFile(
|
|
265
|
+
"git",
|
|
266
|
+
["-C", cwd, ...args],
|
|
267
|
+
{ encoding: "buffer", maxBuffer, signal },
|
|
268
|
+
(error, stdout) => {
|
|
269
|
+
if (error) reject(error);
|
|
270
|
+
else resolve(stdout);
|
|
271
|
+
},
|
|
272
|
+
);
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
function throwIfAborted(signal: AbortSignal | undefined): void {
|
|
277
|
+
if (!signal?.aborted) return;
|
|
278
|
+
const error = new Error("Workflow tree identity capture was cancelled");
|
|
279
|
+
error.name = "AbortError";
|
|
280
|
+
throw error;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function normalizedGitError(error: unknown, fallback: string): Error {
|
|
284
|
+
if (error instanceof Error && error.name === "AbortError") return error;
|
|
285
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
286
|
+
return new Error(
|
|
287
|
+
/maxBuffer|stdout.*large|SIGTERM/iu.test(message) ? `${fallback}: size limit` : fallback,
|
|
288
|
+
);
|
|
289
|
+
}
|
package/src/workflow-ui.ts
CHANGED
|
@@ -46,8 +46,8 @@ function workflowEffects(current: DelegationWorkflow, next: DelegationWorkflow):
|
|
|
46
46
|
if (blockingEnabled(current) !== blockingEnabled(next)) {
|
|
47
47
|
effects.push(
|
|
48
48
|
blockingEnabled(next)
|
|
49
|
-
? "Add blocking `subagent` and read-only `subagent_consult`"
|
|
50
|
-
: "Remove blocking `subagent` and read-only `subagent_consult`",
|
|
49
|
+
? "Add blocking `subagent`, explicit `subagent_auto`, and read-only `subagent_consult`"
|
|
50
|
+
: "Remove blocking `subagent`, explicit `subagent_auto`, and read-only `subagent_consult`",
|
|
51
51
|
);
|
|
52
52
|
}
|
|
53
53
|
if (asyncEnabled(current) !== asyncEnabled(next)) {
|