@llm4ts/shell 0.7.1 → 0.7.3
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/flows/modernize-verify.js +14 -7
- package/package.json +5 -5
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
import { join } from "node:path";
|
|
21
21
|
import * as Effect from "effect/Effect";
|
|
22
22
|
import * as Schema from "effect/Schema";
|
|
23
|
-
import { CurrentEquivSchema, EquivVector, Observations, readEquivVectors, replayEquivVector, diffObservations, writeEquivVectors } from "@llm4ts/flow/Equiv";
|
|
23
|
+
import { CurrentEquivSchema, EquivVector, Observations, canonicaliseFieldMap, readEquivVectors, replayEquivVector, diffObservations, writeEquivVectors } from "@llm4ts/flow/Equiv";
|
|
24
24
|
import { renderEquivReport, VectorVerdict } from "@llm4ts/flow/EquivReport";
|
|
25
25
|
import { FlowAborted, PlanParseError } from "@llm4ts/flow/FlowError";
|
|
26
26
|
import { structuredAndPublish } from "@llm4ts/flow/Flow";
|
|
@@ -44,18 +44,25 @@ const ModDir = "docs/modernization";
|
|
|
44
44
|
* The model-facing vector shape: flat maps only, so structured output stays
|
|
45
45
|
* schema-simple. `kind` is "record" (an emitted record) or "db" (a mutation).
|
|
46
46
|
*/
|
|
47
|
+
/**
|
|
48
|
+
* Values are accepted as any JSON scalar and rendered to strings by
|
|
49
|
+
* `canonicaliseFieldMap`: asked for a numeric COBOL field a model answers
|
|
50
|
+
* `"ZSTC": 0` as often as `"0"`, and rejecting that wastes a generation turn
|
|
51
|
+
* over a difference the comparison does not care about.
|
|
52
|
+
*/
|
|
53
|
+
const GeneratedValue = Schema.Union([Schema.String, Schema.Number, Schema.Boolean]);
|
|
47
54
|
class GeneratedObservation extends Schema.Class("GeneratedObservation")({
|
|
48
55
|
kind: Schema.String,
|
|
49
56
|
channel: Schema.String,
|
|
50
57
|
op: Schema.String,
|
|
51
|
-
key: Schema.Record(Schema.String,
|
|
52
|
-
fields: Schema.Record(Schema.String,
|
|
58
|
+
key: Schema.Record(Schema.String, GeneratedValue),
|
|
59
|
+
fields: Schema.Record(Schema.String, GeneratedValue)
|
|
53
60
|
}) {
|
|
54
61
|
}
|
|
55
62
|
class GeneratedVector extends Schema.Class("GeneratedVector")({
|
|
56
63
|
id: Schema.String,
|
|
57
64
|
rules: Schema.Array(Schema.String),
|
|
58
|
-
inputs: Schema.Record(Schema.String,
|
|
65
|
+
inputs: Schema.Record(Schema.String, GeneratedValue),
|
|
59
66
|
observations: Schema.Array(GeneratedObservation)
|
|
60
67
|
}) {
|
|
61
68
|
}
|
|
@@ -133,9 +140,9 @@ const slug = (title) => title
|
|
|
133
140
|
const toObservation = (vectorId, generated) => {
|
|
134
141
|
switch (generated.kind.toLowerCase()) {
|
|
135
142
|
case "record":
|
|
136
|
-
return Effect.succeed(Observations.record(generated.channel, generated.fields));
|
|
143
|
+
return Effect.succeed(Observations.record(generated.channel, canonicaliseFieldMap(generated.fields)));
|
|
137
144
|
case "db":
|
|
138
|
-
return Effect.succeed(Observations.dbMutation(generated.channel, generated.op, generated.key, generated.fields));
|
|
145
|
+
return Effect.succeed(Observations.dbMutation(generated.channel, generated.op, canonicaliseFieldMap(generated.key), canonicaliseFieldMap(generated.fields)));
|
|
139
146
|
default:
|
|
140
147
|
return Effect.fail(PlanParseError.make({
|
|
141
148
|
message: `vector ${vectorId}: unknown observation kind '${generated.kind}' (expected record|db)`
|
|
@@ -153,7 +160,7 @@ const toVector = Effect.fn("modernize-verify.toVector")(function* (program, gene
|
|
|
153
160
|
id: generated.id,
|
|
154
161
|
tier: "generated",
|
|
155
162
|
rules: generated.rules,
|
|
156
|
-
inputs: generated.inputs,
|
|
163
|
+
inputs: canonicaliseFieldMap(generated.inputs),
|
|
157
164
|
observations
|
|
158
165
|
});
|
|
159
166
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llm4ts/shell",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
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.7.
|
|
53
|
-
"@llm4ts/flow": "0.7.
|
|
54
|
-
"@llm4ts/modernize": "0.7.
|
|
55
|
-
"@llm4ts/runner": "0.7.
|
|
52
|
+
"@llm4ts/core": "0.7.3",
|
|
53
|
+
"@llm4ts/flow": "0.7.3",
|
|
54
|
+
"@llm4ts/modernize": "0.7.3",
|
|
55
|
+
"@llm4ts/runner": "0.7.3"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"effect": "^4.0.0-beta.102"
|