@orkestrel/study 0.0.1 → 0.0.2
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 +63 -1
- package/dist/bin/main.js +2 -5399
- package/dist/bin/main.js.map +1 -1
- package/dist/src/core/index.cjs +47 -6
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +16 -4
- package/dist/src/core/index.d.ts +16 -4
- package/dist/src/core/index.js +48 -8
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +677 -2282
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +154 -446
- package/dist/src/server/index.d.ts +154 -446
- package/dist/src/server/index.js +395 -2007
- package/dist/src/server/index.js.map +1 -1
- package/package.json +15 -6
package/dist/src/core/index.cjs
CHANGED
|
@@ -150,7 +150,7 @@ function buildStudySchedule(definition, scenarios) {
|
|
|
150
150
|
* @param rubric - The independently held grading declaration
|
|
151
151
|
* @param profile - The execution bounds and model room
|
|
152
152
|
* @returns Nothing when every cross-input invariant holds
|
|
153
|
-
* @throws StudyError - Thrown when any input or cross-reference is invalid
|
|
153
|
+
* @throws StudyError - Thrown when any input or cross-reference is invalid, or a quality study has no capacity qualification
|
|
154
154
|
* @example
|
|
155
155
|
* ```ts
|
|
156
156
|
* validateStudyInputs(definition, scenarios, rubric, profile)
|
|
@@ -167,6 +167,7 @@ function validateStudyInputs(definition, scenarios, rubric, profile) {
|
|
|
167
167
|
}
|
|
168
168
|
const covered = new Set(rubric.criteria.map((criterion) => (0, _orkestrel_contract.canonicalStringify)([criterion.scenario, criterion.goal]) ?? ""));
|
|
169
169
|
for (const scenario of scenarios) for (const goal of scenario.goals) if (!covered.has((0, _orkestrel_contract.canonicalStringify)([scenario.id, goal.id]) ?? "")) throw new StudyError("CONFIG", "Every declared goal needs a criterion");
|
|
170
|
+
if (definition.purpose === "quality" && profile.qualification === void 0) throw new StudyError("CONFIG", "Quality studies require a capacity qualification");
|
|
170
171
|
}
|
|
171
172
|
/**
|
|
172
173
|
* Computes arm intervals over the complete declared criterion horizon.
|
|
@@ -631,8 +632,10 @@ var StudyError = class extends Error {
|
|
|
631
632
|
*/
|
|
632
633
|
constructor(code, message, failure) {
|
|
633
634
|
super(message);
|
|
634
|
-
|
|
635
|
+
_orkestrel_contract.INTRINSICS.define(this, STUDY_ERROR_BRAND, {
|
|
635
636
|
value: this,
|
|
637
|
+
enumerable: false,
|
|
638
|
+
writable: false,
|
|
636
639
|
configurable: true
|
|
637
640
|
});
|
|
638
641
|
this.name = "StudyError";
|
|
@@ -641,10 +644,11 @@ var StudyError = class extends Error {
|
|
|
641
644
|
}
|
|
642
645
|
};
|
|
643
646
|
/**
|
|
644
|
-
* Narrows a caught value to
|
|
647
|
+
* Narrows a caught value to a branded study error with valid failure attribution.
|
|
645
648
|
* @remarks
|
|
646
|
-
* Recognition combines the native `Error` base, a subclass prototype,
|
|
647
|
-
*
|
|
649
|
+
* Recognition combines the native `Error` base, a subclass prototype, a declared study code,
|
|
650
|
+
* valid optional failure members, and an own {@link STUDY_ERROR_BRAND} descriptor whose value is
|
|
651
|
+
* the error itself. Subclasses can replace the name.
|
|
648
652
|
* The global key is recognized across package, ESM, CommonJS and captured module copies; it is
|
|
649
653
|
* not unforgeable provenance. A transparent proxy is refused because its forwarded descriptor
|
|
650
654
|
* stores the target, and an unbranded copy, an inherited brand, or a property-only lookalike
|
|
@@ -657,7 +661,27 @@ var StudyError = class extends Error {
|
|
|
657
661
|
* ```
|
|
658
662
|
*/
|
|
659
663
|
function isStudyError(value) {
|
|
660
|
-
return (0, _orkestrel_contract.
|
|
664
|
+
return (0, _orkestrel_contract.holds)(() => {
|
|
665
|
+
if (!(0, _orkestrel_contract.isError)(value) || _orkestrel_contract.INTRINSICS.prototype(value) === _orkestrel_contract.INTRINSICS.error.prototype) return false;
|
|
666
|
+
const brand = _orkestrel_contract.INTRINSICS.describe(value, STUDY_ERROR_BRAND)?.value;
|
|
667
|
+
const code = _orkestrel_contract.INTRINSICS.reflect.read(value, "code");
|
|
668
|
+
const failure = _orkestrel_contract.INTRINSICS.reflect.read(value, "failure");
|
|
669
|
+
if (brand !== value || !isStudyErrorCode(code) || typeof _orkestrel_contract.INTRINSICS.reflect.read(value, "name") !== "string" || typeof _orkestrel_contract.INTRINSICS.reflect.read(value, "message") !== "string") return false;
|
|
670
|
+
if (failure === void 0) return true;
|
|
671
|
+
if (!(0, _orkestrel_contract.isObject)(failure)) return false;
|
|
672
|
+
const cause = _orkestrel_contract.INTRINSICS.reflect.read(failure, "cause");
|
|
673
|
+
const message = _orkestrel_contract.INTRINSICS.reflect.read(failure, "message");
|
|
674
|
+
const role = _orkestrel_contract.INTRINSICS.reflect.read(failure, "role");
|
|
675
|
+
const stop = _orkestrel_contract.INTRINSICS.reflect.read(failure, "stop");
|
|
676
|
+
if (!isStudyCause(cause) || typeof message !== "string" || role !== void 0 && !isStudyRole(role)) return false;
|
|
677
|
+
if (stop === void 0) return true;
|
|
678
|
+
if (!(0, _orkestrel_contract.isObject)(stop)) return false;
|
|
679
|
+
const layer = _orkestrel_contract.INTRINSICS.reflect.read(stop, "layer");
|
|
680
|
+
const id = _orkestrel_contract.INTRINSICS.reflect.read(stop, "id");
|
|
681
|
+
const max = _orkestrel_contract.INTRINSICS.reflect.read(stop, "max");
|
|
682
|
+
const consumed = _orkestrel_contract.INTRINSICS.reflect.read(stop, "consumed");
|
|
683
|
+
return isStudyLayer(layer) && typeof id === "string" && (max === void 0 || (0, _orkestrel_contract.isFiniteNumber)(max)) && (consumed === void 0 || (0, _orkestrel_contract.isFiniteNumber)(consumed));
|
|
684
|
+
});
|
|
661
685
|
}
|
|
662
686
|
//#endregion
|
|
663
687
|
//#region src/core/parsers.ts
|
|
@@ -1877,6 +1901,22 @@ function buildStudyAgentDispatch(dispatch) {
|
|
|
1877
1901
|
//#endregion
|
|
1878
1902
|
//#region src/core/agents/validators.ts
|
|
1879
1903
|
/**
|
|
1904
|
+
* Checks whether a value is a gauge with a finite positive scale and a finite nonnegative overhead.
|
|
1905
|
+
* @param value - The candidate gauge; additional members are admitted
|
|
1906
|
+
* @returns True if the gauge readings are finite and within their bounds; false otherwise
|
|
1907
|
+
* @example
|
|
1908
|
+
* ```ts
|
|
1909
|
+
* isStudyAgentGauge({ scale: 1, overhead: 0 }) // true
|
|
1910
|
+
* ```
|
|
1911
|
+
*/
|
|
1912
|
+
function isStudyAgentGauge(value) {
|
|
1913
|
+
return (0, _orkestrel_contract.holds)(() => {
|
|
1914
|
+
if (!(0, _orkestrel_contract.isObject)(value) || !("scale" in value) || !("overhead" in value)) return false;
|
|
1915
|
+
const { scale, overhead } = value;
|
|
1916
|
+
return (0, _orkestrel_contract.isFiniteNumber)(scale) && scale > 0 && (0, _orkestrel_contract.isFiniteNumber)(overhead) && overhead >= 0;
|
|
1917
|
+
});
|
|
1918
|
+
}
|
|
1919
|
+
/**
|
|
1880
1920
|
* Checks whether a namespace exposes the Agent capabilities the instrumentation invokes.
|
|
1881
1921
|
* @remarks
|
|
1882
1922
|
* The guard reads only `estimateRequest`, `measureRequest`, and `isAgentError`, so a namespace
|
|
@@ -2020,6 +2060,7 @@ exports.computeStudyOutputStop = computeStudyOutputStop;
|
|
|
2020
2060
|
exports.computeStudyScores = computeStudyScores;
|
|
2021
2061
|
exports.failStudyTicket = failStudyTicket;
|
|
2022
2062
|
exports.failureToStudyError = failureToStudyError;
|
|
2063
|
+
exports.isStudyAgentGauge = isStudyAgentGauge;
|
|
2023
2064
|
exports.isStudyAgentRuntime = isStudyAgentRuntime;
|
|
2024
2065
|
exports.isStudyBounds = isStudyBounds;
|
|
2025
2066
|
exports.isStudyCause = isStudyCause;
|