@llm4ts/shell 2.4.0 → 2.4.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.
Files changed (2) hide show
  1. package/flows/pack-fork.js +24 -5
  2. package/package.json +4 -4
@@ -24,10 +24,11 @@ import { basename, join, relative as relativePath, resolve as resolvePath } from
24
24
  import { rmSync } from "node:fs";
25
25
  import * as Effect from "effect/Effect";
26
26
  import { structuredAndPublish } from "@llm4ts/flow/Flow";
27
- import { Info } from "@llm4ts/flow/FlowEvents";
27
+ import { FlowEvents, Info } from "@llm4ts/flow/FlowEvents";
28
+ import { capped, withShrink } from "@llm4ts/flow/Context";
28
29
  import { withDraftApproval } from "@llm4ts/flow/Approval";
29
30
  import { legacySourceWorkspaceLimits, workspaceLimitsFromEnv } from "@llm4ts/flow/Workspace";
30
- import { asReadOnly, coderFromEnv, makeNodeWorkspace, nodePlainFileStore, openPack, resolveFlowInput, runFlowMain, runNode, ScriptUsage, stage } from "@llm4ts/runner";
31
+ import { asReadOnly, asToolless, coderFromEnv, makeNodeWorkspace, nodePlainFileStore, openPack, resolveFlowInput, runFlowMain, runNode, ScriptUsage, stage } from "@llm4ts/runner";
31
32
  import { ConventionSection, conventionPassAsk, conventionSectionJsonSchema, forkPackMarkdown, forkedReadme, parseForkAs, parseTargetKind, passesForTargetKind, readGroundingFiles, targetConventionsReviewer, techStackGroundingFiles } from "./lib/pack-fork.js";
32
33
  const forkPackFiles = Effect.fn("flows/pack-fork.forkPackFiles")(function* (source, destinationAbs, files) {
33
34
  // `source.dir` is "." for an absolute-path pack reference (Packs.ts's
@@ -79,7 +80,14 @@ const program = Effect.gen(function* () {
79
80
  workspace: input.workspace,
80
81
  userPrompt: input.prompt,
81
82
  coder,
82
- reasoning: coder,
83
+ // Every convention pass runs as a one-shot structuredAndPublish()
84
+ // call with no tool-loop continuation — a model that reaches for a
85
+ // tool mid-turn (invited by "Explore the repository…" in three of
86
+ // the four passes) resolves with no text instead of an error
87
+ // ("empty response … no text to parse as structured output"). A
88
+ // read-only coder still offers a read tool over some connectors
89
+ // (pi in particular); asToolless offers none.
90
+ reasoning: asToolless(coderFromEnv(process.env)),
83
91
  environment: process.env
84
92
  }, (context) => Effect.gen(function* () {
85
93
  const repo = yield* makeNodeWorkspace(input.workDir, workspaceLimitsFromEnv(process.env, legacySourceWorkspaceLimits));
@@ -110,8 +118,19 @@ const program = Effect.gen(function* () {
110
118
  const passes = passesForTargetKind(targetKind);
111
119
  const sections = [];
112
120
  for (const [index, pass] of passes.entries()) {
113
- const prompt = conventionPassAsk(pass, index === 0 ? grounding : undefined);
114
- const result = yield* stage(context.events, pass.heading, structuredAndPublish(context.reasoning, context.events, prompt, ConventionSection, conventionSectionJsonSchema));
121
+ const askText = conventionPassAsk(pass, index === 0 ? grounding : undefined);
122
+ // Tech Stack & Dependencies (index 0) is the only pass carrying
123
+ // grounding file content — a real package.json/tsconfig.json can
124
+ // make it substantially larger than the other three, ungrounded
125
+ // passes. `capped` bounds every attempt's prompt size (guarding
126
+ // against a truncated, unparseable structured response); `withShrink`
127
+ // retries at a smaller budget on an actual provider overflow —
128
+ // the same pairing every other modernize-* flow already uses
129
+ // ahead of a structuredAndPublish call.
130
+ const result = yield* stage(context.events, pass.heading, withShrink(pass.heading, (cap) => Effect.gen(function* () {
131
+ const prompt = yield* capped(pass.heading, askText, cap);
132
+ return yield* structuredAndPublish(context.reasoning, context.events, prompt, ConventionSection, conventionSectionJsonSchema);
133
+ })).pipe(Effect.provideService(FlowEvents, context.events)));
115
134
  sections.push(result.markdown);
116
135
  }
117
136
  const conventionsMd = sections.join("\n\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llm4ts/shell",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "description": "Interactive shell and CLI for llm4ts: flow discovery, run-a-flow, and view",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -52,9 +52,9 @@
52
52
  "dependencies": {
53
53
  "@effect/platform-node": "4.0.0-rc.115",
54
54
  "@effect/platform-node-shared": "4.0.0-rc.115",
55
- "@llm4ts/core": "2.4.0",
56
- "@llm4ts/runner": "2.4.0",
57
- "@llm4ts/flow": "2.4.0"
55
+ "@llm4ts/core": "2.4.2",
56
+ "@llm4ts/flow": "2.4.2",
57
+ "@llm4ts/runner": "2.4.2"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "effect": "4.0.0-rc.115"