@llm4ts/shell 3.3.0 → 4.0.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.
- package/README.md +36 -0
- package/dist/Cli.d.ts +4 -4
- package/dist/Cli.d.ts.map +1 -1
- package/dist/Cli.js +5 -4
- package/dist/Cli.js.map +1 -1
- package/dist/CoderChoice.d.ts +2 -4
- package/dist/CoderChoice.d.ts.map +1 -1
- package/dist/CoderChoice.js +8 -12
- package/dist/CoderChoice.js.map +1 -1
- package/dist/Config.d.ts +3 -3
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +8 -6
- package/dist/Config.js.map +1 -1
- package/dist/ConfigEdit.js +4 -4
- package/dist/ConfigEdit.js.map +1 -1
- package/dist/Costs.d.ts +52 -0
- package/dist/Costs.d.ts.map +1 -0
- package/dist/Costs.js +95 -0
- package/dist/Costs.js.map +1 -0
- package/dist/OperatorActTools.d.ts +1 -1
- package/dist/OperatorActTools.d.ts.map +1 -1
- package/dist/OperatorActTools.js +1 -1
- package/dist/OperatorActTools.js.map +1 -1
- package/dist/OperatorConfig.d.ts.map +1 -1
- package/dist/OperatorConfig.js +2 -1
- package/dist/OperatorConfig.js.map +1 -1
- package/dist/OperatorNode.js +2 -2
- package/dist/OperatorNode.js.map +1 -1
- package/dist/OperatorRuns.d.ts +1 -1
- package/dist/OperatorRuns.d.ts.map +1 -1
- package/dist/OperatorRuns.js +1 -1
- package/dist/OperatorRuns.js.map +1 -1
- package/dist/OperatorTools.d.ts +4 -2
- package/dist/OperatorTools.d.ts.map +1 -1
- package/dist/OperatorTools.js +4 -4
- package/dist/OperatorTools.js.map +1 -1
- package/dist/Profile.d.ts +313 -0
- package/dist/Profile.d.ts.map +1 -0
- package/dist/Profile.js +937 -0
- package/dist/Profile.js.map +1 -0
- package/dist/Refine.d.ts.map +1 -1
- package/dist/Refine.js +3 -2
- package/dist/Refine.js.map +1 -1
- package/dist/RunReaders.d.ts +70 -0
- package/dist/RunReaders.d.ts.map +1 -0
- package/dist/RunReaders.js +236 -0
- package/dist/RunReaders.js.map +1 -0
- package/dist/StoryReaders.d.ts +16 -0
- package/dist/StoryReaders.d.ts.map +1 -0
- package/dist/StoryReaders.js +107 -0
- package/dist/StoryReaders.js.map +1 -0
- package/dist/Watch.d.ts +68 -0
- package/dist/Watch.d.ts.map +1 -0
- package/dist/Watch.js +261 -0
- package/dist/Watch.js.map +1 -0
- package/flows/epic-design.js +7 -5
- package/flows/epic-retro.js +3 -2
- package/flows/implement.js +3 -2
- package/flows/issue-pr.js +3 -2
- package/flows/judge-suite.js +2 -2
- package/flows/lib/debt.js +2 -2
- package/flows/lib/epic-design.js +1 -1
- package/flows/lib/epic-retro.js +3 -6
- package/flows/lib/epic-stories.js +53 -118
- package/flows/lib/modernize-extract.js +6 -9
- package/flows/lib/pack-fork.js +8 -10
- package/flows/lib/port.js +8 -10
- package/flows/local.js +3 -2
- package/flows/modernize-bench.js +11 -6
- package/flows/modernize-extract.js +9 -8
- package/flows/modernize-implement.js +5 -8
- package/flows/modernize-pack-check.js +2 -1
- package/flows/modernize-pack-upgrade.js +2 -1
- package/flows/modernize-refine.js +7 -6
- package/flows/modernize-review.js +4 -5
- package/flows/modernize-seed.js +8 -8
- package/flows/modernize-survey.js +5 -8
- package/flows/modernize-verify.js +3 -3
- package/flows/pack-fork.js +5 -4
- package/flows/port-compile.js +4 -3
- package/flows/port-files.js +2 -2
- package/flows/port-guide.js +6 -5
- package/flows/port-ledger.js +3 -3
- package/flows/port-tests.js +5 -4
- package/flows/roundtable.js +2 -2
- package/flows/sdd.js +8 -13
- package/flows/taskforce.js +5 -4
- package/kits/j2ee-nextjs/flows/convert-all.js +8 -7
- package/kits/j2ee-nextjs/flows/convert-feature.js +2 -2
- package/kits/j2ee-nextjs/flows/convert-page.js +2 -2
- package/kits/j2ee-nextjs/flows/lib/convert.js +9 -13
- package/kits/soap-ace/flows/soap-design.js +5 -8
- package/kits/soap-ace/flows/soap-discover.js +4 -3
- package/kits/soap-ace/flows/soap-epic.js +4 -7
- package/kits/soap-ace/flows/soap-explore.js +8 -7
- package/kits/soap-ace/flows/soap-sample.js +10 -10
- package/kits/soap-ace/tools/soap-call.js +3 -2
- package/package.json +4 -24
- package/src/Cli.ts +6 -9
- package/src/CoderChoice.ts +10 -16
- package/src/Config.ts +9 -5
- package/src/ConfigEdit.ts +4 -4
- package/src/Costs.ts +148 -0
- package/src/OperatorActTools.ts +1 -1
- package/src/OperatorConfig.ts +2 -1
- package/src/OperatorNode.ts +2 -2
- package/src/OperatorRuns.ts +1 -1
- package/src/OperatorTools.ts +4 -4
- package/src/Profile.ts +1196 -0
- package/src/Refine.ts +3 -2
- package/src/RunReaders.ts +370 -0
- package/src/StoryReaders.ts +157 -0
- package/src/Watch.ts +451 -0
|
@@ -9,7 +9,7 @@ import * as Effect from "effect/Effect";
|
|
|
9
9
|
import { Dimension } from "@llm4ts/core/eval/Eval";
|
|
10
10
|
import { judge } from "@llm4ts/core/eval/Judge";
|
|
11
11
|
import { TokenUsage } from "@llm4ts/core/Models";
|
|
12
|
-
import { FlowAborted, Info, Plan, implementPlanFlow, lintCommand, loadKitPatternCards, makeChat, makeNodeWorkspace, makePlanStore, mergeReviewResults, minimalReviewers, nodePlainFileStore, nodeProcessExecutor, openPack,
|
|
12
|
+
import { FlowAborted, Info, Plan, implementPlanFlow, lintCommand, loadKitPatternCards, makeChat, makeNodeWorkspace, makePlanStore, mergeReviewResults, minimalReviewers, nodePlainFileStore, nodeProcessExecutor, openPack, stage } from "@llm4ts/runner";
|
|
13
13
|
import { budget, capped } from "@llm4ts/flow/Context";
|
|
14
14
|
import { Decisions, parseDecisions } from "@llm4ts/flow/Decisions";
|
|
15
15
|
import { navigationOrder, parseDomains } from "@llm4ts/flow/Domains";
|
|
@@ -23,10 +23,7 @@ import { closureFor } from "@llm4ts/flow/Survey";
|
|
|
23
23
|
import { freshGraph, graphCachePath } from "@llm4ts/flow/GraphCache";
|
|
24
24
|
import { estimatedUsageOptionsFromEnv, makeEstimatedUsageMeter } from "@llm4ts/flow/EstimatedUsage";
|
|
25
25
|
import { legacySourceWorkspaceLimits, workspaceLimitsFromEnv } from "@llm4ts/flow/Workspace";
|
|
26
|
-
|
|
27
|
-
const raw = Number.parseInt(environment[name] ?? "", 10);
|
|
28
|
-
return Number.isFinite(raw) && raw > 0 ? raw : fallback;
|
|
29
|
-
};
|
|
26
|
+
import { settingValue } from "@llm4ts/flow/Settings";
|
|
30
27
|
/** Sums the coder and reasoning meters into one per-run estimate. */
|
|
31
28
|
export const combineTotals = (first, second) => Effect.gen(function* () {
|
|
32
29
|
const left = yield* first;
|
|
@@ -215,7 +212,7 @@ const legacyEvidence = Effect.fn("convert.legacyEvidence")(function* (deps, page
|
|
|
215
212
|
? ""
|
|
216
213
|
: yield* deps.legacy.read(sourcePath).pipe(Effect.orElseSucceed(() => ""));
|
|
217
214
|
const graph = (yield* freshGraph(deps.files, graphCachePath(deps.legacyDir, deps.pack.name), deps.pack, deps.legacy)).graph;
|
|
218
|
-
const closure = closureFor(graph, page,
|
|
215
|
+
const closure = closureFor(graph, page, settingValue("LLM4TS_MAX_CLOSURE_FILES", deps.environment) ?? 12);
|
|
219
216
|
const parts = [];
|
|
220
217
|
if (sourcePath !== undefined) {
|
|
221
218
|
parts.push(`===== ${sourcePath} =====\n${source}`);
|
|
@@ -319,7 +316,7 @@ const runConversion = Effect.fn("convert.run")(function* (deps, unit) {
|
|
|
319
316
|
}));
|
|
320
317
|
yield* stage(context.events, "judge", Effect.gen(function* () {
|
|
321
318
|
const complianceJudge = judge(context.reasoning, conversionDimensions);
|
|
322
|
-
const rounds =
|
|
319
|
+
const rounds = settingValue("LLM4TS_JUDGE_ROUNDS", environment) ?? 2;
|
|
323
320
|
const specOf = new Map(unit.judged.map((entry) => [entry.name, entry.spec]));
|
|
324
321
|
for (let round = 1; round <= rounds; round += 1) {
|
|
325
322
|
const base = yield* context.git.defaultBase;
|
|
@@ -333,8 +330,7 @@ const runConversion = Effect.fn("convert.run")(function* (deps, unit) {
|
|
|
333
330
|
base,
|
|
334
331
|
programs: unit.judged.map((entry) => entry.name),
|
|
335
332
|
specFor: (program) => Effect.succeed(specOf.get(program) ?? ""),
|
|
336
|
-
query: context.userPrompt
|
|
337
|
-
fingerprint: reviewFingerprint
|
|
333
|
+
query: context.userPrompt
|
|
338
334
|
});
|
|
339
335
|
if (verdict.isClean) {
|
|
340
336
|
return yield* context.events.publish(Info.make({ message: `judge: ${unit.id} cleared the bar` }));
|
|
@@ -539,13 +535,13 @@ export const convertFeature = Effect.fn("convert.feature")(function* (deps, feat
|
|
|
539
535
|
* the pack (default `j2ee-nextjs-spa`, from the kit), and the pattern-card deck.
|
|
540
536
|
*/
|
|
541
537
|
export const setupConversion = Effect.fn("convert.setup")(function* (context, input, environment, flowDir) {
|
|
542
|
-
const
|
|
543
|
-
if (
|
|
538
|
+
const legacyRepo = settingValue("LLM4TS_LEGACY_REPO", environment);
|
|
539
|
+
if (legacyRepo === undefined) {
|
|
544
540
|
return yield* FlowAborted.make({
|
|
545
541
|
message: "set LLM4TS_LEGACY_REPO to the extracted legacy repository path"
|
|
546
542
|
});
|
|
547
543
|
}
|
|
548
|
-
const legacyDir = resolve(input.workspace,
|
|
544
|
+
const legacyDir = resolve(input.workspace, legacyRepo);
|
|
549
545
|
const estimateOptions = estimatedUsageOptionsFromEnv(environment);
|
|
550
546
|
const coderMeter = yield* makeEstimatedUsageMeter(context.coder, estimateOptions);
|
|
551
547
|
const reasoningMeter = yield* makeEstimatedUsageMeter(context.reasoning, estimateOptions);
|
|
@@ -561,7 +557,7 @@ export const setupConversion = Effect.fn("convert.setup")(function* (context, in
|
|
|
561
557
|
const opened = yield* stage(context.events, "pack", openPack({
|
|
562
558
|
environment: {
|
|
563
559
|
...environment,
|
|
564
|
-
LLM4TS_PACK:
|
|
560
|
+
LLM4TS_PACK: settingValue("LLM4TS_PACK", environment) ?? "j2ee-nextjs-spa"
|
|
565
561
|
},
|
|
566
562
|
launchDir: input.workspace,
|
|
567
563
|
flowDir
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
import { readFile } from "node:fs/promises";
|
|
25
25
|
import { fileURLToPath } from "node:url";
|
|
26
26
|
import * as Effect from "effect/Effect";
|
|
27
|
+
import { settingText, settingValue } from "@llm4ts/flow/Settings";
|
|
27
28
|
import { FlowAborted, Info, makeNodeWorkspace, mock, resolveFlowInput, runFlowMain, runNode, ScriptUsage } from "@llm4ts/runner";
|
|
28
29
|
import { coderFor } from "@llm4ts/runner/Connectors";
|
|
29
30
|
import { analysisPaths, writeAnalyses } from "./lib/soap/Analysis.js";
|
|
@@ -44,11 +45,11 @@ const program = Effect.gen(function* () {
|
|
|
44
45
|
const environment = process.env;
|
|
45
46
|
const drafting = command === "design" || command === "revise";
|
|
46
47
|
const reasoner = drafting
|
|
47
|
-
? coderFor((
|
|
48
|
+
? coderFor(settingText("LLM4TS_REASONER", environment) ?? "claude")
|
|
48
49
|
: undefined;
|
|
49
50
|
if (drafting && reasoner === undefined) {
|
|
50
51
|
return yield* ScriptUsage.make({
|
|
51
|
-
message: `unknown LLM4TS_REASONER '${
|
|
52
|
+
message: `unknown LLM4TS_REASONER '${settingText("LLM4TS_REASONER", environment) ?? ""}'`
|
|
52
53
|
});
|
|
53
54
|
}
|
|
54
55
|
yield* runNode({
|
|
@@ -61,13 +62,9 @@ const program = Effect.gen(function* () {
|
|
|
61
62
|
}, (context) => Effect.gen(function* () {
|
|
62
63
|
const say = (message) => context.events.publish(Info.make({ message }));
|
|
63
64
|
const workspace = yield* makeNodeWorkspace(input.workDir);
|
|
64
|
-
const requested = environment
|
|
65
|
+
const requested = settingValue("LLM4TS_SOAP_SERVICE", environment);
|
|
65
66
|
const services = (yield* workspace.discover(".llm4ts/soap/*/catalog.json")).map((path) => path.split("/")[2] ?? "");
|
|
66
|
-
const service = requested
|
|
67
|
-
? requested
|
|
68
|
-
: services.length === 1
|
|
69
|
-
? services[0]
|
|
70
|
-
: undefined;
|
|
67
|
+
const service = requested ?? (services.length === 1 ? services[0] : undefined);
|
|
71
68
|
if (service === undefined) {
|
|
72
69
|
return yield* FlowAborted.make({
|
|
73
70
|
message: services.length === 0
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
// Bearer, mTLS; references only) authenticates every document request.
|
|
22
22
|
import { isAbsolute, resolve } from "node:path";
|
|
23
23
|
import * as Effect from "effect/Effect";
|
|
24
|
+
import { settingValue } from "@llm4ts/flow/Settings";
|
|
24
25
|
import { Info, makeNodeWorkspace, mock, resolveFlowInput, runFlowMain, runNode } from "@llm4ts/runner";
|
|
25
26
|
import { judgmentConnectorFromEnvironment } from "@llm4ts/runner/Connectors";
|
|
26
27
|
import { nodeSecretSource, resolveSide } from "./lib/soap/Auth.js";
|
|
@@ -33,7 +34,7 @@ const program = Effect.gen(function* () {
|
|
|
33
34
|
const raw = input.prompt.trim();
|
|
34
35
|
const location = isUrl(raw) || isAbsolute(raw) ? raw : resolve(input.workspace, raw);
|
|
35
36
|
const judgment = yield* judgmentConnectorFromEnvironment();
|
|
36
|
-
const service = process.env
|
|
37
|
+
const service = settingValue("LLM4TS_SOAP_SERVICE", process.env);
|
|
37
38
|
yield* runNode({
|
|
38
39
|
workDir: input.workDir,
|
|
39
40
|
workspace: input.workspace,
|
|
@@ -45,9 +46,9 @@ const program = Effect.gen(function* () {
|
|
|
45
46
|
}, (context) => Effect.gen(function* () {
|
|
46
47
|
const say = (message) => context.events.publish(Info.make({ message }));
|
|
47
48
|
const workspace = yield* makeNodeWorkspace(input.workDir);
|
|
48
|
-
const profile = service === undefined
|
|
49
|
+
const profile = service === undefined
|
|
49
50
|
? undefined
|
|
50
|
-
: yield* loadAuthProfile(workspace, service, process.env
|
|
51
|
+
: yield* loadAuthProfile(workspace, service, settingValue("LLM4TS_SOAP_ENV", process.env));
|
|
51
52
|
if (isUrl(location) && profile === undefined) {
|
|
52
53
|
yield* say("fetching without credentials (set LLM4TS_SOAP_SERVICE and write its auth.json for an authenticated WSDL)");
|
|
53
54
|
}
|
|
@@ -24,6 +24,7 @@ import { readdir, readFile } from "node:fs/promises";
|
|
|
24
24
|
import { dirname, join, relative, resolve } from "node:path";
|
|
25
25
|
import { fileURLToPath } from "node:url";
|
|
26
26
|
import * as Effect from "effect/Effect";
|
|
27
|
+
import { settingValue } from "@llm4ts/flow/Settings";
|
|
27
28
|
import { makeStoryPlanStore } from "@llm4ts/flow/StoryPlan";
|
|
28
29
|
import { FlowAborted, Info, makeNodeWorkspace, mock, nodePlainFileStore, nodeProcessExecutor, resolveFlowInput, runFlowMain, runNode, ScriptUsage } from "@llm4ts/runner";
|
|
29
30
|
import { analysisPaths, writeAnalyses } from "./lib/soap/Analysis.js";
|
|
@@ -116,13 +117,9 @@ const program = Effect.gen(function* () {
|
|
|
116
117
|
if (!existsSync(join(targetRoot, ".git")))
|
|
117
118
|
yield* say(`⚠ ${targetRoot} is not a git repository; epic-stories needs one with at least one commit`);
|
|
118
119
|
const workspace = yield* makeNodeWorkspace(input.workDir);
|
|
119
|
-
const requested = environment
|
|
120
|
+
const requested = settingValue("LLM4TS_SOAP_SERVICE", environment);
|
|
120
121
|
const services = (yield* workspace.discover(".llm4ts/soap/*/catalog.json")).map((path) => path.split("/")[2] ?? "");
|
|
121
|
-
const service = requested
|
|
122
|
-
? requested
|
|
123
|
-
: services.length === 1
|
|
124
|
-
? services[0]
|
|
125
|
-
: undefined;
|
|
122
|
+
const service = requested ?? (services.length === 1 ? services[0] : undefined);
|
|
126
123
|
if (service === undefined) {
|
|
127
124
|
return yield* FlowAborted.make({
|
|
128
125
|
message: services.length === 0
|
|
@@ -144,7 +141,7 @@ const program = Effect.gen(function* () {
|
|
|
144
141
|
message: `${paths.design} must be approved with no check errors (${file.approved ? `${errors.length} errors` : "not approved"}); run soap-design "check"`
|
|
145
142
|
});
|
|
146
143
|
}
|
|
147
|
-
const api = environment
|
|
144
|
+
const api = settingValue("LLM4TS_ACE_API", environment) ?? apiNameFor(service);
|
|
148
145
|
const soapRoot = catalog.documents[0] === undefined ? undefined : dirname(catalog.documents[0]);
|
|
149
146
|
// Schemas may be declared in ISO-8859-1: decode by their declaration and
|
|
150
147
|
// re-emit as UTF-8 so the ACE toolkit and git see one encoding.
|
|
@@ -33,6 +33,7 @@ import { readFile } from "node:fs/promises";
|
|
|
33
33
|
import { isAbsolute, resolve } from "node:path";
|
|
34
34
|
import { fileURLToPath } from "node:url";
|
|
35
35
|
import * as Effect from "effect/Effect";
|
|
36
|
+
import { settingText, settingValue } from "@llm4ts/flow/Settings";
|
|
36
37
|
import { FlowAborted, Info, makeNodeWorkspace, mock, resolveFlowInput, runFlowMain, runNode, ScriptUsage } from "@llm4ts/runner";
|
|
37
38
|
import { coderFor, judgmentConnectorFromEnvironment } from "@llm4ts/runner/Connectors";
|
|
38
39
|
import { nodeSecretSource, resolveSide } from "./lib/soap/Auth.js";
|
|
@@ -71,9 +72,9 @@ const program = Effect.gen(function* () {
|
|
|
71
72
|
const raw = input.prompt.trim();
|
|
72
73
|
const location = raw === "" ? undefined : isUrl(raw) || isAbsolute(raw) ? raw : resolve(input.workspace, raw);
|
|
73
74
|
const environment = process.env;
|
|
74
|
-
const requested = environment
|
|
75
|
+
const requested = settingValue("LLM4TS_SOAP_SERVICE", environment);
|
|
75
76
|
const judgment = yield* judgmentConnectorFromEnvironment();
|
|
76
|
-
const reasonerName = (
|
|
77
|
+
const reasonerName = settingText("LLM4TS_REASONER", environment) ?? "claude";
|
|
77
78
|
const reasoner = flags.design ? coderFor(reasonerName) : undefined;
|
|
78
79
|
if (flags.design && reasoner === undefined) {
|
|
79
80
|
return yield* ScriptUsage.make({ message: `unknown LLM4TS_REASONER '${reasonerName}'` });
|
|
@@ -97,7 +98,7 @@ const program = Effect.gen(function* () {
|
|
|
97
98
|
if (location !== undefined) {
|
|
98
99
|
const fetchProfile = requested === undefined
|
|
99
100
|
? undefined
|
|
100
|
-
: yield* loadAuthProfile(workspace, requested,
|
|
101
|
+
: yield* loadAuthProfile(workspace, requested, settingValue("LLM4TS_SOAP_ENV", environment));
|
|
101
102
|
const fetchSide = yield* resolveSide(nodeSecretSource(environment), fetchProfile?.fetch);
|
|
102
103
|
const discovered = yield* discoverService({
|
|
103
104
|
workspace,
|
|
@@ -127,7 +128,7 @@ const program = Effect.gen(function* () {
|
|
|
127
128
|
catalog = yield* loadCatalog(workspace, service);
|
|
128
129
|
yield* say(`continuing ${service}: ${catalog.operations.length} operations`);
|
|
129
130
|
}
|
|
130
|
-
const env = environment
|
|
131
|
+
const env = settingValue("LLM4TS_SOAP_ENV", environment);
|
|
131
132
|
const profile = yield* loadAuthProfile(workspace, service, env);
|
|
132
133
|
if (profile !== undefined)
|
|
133
134
|
yield* say(`profile: ${profilePath(service, env)}`);
|
|
@@ -140,11 +141,11 @@ const program = Effect.gen(function* () {
|
|
|
140
141
|
judged = new Map(yield* Effect.forEach(candidates, (operation) => Effect.map(judgeClass(seat, catalog, operation), (answer) => [operation.name, answer])));
|
|
141
142
|
}
|
|
142
143
|
// 2-3. requests and the probe
|
|
143
|
-
const stub = environment
|
|
144
|
-
const transport = stub === undefined
|
|
144
|
+
const stub = settingValue("LLM4TS_SOAP_STUB", environment);
|
|
145
|
+
const transport = stub === undefined
|
|
145
146
|
? makeNodeSoapTransport()
|
|
146
147
|
: makeDirectoryStubTransport(resolve(input.workspace, stub), catalog);
|
|
147
|
-
if (stub !== undefined
|
|
148
|
+
if (stub !== undefined)
|
|
148
149
|
yield* say(`LLM4TS_SOAP_STUB: answering from ${stub}, not the network`);
|
|
149
150
|
const result = yield* exploreService({
|
|
150
151
|
workspace,
|
|
@@ -34,6 +34,7 @@ import * as Effect from "effect/Effect";
|
|
|
34
34
|
import { FlowAborted, Info, makeNodeWorkspace, mock, resolveFlowInput, runFlowMain, runNode, ScriptUsage } from "@llm4ts/runner";
|
|
35
35
|
import { coderFor } from "@llm4ts/runner/Connectors";
|
|
36
36
|
import { terminalInteraction } from "@llm4ts/runner/TerminalInteraction";
|
|
37
|
+
import { settingText, settingValue } from "@llm4ts/flow/Settings";
|
|
37
38
|
import { nodeSecretSource } from "./lib/soap/Auth.js";
|
|
38
39
|
import { callOperation } from "./lib/soap/Call.js";
|
|
39
40
|
import { operationByName } from "./lib/soap/Catalog.js";
|
|
@@ -95,7 +96,7 @@ export const parseSampleFlags = (argv) => Effect.gen(function* () {
|
|
|
95
96
|
});
|
|
96
97
|
/** The service directory: LLM4TS_SOAP_SERVICE, or the only one discovered. */
|
|
97
98
|
const pickService = (workspace, requested) => Effect.gen(function* () {
|
|
98
|
-
if (requested !== undefined
|
|
99
|
+
if (requested !== undefined)
|
|
99
100
|
return requested;
|
|
100
101
|
const catalogs = yield* workspace.discover(".llm4ts/soap/*/catalog.json");
|
|
101
102
|
const services = catalogs.map((path) => path.split("/")[2] ?? "");
|
|
@@ -117,13 +118,13 @@ const program = Effect.gen(function* () {
|
|
|
117
118
|
const input = yield* resolveFlowInput("list", flags.rest);
|
|
118
119
|
const [command = "list", ...args] = input.prompt.trim().split(/\s+/);
|
|
119
120
|
const environment = process.env;
|
|
120
|
-
const env = flags.env ?? (
|
|
121
|
+
const env = flags.env ?? settingValue("LLM4TS_SOAP_ENV", environment);
|
|
121
122
|
const reasoner = command === "propose"
|
|
122
|
-
? coderFor((
|
|
123
|
+
? coderFor(settingText("LLM4TS_REASONER", environment) ?? "claude")
|
|
123
124
|
: undefined;
|
|
124
125
|
if (command === "propose" && reasoner === undefined) {
|
|
125
126
|
return yield* ScriptUsage.make({
|
|
126
|
-
message: `unknown LLM4TS_REASONER '${
|
|
127
|
+
message: `unknown LLM4TS_REASONER '${settingText("LLM4TS_REASONER", environment) ?? ""}'`
|
|
127
128
|
});
|
|
128
129
|
}
|
|
129
130
|
yield* runNode({
|
|
@@ -136,7 +137,7 @@ const program = Effect.gen(function* () {
|
|
|
136
137
|
}, (context) => Effect.gen(function* () {
|
|
137
138
|
const say = (message) => context.events.publish(Info.make({ message }));
|
|
138
139
|
const workspace = yield* makeNodeWorkspace(input.workDir);
|
|
139
|
-
const service = yield* pickService(workspace, environment
|
|
140
|
+
const service = yield* pickService(workspace, settingValue("LLM4TS_SOAP_SERVICE", environment));
|
|
140
141
|
const catalog = yield* loadCatalog(workspace, service);
|
|
141
142
|
const operations = yield* loadOperationsFile(workspace, service);
|
|
142
143
|
switch (command) {
|
|
@@ -252,8 +253,7 @@ const program = Effect.gen(function* () {
|
|
|
252
253
|
message: `no profile at ${profilePath(service, env)}; write it first`
|
|
253
254
|
});
|
|
254
255
|
}
|
|
255
|
-
|
|
256
|
-
if (stub !== undefined && stub !== "") {
|
|
256
|
+
if (settingValue("LLM4TS_SOAP_STUB", environment) !== undefined) {
|
|
257
257
|
return yield* FlowAborted.make({
|
|
258
258
|
message: "trust reads a real server; unset LLM4TS_SOAP_STUB"
|
|
259
259
|
});
|
|
@@ -325,11 +325,11 @@ const program = Effect.gen(function* () {
|
|
|
325
325
|
secrets: nodeSecretSource(environment),
|
|
326
326
|
transport: makeNodeSoapTransport()
|
|
327
327
|
});
|
|
328
|
-
const stub = environment
|
|
329
|
-
const transport = stub === undefined
|
|
328
|
+
const stub = settingValue("LLM4TS_SOAP_STUB", environment);
|
|
329
|
+
const transport = stub === undefined
|
|
330
330
|
? makeNodeSoapTransport()
|
|
331
331
|
: makeDirectoryStubTransport(resolve(input.workspace, stub), catalog);
|
|
332
|
-
if (stub !== undefined
|
|
332
|
+
if (stub !== undefined)
|
|
333
333
|
yield* say(`LLM4TS_SOAP_STUB: answering from ${stub}, not the network`);
|
|
334
334
|
const targets = [];
|
|
335
335
|
const operationNames = target === "all"
|
|
@@ -11,6 +11,7 @@ import * as Effect from "effect/Effect";
|
|
|
11
11
|
import * as Schema from "effect/Schema";
|
|
12
12
|
import { nodeSecretSource } from "@llm4ts/flow/endpoint/Auth";
|
|
13
13
|
import { SoapTransport } from "@llm4ts/flow/endpoint/Transport";
|
|
14
|
+
import { settingValue } from "@llm4ts/flow/Settings";
|
|
14
15
|
import { ToolContext, ToolError, defineTool, report } from "@llm4ts/flow/tools/Tool";
|
|
15
16
|
import { makeNodeWorkspace } from "@llm4ts/runner/NodeWorkspace";
|
|
16
17
|
import { runToolMain } from "@llm4ts/runner/ToolMain";
|
|
@@ -73,8 +74,8 @@ export const soapCall = defineTool({
|
|
|
73
74
|
return yield* fail(`no profile at ${profilePath(input.service, input.env)}`);
|
|
74
75
|
}
|
|
75
76
|
// `LLM4TS_SOAP_STUB=<dir>` answers from recorded responses, as soap-sample does.
|
|
76
|
-
const stub = context.environment
|
|
77
|
-
const transport = stub === undefined
|
|
77
|
+
const stub = settingValue("LLM4TS_SOAP_STUB", context.environment);
|
|
78
|
+
const transport = stub === undefined
|
|
78
79
|
? live
|
|
79
80
|
: makeDirectoryStubTransport(resolve(context.projectRoot, stub), catalog);
|
|
80
81
|
const secrets = nodeSecretSource(context.environment);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llm4ts/shell",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.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",
|
|
@@ -18,26 +18,6 @@
|
|
|
18
18
|
"kits"
|
|
19
19
|
],
|
|
20
20
|
"exports": {
|
|
21
|
-
"./Cli": "./dist/Cli.js",
|
|
22
|
-
"./CoderChoice": "./dist/CoderChoice.js",
|
|
23
|
-
"./Config": "./dist/Config.js",
|
|
24
|
-
"./ConfigCommand": "./dist/ConfigCommand.js",
|
|
25
|
-
"./ConfigEdit": "./dist/ConfigEdit.js",
|
|
26
|
-
"./ConfigTrust": "./dist/ConfigTrust.js",
|
|
27
|
-
"./FlowCatalog": "./dist/FlowCatalog.js",
|
|
28
|
-
"./FlowLaunch": "./dist/FlowLaunch.js",
|
|
29
|
-
"./FlowProcess": "./dist/FlowProcess.js",
|
|
30
|
-
"./Menu": "./dist/Menu.js",
|
|
31
|
-
"./OperatorActTools": "./dist/OperatorActTools.js",
|
|
32
|
-
"./OperatorConfig": "./dist/OperatorConfig.js",
|
|
33
|
-
"./OperatorNode": "./dist/OperatorNode.js",
|
|
34
|
-
"./OperatorRuns": "./dist/OperatorRuns.js",
|
|
35
|
-
"./OperatorServer": "./dist/OperatorServer.js",
|
|
36
|
-
"./OperatorTools": "./dist/OperatorTools.js",
|
|
37
|
-
"./Refine": "./dist/Refine.js",
|
|
38
|
-
"./RunSupervisor": "./dist/RunSupervisor.js",
|
|
39
|
-
"./Package": "./dist/Package.js",
|
|
40
|
-
"./ShellErrors": "./dist/ShellErrors.js",
|
|
41
21
|
"./package.json": "./package.json"
|
|
42
22
|
},
|
|
43
23
|
"publishConfig": {
|
|
@@ -65,9 +45,9 @@
|
|
|
65
45
|
"dependencies": {
|
|
66
46
|
"@effect/platform-node": "4.0.0",
|
|
67
47
|
"@effect/platform-node-shared": "4.0.0",
|
|
68
|
-
"@llm4ts/
|
|
69
|
-
"@llm4ts/
|
|
70
|
-
"@llm4ts/
|
|
48
|
+
"@llm4ts/runner": "4.0.0",
|
|
49
|
+
"@llm4ts/core": "4.0.0",
|
|
50
|
+
"@llm4ts/flow": "4.0.0"
|
|
71
51
|
},
|
|
72
52
|
"peerDependencies": {
|
|
73
53
|
"effect": "4.0.0"
|
package/src/Cli.ts
CHANGED
|
@@ -10,12 +10,7 @@ import { FileSystem } from "effect/FileSystem"
|
|
|
10
10
|
import * as Schema from "effect/Schema"
|
|
11
11
|
import { Argument, Command, Flag } from "effect/cli"
|
|
12
12
|
import { makeCliProgram } from "@llm4ts/runner/Cli"
|
|
13
|
-
import {
|
|
14
|
-
CostsResult,
|
|
15
|
-
makeCostsProgram,
|
|
16
|
-
renderCostsResult,
|
|
17
|
-
type CostsOptions
|
|
18
|
-
} from "@llm4ts/runner/Costs"
|
|
13
|
+
import { CostsResult, makeCostsProgram, renderCostsResult, type CostsOptions } from "./Costs.ts"
|
|
19
14
|
import { makeDoctorProgram } from "@llm4ts/runner/Doctor"
|
|
20
15
|
import { makeGeminiBridgeProgram, type GeminiBridgeOptions } from "@llm4ts/runner/GeminiBridgeServe"
|
|
21
16
|
import { nodeProcessExecutor } from "@llm4ts/runner/NodeProcessExecutor"
|
|
@@ -33,8 +28,8 @@ import {
|
|
|
33
28
|
nodeTraceSources,
|
|
34
29
|
nodeWatchDependencies,
|
|
35
30
|
type WatchOptions
|
|
36
|
-
} from "
|
|
37
|
-
import { makeProfileProgram, type ProfileOptions } from "
|
|
31
|
+
} from "./Watch.ts"
|
|
32
|
+
import { makeProfileProgram, type ProfileOptions } from "./Profile.ts"
|
|
38
33
|
import {
|
|
39
34
|
makeGraphProgram,
|
|
40
35
|
nodeGraphDependencies,
|
|
@@ -58,6 +53,7 @@ import {
|
|
|
58
53
|
resolvedEnvironment,
|
|
59
54
|
type FlagAssignment
|
|
60
55
|
} from "./Config.ts"
|
|
56
|
+
import { settingValue } from "@llm4ts/flow/Settings"
|
|
61
57
|
import { configCommand, configView, parseAssignment, renderDoctorConfig } from "./ConfigCommand.ts"
|
|
62
58
|
import { launchFlow } from "./FlowLaunch.ts"
|
|
63
59
|
import { mcpOptionsFrom } from "./OperatorConfig.ts"
|
|
@@ -1039,7 +1035,8 @@ export const geminiBridgeOptionsFrom = (
|
|
|
1039
1035
|
message: `--mode is "${mode}"; use model (OpenAI chat completions) or acp (Anthropic Messages)`
|
|
1040
1036
|
})
|
|
1041
1037
|
}
|
|
1042
|
-
const token =
|
|
1038
|
+
const token =
|
|
1039
|
+
Option.getOrUndefined(flags.token) ?? settingValue("LLM4TS_GEMINI_BRIDGE_TOKEN", environment)
|
|
1043
1040
|
return {
|
|
1044
1041
|
port,
|
|
1045
1042
|
mode,
|
package/src/CoderChoice.ts
CHANGED
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
import { accessSync, constants } from "node:fs"
|
|
2
2
|
import { delimiter, join } from "node:path"
|
|
3
|
+
import { connectorTable, offeredCoders } from "@llm4ts/core/Models"
|
|
4
|
+
import { settingValue } from "@llm4ts/flow/Settings"
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
|
-
* The
|
|
6
|
-
* the executable
|
|
7
|
-
* the connector identity vocabulary of `@llm4ts/core/Models` narrowed to the
|
|
8
|
-
* CLI coding agents the runner exposes.
|
|
7
|
+
* The coding agents a menu offers: the name written as `LLM4TS_CODER`, and
|
|
8
|
+
* the executable its connector spawns. Both come from core's connector table.
|
|
9
9
|
*/
|
|
10
10
|
export interface CoderChoice {
|
|
11
11
|
readonly token: string
|
|
12
12
|
readonly executable: string
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export const coderChoices: ReadonlyArray<CoderChoice> =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
{ token: "pi", executable: "pi" },
|
|
20
|
-
{ token: "agy", executable: "agy" },
|
|
21
|
-
{ token: "grok", executable: "grok" },
|
|
22
|
-
{ token: "cursor", executable: "cursor-agent" },
|
|
23
|
-
{ token: "opencode", executable: "opencode" }
|
|
24
|
-
]
|
|
15
|
+
export const coderChoices: ReadonlyArray<CoderChoice> = offeredCoders.map((name) => ({
|
|
16
|
+
token: connectorTable[name].names[0],
|
|
17
|
+
executable: connectorTable[name].executable
|
|
18
|
+
}))
|
|
25
19
|
|
|
26
20
|
/**
|
|
27
21
|
* Locates an executable on `PATH` without spawning a process. Decoration
|
|
@@ -53,6 +47,6 @@ export const findOnPath = (
|
|
|
53
47
|
export const resolvedCoderToken = (
|
|
54
48
|
environment: Readonly<Record<string, string | undefined>> = process.env
|
|
55
49
|
): string => {
|
|
56
|
-
const token =
|
|
57
|
-
return coderChoices.
|
|
50
|
+
const token = settingValue("LLM4TS_CODER", environment)
|
|
51
|
+
return coderChoices.find((choice) => choice.token === token)?.token ?? "claude"
|
|
58
52
|
}
|
package/src/Config.ts
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
readSetting,
|
|
17
17
|
settingFacts,
|
|
18
18
|
settingNames,
|
|
19
|
+
unreadableInEnvironment,
|
|
19
20
|
type Environment,
|
|
20
21
|
type SettingFacts,
|
|
21
22
|
type SettingName
|
|
@@ -259,9 +260,9 @@ export interface ResolveInput {
|
|
|
259
260
|
* Pure: flag > environment > project file > global file. Judges each
|
|
260
261
|
* assignment against the registry and keeps what each winner shadows. An
|
|
261
262
|
* empty value counts as unset unless the grammar gives empty a meaning. A
|
|
262
|
-
* value the grammar does not read is
|
|
263
|
-
*
|
|
264
|
-
*
|
|
263
|
+
* value the grammar does not read is an error from every layer: dropped from
|
|
264
|
+
* a flag or a file, kept from the environment so `config show` can print
|
|
265
|
+
* where it comes from. A launch refuses on either.
|
|
265
266
|
*/
|
|
266
267
|
export const resolveConfig = (input: ResolveInput): Resolution => {
|
|
267
268
|
const known = new Map<string, SettingFacts>(input.facts.map((fact) => [fact.name, fact]))
|
|
@@ -324,9 +325,12 @@ export const resolveConfig = (input: ResolveInput): Resolution => {
|
|
|
324
325
|
const read = readSetting(fact.name, value)
|
|
325
326
|
if (Result.isFailure(read)) {
|
|
326
327
|
problems.push({
|
|
327
|
-
severity:
|
|
328
|
+
severity: "error",
|
|
328
329
|
kind: "unreadable",
|
|
329
|
-
message:
|
|
330
|
+
message:
|
|
331
|
+
source.layer === "environment"
|
|
332
|
+
? unreadableInEnvironment(fact.name)
|
|
333
|
+
: `${where}: ${name} must be ${read.failure}`,
|
|
330
334
|
name,
|
|
331
335
|
source
|
|
332
336
|
})
|
package/src/ConfigEdit.ts
CHANGED
|
@@ -120,10 +120,10 @@ export const seatSettings: ReadonlyArray<SettingName> = ["LLM4TS_CODER", "LLM4TS
|
|
|
120
120
|
export const valuePrompt = (fact: SettingFacts): ValuePrompt =>
|
|
121
121
|
fact.toggle
|
|
122
122
|
? { kind: "toggle" }
|
|
123
|
-
: fact.
|
|
124
|
-
? { kind: "
|
|
125
|
-
:
|
|
126
|
-
? { kind: "
|
|
123
|
+
: seatSettings.includes(fact.name)
|
|
124
|
+
? { kind: "seat" }
|
|
125
|
+
: fact.choices.length > 0
|
|
126
|
+
? { kind: "choices", choices: fact.choices }
|
|
127
127
|
: { kind: "text" }
|
|
128
128
|
|
|
129
129
|
/**
|