@llm4ts/flow 3.3.0 → 3.4.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/dist/Bench.d.ts.map +1 -1
- package/dist/Bench.js +3 -7
- package/dist/Bench.js.map +1 -1
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +2 -8
- package/dist/Context.js.map +1 -1
- package/dist/CostTracker.d.ts +1 -1
- package/dist/CostTracker.d.ts.map +1 -1
- package/dist/CostTracker.js +2 -8
- package/dist/CostTracker.js.map +1 -1
- package/dist/EstimatedUsage.d.ts.map +1 -1
- package/dist/EstimatedUsage.js +4 -3
- package/dist/EstimatedUsage.js.map +1 -1
- package/dist/FlowEvents.d.ts +100 -0
- package/dist/FlowEvents.d.ts.map +1 -1
- package/dist/FlowEvents.js +188 -107
- package/dist/FlowEvents.js.map +1 -1
- package/dist/FlowRecorder.d.ts +1 -1
- package/dist/FlowRecorder.d.ts.map +1 -1
- package/dist/FlowRecorder.js +4 -10
- package/dist/FlowRecorder.js.map +1 -1
- package/dist/GateTriage.d.ts +1 -1
- package/dist/GateTriage.d.ts.map +1 -1
- package/dist/GateTriage.js +1 -1
- package/dist/GateTriage.js.map +1 -1
- package/dist/GraphRules.d.ts +3 -1
- package/dist/GraphRules.d.ts.map +1 -1
- package/dist/GraphRules.js +2 -0
- package/dist/GraphRules.js.map +1 -1
- package/dist/JudgmentLog.d.ts.map +1 -1
- package/dist/JudgmentLog.js +5 -8
- package/dist/JudgmentLog.js.map +1 -1
- package/dist/NodePreflight.d.ts.map +1 -1
- package/dist/NodePreflight.js +2 -2
- package/dist/NodePreflight.js.map +1 -1
- package/dist/OracleGuard.d.ts +1 -1
- package/dist/OracleGuard.d.ts.map +1 -1
- package/dist/OracleGuard.js +1 -1
- package/dist/OracleGuard.js.map +1 -1
- package/dist/Orientation.d.ts.map +1 -1
- package/dist/Orientation.js +3 -5
- package/dist/Orientation.js.map +1 -1
- package/dist/Retro.d.ts.map +1 -1
- package/dist/Retro.js +2 -3
- package/dist/Retro.js.map +1 -1
- package/dist/Settings.d.ts +26 -0
- package/dist/Settings.d.ts.map +1 -1
- package/dist/Settings.js +30 -7
- package/dist/Settings.js.map +1 -1
- package/dist/Spans.d.ts.map +1 -1
- package/dist/Spans.js +2 -4
- package/dist/Spans.js.map +1 -1
- package/dist/Survey.d.ts +2 -4
- package/dist/Survey.d.ts.map +1 -1
- package/dist/Survey.js +2 -2
- package/dist/Survey.js.map +1 -1
- package/dist/TestEvidence.d.ts.map +1 -1
- package/dist/TestEvidence.js +4 -3
- package/dist/TestEvidence.js.map +1 -1
- package/dist/Workspace.d.ts.map +1 -1
- package/dist/Workspace.js +5 -22
- package/dist/Workspace.js.map +1 -1
- package/dist/settings/Registry.d.ts +5 -5
- package/dist/settings/Registry.d.ts.map +1 -1
- package/dist/settings/Registry.js +8 -7
- package/dist/settings/Registry.js.map +1 -1
- package/dist/settings/Value.d.ts +6 -1
- package/dist/settings/Value.d.ts.map +1 -1
- package/dist/settings/Value.js +8 -3
- package/dist/settings/Value.js.map +1 -1
- package/package.json +2 -2
- package/src/Bench.ts +6 -19
- package/src/Context.ts +2 -8
- package/src/CostTracker.ts +3 -15
- package/src/EstimatedUsage.ts +4 -3
- package/src/FlowEvents.ts +383 -117
- package/src/FlowRecorder.ts +7 -16
- package/src/GateTriage.ts +1 -1
- package/src/GraphRules.ts +4 -1
- package/src/JudgmentLog.ts +5 -13
- package/src/NodePreflight.ts +2 -4
- package/src/OracleGuard.ts +1 -1
- package/src/Orientation.ts +3 -5
- package/src/Retro.ts +2 -5
- package/src/Settings.ts +46 -7
- package/src/Spans.ts +2 -4
- package/src/Survey.ts +2 -2
- package/src/TestEvidence.ts +4 -3
- package/src/Workspace.ts +7 -24
- package/src/settings/Registry.ts +13 -7
- package/src/settings/Value.ts +12 -5
package/src/JudgmentLog.ts
CHANGED
|
@@ -5,8 +5,7 @@ import * as Ref from "effect/Ref"
|
|
|
5
5
|
import * as Schema from "effect/Schema"
|
|
6
6
|
import * as Semaphore from "effect/Semaphore"
|
|
7
7
|
import type * as Scope from "effect/Scope"
|
|
8
|
-
import
|
|
9
|
-
import { awaitConsumed, JudgmentObserved, type FlowEvent, type FlowEventHub } from "./FlowEvents.ts"
|
|
8
|
+
import { JudgmentObserved, type FlowEvent, type FlowEventHub } from "./FlowEvents.ts"
|
|
10
9
|
import type { PlainFileStoreShape } from "./Persistence.ts"
|
|
11
10
|
|
|
12
11
|
export class JudgmentObservation extends Schema.Class<JudgmentObservation>("JudgmentObservation")({
|
|
@@ -42,7 +41,6 @@ export const makeJudgmentLog = Effect.fn("@llm4ts/flow/JudgmentLog.make")(functi
|
|
|
42
41
|
readonly root: string
|
|
43
42
|
readonly runId: string
|
|
44
43
|
}): Effect.fn.Return<JudgmentLogShape> {
|
|
45
|
-
const consumed = yield* Ref.make(0)
|
|
46
44
|
const degraded = yield* Ref.make(false)
|
|
47
45
|
const lock = yield* Semaphore.make(1)
|
|
48
46
|
const record = (event: FlowEvent): Effect.Effect<void> =>
|
|
@@ -66,23 +64,17 @@ export const makeJudgmentLog = Effect.fn("@llm4ts/flow/JudgmentLog.make")(functi
|
|
|
66
64
|
)
|
|
67
65
|
|
|
68
66
|
const awaitDrained = (hub: FlowEventHub, timeout?: Duration.Input): Effect.Effect<boolean> =>
|
|
69
|
-
|
|
67
|
+
Effect.map(hub.drained(timeout), (report) => report.complete)
|
|
70
68
|
|
|
71
69
|
return {
|
|
72
70
|
record,
|
|
73
71
|
awaitDrained,
|
|
74
72
|
consume: (hub) =>
|
|
75
73
|
Effect.gen(function* () {
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
yield* Stream.fromSubscription(subscription).pipe(
|
|
79
|
-
Stream.runForEach((event) =>
|
|
80
|
-
record(event).pipe(Effect.andThen(Ref.update(consumed, (count) => count + 1)))
|
|
81
|
-
),
|
|
82
|
-
Effect.forkScoped
|
|
83
|
-
)
|
|
74
|
+
// A judgment log may be attached to a run already under way.
|
|
75
|
+
const consumer = yield* hub.consume("judgment log", record, { from: "now" })
|
|
84
76
|
// Registered after the consumer fiber: drain before scope interrupts it.
|
|
85
|
-
yield* Effect.addFinalizer(() =>
|
|
77
|
+
yield* Effect.addFinalizer(() => consumer.caughtUp())
|
|
86
78
|
})
|
|
87
79
|
}
|
|
88
80
|
})
|
package/src/NodePreflight.ts
CHANGED
|
@@ -18,6 +18,7 @@ import type { ProcessExecutorShape } from "@llm4ts/core/ProcessExecutor"
|
|
|
18
18
|
import { FlowAborted, type FlowError } from "./FlowError.ts"
|
|
19
19
|
import { Info, type FlowEventsShape } from "./FlowEvents.ts"
|
|
20
20
|
import type { PlainFileStoreShape } from "./Persistence.ts"
|
|
21
|
+
import { settingValue } from "./Settings.ts"
|
|
21
22
|
|
|
22
23
|
/** A Node pin as the application wrote it, and where. */
|
|
23
24
|
export class NodePin extends Schema.Class<NodePin>("NodePin")({
|
|
@@ -226,9 +227,6 @@ export type NodePreflightReport =
|
|
|
226
227
|
}
|
|
227
228
|
| { readonly _tag: "Ok"; readonly node: string; readonly summary: string }
|
|
228
229
|
|
|
229
|
-
const switchedOff = (value: string | undefined): boolean =>
|
|
230
|
-
value !== undefined && ["off", "0", "false", "no"].includes(value.trim().toLowerCase())
|
|
231
|
-
|
|
232
230
|
const describePin = (pin: NodePin): string => `${pin.spec} (${pin.source})`
|
|
233
231
|
|
|
234
232
|
/**
|
|
@@ -242,7 +240,7 @@ export const nodePreflightReport = Effect.fn("@llm4ts/flow/NodePreflight.report"
|
|
|
242
240
|
appDir: string,
|
|
243
241
|
environment: Readonly<Record<string, string | undefined>>
|
|
244
242
|
): Effect.fn.Return<NodePreflightReport> {
|
|
245
|
-
if (
|
|
243
|
+
if (!settingValue("LLM4TS_NODE_CHECK", environment)) {
|
|
246
244
|
return { _tag: "Off", summary: "node: check off (LLM4TS_NODE_CHECK)" }
|
|
247
245
|
}
|
|
248
246
|
const pins = yield* nodePinsOf(files, appDir)
|
package/src/OracleGuard.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// its plan entry says it may. Deterministic, from the diff and the gate
|
|
4
4
|
// output; a violation is a gate failure the fix round can undo.
|
|
5
5
|
import * as Schema from "effect/Schema"
|
|
6
|
-
import { ReviewIssue } from "./
|
|
6
|
+
import { ReviewIssue } from "./ReviewModel.ts"
|
|
7
7
|
|
|
8
8
|
export class OracleRules extends Schema.Class<OracleRules>("OracleRules")({
|
|
9
9
|
/** Regex source: a path matching it is a test file. */
|
package/src/Orientation.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// call, computed once per epic, so every story stops rediscovering the
|
|
5
5
|
// layout with `ls`, `find` and `grep` round trips.
|
|
6
6
|
import { cap } from "./Context.ts"
|
|
7
|
+
import { settingGiven } from "./Settings.ts"
|
|
7
8
|
|
|
8
9
|
export interface OrientationInput {
|
|
9
10
|
/** Tracked files, repo-relative, as `git ls-files` prints them. */
|
|
@@ -184,9 +185,6 @@ export const orientationOf = (input: OrientationInput): string | undefined => {
|
|
|
184
185
|
export const orientationChars = (
|
|
185
186
|
environment: Readonly<Record<string, string | undefined>>
|
|
186
187
|
): { readonly orientationChars?: number } => {
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
return raw === undefined || raw.length === 0 || !Number.isInteger(value) || value < 0
|
|
190
|
-
? {}
|
|
191
|
-
: { orientationChars: value }
|
|
188
|
+
const chars = settingGiven("LLM4TS_ORIENTATION_CHARS", environment)
|
|
189
|
+
return chars._tag === "Read" ? { orientationChars: chars.value } : {}
|
|
192
190
|
}
|
package/src/Retro.ts
CHANGED
|
@@ -18,7 +18,7 @@ import { ApprovedMarker, DraftApprovalMarker } from "./Approval.ts"
|
|
|
18
18
|
import { Board, BoardVersion } from "./BoardSync.ts"
|
|
19
19
|
import { cap } from "./Context.ts"
|
|
20
20
|
import { PersistenceError, type FlowError, type StoryPlanInvalid } from "./FlowError.ts"
|
|
21
|
-
import { FlowEvent, Info, type FlowEventsShape } from "./FlowEvents.ts"
|
|
21
|
+
import { FlowEvent, Info, laneOf, type FlowEventsShape } from "./FlowEvents.ts"
|
|
22
22
|
import type { TraceLine } from "./FlowRecorder.ts"
|
|
23
23
|
import { Plan, Task, parsePlan } from "./Plan.ts"
|
|
24
24
|
import { loadVersioned, makePlanStore, type PlainFileStoreShape } from "./Persistence.ts"
|
|
@@ -186,9 +186,6 @@ const traceView = (lines: ReadonlyArray<TraceLine>): TraceView => {
|
|
|
186
186
|
return { outcome, events }
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
const laneOf = (event: FlowEvent): string | undefined =>
|
|
190
|
-
"lane" in event && typeof event.lane === "string" ? event.lane : undefined
|
|
191
|
-
|
|
192
189
|
const retryLine = /^⟳ (.+?) — retry (\d+)\/(\d+): (.*)$/u
|
|
193
190
|
|
|
194
191
|
const retryKind = (what: string): string =>
|
|
@@ -317,7 +314,7 @@ const storySection = (
|
|
|
317
314
|
)
|
|
318
315
|
}
|
|
319
316
|
|
|
320
|
-
const laneEvents = trace.events.filter((event) => laneOf(event) === story.id)
|
|
317
|
+
const laneEvents = trace.events.filter((event) => laneOf(event)?.lane === story.id)
|
|
321
318
|
const traceLines: Array<string> = []
|
|
322
319
|
const retries: Array<string> = []
|
|
323
320
|
for (const event of laneEvents) {
|
package/src/Settings.ts
CHANGED
|
@@ -113,6 +113,32 @@ export const readSetting = <N extends SettingName>(
|
|
|
113
113
|
return Option.isSome(decoded) ? Result.succeed(decoded.value) : Result.fail(value.grammar)
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
/** What the environment holds for a setting, before any default. */
|
|
117
|
+
export type Given<N extends SettingName> =
|
|
118
|
+
| { readonly _tag: "Unset" }
|
|
119
|
+
| { readonly _tag: "Read"; readonly value: ValueOf<N> }
|
|
120
|
+
/** `text` is the trimmed value the grammar did not read: to report or refuse, never to parse. */
|
|
121
|
+
| { readonly _tag: "Unreadable"; readonly text: string }
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* `settingValue` without the default, for a reader that keeps its own default
|
|
125
|
+
* or tells an unreadable value from an unset one.
|
|
126
|
+
*/
|
|
127
|
+
export const settingGiven = <N extends SettingName>(
|
|
128
|
+
name: N,
|
|
129
|
+
environment: Environment
|
|
130
|
+
): Given<N> => {
|
|
131
|
+
const raw = environment[name]
|
|
132
|
+
if (raw === undefined) {
|
|
133
|
+
return { _tag: "Unset" }
|
|
134
|
+
}
|
|
135
|
+
const read = readSetting(name, raw)
|
|
136
|
+
if (Result.isFailure(read)) {
|
|
137
|
+
return { _tag: "Unreadable", text: raw.trim() }
|
|
138
|
+
}
|
|
139
|
+
return read.success === undefined ? { _tag: "Unset" } : { _tag: "Read", value: read.success }
|
|
140
|
+
}
|
|
141
|
+
|
|
116
142
|
/**
|
|
117
143
|
* The setting's value in `environment`. Unset: the default when the setting
|
|
118
144
|
* has one, else `undefined`. A value the grammar does not read counts as
|
|
@@ -122,13 +148,26 @@ export const settingValue = <N extends SettingName>(
|
|
|
122
148
|
name: N,
|
|
123
149
|
environment: Environment
|
|
124
150
|
): Reading<N> => {
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
151
|
+
const given = settingGiven(name, environment)
|
|
152
|
+
return given._tag === "Read" ? given.value : entries[name].fallback.value
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
type Spelled = {
|
|
156
|
+
readonly [N in SettingName]: Values[N] extends string | number ? N : never
|
|
157
|
+
}[SettingName]
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* The setting as the text to look up or quote: the value read, else the text
|
|
161
|
+
* the grammar refused, else `undefined`. For a reader that names what it was
|
|
162
|
+
* given in its own refusal.
|
|
163
|
+
*/
|
|
164
|
+
export const settingText = (name: Spelled, environment: Environment): string | undefined => {
|
|
165
|
+
const given = settingGiven(name, environment)
|
|
166
|
+
return given._tag === "Read"
|
|
167
|
+
? String(given.value)
|
|
168
|
+
: given._tag === "Unreadable"
|
|
169
|
+
? given.text
|
|
170
|
+
: undefined
|
|
132
171
|
}
|
|
133
172
|
|
|
134
173
|
const belongsIn: Readonly<Record<SettingScope, string>> = {
|
package/src/Spans.ts
CHANGED
|
@@ -9,6 +9,7 @@ import * as Option from "effect/Option"
|
|
|
9
9
|
import type * as Tracer from "effect/Tracer"
|
|
10
10
|
import type { TokenUsage } from "@llm4ts/core/Models"
|
|
11
11
|
import { isEstimatedModel } from "./EstimatedUsage.ts"
|
|
12
|
+
import { settingValue } from "./Settings.ts"
|
|
12
13
|
|
|
13
14
|
export type SpanKind = "CHAIN" | "AGENT" | "LLM" | "TOOL" | "EVALUATOR"
|
|
14
15
|
|
|
@@ -49,10 +50,7 @@ export type OtelContent = "off" | "on" | "full"
|
|
|
49
50
|
/** LLM4TS_OTEL_CONTENT: `on` or `full`; anything else is off. */
|
|
50
51
|
export const otelContent = (
|
|
51
52
|
environment: Readonly<Record<string, string | undefined>>
|
|
52
|
-
): OtelContent =>
|
|
53
|
-
const value = environment.LLM4TS_OTEL_CONTENT?.trim().toLowerCase()
|
|
54
|
-
return value === "on" ? "on" : value === "full" ? "full" : "off"
|
|
55
|
-
}
|
|
53
|
+
): OtelContent => settingValue("LLM4TS_OTEL_CONTENT", environment)
|
|
56
54
|
|
|
57
55
|
export interface SpanOptions {
|
|
58
56
|
readonly kind: SpanKind
|
package/src/Survey.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { PlanParseError } from "./FlowError.ts"
|
|
|
5
5
|
import {
|
|
6
6
|
edgeRuleOfSurvey,
|
|
7
7
|
emptyGraphRules,
|
|
8
|
+
JoinMatch,
|
|
8
9
|
matchUrl,
|
|
9
10
|
matchUrlPath,
|
|
10
11
|
normalizeUrl,
|
|
@@ -29,8 +30,7 @@ export const GraphMechanism = Schema.Literals([
|
|
|
29
30
|
"codegraph"
|
|
30
31
|
])
|
|
31
32
|
export type GraphMechanism = typeof GraphMechanism.Type
|
|
32
|
-
export
|
|
33
|
-
export type JoinMatch = typeof JoinMatch.Type
|
|
33
|
+
export { JoinMatch }
|
|
34
34
|
|
|
35
35
|
export class GraphEvidence extends Schema.Class<GraphEvidence>("GraphEvidence")({
|
|
36
36
|
file: Schema.String,
|
package/src/TestEvidence.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import * as Schema from "effect/Schema"
|
|
7
7
|
import type { OracleRules } from "./OracleGuard.ts"
|
|
8
8
|
import { defaultOracleRules } from "./OracleGuard.ts"
|
|
9
|
+
import { settingValue } from "./Settings.ts"
|
|
9
10
|
|
|
10
11
|
/** The tag tests of a criterion carry in their name: `[story-id#2]` for its second criterion. */
|
|
11
12
|
export const criterionTag = (storyId: string, index: number): string => `[${storyId}#${index}]`
|
|
@@ -106,11 +107,11 @@ export type EvidenceSource =
|
|
|
106
107
|
export const evidenceSourceFromEnvironment = (
|
|
107
108
|
environment: Readonly<Record<string, string | undefined>>
|
|
108
109
|
): EvidenceSource | undefined => {
|
|
109
|
-
const report = environment
|
|
110
|
-
if (report !== undefined
|
|
110
|
+
const report = settingValue("LLM4TS_TEST_REPORT", environment)
|
|
111
|
+
if (report !== undefined) {
|
|
111
112
|
return { _tag: "Report", path: report }
|
|
112
113
|
}
|
|
113
|
-
const command = environment
|
|
114
|
+
const command = settingValue("LLM4TS_TEST_ONE", environment)
|
|
114
115
|
if (command !== undefined && (command.includes("{tag}") || command.includes("{tagRegex}"))) {
|
|
115
116
|
return { _tag: "Command", argv: command.split(/\s+/u) }
|
|
116
117
|
}
|
package/src/Workspace.ts
CHANGED
|
@@ -3,6 +3,7 @@ import * as Effect from "effect/Effect"
|
|
|
3
3
|
import * as Ref from "effect/Ref"
|
|
4
4
|
import * as Schema from "effect/Schema"
|
|
5
5
|
import { WorkspaceIoError, WorkspaceLimitError, WorkspacePathError } from "./FlowError.ts"
|
|
6
|
+
import { settingValue } from "./Settings.ts"
|
|
6
7
|
|
|
7
8
|
export type WorkspaceError = WorkspacePathError | WorkspaceLimitError | WorkspaceIoError
|
|
8
9
|
|
|
@@ -63,27 +64,6 @@ export const legacySourceWorkspaceLimits: WorkspaceLimits = Object.freeze({
|
|
|
63
64
|
maxResults: 20_000
|
|
64
65
|
})
|
|
65
66
|
|
|
66
|
-
const positiveInteger = (raw: string | undefined): number | undefined => {
|
|
67
|
-
const text = raw?.trim()
|
|
68
|
-
if (text === undefined || text.length === 0 || !/^\d+$/.test(text)) {
|
|
69
|
-
return undefined
|
|
70
|
-
}
|
|
71
|
-
const parsed = Number.parseInt(text, 10)
|
|
72
|
-
return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : undefined
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const directoryList = (raw: string | undefined): ReadonlyArray<string> | undefined => {
|
|
76
|
-
const text = raw?.trim()
|
|
77
|
-
if (text === undefined || text.length === 0) {
|
|
78
|
-
return undefined
|
|
79
|
-
}
|
|
80
|
-
const names = text
|
|
81
|
-
.split(",")
|
|
82
|
-
.map((name) => name.trim())
|
|
83
|
-
.filter((name) => name.length > 0 && !name.includes("/") && !name.includes("\\"))
|
|
84
|
-
return names.length === 0 ? undefined : names
|
|
85
|
-
}
|
|
86
|
-
|
|
87
67
|
/**
|
|
88
68
|
* `defaults` with the caps overridden from the environment when the values
|
|
89
69
|
* are well-formed; anything else leaves that default untouched:
|
|
@@ -101,9 +81,12 @@ export const workspaceLimitsFromEnv = (
|
|
|
101
81
|
environment: Readonly<Record<string, string | undefined>>,
|
|
102
82
|
defaults: WorkspaceLimits = defaultWorkspaceLimits
|
|
103
83
|
): WorkspaceLimits => {
|
|
104
|
-
const maxReadBytes =
|
|
105
|
-
const maxResults =
|
|
106
|
-
const
|
|
84
|
+
const maxReadBytes = settingValue("LLM4TS_MAX_READ_BYTES", environment)
|
|
85
|
+
const maxResults = settingValue("LLM4TS_MAX_DISCOVER_RESULTS", environment)
|
|
86
|
+
const names = (settingValue("LLM4TS_EXCLUDE_DIRS", environment) ?? []).filter(
|
|
87
|
+
(name) => !name.includes("/") && !name.includes("\\")
|
|
88
|
+
)
|
|
89
|
+
const excludeDirs = names.length === 0 ? undefined : names
|
|
107
90
|
if (maxReadBytes === undefined && maxResults === undefined && excludeDirs === undefined) {
|
|
108
91
|
return defaults
|
|
109
92
|
}
|
package/src/settings/Registry.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import * as Duration from "effect/Duration"
|
|
2
|
+
import {
|
|
3
|
+
apiProviderNames,
|
|
4
|
+
coderNames,
|
|
5
|
+
offeredApiProviderNames,
|
|
6
|
+
offeredCoderNames
|
|
7
|
+
} from "@llm4ts/core/Models"
|
|
2
8
|
import * as Value from "./Value.ts"
|
|
3
9
|
|
|
4
10
|
/** @internal */
|
|
@@ -78,14 +84,14 @@ export const settings = {
|
|
|
78
84
|
LLM4TS_CODER: setting({
|
|
79
85
|
group: "seats",
|
|
80
86
|
scope: "global",
|
|
81
|
-
value: Value.
|
|
87
|
+
value: Value.oneOf(coderNames),
|
|
82
88
|
fallback: fallback.perFlow("claude; pi in the epic flows"),
|
|
83
|
-
doc:
|
|
89
|
+
doc: `The coding agent that edits files: ${Value.listed(offeredCoderNames)}.`
|
|
84
90
|
}),
|
|
85
91
|
LLM4TS_REASONER: setting({
|
|
86
92
|
group: "seats",
|
|
87
93
|
scope: "global",
|
|
88
|
-
value: Value.
|
|
94
|
+
value: Value.oneOf(coderNames),
|
|
89
95
|
fallback: fallback.perFlow("claude"),
|
|
90
96
|
doc: "The agent that plans, reviews and judges in the epic, soap, roundtable and taskforce flows; any coder name."
|
|
91
97
|
}),
|
|
@@ -127,9 +133,9 @@ export const settings = {
|
|
|
127
133
|
LLM4TS_PROVIDER: setting({
|
|
128
134
|
group: "seats",
|
|
129
135
|
scope: "global",
|
|
130
|
-
value: Value.
|
|
136
|
+
value: Value.oneOf(apiProviderNames),
|
|
131
137
|
fallback: fallback.value("mock", "mock"),
|
|
132
|
-
doc:
|
|
138
|
+
doc: `The API provider of provider-driven flows such as hello: ${Value.listed(offeredApiProviderNames)}. Any provider but mock needs LLM4TS_MODEL.`
|
|
133
139
|
}),
|
|
134
140
|
LLM4TS_MODEL: setting({
|
|
135
141
|
group: "seats",
|
|
@@ -141,7 +147,7 @@ export const settings = {
|
|
|
141
147
|
LLM4TS_JUDGMENT_PROVIDER: setting({
|
|
142
148
|
group: "seats",
|
|
143
149
|
scope: "global",
|
|
144
|
-
value: Value.
|
|
150
|
+
value: Value.oneOf(apiProviderNames),
|
|
145
151
|
fallback: fallback.off("the reasoning seat answers typed judgments"),
|
|
146
152
|
doc: "The API provider of the judgment seat, named the way LLM4TS_PROVIDER is."
|
|
147
153
|
}),
|
|
@@ -276,7 +282,7 @@ export const settings = {
|
|
|
276
282
|
scope: "project",
|
|
277
283
|
value: Value.positive,
|
|
278
284
|
fallback: fallback.value(4000, "4000"),
|
|
279
|
-
doc: "How many characters of a red gate's output the fix prompt carries."
|
|
285
|
+
doc: "How many characters of a red gate's output the fix prompt carries; at least 500 in port-tests."
|
|
280
286
|
}),
|
|
281
287
|
LLM4TS_TEST_REPORT: setting({
|
|
282
288
|
group: "gates",
|
package/src/settings/Value.ts
CHANGED
|
@@ -195,12 +195,15 @@ export const commandOrNone: SettingValue<string> = make(
|
|
|
195
195
|
{ runs: true, empty: "value" }
|
|
196
196
|
)
|
|
197
197
|
|
|
198
|
-
/**
|
|
198
|
+
/**
|
|
199
|
+
* `cmd; cmd`. A lone `;` is the empty list: the way to say "run none" where
|
|
200
|
+
* an empty value means "not set" and the default commands would run.
|
|
201
|
+
*/
|
|
199
202
|
export const commands: SettingValue<ReadonlyArray<string>> = make(
|
|
200
|
-
"command lines separated by ;",
|
|
203
|
+
"command lines separated by ; (a lone ; for none)",
|
|
201
204
|
Schema.Array(Schema.String),
|
|
202
|
-
listOf(";"),
|
|
203
|
-
(value) => value.join("; "),
|
|
205
|
+
(text) => listOf(";")(text) ?? (text.includes(";") ? [] : undefined),
|
|
206
|
+
(value) => (value.length === 0 ? ";" : value.join("; ")),
|
|
204
207
|
{ runs: true }
|
|
205
208
|
)
|
|
206
209
|
|
|
@@ -232,10 +235,14 @@ export const cliFlags: SettingValue<Readonly<Record<string, string>>> = make(
|
|
|
232
235
|
.join(";")
|
|
233
236
|
)
|
|
234
237
|
|
|
238
|
+
/** `a, b or c`. */
|
|
239
|
+
export const listed = (words: ReadonlyArray<string>): string =>
|
|
240
|
+
words.join(", ").replace(/, ([^,]*)$/u, " or $1")
|
|
241
|
+
|
|
235
242
|
/** One of `choices`, any case; choices are written in lower case. */
|
|
236
243
|
export const oneOf = <const L extends ReadonlyArray<string>>(choices: L): SettingValue<L[number]> =>
|
|
237
244
|
make<L[number]>(
|
|
238
|
-
choices
|
|
245
|
+
listed(choices),
|
|
239
246
|
Schema.Literals(choices),
|
|
240
247
|
(value) => choices.find((choice) => choice === value.toLowerCase()),
|
|
241
248
|
(value) => value,
|