chore: remove all dryRun infrastructure

dryRun no longer needed — tests use mock agents + mock fetch instead.
Removes isDryRun from WorkflowFnOptions, dryRun from ExtractConfig,
dryRunMeta from RoleDefinition, --dry-run from CLI, and all related
plumbing in engine/worker/fork/extract.

小橘 <xiaoju@shazhou.work>
This commit is contained in:
2026-05-06 14:25:44 +00:00
parent fa9163e462
commit 2482fb7e62
26 changed files with 184 additions and 102 deletions
-2
View File
@@ -116,8 +116,6 @@ export function createWorkflow<M extends RoleMeta>(
const meta = await extractMetaOrThrow(next, raw, roleDef.schema, {
provider: extract.provider,
dryRun: extract.dryRun,
dryRunMeta: roleDef.dryRunMeta,
});
const ts = Date.now();
-3
View File
@@ -20,7 +20,6 @@ export type PrefilledDiskStep = {
};
export type ExecuteThreadOptions = {
isDryRun: boolean;
maxRounds: number;
signal: AbortSignal;
/** Invoked after each successful yield (and outer-loop checks); used for pause/resume. */
@@ -133,7 +132,6 @@ export async function executeThread(
parameters: {
prompt: input.prompt,
options: {
isDryRun: options.isDryRun,
maxRounds: options.maxRounds,
},
},
@@ -168,7 +166,6 @@ export async function executeThread(
const bundleOptions: WorkflowFnOptions = {
threadId: io.threadId,
isDryRun: options.isDryRun,
maxRounds: options.maxRounds,
};
+1 -3
View File
@@ -7,14 +7,12 @@ export async function extractMetaOrThrow<T extends Record<string, unknown>>(
roleName: string,
raw: string,
schema: z.ZodType<T>,
options: { provider: LlmProvider; dryRun: boolean; dryRunMeta: T },
options: { provider: LlmProvider },
): Promise<T> {
const result = await llmExtractWithRetry({
text: raw,
schema,
provider: options.provider,
dryRun: options.dryRun,
dryRunMeta: options.dryRunMeta,
});
if (!result.ok) {
throw new Error(
+4 -7
View File
@@ -9,7 +9,6 @@ export type ParsedThreadStartRecord = {
hash: string;
threadId: string;
prompt: string;
isDryRun: boolean;
maxRounds: number;
};
@@ -72,10 +71,9 @@ function parseStartRecordLine(firstLine: string): Result<ParsedThreadStartRecord
return err("start record missing parameters.options");
}
const optRec = options as Record<string, unknown>;
const isDryRun = optRec.isDryRun;
const maxRounds = optRec.maxRounds;
if (typeof isDryRun !== "boolean" || typeof maxRounds !== "number") {
return err("start record missing parameters.options.isDryRun or maxRounds");
if (typeof maxRounds !== "number") {
return err("start record missing parameters.options.maxRounds");
}
return ok({
@@ -83,7 +81,6 @@ function parseStartRecordLine(firstLine: string): Result<ParsedThreadStartRecord
hash,
threadId,
prompt,
isDryRun,
maxRounds,
});
}
@@ -197,7 +194,7 @@ export type ForkPlan = {
hash: string;
sourceThreadId: string;
prompt: string;
runOptions: { isDryRun: boolean; maxRounds: number };
runOptions: { maxRounds: number };
historicalSteps: ForkHistoricalStep[];
};
@@ -222,7 +219,7 @@ export function buildForkPlan(
hash: start.hash,
sourceThreadId: start.threadId,
prompt: start.prompt,
runOptions: { isDryRun: start.isDryRun, maxRounds: start.maxRounds },
runOptions: { maxRounds: start.maxRounds },
historicalSteps: selected.value,
});
}
-7
View File
@@ -7,9 +7,6 @@ export type LlmExtractArgs<T> = {
text: string;
schema: z.ZodType<T>;
provider: LlmProvider;
dryRun: boolean;
/** Returned when `dryRun` is true (ignored for live extract). */
dryRunMeta: T;
};
export type LlmError =
@@ -127,10 +124,6 @@ export function llmErrorToCause(error: LlmError): Error {
async function performLlmExtract<T>(
options: LlmExtractArgs<T> & { userContent: string },
): Promise<Result<T, LlmError>> {
if (options.dryRun) {
return ok(options.dryRunMeta);
}
const rawJsonSchema = z.toJSONSchema(options.schema) as Record<string, unknown>;
const parameters = stripJsonSchemaMeta(rawJsonSchema);
const toolName = readToolName(parameters);
+1 -4
View File
@@ -36,7 +36,6 @@ export type ThreadInput = {
/** Options passed to a workflow bundle's `run` export (engine-provided). */
export type WorkflowFnOptions = {
threadId: string;
isDryRun: boolean;
maxRounds: number;
};
@@ -82,15 +81,13 @@ export type AgentBinding = {
/** Structured extraction settings for the workflow engine. */
export type ExtractConfig = {
provider: LlmProvider;
dryRun: boolean;
};
/** Role wiring: prompts, schema, dry-run meta, and human-readable description. */
/** Role wiring: prompts, schema, and human-readable description. */
export type RoleDefinition<Meta extends Record<string, unknown>> = {
description: string;
systemPrompt: string;
schema: z.ZodType<Meta>;
dryRunMeta: Meta;
};
/**
+3 -4
View File
@@ -16,7 +16,7 @@ type RunCommand = {
threadId: string;
workflowName: string;
prompt: string;
options: { isDryRun: boolean; maxRounds: number };
options: { maxRounds: number };
steps: RoleOutput[];
/** Timestamps aligned with `steps` for `.data.jsonl` replay; length must match `steps` when non-null. */
stepTimestamps: number[] | null;
@@ -114,9 +114,8 @@ function parseRunControlPayload(rec: Record<string, unknown>): RunCommand | null
return null;
}
const optRec = options as Record<string, unknown>;
const isDryRun = optRec.isDryRun;
const maxRounds = optRec.maxRounds;
if (typeof isDryRun !== "boolean" || typeof maxRounds !== "number") {
if (typeof maxRounds !== "number") {
return null;
}
const parsedSteps = parseRunStepsPayload(rec);
@@ -136,7 +135,7 @@ function parseRunControlPayload(rec: Record<string, unknown>): RunCommand | null
threadId,
workflowName,
prompt,
options: { isDryRun, maxRounds },
options: { maxRounds },
steps: parsedSteps.steps,
stepTimestamps: parsedSteps.stepTimestamps,
forkSourceThreadId,