@llm4ts/shell 0.6.0 → 0.6.2
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/dist/Cli.d.ts +2 -2
- package/dist/Cli.js +3 -3
- package/dist/Cli.js.map +1 -1
- package/dist/FlowCatalog.d.ts.map +1 -1
- package/dist/FlowCatalog.js +6 -2
- package/dist/FlowCatalog.js.map +1 -1
- package/flows/implement.js +29 -0
- package/flows/issue-pr.js +71 -0
- package/flows/judge-suite.js +48 -0
- package/flows/local.js +40 -0
- package/flows/modernize-bench.js +264 -0
- package/flows/modernize-extract.js +455 -0
- package/flows/modernize-implement.js +249 -0
- package/flows/modernize-review.js +237 -0
- package/flows/modernize-seed.js +189 -0
- package/flows/modernize-survey.js +0 -0
- package/flows/modernize-verify.js +435 -0
- package/flows/sdd.js +114 -0
- package/package.json +5 -5
- package/src/Cli.ts +3 -3
- package/src/FlowCatalog.ts +8 -2
- package/flows/implement.ts +0 -38
- package/flows/issue-pr.ts +0 -108
- package/flows/judge-suite.ts +0 -63
- package/flows/local.ts +0 -59
- package/flows/modernize-bench.ts +0 -368
- package/flows/modernize-extract.ts +0 -642
- package/flows/modernize-implement.ts +0 -340
- package/flows/modernize-review.ts +0 -351
- package/flows/modernize-seed.ts +0 -266
- package/flows/modernize-survey.ts +0 -0
- package/flows/modernize-verify.ts +0 -618
- package/flows/sdd.ts +0 -181
package/dist/Cli.d.ts
CHANGED
|
@@ -23,8 +23,8 @@ export declare const renderFlowList: (flows: ReadonlyArray<DiscoveredFlow>, opti
|
|
|
23
23
|
}) => string;
|
|
24
24
|
/**
|
|
25
25
|
* Resolves a flow argument to a runnable script path: an explicit path (a
|
|
26
|
-
* value containing a separator or ending in `.ts`) is used as-is,
|
|
27
|
-
* else is looked up by name in the discovery listing.
|
|
26
|
+
* value containing a separator or ending in `.ts`/`.js`) is used as-is,
|
|
27
|
+
* anything else is looked up by name in the discovery listing.
|
|
28
28
|
*/
|
|
29
29
|
export declare const resolveFlow: (reference: string, tiers: FlowTierPaths) => Effect.Effect<string, ShellUsageError, FileSystem>;
|
|
30
30
|
export declare const shellCommand: Command.Command<"llm4ts", {} | {}, {}, import("./FlowLaunch.ts").FlowLaunchError | ShellUsageError | ShellActionError, import("effect/unstable/cli/Prompt").Environment>;
|
package/dist/Cli.js
CHANGED
|
@@ -53,11 +53,11 @@ export const renderFlowList = (flows, options) => {
|
|
|
53
53
|
};
|
|
54
54
|
/**
|
|
55
55
|
* Resolves a flow argument to a runnable script path: an explicit path (a
|
|
56
|
-
* value containing a separator or ending in `.ts`) is used as-is,
|
|
57
|
-
* else is looked up by name in the discovery listing.
|
|
56
|
+
* value containing a separator or ending in `.ts`/`.js`) is used as-is,
|
|
57
|
+
* anything else is looked up by name in the discovery listing.
|
|
58
58
|
*/
|
|
59
59
|
export const resolveFlow = Effect.fn("@llm4ts/shell/Cli.resolveFlow")(function* (reference, tiers) {
|
|
60
|
-
if (reference.includes("/") || reference.endsWith(".ts")) {
|
|
60
|
+
if (reference.includes("/") || reference.endsWith(".ts") || reference.endsWith(".js")) {
|
|
61
61
|
const fs = yield* FileSystem;
|
|
62
62
|
const exists = yield* fs.exists(reference).pipe(Effect.orElseSucceed(() => false));
|
|
63
63
|
if (!exists) {
|
package/dist/Cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cli.js","sourceRoot":"","sources":["../src/Cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,QAAQ,MAAM,8BAA8B,CAAA;AACx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,MAAM,aAAa,8EAwBxB,CAAA"}
|
package/dist/FlowCatalog.js
CHANGED
|
@@ -36,19 +36,23 @@ export const defaultTierPaths = (options) => {
|
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
38
|
const tierOrder = ["project", "global", "builtin"];
|
|
39
|
+
// User-authored flows are .ts (launched with type stripping); the built-in
|
|
40
|
+
// tier ships .js because Node refuses to strip types under node_modules.
|
|
41
|
+
const flowExtension = (entry) => entry.endsWith(".ts") ? ".ts" : entry.endsWith(".js") ? ".js" : undefined;
|
|
39
42
|
const listTier = Effect.fn("@llm4ts/shell/FlowCatalog.listTier")(function* (tier, directory) {
|
|
40
43
|
const fs = yield* FileSystem;
|
|
41
44
|
const entries = yield* fs.readDirectory(directory).pipe(Effect.orElseSucceed(() => []));
|
|
42
45
|
const flows = [];
|
|
43
46
|
for (const entry of [...entries].sort()) {
|
|
44
|
-
|
|
47
|
+
const extension = flowExtension(entry);
|
|
48
|
+
if (extension === undefined) {
|
|
45
49
|
continue;
|
|
46
50
|
}
|
|
47
51
|
const path = join(directory, entry);
|
|
48
52
|
const source = yield* fs.readFileString(path).pipe(Effect.orElseSucceed(() => ""));
|
|
49
53
|
const description = parseFlowDescription(source);
|
|
50
54
|
flows.push({
|
|
51
|
-
name: entry.slice(0, -
|
|
55
|
+
name: entry.slice(0, -extension.length),
|
|
52
56
|
path,
|
|
53
57
|
tier,
|
|
54
58
|
...(description === undefined ? {} : { description })
|
package/dist/FlowCatalog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlowCatalog.js","sourceRoot":"","sources":["../src/FlowCatalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAkB9C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,M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AAI,GAAG,EAGnB,CAAA;IACH,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;QAC7B,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,CAAA;QAC7B,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC5B,SAAQ;QACV,CAAC;QACD,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,CAAC;YACpD,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACtC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC3B,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAA;YAC9C,CAAC;iBAAM,CAAC;gBACN,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAC7B,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;SACxB,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAkB,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;SAClE,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;AAC/D,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Persistent plan: plan the task, then implement, review, and commit one task at a time.
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import { implementPlanFlow } from "@llm4ts/flow/Flow";
|
|
5
|
+
import { defaultPlanPath } from "@llm4ts/flow/Plan";
|
|
6
|
+
import { planFrom } from "@llm4ts/flow/Planner";
|
|
7
|
+
import { makePlanStore } from "@llm4ts/flow/Persistence";
|
|
8
|
+
import { coderFromEnv } from "@llm4ts/runner/Connectors";
|
|
9
|
+
import { resolveFlowInput } from "@llm4ts/runner/FlowArgs";
|
|
10
|
+
import { runFlowMain, runNode } from "@llm4ts/runner/FlowRunner";
|
|
11
|
+
import { nodePlainFileStore } from "@llm4ts/runner/NodePlainFileStore";
|
|
12
|
+
const program = Effect.gen(function* () {
|
|
13
|
+
const input = yield* resolveFlowInput("Add a multiply function to the calculator, including focused tests.");
|
|
14
|
+
const planPath = join(input.workDir, defaultPlanPath(input.prompt));
|
|
15
|
+
const store = makePlanStore(nodePlainFileStore);
|
|
16
|
+
yield* runNode({
|
|
17
|
+
workDir: input.workDir,
|
|
18
|
+
workspace: input.workspace,
|
|
19
|
+
userPrompt: input.prompt,
|
|
20
|
+
coder: coderFromEnv(process.env),
|
|
21
|
+
environment: process.env
|
|
22
|
+
}, (context) => implementPlanFlow(context, {
|
|
23
|
+
store,
|
|
24
|
+
planPath,
|
|
25
|
+
plan: planFrom(context.reasoning, input.prompt),
|
|
26
|
+
system: "Implement one task at a time in the current repository."
|
|
27
|
+
}));
|
|
28
|
+
});
|
|
29
|
+
runFlowMain(program);
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// GitHub issue to pull request: assess the issue, plan, implement, push, and open a PR.
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import { implementPlanFlow } from "@llm4ts/flow/Flow";
|
|
5
|
+
import { FlowAborted } from "@llm4ts/flow/FlowError";
|
|
6
|
+
import { parseIssueRef } from "@llm4ts/flow/GitHubTool";
|
|
7
|
+
import { stage } from "@llm4ts/flow/PlanExecution";
|
|
8
|
+
import { assessThenPlan } from "@llm4ts/flow/Planner";
|
|
9
|
+
import { makePlanStore } from "@llm4ts/flow/Persistence";
|
|
10
|
+
import { summarisePr } from "@llm4ts/flow/PrSummary";
|
|
11
|
+
import { allReviewers } from "@llm4ts/flow/Review";
|
|
12
|
+
import { ScriptUsage, resolveFlowInput } from "@llm4ts/runner/FlowArgs";
|
|
13
|
+
import { coderFromEnv } from "@llm4ts/runner/Connectors";
|
|
14
|
+
import { runFlowMain, runNode } from "@llm4ts/runner/FlowRunner";
|
|
15
|
+
import { nodePlainFileStore } from "@llm4ts/runner/NodePlainFileStore";
|
|
16
|
+
const program = Effect.gen(function* () {
|
|
17
|
+
const input = yield* resolveFlowInput();
|
|
18
|
+
const issueRef = parseIssueRef(input.prompt);
|
|
19
|
+
if (issueRef === undefined) {
|
|
20
|
+
return yield* ScriptUsage.make({
|
|
21
|
+
message: 'usage: the issue-pr flow expects an issue reference like "owner/repository#42"'
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
const store = makePlanStore(nodePlainFileStore);
|
|
25
|
+
const planPath = join(input.workDir, `.llm4ts/issue-${issueRef.number}.md`);
|
|
26
|
+
yield* runNode({
|
|
27
|
+
workDir: input.workDir,
|
|
28
|
+
workspace: input.workspace,
|
|
29
|
+
userPrompt: input.prompt,
|
|
30
|
+
coder: coderFromEnv(process.env),
|
|
31
|
+
environment: process.env
|
|
32
|
+
}, (context) => Effect.gen(function* () {
|
|
33
|
+
const startBranch = yield* context.git.currentBranch;
|
|
34
|
+
const issue = yield* stage(context.events, `read issue ${issueRef.shortRef}`, context.hosting.readIssue(issueRef));
|
|
35
|
+
const payload = [
|
|
36
|
+
`Issue: ${issue.title}`,
|
|
37
|
+
"",
|
|
38
|
+
`Reporter: ${issue.author}`,
|
|
39
|
+
"",
|
|
40
|
+
issue.body
|
|
41
|
+
].join("\n");
|
|
42
|
+
const stored = yield* store.load(planPath);
|
|
43
|
+
const plan = stored ??
|
|
44
|
+
(yield* assessThenPlan(context.reasoning, payload).pipe(Effect.flatMap((verdict) => verdict.kind === "Blocked"
|
|
45
|
+
? stage(context.events, "post assessment on issue", context.hosting.writeIssueComment(issueRef, verdict.reason)).pipe(Effect.as(undefined))
|
|
46
|
+
: store.save(planPath, verdict.value).pipe(Effect.as(verdict.value)))));
|
|
47
|
+
if (plan === undefined) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const completed = yield* implementPlanFlow(context, {
|
|
51
|
+
store,
|
|
52
|
+
planPath,
|
|
53
|
+
plan: Effect.succeed(plan),
|
|
54
|
+
system: "Implement one issue task at a time in the current repository.",
|
|
55
|
+
reviewers: allReviewers
|
|
56
|
+
});
|
|
57
|
+
yield* stage(context.events, "push branch", context.git.push("origin", completed.epicId));
|
|
58
|
+
const base = yield* context.git.defaultBase;
|
|
59
|
+
const diff = yield* context.git.diffVsBase(base);
|
|
60
|
+
if (diff.trim().length === 0) {
|
|
61
|
+
return yield* FlowAborted.make({
|
|
62
|
+
message: `no changes found against ${base}`
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
const summary = yield* stage(context.events, "summarise pull request", summarisePr(context.reasoning, diff, `Originating issue: ${issueRef.shortRef}\nTitle: ${issue.title}`));
|
|
66
|
+
yield* stage(context.events, "open pull request", context.hosting.createPr(summary.title, `${summary.body}\n\nCloses ${issueRef.shortRef}.`, base));
|
|
67
|
+
yield* store.remove(planPath);
|
|
68
|
+
yield* stage(context.events, `return to ${startBranch}`, context.git.checkout(startBranch));
|
|
69
|
+
}));
|
|
70
|
+
});
|
|
71
|
+
runFlowMain(program);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// LLM-as-a-Judge evaluation: three scored runs across rubric dimensions with variance reporting.
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import { Dimension, Sample, repeat } from "@llm4ts/core/eval/Eval";
|
|
4
|
+
import { judge } from "@llm4ts/core/eval/Judge";
|
|
5
|
+
import { Info } from "@llm4ts/flow/FlowEvents";
|
|
6
|
+
import { coderFromEnv } from "@llm4ts/runner/Connectors";
|
|
7
|
+
import { resolveFlowInput } from "@llm4ts/runner/FlowArgs";
|
|
8
|
+
import { runFlowMain, runNode } from "@llm4ts/runner/FlowRunner";
|
|
9
|
+
const dimensions = [
|
|
10
|
+
Dimension.make({
|
|
11
|
+
name: "correctness",
|
|
12
|
+
rubric: "Does the response answer the request accurately?"
|
|
13
|
+
}),
|
|
14
|
+
Dimension.make({
|
|
15
|
+
name: "groundedness",
|
|
16
|
+
rubric: "Is every claim supported by the supplied context?"
|
|
17
|
+
}),
|
|
18
|
+
Dimension.make({
|
|
19
|
+
name: "safety",
|
|
20
|
+
rubric: "Does the response avoid secrets, PII, and unsafe instructions?"
|
|
21
|
+
})
|
|
22
|
+
];
|
|
23
|
+
const program = Effect.gen(function* () {
|
|
24
|
+
const input = yield* resolveFlowInput("You can return an unopened item within 30 days with its receipt.");
|
|
25
|
+
const selected = coderFromEnv(process.env);
|
|
26
|
+
yield* runNode({
|
|
27
|
+
workDir: input.workDir,
|
|
28
|
+
workspace: input.workspace,
|
|
29
|
+
userPrompt: input.prompt,
|
|
30
|
+
coder: selected,
|
|
31
|
+
environment: process.env
|
|
32
|
+
}, (context) => Effect.gen(function* () {
|
|
33
|
+
const evaluator = judge(context.reasoning, dimensions);
|
|
34
|
+
const result = yield* repeat(evaluator, Sample.make({
|
|
35
|
+
query: "Can I return an unopened purchase?",
|
|
36
|
+
context: "Returns are accepted within 30 days when accompanied by a receipt.",
|
|
37
|
+
response: input.prompt,
|
|
38
|
+
expected: "Explain the 30-day and receipt requirements."
|
|
39
|
+
}), 3);
|
|
40
|
+
yield* context.events.publish(Info.make({
|
|
41
|
+
message: JSON.stringify({
|
|
42
|
+
scores: result.aggregate.scores,
|
|
43
|
+
flakyDimensions: result.flakyDimensions
|
|
44
|
+
})
|
|
45
|
+
}));
|
|
46
|
+
}));
|
|
47
|
+
});
|
|
48
|
+
runFlowMain(program);
|
package/flows/local.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Local-first flow: an LM Studio reasoner drafts the plan, a local pi agent implements it.
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import { completeAndPublish } from "@llm4ts/flow/Flow";
|
|
4
|
+
import { AssistantMessage, Info } from "@llm4ts/flow/FlowEvents";
|
|
5
|
+
import { lmStudio, pi, withModel, withTimeoutSeconds } from "@llm4ts/runner/Connectors";
|
|
6
|
+
import { resolveFlowInput } from "@llm4ts/runner/FlowArgs";
|
|
7
|
+
import { runFlowMain, runNode } from "@llm4ts/runner/FlowRunner";
|
|
8
|
+
const reasoningModel = process.env.LLM4TS_REASONING_MODEL ?? "qwen/qwen3-coder-30b";
|
|
9
|
+
const coderModel = process.env.LLM4TS_CODER_MODEL ?? reasoningModel;
|
|
10
|
+
const program = Effect.gen(function* () {
|
|
11
|
+
const input = yield* resolveFlowInput("Add a multiply function to the calculator, including focused tests.");
|
|
12
|
+
yield* runNode({
|
|
13
|
+
workDir: input.workDir,
|
|
14
|
+
workspace: input.workspace,
|
|
15
|
+
userPrompt: input.prompt,
|
|
16
|
+
coder: withModel(pi, coderModel),
|
|
17
|
+
reasoning: withTimeoutSeconds(withModel(lmStudio, reasoningModel), 600),
|
|
18
|
+
environment: process.env
|
|
19
|
+
}, (context) => Effect.gen(function* () {
|
|
20
|
+
yield* context.events.publish(Info.make({ message: "local reasoner: preparing plan" }));
|
|
21
|
+
const plan = yield* completeAndPublish(context.reasoning, context.events, [
|
|
22
|
+
"Read the request and propose a concise, repository-aware implementation plan.",
|
|
23
|
+
"Call out the exact files and tests the coding agent should inspect.",
|
|
24
|
+
"",
|
|
25
|
+
input.prompt
|
|
26
|
+
].join("\n"));
|
|
27
|
+
yield* context.events.publish(AssistantMessage.make({ text: "Handing the local plan to pi." }));
|
|
28
|
+
yield* completeAndPublish(context.coder, context.events, [
|
|
29
|
+
"Implement the request in the current repository.",
|
|
30
|
+
"Use this plan as guidance, but verify it against the actual code. Run relevant tests and summarize the result.",
|
|
31
|
+
"",
|
|
32
|
+
"Request:",
|
|
33
|
+
input.prompt,
|
|
34
|
+
"",
|
|
35
|
+
"Plan:",
|
|
36
|
+
plan
|
|
37
|
+
].join("\n"));
|
|
38
|
+
}));
|
|
39
|
+
});
|
|
40
|
+
runFlowMain(program);
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
// Legacy modernization benchmark: measure an extraction run and report the cost of a wave.
|
|
2
|
+
//
|
|
3
|
+
// Two modes:
|
|
4
|
+
//
|
|
5
|
+
// report — `modernize-bench --repo <anything> report` (or LLM4TS_BENCH_MODE=report)
|
|
6
|
+
// loads bench-results.jsonl next to the launch directory and prints
|
|
7
|
+
// the comparison report. LLM4TS_BENCH_PROJECT=<n> adds the per-wave
|
|
8
|
+
// projection modernize-survey embeds in its wave plan.
|
|
9
|
+
//
|
|
10
|
+
// measure — the default. Runs the extraction pipeline over the estate at
|
|
11
|
+
// `--repo`, taps the flow's own events for per-stage tokens, cost,
|
|
12
|
+
// and self-healing counters, then appends one schema-versioned
|
|
13
|
+
// BenchRecord to bench-results.jsonl. Extraction is the dominant
|
|
14
|
+
// cost of a modernization wave, so its measurement is what a wave
|
|
15
|
+
// projection needs.
|
|
16
|
+
//
|
|
17
|
+
// The measured run writes into the estate exactly as modernize-extract would;
|
|
18
|
+
// point it at a disposable fixture copy, not a live estate.
|
|
19
|
+
//
|
|
20
|
+
// Run: modernize-bench --repo ~/estates/fixture-copy
|
|
21
|
+
import { arch, cpus, hostname, totalmem, type as osType } from "node:os";
|
|
22
|
+
import { join } from "node:path";
|
|
23
|
+
import * as Effect from "effect/Effect";
|
|
24
|
+
import { Sample } from "@llm4ts/core/eval/Eval";
|
|
25
|
+
import { judge } from "@llm4ts/core/eval/Judge";
|
|
26
|
+
import { BenchJudge, BenchMachine, BenchQuality, BenchRecord, BenchScore, CurrentBenchSchema, makeBenchPhase, makeBenchTap } from "@llm4ts/flow/Bench";
|
|
27
|
+
import { loadBenchRecords, appendBenchRecord, renderBenchReport } from "@llm4ts/flow/BenchReport";
|
|
28
|
+
import { FlowAborted, FlowLlmError } from "@llm4ts/flow/FlowError";
|
|
29
|
+
import { Info, TokensUsed } from "@llm4ts/flow/FlowEvents";
|
|
30
|
+
import { packageVersion } from "@llm4ts/flow/Package";
|
|
31
|
+
import { stage } from "@llm4ts/flow/PlanExecution";
|
|
32
|
+
import { mergeReviewResults } from "@llm4ts/flow/Review";
|
|
33
|
+
import { coverage, coverageUnits, features, matchingFiles } from "@llm4ts/flow/SpecChecks";
|
|
34
|
+
import { legacySourceWorkspaceLimits, workspaceLimitsFromEnv } from "@llm4ts/flow/Workspace";
|
|
35
|
+
import { ProgramArtifacts, ProgramUnit, extractProgramsResumably } from "@llm4ts/modernize/Artifacts";
|
|
36
|
+
import { asReadOnly, coderFromEnv } from "@llm4ts/runner/Connectors";
|
|
37
|
+
import { resolveFlowInput } from "@llm4ts/runner/FlowArgs";
|
|
38
|
+
import { runFlowMain, runNode } from "@llm4ts/runner/FlowRunner";
|
|
39
|
+
import { nodePlainFileStore } from "@llm4ts/runner/NodePlainFileStore";
|
|
40
|
+
import { makeNodeWorkspace } from "@llm4ts/runner/NodeWorkspace";
|
|
41
|
+
import { openPack } from "@llm4ts/runner/Packs";
|
|
42
|
+
import { reviewFingerprint } from "@llm4ts/runner/ReviewFingerprint";
|
|
43
|
+
const ModDir = "docs/modernization";
|
|
44
|
+
const BenchFile = "bench-results.jsonl";
|
|
45
|
+
const programName = (relativePath) => {
|
|
46
|
+
const base = relativePath.slice(relativePath.lastIndexOf("/") + 1);
|
|
47
|
+
const dot = base.lastIndexOf(".");
|
|
48
|
+
return dot > 0 ? base.slice(0, dot) : base;
|
|
49
|
+
};
|
|
50
|
+
const machine = () => BenchMachine.make({
|
|
51
|
+
hostname: hostname(),
|
|
52
|
+
os: osType(),
|
|
53
|
+
arch: arch(),
|
|
54
|
+
cores: cpus().length,
|
|
55
|
+
memoryGb: Math.round((totalmem() / 1024 ** 3) * 10) / 10,
|
|
56
|
+
runtime: `node ${process.versions.node}`
|
|
57
|
+
});
|
|
58
|
+
const program = Effect.gen(function* () {
|
|
59
|
+
const input = yield* resolveFlowInput("Benchmark a modernization extraction run");
|
|
60
|
+
const mode = process.env.LLM4TS_BENCH_MODE?.trim() ??
|
|
61
|
+
(input.prompt.trim().toLowerCase() === "report" ? "report" : "measure");
|
|
62
|
+
const files = nodePlainFileStore;
|
|
63
|
+
const benchPath = join(input.workspace, BenchFile);
|
|
64
|
+
const coder = coderFromEnv(process.env);
|
|
65
|
+
const startedAt = new Date();
|
|
66
|
+
if (mode === "report") {
|
|
67
|
+
const records = yield* loadBenchRecords(files, benchPath);
|
|
68
|
+
if (records.length === 0) {
|
|
69
|
+
return yield* FlowAborted.make({ message: `no benchmark records at ${benchPath}` });
|
|
70
|
+
}
|
|
71
|
+
const projected = Number.parseInt(process.env.LLM4TS_BENCH_PROJECT ?? "", 10);
|
|
72
|
+
process.stdout.write(`${renderBenchReport(records, Number.isFinite(projected) && projected > 0 ? projected : undefined)}\n`);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
yield* runNode({
|
|
76
|
+
workDir: input.workDir,
|
|
77
|
+
workspace: input.workspace,
|
|
78
|
+
userPrompt: input.prompt,
|
|
79
|
+
coder,
|
|
80
|
+
reasoning: asReadOnly(coder),
|
|
81
|
+
environment: process.env
|
|
82
|
+
}, (context) => Effect.scoped(Effect.gen(function* () {
|
|
83
|
+
const estate = yield* makeNodeWorkspace(input.workDir, workspaceLimitsFromEnv(process.env, legacySourceWorkspaceLimits));
|
|
84
|
+
const { pack } = yield* stage(context.events, "pack", openPack({
|
|
85
|
+
environment: process.env,
|
|
86
|
+
launchDir: input.workspace,
|
|
87
|
+
flowDir: import.meta.dirname
|
|
88
|
+
}));
|
|
89
|
+
const modDirAbs = join(input.workDir, ModDir);
|
|
90
|
+
// The tap observes the same events the terminal renders, so the
|
|
91
|
+
// measurement never needs its own instrumentation inside the flow.
|
|
92
|
+
const tap = yield* makeBenchTap(context.events);
|
|
93
|
+
const phases = [];
|
|
94
|
+
const measured = (name, body) => Effect.gen(function* () {
|
|
95
|
+
yield* tap.reset;
|
|
96
|
+
const began = Date.now();
|
|
97
|
+
const value = yield* stage(context.events, name, body);
|
|
98
|
+
const observation = yield* tap.get;
|
|
99
|
+
phases.push(makeBenchPhase(observation, name, Date.now() - began));
|
|
100
|
+
return value;
|
|
101
|
+
});
|
|
102
|
+
const programs = yield* measured("inventory", matchingFiles(estate, pack.programs ?? pack.sources ?? ".*"));
|
|
103
|
+
if (programs.length === 0) {
|
|
104
|
+
return yield* FlowAborted.make({
|
|
105
|
+
message: `no source units matched the pack's programs/sources regex under ${input.workDir}`
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
const units = programs.map((relativePath) => ProgramUnit.make({ name: programName(relativePath), sourcePath: relativePath }));
|
|
109
|
+
const system = [
|
|
110
|
+
pack.prompt("analysis"),
|
|
111
|
+
pack.lessons === undefined
|
|
112
|
+
? undefined
|
|
113
|
+
: `Lessons from previous modernization runs — apply them:\n${pack.lessons}`
|
|
114
|
+
]
|
|
115
|
+
.filter((part) => part !== undefined)
|
|
116
|
+
.join("\n\n");
|
|
117
|
+
/**
|
|
118
|
+
* Structured calls report usage only to their caller; the Chat seam
|
|
119
|
+
* is what normally publishes `TokensUsed` (ADR 0005). A benchmark
|
|
120
|
+
* that skipped this would measure wall-clock and nothing else, so
|
|
121
|
+
* every measured call republishes its own usage for the tap.
|
|
122
|
+
*/
|
|
123
|
+
const publishUsage = (agent, usage, model) => context.events.publish(TokensUsed.make({
|
|
124
|
+
agent,
|
|
125
|
+
usage,
|
|
126
|
+
...(model === undefined ? {} : { model })
|
|
127
|
+
}));
|
|
128
|
+
yield* measured("extract", extractProgramsResumably(files, units, (unit) => context.coder
|
|
129
|
+
.executeStructuredWithUsage([
|
|
130
|
+
system,
|
|
131
|
+
"",
|
|
132
|
+
`Extract the behavioural spec for ONE source unit: ${unit.sourcePath}`,
|
|
133
|
+
'Respond only with JSON: {"spec":"…","feature":"…","traceability":"…","mapping":"…"}.',
|
|
134
|
+
pack.prompt("spec") ?? "",
|
|
135
|
+
pack.prompt("bdd") ?? ""
|
|
136
|
+
].join("\n"), ProgramArtifacts, { type: "object" })
|
|
137
|
+
.pipe(Effect.mapError(FlowLlmError.from), Effect.tap(([, usage, model]) => usage === undefined ? Effect.void : publishUsage("coder", usage, model)), Effect.map(([artifacts]) => artifacts)), modDirAbs));
|
|
138
|
+
// The deterministic half of the extraction gate, measured on its own:
|
|
139
|
+
// it is the part a slower model cannot make cheaper.
|
|
140
|
+
const deterministic = yield* measured("gate", Effect.gen(function* () {
|
|
141
|
+
const fragments = [];
|
|
142
|
+
for (const unit of units) {
|
|
143
|
+
const text = yield* files.read(join(modDirAbs, "traceability", `${unit.name}.md`));
|
|
144
|
+
if (text !== undefined) {
|
|
145
|
+
fragments.push(text);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
const trace = fragments.join("\n\n");
|
|
149
|
+
const covered = yield* coverage(estate, pack.coverage, trace);
|
|
150
|
+
const wellFormed = yield* features(estate, `${ModDir}/features`);
|
|
151
|
+
return mergeReviewResults([covered, wellFormed]);
|
|
152
|
+
}));
|
|
153
|
+
/**
|
|
154
|
+
* The evaluator has no usage-reporting variant, so the seat it runs
|
|
155
|
+
* on is wrapped instead: every structured call it makes reports its
|
|
156
|
+
* usage to the tap before returning the value.
|
|
157
|
+
*/
|
|
158
|
+
const metered = {
|
|
159
|
+
...context.reasoning,
|
|
160
|
+
executeStructured: (prompt, schema, jsonSchema) => context.reasoning.executeStructuredWithUsage(prompt, schema, jsonSchema).pipe(Effect.tap(([, usage, model]) => usage === undefined ? Effect.void : publishUsage("reasoning", usage, model)), Effect.map(([value]) => value))
|
|
161
|
+
};
|
|
162
|
+
const judged = yield* measured("judge", Effect.gen(function* () {
|
|
163
|
+
const packJudge = judge(metered, pack.judgeDimensions);
|
|
164
|
+
const scores = [];
|
|
165
|
+
let findings = 0;
|
|
166
|
+
for (const unit of units) {
|
|
167
|
+
const spec = (yield* files.read(join(modDirAbs, "specs", `${unit.name}.md`))) ?? "";
|
|
168
|
+
const source = (yield* files.read(join(input.workDir, unit.sourcePath))) ?? "";
|
|
169
|
+
const scored = yield* packJudge
|
|
170
|
+
.evaluate(Sample.make({ response: spec, context: source, query: input.prompt }))
|
|
171
|
+
.pipe(Effect.mapError(FlowLlmError.from));
|
|
172
|
+
for (const score of scored.scores) {
|
|
173
|
+
const max = pack.judgeDimensions.find((d) => d.name === score.name)?.maxScore ?? 2;
|
|
174
|
+
scores.push(BenchScore.make({
|
|
175
|
+
name: `${unit.name}:${score.name}`,
|
|
176
|
+
score: score.score,
|
|
177
|
+
max,
|
|
178
|
+
reasoning: score.reasoning
|
|
179
|
+
}));
|
|
180
|
+
if (score.score < max) {
|
|
181
|
+
findings += 1;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return { scores, findings };
|
|
186
|
+
}));
|
|
187
|
+
const quality = yield* Effect.gen(function* () {
|
|
188
|
+
const specFiles = yield* matchingFiles(estate, `^${ModDir}/specs/.*\\.md$`).pipe(Effect.orElseSucceed(() => []));
|
|
189
|
+
const featureFiles = yield* matchingFiles(estate, `^${ModDir}/features/.*\\.feature$`).pipe(Effect.orElseSucceed(() => []));
|
|
190
|
+
let scenarios = 0;
|
|
191
|
+
for (const path of featureFiles) {
|
|
192
|
+
const text = yield* estate.read(path).pipe(Effect.orElseSucceed(() => ""));
|
|
193
|
+
scenarios += text
|
|
194
|
+
.split(/\r?\n/)
|
|
195
|
+
.filter((line) => line.trim().startsWith("Scenario")).length;
|
|
196
|
+
}
|
|
197
|
+
let sourceLines = 0;
|
|
198
|
+
for (const path of programs) {
|
|
199
|
+
const text = yield* estate.read(path).pipe(Effect.orElseSucceed(() => ""));
|
|
200
|
+
sourceLines += text.split(/\r?\n/).length;
|
|
201
|
+
}
|
|
202
|
+
const units_ = yield* coverageUnits(estate, pack.coverage);
|
|
203
|
+
const malformed = (yield* features(estate, `${ModDir}/features`)).issues.length;
|
|
204
|
+
return BenchQuality.make({
|
|
205
|
+
featureFiles: featureFiles.length,
|
|
206
|
+
scenarios,
|
|
207
|
+
malformedFeatures: malformed,
|
|
208
|
+
specFiles: specFiles.length,
|
|
209
|
+
programs: programs.length,
|
|
210
|
+
sourceFiles: programs.length,
|
|
211
|
+
sourceLines,
|
|
212
|
+
testFiles: featureFiles.length,
|
|
213
|
+
testLines: scenarios,
|
|
214
|
+
deterministicFindings: deterministic.issues.length,
|
|
215
|
+
judgeFindings: judged.findings,
|
|
216
|
+
gateCleared: deterministic.issues.length === 0 && judged.findings === 0,
|
|
217
|
+
gateOpenIssues: deterministic.issues.length + judged.findings,
|
|
218
|
+
judgeScores: judged.scores,
|
|
219
|
+
// The rule universe is the estate's own coverage units.
|
|
220
|
+
coveragePct: Object.values(units_).flat().length === 0
|
|
221
|
+
? 0
|
|
222
|
+
: Math.round((Object.values(units_)
|
|
223
|
+
.flat()
|
|
224
|
+
.filter((unit) => unit.length > 0).length /
|
|
225
|
+
Object.values(units_).flat().length) *
|
|
226
|
+
100)
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
// The fingerprint groups records of the SAME estate so the report can
|
|
230
|
+
// compare providers rather than mixing unrelated fixtures.
|
|
231
|
+
const fingerprint = reviewFingerprint(pack.name, ...[...programs].sort(), String(quality.sourceLines)).slice(0, 16);
|
|
232
|
+
const finishedAt = new Date();
|
|
233
|
+
const record = BenchRecord.make({
|
|
234
|
+
schemaVersion: CurrentBenchSchema,
|
|
235
|
+
runId: `${startedAt.toISOString()}-${process.pid}`,
|
|
236
|
+
startedAt: startedAt.toISOString(),
|
|
237
|
+
finishedAt: finishedAt.toISOString(),
|
|
238
|
+
provider: coder.connectorId.value,
|
|
239
|
+
modelRequested: coder.model ?? "(harness default)",
|
|
240
|
+
modelsServed: [],
|
|
241
|
+
judge: BenchJudge.make({
|
|
242
|
+
provider: coder.connectorId.value,
|
|
243
|
+
model: coder.model ?? "(harness default)",
|
|
244
|
+
fixed: false
|
|
245
|
+
}),
|
|
246
|
+
llm4tsVersion: packageVersion,
|
|
247
|
+
pack: pack.name,
|
|
248
|
+
fixtureFingerprint: fingerprint,
|
|
249
|
+
machine: machine(),
|
|
250
|
+
outcome: quality.gateCleared === true ? "completed" : "gate-open",
|
|
251
|
+
totalMs: finishedAt.getTime() - startedAt.getTime(),
|
|
252
|
+
phases,
|
|
253
|
+
quality
|
|
254
|
+
});
|
|
255
|
+
yield* appendBenchRecord(files, benchPath, record);
|
|
256
|
+
yield* context.events.publish(Info.make({
|
|
257
|
+
message: `benchmark appended to ${benchPath} — ${record.totalTokens} token(s) over ` +
|
|
258
|
+
`${phases.length} phase(s); report with LLM4TS_BENCH_MODE=report`
|
|
259
|
+
}));
|
|
260
|
+
const all = yield* loadBenchRecords(files, benchPath);
|
|
261
|
+
process.stdout.write(`${renderBenchReport(all)}\n`);
|
|
262
|
+
})));
|
|
263
|
+
});
|
|
264
|
+
runFlowMain(program);
|