@llm4ts/shell 0.6.2 → 0.7.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.
@@ -27,6 +27,7 @@ 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";
@@ -226,9 +227,7 @@ const program = Effect.gen(function* () {
226
227
  yield* context.events.publish(Info.make({
227
228
  message: `extracting ${target.sourcePath} (${index + 1}/${units.length})`
228
229
  }));
229
- return yield* context.coder
230
- .executeStructured(`${system}\n\n${programAsk(pack, target.sourcePath)}`, ProgramArtifacts, programArtifactsJsonSchema)
231
- .pipe(Effect.mapError(FlowLlmError.from),
230
+ return yield* structuredAndPublish(context.coder, context.events, `${system}\n\n${programAsk(pack, target.sourcePath)}`, ProgramArtifacts, programArtifactsJsonSchema, "coder").pipe(
232
231
  // A turn-limit trip is the wedged-agent tail, not a
233
232
  // failure: keep whatever the analyst already produced.
234
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.2",
3
+ "version": "0.7.0",
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/core": "0.6.2",
53
- "@llm4ts/flow": "0.6.2",
54
- "@llm4ts/modernize": "0.6.2",
55
- "@llm4ts/runner": "0.6.2"
52
+ "@llm4ts/core": "0.7.0",
53
+ "@llm4ts/modernize": "0.7.0",
54
+ "@llm4ts/flow": "0.7.0",
55
+ "@llm4ts/runner": "0.7.0"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "effect": "^4.0.0-beta.102"