@llm4ts/shell 0.6.1 → 0.6.3

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.
@@ -31,6 +31,7 @@ import { packageVersion } from "@llm4ts/flow/Package";
31
31
  import { stage } from "@llm4ts/flow/PlanExecution";
32
32
  import { mergeReviewResults } from "@llm4ts/flow/Review";
33
33
  import { coverage, coverageUnits, features, matchingFiles } from "@llm4ts/flow/SpecChecks";
34
+ import { legacySourceWorkspaceLimits, workspaceLimitsFromEnv } from "@llm4ts/flow/Workspace";
34
35
  import { ProgramArtifacts, ProgramUnit, extractProgramsResumably } from "@llm4ts/modernize/Artifacts";
35
36
  import { asReadOnly, coderFromEnv } from "@llm4ts/runner/Connectors";
36
37
  import { resolveFlowInput } from "@llm4ts/runner/FlowArgs";
@@ -79,7 +80,7 @@ const program = Effect.gen(function* () {
79
80
  reasoning: asReadOnly(coder),
80
81
  environment: process.env
81
82
  }, (context) => Effect.scoped(Effect.gen(function* () {
82
- const estate = yield* makeNodeWorkspace(input.workDir);
83
+ const estate = yield* makeNodeWorkspace(input.workDir, workspaceLimitsFromEnv(process.env, legacySourceWorkspaceLimits));
83
84
  const { pack } = yield* stage(context.events, "pack", openPack({
84
85
  environment: process.env,
85
86
  launchDir: input.workspace,
@@ -27,9 +27,11 @@ import * as Effect from "effect/Effect";
27
27
  import { Sample } from "@llm4ts/core/eval/Eval";
28
28
  import { judge } from "@llm4ts/core/eval/Judge";
29
29
  import { FlowAborted, FlowLlmError } from "@llm4ts/flow/FlowError";
30
+ import { structuredAndPublish } from "@llm4ts/flow/Flow";
30
31
  import { Info } from "@llm4ts/flow/FlowEvents";
31
32
  import { makeChat } from "@llm4ts/flow/Chat";
32
33
  import { loadPatternCards, matchingPatternCards } from "@llm4ts/flow/Patterns";
34
+ import { legacySourceWorkspaceLimits, workspaceLimitsFromEnv } from "@llm4ts/flow/Workspace";
33
35
  import { stage } from "@llm4ts/flow/PlanExecution";
34
36
  import { defaultPlanInstructions, planFrom } from "@llm4ts/flow/Planner";
35
37
  import { ReviewIssue, ReviewResult, mergeReviewResults } from "@llm4ts/flow/Review";
@@ -173,7 +175,7 @@ const program = Effect.gen(function* () {
173
175
  reasoning: asReadOnly(coder),
174
176
  environment: process.env
175
177
  }, (context) => Effect.gen(function* () {
176
- const repo = yield* makeNodeWorkspace(input.workDir);
178
+ const repo = yield* makeNodeWorkspace(input.workDir, workspaceLimitsFromEnv(process.env, legacySourceWorkspaceLimits));
177
179
  const opened = yield* stage(context.events, "pack", openPack({
178
180
  environment: process.env,
179
181
  launchDir: input.workspace,
@@ -225,9 +227,7 @@ const program = Effect.gen(function* () {
225
227
  yield* context.events.publish(Info.make({
226
228
  message: `extracting ${target.sourcePath} (${index + 1}/${units.length})`
227
229
  }));
228
- return yield* context.coder
229
- .executeStructured(`${system}\n\n${programAsk(pack, target.sourcePath)}`, ProgramArtifacts, programArtifactsJsonSchema)
230
- .pipe(Effect.mapError(FlowLlmError.from),
230
+ return yield* structuredAndPublish(context.coder, context.events, `${system}\n\n${programAsk(pack, target.sourcePath)}`, ProgramArtifacts, programArtifactsJsonSchema, "coder").pipe(
231
231
  // A turn-limit trip is the wedged-agent tail, not a
232
232
  // failure: keep whatever the analyst already produced.
233
233
  Effect.catchIf((error) => error.cause?._tag === "TurnLimitError", (error) => Effect.gen(function* () {
@@ -20,6 +20,7 @@ import * as Schema from "effect/Schema";
20
20
  import { Dimension, Sample } from "@llm4ts/core/eval/Eval";
21
21
  import { judge } from "@llm4ts/core/eval/Judge";
22
22
  import { FlowAborted, FlowLlmError } from "@llm4ts/flow/FlowError";
23
+ import { structuredAndPublish } from "@llm4ts/flow/Flow";
23
24
  import { Info } from "@llm4ts/flow/FlowEvents";
24
25
  import { appendPackLesson } from "@llm4ts/flow/Pack";
25
26
  import { makePlanStore } from "@llm4ts/flow/Persistence";
@@ -167,18 +168,14 @@ const program = Effect.gen(function* () {
167
168
  const results = [];
168
169
  for (const lens of roster) {
169
170
  const prompt = `${lens.systemPrompt}\n\n${reviewPrompt(`modernization increment vs committed specs\n\n${specText}`, diff)}`;
170
- results.push(yield* reviewService
171
- .executeStructured(prompt, ReviewResult, reviewJsonSchema)
172
- .pipe(Effect.mapError(FlowLlmError.from)));
171
+ results.push(yield* structuredAndPublish(reviewService, context.events, prompt, ReviewResult, reviewJsonSchema, "reviewer"));
173
172
  }
174
173
  return mergeReviewResults(results);
175
174
  }));
176
175
  const scored = yield* stage(context.events, "judge", judge(context.reasoning, complianceDimensions)
177
176
  .evaluate(Sample.make({ response: diff, context: specText, query: input.prompt }))
178
177
  .pipe(Effect.mapError(FlowLlmError.from)));
179
- const outcome = yield* stage(context.events, "distill", context.reasoning
180
- .executeStructured(distillPrompt(pack, findings, scored, diff), ReviewOutcome, reviewOutcomeJsonSchema)
181
- .pipe(Effect.mapError(FlowLlmError.from)));
178
+ const outcome = yield* stage(context.events, "distill", structuredAndPublish(context.reasoning, context.events, distillPrompt(pack, findings, scored, diff), ReviewOutcome, reviewOutcomeJsonSchema));
182
179
  yield* stage(context.events, "fix specs", Effect.gen(function* () {
183
180
  const documents = [
184
181
  ...outcome.fixes.map((fix) => ["fix", fix]),
Binary file
@@ -22,7 +22,8 @@ import * as Effect from "effect/Effect";
22
22
  import * as Schema from "effect/Schema";
23
23
  import { CurrentEquivSchema, EquivVector, Observations, readEquivVectors, replayEquivVector, diffObservations, writeEquivVectors } from "@llm4ts/flow/Equiv";
24
24
  import { renderEquivReport, VectorVerdict } from "@llm4ts/flow/EquivReport";
25
- import { FlowAborted, FlowLlmError, PlanParseError } from "@llm4ts/flow/FlowError";
25
+ import { FlowAborted, PlanParseError } from "@llm4ts/flow/FlowError";
26
+ import { structuredAndPublish } from "@llm4ts/flow/Flow";
26
27
  import { Info } from "@llm4ts/flow/FlowEvents";
27
28
  import { makePlanStore } from "@llm4ts/flow/Persistence";
28
29
  import { stage } from "@llm4ts/flow/PlanExecution";
@@ -287,9 +288,7 @@ const program = Effect.gen(function* () {
287
288
  const feature = featurePath === undefined
288
289
  ? ""
289
290
  : yield* target.read(featurePath).pipe(Effect.orElseSucceed(() => ""));
290
- const generated = yield* context.reasoning
291
- .executeStructured(generatePrompt(pack, name, spec, feature, universe), GeneratedVectors, generatedVectorsJsonSchema)
292
- .pipe(Effect.mapError(FlowLlmError.from));
291
+ const generated = yield* structuredAndPublish(context.reasoning, context.events, generatePrompt(pack, name, spec, feature, universe), GeneratedVectors, generatedVectorsJsonSchema);
293
292
  if (generated.vectors.length === 0) {
294
293
  return yield* FlowAborted.make({
295
294
  message: `generator produced no vectors for ${name}`
@@ -370,9 +369,7 @@ const program = Effect.gen(function* () {
370
369
  for (const name of programs) {
371
370
  specTexts.push((yield* files.read(join(input.workDir, pack.specsDir, `${name}.md`))) ?? "");
372
371
  }
373
- const outcome = yield* context.reasoning
374
- .executeStructured(triagePrompt(pack, failing, specTexts.join("\n\n")), VerifyOutcome, verifyOutcomeJsonSchema)
375
- .pipe(Effect.mapError(FlowLlmError.from));
372
+ const outcome = yield* structuredAndPublish(context.reasoning, context.events, triagePrompt(pack, failing, specTexts.join("\n\n")), VerifyOutcome, verifyOutcomeJsonSchema);
376
373
  for (const fix of outcome.fixes) {
377
374
  yield* files.writeAtomic(join(input.workDir, pack.specsDir, "fixes", `fix-${slug(fix.title)}.md`), `# ${fix.title}\n\n${fix.spec}\n`);
378
375
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llm4ts/shell",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "Interactive shell and CLI for llm4ts: flow discovery, run-a-flow, and view",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -49,10 +49,10 @@
49
49
  ],
50
50
  "dependencies": {
51
51
  "@effect/platform-node": "^4.0.0-beta.102",
52
- "@llm4ts/flow": "0.6.1",
53
- "@llm4ts/runner": "0.6.1",
54
- "@llm4ts/modernize": "0.6.1",
55
- "@llm4ts/core": "0.6.1"
52
+ "@llm4ts/modernize": "0.6.3",
53
+ "@llm4ts/runner": "0.6.3",
54
+ "@llm4ts/flow": "0.6.3",
55
+ "@llm4ts/core": "0.6.3"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "effect": "^4.0.0-beta.102"