@orkestrel/brief 0.0.5 → 0.0.6
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/src/core/index.cjs +33 -18
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +16 -0
- package/dist/src/core/index.d.ts +16 -0
- package/dist/src/core/index.js +33 -19
- package/dist/src/core/index.js.map +1 -1
- package/package.json +13 -12
package/dist/src/core/index.cjs
CHANGED
|
@@ -45,6 +45,36 @@ var RISK_SEVERITIES = Object.freeze([
|
|
|
45
45
|
"high"
|
|
46
46
|
]);
|
|
47
47
|
/**
|
|
48
|
+
* Every published `Interpretation` member name, frozen.
|
|
49
|
+
*
|
|
50
|
+
* @remarks
|
|
51
|
+
* The capture list `BriefCompiler` hands `captureValue` at each interpret door — the borrowed
|
|
52
|
+
* engine's return, and the caller's supplied interpretation. A class instance carries its
|
|
53
|
+
* contract on the prototype, so the captured view materializes exactly the members named here,
|
|
54
|
+
* and a name missing from the list is a member the view drops.
|
|
55
|
+
*
|
|
56
|
+
* The `satisfies` clause refuses a name `Interpretation` does not declare, and it holds the
|
|
57
|
+
* element type at the listed names rather than widening it to `string`. That is what lets the
|
|
58
|
+
* equality assertion beside the capture cases refuse a list that has fallen short of the
|
|
59
|
+
* published shape.
|
|
60
|
+
*/
|
|
61
|
+
var INTERPRETATION_MEMBERS = Object.freeze([
|
|
62
|
+
"text",
|
|
63
|
+
"normalized",
|
|
64
|
+
"intent",
|
|
65
|
+
"entities",
|
|
66
|
+
"subject",
|
|
67
|
+
"definition",
|
|
68
|
+
"mappings",
|
|
69
|
+
"ambiguities",
|
|
70
|
+
"prompt",
|
|
71
|
+
"stages",
|
|
72
|
+
"failures",
|
|
73
|
+
"complete",
|
|
74
|
+
"confidence",
|
|
75
|
+
"digest"
|
|
76
|
+
]);
|
|
77
|
+
/**
|
|
48
78
|
* `16` — the default turn cap `briefToGoal` renders.
|
|
49
79
|
*
|
|
50
80
|
* @remarks
|
|
@@ -2014,25 +2044,9 @@ var BriefCompiler = class {
|
|
|
2014
2044
|
return cloned.success ? freezeDeep(cloned.value) : captureValue(value, members);
|
|
2015
2045
|
}
|
|
2016
2046
|
#read(input, raw, stages, failures) {
|
|
2017
|
-
const members = [
|
|
2018
|
-
"text",
|
|
2019
|
-
"normalized",
|
|
2020
|
-
"intent",
|
|
2021
|
-
"entities",
|
|
2022
|
-
"subject",
|
|
2023
|
-
"definition",
|
|
2024
|
-
"mappings",
|
|
2025
|
-
"ambiguities",
|
|
2026
|
-
"prompt",
|
|
2027
|
-
"stages",
|
|
2028
|
-
"failures",
|
|
2029
|
-
"complete",
|
|
2030
|
-
"confidence",
|
|
2031
|
-
"digest"
|
|
2032
|
-
];
|
|
2033
2047
|
const text = input.text;
|
|
2034
2048
|
if (text !== void 0) {
|
|
2035
|
-
const read = (0, _orkestrel_contract.attempt)(() => this.#own(this.#interpret.interpret(text),
|
|
2049
|
+
const read = (0, _orkestrel_contract.attempt)(() => this.#own(this.#interpret.interpret(text), INTERPRETATION_MEMBERS));
|
|
2036
2050
|
if (read.success && (0, _orkestrel_interpret.isInterpretation)(read.value)) {
|
|
2037
2051
|
stages.push(Object.freeze({
|
|
2038
2052
|
stage: "interpret",
|
|
@@ -2057,7 +2071,7 @@ var BriefCompiler = class {
|
|
|
2057
2071
|
const supplied = input.interpretation;
|
|
2058
2072
|
if (supplied === void 0 || (0, _orkestrel_interpret.isInterpretation)(supplied)) return supplied;
|
|
2059
2073
|
const live = raw.interpretation;
|
|
2060
|
-
const captured = (0, _orkestrel_contract.attempt)(() => captureValue(live,
|
|
2074
|
+
const captured = (0, _orkestrel_contract.attempt)(() => captureValue(live, INTERPRETATION_MEMBERS));
|
|
2061
2075
|
if (captured.success && (0, _orkestrel_interpret.isInterpretation)(captured.value)) return captured.value;
|
|
2062
2076
|
const message = "The supplied interpretation does not satisfy the published shape";
|
|
2063
2077
|
stages.push(Object.freeze({
|
|
@@ -2222,6 +2236,7 @@ exports.BriefError = BriefError;
|
|
|
2222
2236
|
exports.BriefManager = BriefManager;
|
|
2223
2237
|
exports.DEFAULT_BRIEF_TURNS = DEFAULT_BRIEF_TURNS;
|
|
2224
2238
|
exports.GATE_ID = GATE_ID;
|
|
2239
|
+
exports.INTERPRETATION_MEMBERS = INTERPRETATION_MEMBERS;
|
|
2225
2240
|
exports.LINE_BREAK_PATTERN = LINE_BREAK_PATTERN;
|
|
2226
2241
|
exports.OUTPUT_FORMATS = OUTPUT_FORMATS;
|
|
2227
2242
|
exports.RISK_SEVERITIES = RISK_SEVERITIES;
|