@llm4ts/shell 2.4.0 → 2.4.1

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 +15 -3
  2. package/package.json +4 -4
@@ -24,7 +24,8 @@ 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
31
  import { asReadOnly, coderFromEnv, makeNodeWorkspace, nodePlainFileStore, openPack, resolveFlowInput, runFlowMain, runNode, ScriptUsage, stage } from "@llm4ts/runner";
@@ -110,8 +111,19 @@ const program = Effect.gen(function* () {
110
111
  const passes = passesForTargetKind(targetKind);
111
112
  const sections = [];
112
113
  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));
114
+ const askText = conventionPassAsk(pass, index === 0 ? grounding : undefined);
115
+ // Tech Stack & Dependencies (index 0) is the only pass carrying
116
+ // grounding file content — a real package.json/tsconfig.json can
117
+ // make it substantially larger than the other three, ungrounded
118
+ // passes. `capped` bounds every attempt's prompt size (guarding
119
+ // against a truncated, unparseable structured response); `withShrink`
120
+ // retries at a smaller budget on an actual provider overflow —
121
+ // the same pairing every other modernize-* flow already uses
122
+ // ahead of a structuredAndPublish call.
123
+ const result = yield* stage(context.events, pass.heading, withShrink(pass.heading, (cap) => Effect.gen(function* () {
124
+ const prompt = yield* capped(pass.heading, askText, cap);
125
+ return yield* structuredAndPublish(context.reasoning, context.events, prompt, ConventionSection, conventionSectionJsonSchema);
126
+ })).pipe(Effect.provideService(FlowEvents, context.events)));
115
127
  sections.push(result.markdown);
116
128
  }
117
129
  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.1",
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.1",
56
+ "@llm4ts/runner": "2.4.1",
57
+ "@llm4ts/flow": "2.4.1"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "effect": "4.0.0-rc.115"