@orkestrel/scaffold 0.0.114 → 0.0.116
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/bin/main.js +137 -15
- package/dist/bin/main.js.map +1 -1
- package/dist/host/agents/orchestration.md +5 -3
- package/dist/host/agents/platforms/windows.md +1 -0
- package/dist/host/agents/skills/orkestrel-align/references/integration.md +1 -1
- package/dist/host/agents/skills/orkestrel-debrief/SKILL.md +4 -4
- package/dist/host/agents/skills/orkestrel-dispatch/SKILL.md +4 -1
- package/dist/host/agents/skills/orkestrel-falsify/SKILL.md +8 -2
- package/dist/host/agents/skills/orkestrel-harden/references/equivalence.md +1 -0
- package/dist/host/agents/skills/orkestrel-harden/references/hardening.md +1 -1
- package/dist/host/agents/skills/orkestrel-parallel/SKILL.md +1 -1
- package/dist/host/agents/skills/orkestrel-parallel/references/codex.md +1 -0
- package/dist/host/agents/skills/orkestrel-publish/references/wave.md +9 -3
- package/dist/host/claude/agents/analyst.md +1 -1
- package/dist/host/claude/agents/astra.md +2 -2
- package/dist/host/claude/agents/builder.md +4 -4
- package/dist/host/claude/agents/opus.md +3 -3
- package/dist/host/claude/agents/orkestrel.md +5 -7
- package/dist/host/claude/agents/planner.md +8 -2
- package/dist/host/claude/rules/campaign.md +2 -1
- package/dist/host/claude/rules/documentation.md +1 -0
- package/dist/host/claude/rules/names.md +3 -1
- package/dist/host/claude/rules/tests.md +7 -4
- package/dist/host/claude/rules/writing.md +1 -0
- package/dist/host/claude/skills/enterprise-bootstrap/SKILL.md +1 -2
- package/dist/host/claude/skills/orkestrel-align/SKILL.md +1 -1
- package/dist/host/claude/skills/orkestrel-build/SKILL.md +1 -2
- package/dist/host/claude/skills/orkestrel-debrief/SKILL.md +1 -2
- package/dist/host/claude/skills/orkestrel-dispatch/SKILL.md +1 -1
- package/dist/host/claude/skills/orkestrel-falsify/SKILL.md +1 -1
- package/dist/host/claude/skills/orkestrel-harden/SKILL.md +1 -1
- package/dist/host/claude/skills/orkestrel-journey/SKILL.md +1 -1
- package/dist/host/claude/skills/orkestrel-parallel/SKILL.md +1 -1
- package/dist/host/claude/skills/orkestrel-polish/SKILL.md +1 -2
- package/dist/host/claude/skills/orkestrel-publish/SKILL.md +1 -2
- package/dist/host/claude/skills/orkestrel-scout/SKILL.md +1 -1
- package/dist/host/codex/agents/analyst.toml +8 -5
- package/dist/host/codex/agents/astra.toml +4 -5
- package/dist/host/codex/agents/builder.toml +5 -5
- package/dist/host/codex/agents/opus.toml +3 -4
- package/dist/host/codex/agents/orkestrel.toml +2 -1
- package/dist/host/codex/agents/planner.toml +8 -5
- package/dist/host/codex/agents/reviewer.toml +5 -4
- package/dist/host/guides/abort.md +17 -17
- package/dist/host/guides/agent.md +445 -445
- package/dist/host/guides/brief.md +143 -143
- package/dist/host/guides/browser.md +731 -731
- package/dist/host/guides/budget.md +39 -39
- package/dist/host/guides/capture.md +298 -298
- package/dist/host/guides/console.md +109 -109
- package/dist/host/guides/contract.md +335 -335
- package/dist/host/guides/csv.md +30 -30
- package/dist/host/guides/database.md +163 -163
- package/dist/host/guides/emitter.md +17 -17
- package/dist/host/guides/form.md +99 -99
- package/dist/host/guides/guide.md +361 -183
- package/dist/host/guides/html.md +49 -49
- package/dist/host/guides/indexeddb.md +40 -40
- package/dist/host/guides/interpret.md +139 -139
- package/dist/host/guides/lsp.md +114 -114
- package/dist/host/guides/markdown.md +68 -68
- package/dist/host/guides/mcp.md +3745 -3745
- package/dist/host/guides/middleware.md +170 -170
- package/dist/host/guides/msg.md +95 -95
- package/dist/host/guides/ndjson.md +8 -8
- package/dist/host/guides/ollama.md +56 -56
- package/dist/host/guides/pool.md +21 -21
- package/dist/host/guides/probe.md +82 -82
- package/dist/host/guides/process.md +99 -99
- package/dist/host/guides/program.md +98 -96
- package/dist/host/guides/qualifier.md +70 -70
- package/dist/host/guides/queue.md +37 -37
- package/dist/host/guides/rater.md +38 -38
- package/dist/host/guides/reason.md +308 -308
- package/dist/host/guides/relation.md +50 -50
- package/dist/host/guides/router.md +58 -58
- package/dist/host/guides/scaffold.md +554 -419
- package/dist/host/guides/sea.md +128 -128
- package/dist/host/guides/server.md +100 -100
- package/dist/host/guides/sqlite.md +28 -28
- package/dist/host/guides/sse.md +20 -20
- package/dist/host/guides/study.md +444 -444
- package/dist/host/guides/table.md +82 -82
- package/dist/host/guides/template.md +41 -41
- package/dist/host/guides/terminal.md +121 -121
- package/dist/host/guides/test.md +273 -273
- package/dist/host/guides/timeout.md +18 -18
- package/dist/host/guides/tool.md +27 -27
- package/dist/host/guides/toolbox.md +166 -166
- package/dist/host/guides/websocket.md +54 -54
- package/dist/host/guides/worker.md +24 -24
- package/dist/host/guides/workflow.md +187 -187
- package/dist/host/guides/workspace.md +55 -55
- package/dist/host/manifest.json +93 -93
- package/dist/host/tests/setupPolicy.ts +5 -3
- package/dist/src/core/index.cjs +89 -3
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +229 -144
- package/dist/src/core/index.d.ts +229 -144
- package/dist/src/core/index.js +87 -4
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +292 -66
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +188 -6
- package/dist/src/server/index.d.ts +188 -6
- package/dist/src/server/index.js +287 -69
- package/dist/src/server/index.js.map +1 -1
- package/package.json +4 -3
|
@@ -125,31 +125,31 @@ manager.destroy()
|
|
|
125
125
|
|
|
126
126
|
A `Shape` cell holds an interface's data members as bare names in braces, `?` marking an optional member and `plus` introducing its call-signature members, and a type alias's own type literal with a union's arms escaped as `\|`.
|
|
127
127
|
|
|
128
|
-
|
|
|
129
|
-
| ------------------------- | --------- |
|
|
130
|
-
| `Decision` | type | `'approved' \| 'denied' \| 'submitted'`
|
|
131
|
-
| `Status` | type | `
|
|
132
|
-
| `ProgramEffect` | type | `'notice' \| 'limit'`
|
|
133
|
-
| `ProgramErrorCode` | type | `'DUPLICATE' \| 'MISSING' \| 'DEFINITION' \| 'MISMATCH' \| 'RESERVED' \| 'DESTROYED'`
|
|
134
|
-
| `ProgramInput` | interface | `{ description?, notices?, authority?, aggregate?, metadata? }`
|
|
135
|
-
| `NoticeInput` | interface | `{ scope? }`
|
|
136
|
-
| `AggregateInput` | interface | `{ partition?, gates? }`
|
|
137
|
-
| `Notice` | interface | `{ id, message, scope? }`
|
|
138
|
-
| `Determination` | interface | `{ id, effect, applied, scope?, message?, premises }`
|
|
139
|
-
| `AggregateDefinition` | interface | `{ fields, partition?, gates? }`
|
|
140
|
-
| `AggregateProjection` | interface | `{ count, sums, group? }`
|
|
141
|
-
| `AggregateGroup` | interface | `{ key, count, sums }`
|
|
142
|
-
| `Tally` | interface | `{ count, sums }`
|
|
143
|
-
| `ProgramDefinition` | interface | `{ id, name, description?, qualification, rating?, notices?, authority?, aggregate?, metadata? }`
|
|
144
|
-
| `ProgramResult` | interface | `{ id, name, eligibility, status, decision?, qualification, rating?, determinations, success, trace, errors }`
|
|
145
|
-
| `AggregateResult` | interface | `{ id, name, subjects, determinations, groups, tallies, count, sums, success, trace, errors }`
|
|
146
|
-
| `ProgramValidationResult` | interface | `{ valid, errors, warnings }`
|
|
147
|
-
| `ProgramEventMap` | type | `{ qualify
|
|
148
|
-
| `ProgramOptions` | interface | `{ qualifier?, rater?, engine?, validate?, labels?, on?, error? }`
|
|
149
|
-
| `ProgramInterface` | interface | `{ id, name, definition, emitter
|
|
150
|
-
| `ProgramManagerEventMap` | type | `{ add
|
|
151
|
-
| `ProgramManagerOptions` | interface | `{ qualifier?, rater?, engine?, programs?, validate?, labels?, on?, error? }`
|
|
152
|
-
| `ProgramManagerInterface` | interface | `{ emitter, count
|
|
128
|
+
| Name | Kind | Signature | Summary |
|
|
129
|
+
| ------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
|
|
130
|
+
| `Decision` | type | `'approved' \| 'denied' \| 'submitted'` | Identifies a final authority outcome, derived from global eligibility. |
|
|
131
|
+
| `Status` | type | `(typeof STATUSES)[number]` | Identifies the presentation and tally status derived from eligibility, conditions, and rating success. |
|
|
132
|
+
| `ProgramEffect` | type | `'notice' \| 'limit'` | Identifies a post-qualification program determination effect. |
|
|
133
|
+
| `ProgramErrorCode` | type | `'DUPLICATE' \| 'MISSING' \| 'DEFINITION' \| 'MISMATCH' \| 'RESERVED' \| 'DESTROYED'` | Identifies a coded `ProgramError` programmer-error code. |
|
|
134
|
+
| `ProgramInput` | interface | `{ description?, notices?, authority?, aggregate?, metadata? }` | Describes the optional fields accepted by `buildProgramDefinition`. |
|
|
135
|
+
| `NoticeInput` | interface | `{ scope? }` | Describes the optional fields accepted by `buildNotice`. |
|
|
136
|
+
| `AggregateInput` | interface | `{ partition?, gates? }` | Describes the optional fields accepted by `buildAggregateDefinition`. |
|
|
137
|
+
| `Notice` | interface | `{ id, message, scope? }` | Describes an authored, unconditional program notice. |
|
|
138
|
+
| `Determination` | interface | `{ id, effect, applied, scope?, message?, premises }` | Describes one resolved notice or authority-limit outcome. |
|
|
139
|
+
| `AggregateDefinition` | interface | `{ fields, partition?, gates? }` | Describes batch aggregate fields, an optional partition field, and optional gates. |
|
|
140
|
+
| `AggregateProjection` | interface | `{ count, sums, group? }` | Describes one subject's private aggregate working projection. |
|
|
141
|
+
| `AggregateGroup` | interface | `{ key, count, sums }` | Describes one batch aggregate partition. |
|
|
142
|
+
| `Tally` | interface | `{ count, sums }` | Describes a status tally — a count plus summed aggregate fields. |
|
|
143
|
+
| `ProgramDefinition` | interface | `{ id, name, description?, qualification, rating?, notices?, authority?, aggregate?, metadata? }` | Describes a pure authored program definition. |
|
|
144
|
+
| `ProgramResult` | interface | `{ id, name, eligibility, status, decision?, qualification, rating?, determinations, success, trace, errors }` | Describes one subject's complete program outcome. |
|
|
145
|
+
| `AggregateResult` | interface | `{ id, name, subjects, determinations, groups, tallies, count, sums, success, trace, errors }` | Describes a batch program outcome across every subject. |
|
|
146
|
+
| `ProgramValidationResult` | interface | `{ valid, errors, warnings }` | Describes semantic definition validation. |
|
|
147
|
+
| `ProgramEventMap` | type | `{ readonly qualify: readonly [result: QualificationResult]; readonly rate: readonly [result: RatingResult]; readonly determine: readonly [result: Determination]; readonly decide: readonly [decision: Decision, result: ProgramResult]; readonly execute: readonly [result: ProgramResult]; readonly aggregate: readonly [result: AggregateResult]; readonly destroy: readonly []; }` | Describes the push observation surface of a `ProgramInterface`. |
|
|
148
|
+
| `ProgramOptions` | interface | `{ qualifier?, rater?, engine?, validate?, labels?, on?, error? }` | Describes the options for `createProgram` / the `Program` constructor. |
|
|
149
|
+
| `ProgramInterface` | interface | `{ id, name, definition, emitter, execute(), validate(), destroy() }` | Defines one compiled program that composes one qualifier and one rater over a shared reason engine. |
|
|
150
|
+
| `ProgramManagerEventMap` | type | `{ readonly add: readonly [id: string]; readonly remove: readonly [id: string]; readonly destroy: readonly []; }` | Describes the push observation surface of a `ProgramManagerInterface`. |
|
|
151
|
+
| `ProgramManagerOptions` | interface | `{ qualifier?, rater?, engine?, programs?, validate?, labels?, on?, error? }` | Describes the options for `createProgramManager` / the `ProgramManager` constructor. |
|
|
152
|
+
| `ProgramManagerInterface` | interface | `{ emitter, count, has(), program(), programs(), add(), remove(), destroy() }` | Defines an ordered manager over compiled programs, sharing one qualifier and rater. |
|
|
153
153
|
|
|
154
154
|
Every public data member is `readonly`, every optional key is omitted rather than
|
|
155
155
|
`undefined`, and each name is single-word within its entity. Qualifier
|
|
@@ -162,13 +162,13 @@ rater supplies `RatingDefinition` and `RatingResult`; reason supplies
|
|
|
162
162
|
|
|
163
163
|
A `Shape` cell holds the constant's declared type.
|
|
164
164
|
|
|
165
|
-
|
|
|
165
|
+
| Name | Kind | Signature | Summary |
|
|
166
166
|
| -------------------------- | ----- | --------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
|
|
167
|
-
| `DEFAULT_PROGRAM_VALIDATE` | const | `
|
|
168
|
-
| `STATUSES` | const | `readonly [
|
|
167
|
+
| `DEFAULT_PROGRAM_VALIDATE` | const | `true` | Names the default definition validation policy, `true`, for `createProgram` / `ProgramManager.add`. |
|
|
168
|
+
| `STATUSES` | const | `readonly ["ineligible", "referral", "conditional", "unrated", "eligible"]` | Lists every `Status` literal in tally order — the source the union and its guard derive from. |
|
|
169
169
|
| `ELIGIBILITY_DECISIONS` | const | `Readonly<Record<Eligibility, Decision>>` | Maps each global eligibility to its deterministic authority decision. |
|
|
170
|
-
| `AGGREGATE_KEY` | const | `
|
|
171
|
-
| `OUTCOME_KEY` | const | `
|
|
170
|
+
| `AGGREGATE_KEY` | const | `"aggregate"` | Names the reserved working-subject key a batch's aggregate projection is written under, `'aggregate'`. |
|
|
171
|
+
| `OUTCOME_KEY` | const | `"outcome"` | Names the reserved working-subject key the authority's outcome projection is written under, `'outcome'`. |
|
|
172
172
|
|
|
173
173
|
`STATUSES` and `ELIGIBILITY_DECISIONS` are `Object.freeze`d; the reserved keys and
|
|
174
174
|
the validation default are primitives. The reserved keys exist only for composed
|
|
@@ -182,10 +182,10 @@ The error guard recognizes the shared brand across package copies and accepts
|
|
|
182
182
|
subclasses without requiring their name. It refuses transparent proxies and
|
|
183
183
|
unbranded look-alikes.
|
|
184
184
|
|
|
185
|
-
|
|
|
186
|
-
| ---------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
187
|
-
| `ProgramError` | class | Reports a coded programmer error thrown by the program layer, carrying a machine-readable code and an optional context and cause. |
|
|
188
|
-
| `isProgramError` | function | Determines whether a caught value is a `ProgramError`. |
|
|
185
|
+
| Name | Kind | Signature | Summary |
|
|
186
|
+
| ---------------- | -------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
187
|
+
| `ProgramError` | class | `new (code: ProgramErrorCode, message: string, context?: unknown, cause?: unknown) => ProgramError` | Reports a coded programmer error thrown by the program layer, carrying a machine-readable code and an optional context and cause. |
|
|
188
|
+
| `isProgramError` | function | `(value: unknown) => value is ProgramError` | Determines whether a caught value is a `ProgramError`. |
|
|
189
189
|
|
|
190
190
|
```ts
|
|
191
191
|
import { isProgramError, ProgramError } from '@orkestrel/program'
|
|
@@ -197,15 +197,6 @@ try {
|
|
|
197
197
|
}
|
|
198
198
|
```
|
|
199
199
|
|
|
200
|
-
| Code | Meaning |
|
|
201
|
-
| ------------ | -------------------------------------------------------------------------------------------------------------- |
|
|
202
|
-
| `DUPLICATE` | A manager already contains the program id, or an authored definition has a duplicate rating-line or notice id. |
|
|
203
|
-
| `MISSING` | A notice, ruling scope, or other authored reference names no rating line. |
|
|
204
|
-
| `DEFINITION` | Program, qualification, rating, authority, or aggregate policy is invalid. |
|
|
205
|
-
| `MISMATCH` | An injected entity or returned result has the wrong contract. |
|
|
206
|
-
| `RESERVED` | A subject already carries `aggregate` or `outcome`. |
|
|
207
|
-
| `DESTROYED` | An operation was attempted after teardown. |
|
|
208
|
-
|
|
209
200
|
Eligibility and rating failures remain nested result evidence rather than throws.
|
|
210
201
|
|
|
211
202
|
### Validators
|
|
@@ -227,22 +218,22 @@ than delegating to reason's independently evolvable validation contract.
|
|
|
227
218
|
|
|
228
219
|
In a guard table a `Shape` cell holds the type the guard narrows to.
|
|
229
220
|
|
|
230
|
-
|
|
|
231
|
-
| --------------------------- | -------- |
|
|
232
|
-
| `isDecision` | const | `Decision
|
|
233
|
-
| `isStatus` | const | `Status
|
|
234
|
-
| `isProgramEffect` | const | `ProgramEffect
|
|
235
|
-
| `isNotice` | function | `Notice` | Determines whether a value is an exact `Notice` record. |
|
|
236
|
-
| `isAggregateDefinition` | function | `AggregateDefinition` | Determines whether a value is an exact `AggregateDefinition` record. |
|
|
237
|
-
| `isProgramDefinition` | function | `ProgramDefinition` | Determines whether a value is an exact `ProgramDefinition` record. |
|
|
238
|
-
| `isProgramSums` | function | `Readonly<Record<string, number>>` | Determines whether a value is an open program sums record. |
|
|
239
|
-
| `isDetermination` | const | `Determination
|
|
240
|
-
| `isAggregateGroup` | const | `AggregateGroup
|
|
241
|
-
| `isTally` | const | `Tally
|
|
242
|
-
| `isTallies` | function | `Readonly<Record<Status, Tally>>` | Determines whether a value is a total open status-tally record. |
|
|
243
|
-
| `isProgramResult` | const | `ProgramResult
|
|
244
|
-
| `isAggregateResult` | const | `AggregateResult
|
|
245
|
-
| `isProgramValidationResult` | const | `ProgramValidationResult
|
|
221
|
+
| Name | Kind | Signature | Summary |
|
|
222
|
+
| --------------------------- | -------- | --------------------------------------------------------------- | -------------------------------------------------------------------- |
|
|
223
|
+
| `isDecision` | const | `Guard<Decision>` | Determines whether a value is a `Decision` literal. |
|
|
224
|
+
| `isStatus` | const | `Guard<Status>` | Determines whether a value is a `Status` literal. |
|
|
225
|
+
| `isProgramEffect` | const | `Guard<ProgramEffect>` | Determines whether a value is a `ProgramEffect` literal. |
|
|
226
|
+
| `isNotice` | function | `(value: unknown) => value is Notice` | Determines whether a value is an exact `Notice` record. |
|
|
227
|
+
| `isAggregateDefinition` | function | `(value: unknown) => value is AggregateDefinition` | Determines whether a value is an exact `AggregateDefinition` record. |
|
|
228
|
+
| `isProgramDefinition` | function | `(value: unknown) => value is ProgramDefinition` | Determines whether a value is an exact `ProgramDefinition` record. |
|
|
229
|
+
| `isProgramSums` | function | `(value: unknown) => value is Readonly<Record<string, number>>` | Determines whether a value is an open program sums record. |
|
|
230
|
+
| `isDetermination` | const | `Guard<Determination>` | Determines whether a value is an open result-side `Determination`. |
|
|
231
|
+
| `isAggregateGroup` | const | `Guard<AggregateGroup>` | Determines whether a value is an open result-side `AggregateGroup`. |
|
|
232
|
+
| `isTally` | const | `Guard<Tally>` | Determines whether a value is an open result-side `Tally`. |
|
|
233
|
+
| `isTallies` | function | `(value: unknown) => value is Readonly<Record<Status, Tally>>` | Determines whether a value is a total open status-tally record. |
|
|
234
|
+
| `isProgramResult` | const | `Guard<ProgramResult>` | Determines whether a value is an open `ProgramResult`. |
|
|
235
|
+
| `isAggregateResult` | const | `Guard<AggregateResult>` | Determines whether a value is an open `AggregateResult`. |
|
|
236
|
+
| `isProgramValidationResult` | const | `Guard<ProgramValidationResult>` | Determines whether a value is an open `ProgramValidationResult`. |
|
|
246
237
|
|
|
247
238
|
`isProgramSums` checks every own string-named member, including non-enumerable
|
|
248
239
|
members, as a JavaScript `number`; it ignores inherited and symbol-named members.
|
|
@@ -286,35 +277,35 @@ generic over any `Rule`/`Subject`/`EvaluatorInterface`) rather than re-implement
|
|
|
286
277
|
them. `Program` owns one stateless `#evaluator` (created with `createEvaluator()`,
|
|
287
278
|
never destroyed — it holds no state to tear down) purely to drive that reuse.
|
|
288
279
|
|
|
289
|
-
|
|
|
290
|
-
| --------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
291
|
-
| `selectProgramLines` | function | Selects the rating lines a subject may be rated on from scoped eligibility. |
|
|
292
|
-
| `deriveStatus` | function | Derives the final program `Status` from a definition's rating policy and qualification/rating evidence. |
|
|
293
|
-
| `decideEligibility` | function | Maps a global `Eligibility` to its deterministic authority `Decision`. |
|
|
294
|
-
| `buildNoticeDeterminations` | function | Resolves authored `Notice` values into unconditionally-applied `notice` `Determination` values. |
|
|
295
|
-
| `buildLimitDeterminations` | function | Converts a logical result's applied rules into `limit` `Determination` values. |
|
|
296
|
-
| `buildProgramResult` | function | Assembles a `ProgramResult` from its qualification, rating, and determination parts — before or after authority. |
|
|
297
|
-
| `buildOutcomeProjection` | function | Builds the private authority outcome projection from an assembled program result. |
|
|
298
|
-
| `buildQualificationSubject` | function | Adds optional aggregate context to a private subject copy for qualification. |
|
|
299
|
-
| `findMissingScopes` | function | Returns authored scopes (qualification ruling scopes or notice scopes) that name no rating line on the program. |
|
|
300
|
-
| `hasReservedKey` | function | Determines whether a caller subject already carries a reserved program key. |
|
|
301
|
-
| `assertProgramSubject` | function | Asserts a value is a valid program `Subject`, narrowing it in place. |
|
|
302
|
-
| `assertProgramDefinition` | function | Asserts a program definition's always-on construction invariants — missing scope references and duplicate rating-line or notice ids. |
|
|
303
|
-
| `validateProgramDefinition` | function | Validates a program definition's shape, references, and nested definitions. |
|
|
304
|
-
| `formatGroupKey` | function | Coerces a subject's partition-key field to its group-key string. |
|
|
305
|
-
| `sumFields` | function | Folds one subject's finite aggregate field values into a sums record. |
|
|
306
|
-
| `aggregateSums` | function | Sums aggregate fields across a batch of subjects. |
|
|
307
|
-
| `aggregateGroups` | function | Partitions a batch of subjects by a field, summing aggregate fields per key. |
|
|
308
|
-
| `buildAggregateProjection` | function | Builds one subject's overall and optional group aggregate projection. |
|
|
309
|
-
| `buildAggregateRecord` | function | Builds the reserved-key record a batch aggregate-gate definition runs against. |
|
|
310
|
-
| `buildEmptySums` | function | Builds a zero-sum record for a set of aggregate fields. |
|
|
311
|
-
| `buildEmptyTallies` | function | Builds complete zero status tallies in `STATUSES` order. |
|
|
312
|
-
| `completeTallies` | function | Completes a partial status tally record with zero entries for every missing `Status`. |
|
|
313
|
-
| `tallySubject` | function | Adds one subject's aggregate contribution to a status tally record. |
|
|
314
|
-
| `buildAggregateResult` | function | Assembles one batch `AggregateResult` from its per-subject and aggregate parts. |
|
|
315
|
-
| `buildProgramDefinition` | function | Builds a fresh `ProgramDefinition`. |
|
|
316
|
-
| `buildNotice` | function | Builds a fresh `Notice`. |
|
|
317
|
-
| `buildAggregateDefinition` | function | Builds a fresh `AggregateDefinition`. |
|
|
280
|
+
| Name | Kind | Signature | Summary |
|
|
281
|
+
| --------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
282
|
+
| `selectProgramLines` | function | `(lines: readonly LineDefinition[], scopes: Readonly<Record<string, Eligibility>>) => readonly LineDefinition[]` | Selects the rating lines a subject may be rated on from scoped eligibility. |
|
|
283
|
+
| `deriveStatus` | function | `(definition: ProgramDefinition, qualification: QualificationResult, rating?: RatingResult) => Status` | Derives the final program `Status` from a definition's rating policy and qualification/rating evidence. |
|
|
284
|
+
| `decideEligibility` | function | `(eligibility: Eligibility) => Decision` | Maps a global `Eligibility` to its deterministic authority `Decision`. |
|
|
285
|
+
| `buildNoticeDeterminations` | function | `(notices: readonly Notice[], subject: Readonly<Record<string, unknown>>) => readonly Determination[]` | Resolves authored `Notice` values into unconditionally-applied `notice` `Determination` values. |
|
|
286
|
+
| `buildLimitDeterminations` | function | `(definition: LogicalDefinition, result: LogicalResult, working: Readonly<Record<string, unknown>>, evaluator: EvaluatorInterface, labels?: Readonly<Record<string, string>>) => readonly Determination[]` | Converts a logical result's applied rules into `limit` `Determination` values. |
|
|
287
|
+
| `buildProgramResult` | function | `(definition: ProgramDefinition, qualification: QualificationResult, rating: RatingResult \| undefined, determinations: readonly Determination[], status: Status, options?: { readonly authority?: LogicalResult; }) => ProgramResult` | Assembles a `ProgramResult` from its qualification, rating, and determination parts — before or after authority. |
|
|
288
|
+
| `buildOutcomeProjection` | function | `(result: ProgramResult) => Readonly<Record<string, unknown>>` | Builds the private authority outcome projection from an assembled program result. |
|
|
289
|
+
| `buildQualificationSubject` | function | `(subject: Subject, aggregate?: AggregateProjection) => Subject` | Adds optional aggregate context to a private subject copy for qualification. |
|
|
290
|
+
| `findMissingScopes` | function | `(definition: ProgramDefinition) => readonly string[]` | Returns authored scopes (qualification ruling scopes or notice scopes) that name no rating line on the program. |
|
|
291
|
+
| `hasReservedKey` | function | `(subject: Readonly<Record<string, unknown>>) => boolean` | Determines whether a caller subject already carries a reserved program key. |
|
|
292
|
+
| `assertProgramSubject` | function | `(subject: unknown) => asserts subject is Subject` | Asserts a value is a valid program `Subject`, narrowing it in place. |
|
|
293
|
+
| `assertProgramDefinition` | function | `(definition: ProgramDefinition) => void` | Asserts a program definition's always-on construction invariants — missing scope references and duplicate rating-line or notice ids. |
|
|
294
|
+
| `validateProgramDefinition` | function | `(definition: ProgramDefinition, qualifier: QualifierInterface, engine: ReasonInterface) => ProgramValidationResult` | Validates a program definition's shape, references, and nested definitions. |
|
|
295
|
+
| `formatGroupKey` | function | `(subject: Subject, partition: FieldPath) => string` | Coerces a subject's partition-key field to its group-key string. |
|
|
296
|
+
| `sumFields` | function | `(sums: Readonly<Record<string, number>>, subject: Subject, fields: readonly FieldPath[]) => Readonly<Record<string, number>>` | Folds one subject's finite aggregate field values into a sums record. |
|
|
297
|
+
| `aggregateSums` | function | `(subjects: readonly Subject[], fields: readonly FieldPath[]) => Readonly<Record<string, number>>` | Sums aggregate fields across a batch of subjects. |
|
|
298
|
+
| `aggregateGroups` | function | `(subjects: readonly Subject[], fields: readonly FieldPath[], partition?: FieldPath) => readonly AggregateGroup[]` | Partitions a batch of subjects by a field, summing aggregate fields per key. |
|
|
299
|
+
| `buildAggregateProjection` | function | `(subject: Subject, count: number, sums: Readonly<Record<string, number>>, groups: readonly AggregateGroup[], partition?: FieldPath) => AggregateProjection` | Builds one subject's overall and optional group aggregate projection. |
|
|
300
|
+
| `buildAggregateRecord` | function | `(count: number, sums: Readonly<Record<string, number>>, groups: readonly AggregateGroup[]) => Readonly<Record<string, unknown>>` | Builds the reserved-key record a batch aggregate-gate definition runs against. |
|
|
301
|
+
| `buildEmptySums` | function | `(fields: readonly FieldPath[]) => Readonly<Record<string, number>>` | Builds a zero-sum record for a set of aggregate fields. |
|
|
302
|
+
| `buildEmptyTallies` | function | `(fields: readonly FieldPath[]) => Readonly<Record<Status, Tally>>` | Builds complete zero status tallies in `STATUSES` order. |
|
|
303
|
+
| `completeTallies` | function | `(entries: Partial<Record<Status, Tally>>) => Readonly<Record<Status, Tally>>` | Completes a partial status tally record with zero entries for every missing `Status`. |
|
|
304
|
+
| `tallySubject` | function | `(tallies: Readonly<Record<Status, Tally>>, result: ProgramResult, subject: Subject, fields: readonly FieldPath[]) => Readonly<Record<Status, Tally>>` | Adds one subject's aggregate contribution to a status tally record. |
|
|
305
|
+
| `buildAggregateResult` | function | `(definition: ProgramDefinition, subjects: readonly ProgramResult[], determinations: readonly Determination[], groups: readonly AggregateGroup[], tallies: Readonly<Record<Status, Tally>>, sums: Readonly<Record<string, number>>, options?: { readonly gates?: LogicalResult; }) => AggregateResult` | Assembles one batch `AggregateResult` from its per-subject and aggregate parts. |
|
|
306
|
+
| `buildProgramDefinition` | function | `(id: string, name: string, qualification: QualificationDefinition, rating?: RatingDefinition, input?: ProgramInput) => ProgramDefinition` | Builds a fresh `ProgramDefinition`. |
|
|
307
|
+
| `buildNotice` | function | `(id: string, message: string, input?: NoticeInput) => Notice` | Builds a fresh `Notice`. |
|
|
308
|
+
| `buildAggregateDefinition` | function | `(fields: readonly FieldPath[], input?: AggregateInput) => AggregateDefinition` | Builds a fresh `AggregateDefinition`. |
|
|
318
309
|
|
|
319
310
|
The per-subject orchestration leaves guard the subject, select surviving lines, and
|
|
320
311
|
map eligibility to a decision:
|
|
@@ -377,10 +368,10 @@ const definition = buildProgramDefinition('standard', 'Standard', qualification,
|
|
|
377
368
|
|
|
378
369
|
### Factories
|
|
379
370
|
|
|
380
|
-
|
|
|
381
|
-
| ---------------------- | -------- | --------------------------------------------------------------------- |
|
|
382
|
-
| `createProgram` | function | Creates one compiled `ProgramInterface` over a qualifier and rater. |
|
|
383
|
-
| `createProgramManager` | function | Creates one ordered `ProgramManagerInterface` over compiled programs. |
|
|
371
|
+
| Name | Kind | Signature | Summary |
|
|
372
|
+
| ---------------------- | -------- | ------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
|
|
373
|
+
| `createProgram` | function | `(definition: ProgramDefinition, options?: ProgramOptions) => ProgramInterface` | Creates one compiled `ProgramInterface` over a qualifier and rater. |
|
|
374
|
+
| `createProgramManager` | function | `(options?: ProgramManagerOptions) => ProgramManagerInterface` | Creates one ordered `ProgramManagerInterface` over compiled programs. |
|
|
384
375
|
|
|
385
376
|
The factories compile entities. The authored definitions they compile are plain
|
|
386
377
|
values, so their builders are helper leaves rather than factories.
|
|
@@ -405,10 +396,10 @@ manager.destroy()
|
|
|
405
396
|
|
|
406
397
|
### Classes
|
|
407
398
|
|
|
408
|
-
|
|
|
409
|
-
| ---------------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
410
|
-
| `Program` | class | Composes one qualifier and one rater over a shared reason engine, compiling one authored definition and executing single subjects or aggregate-aware batches. |
|
|
411
|
-
| `ProgramManager` | class | Manages compiled `ProgramInterface` programs in order, sharing one qualifier, rater, and reason engine across every program it compiles. |
|
|
399
|
+
| Name | Kind | Signature | Summary |
|
|
400
|
+
| ---------------- | ----- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
401
|
+
| `Program` | class | `new (definition: ProgramDefinition, options?: ProgramOptions) => ProgramInterface` | Composes one qualifier and one rater over a shared reason engine, compiling one authored definition and executing single subjects or aggregate-aware batches. |
|
|
402
|
+
| `ProgramManager` | class | `new (options?: ProgramManagerOptions) => ProgramManagerInterface` | Manages compiled `ProgramInterface` programs in order, sharing one qualifier, rater, and reason engine across every program it compiles. |
|
|
412
403
|
|
|
413
404
|
The package has no entity named `Rater`. Rating remains a sibling concern.
|
|
414
405
|
|
|
@@ -470,6 +461,17 @@ keeps execution and collection responsibilities separate.
|
|
|
470
461
|
|
|
471
462
|
## Contract
|
|
472
463
|
|
|
464
|
+
### Error codes
|
|
465
|
+
|
|
466
|
+
| Code | Meaning |
|
|
467
|
+
| ------------ | -------------------------------------------------------------------------------------------------------------- |
|
|
468
|
+
| `DUPLICATE` | A manager already contains the program id, or an authored definition has a duplicate rating-line or notice id. |
|
|
469
|
+
| `MISSING` | A notice, ruling scope, or other authored reference names no rating line. |
|
|
470
|
+
| `DEFINITION` | Program, qualification, rating, authority, or aggregate policy is invalid. |
|
|
471
|
+
| `MISMATCH` | An injected entity or returned result has the wrong contract. |
|
|
472
|
+
| `RESERVED` | A subject already carries `aggregate` or `outcome`. |
|
|
473
|
+
| `DESTROYED` | An operation was attempted after teardown. |
|
|
474
|
+
|
|
473
475
|
### Execution order
|
|
474
476
|
|
|
475
477
|
For one subject:
|
|
@@ -64,26 +64,26 @@ per subject.
|
|
|
64
64
|
|
|
65
65
|
A `Shape` cell holds an interface's data members as bare names in braces, `?` marking an optional member and `plus` introducing its call-signature members, and a type alias's own type literal with a union's arms escaped as `\|`.
|
|
66
66
|
|
|
67
|
-
|
|
|
68
|
-
| ------------------------- | --------- |
|
|
69
|
-
| `Eligibility` | type | `'eligible' \| 'ineligible' \| 'referral'`
|
|
70
|
-
| `QualificationEffect` | type | `'restriction' \| 'referral' \| 'condition'`
|
|
71
|
-
| `QualificationPass` | type | `QuantitativeDefinition \| LogicalDefinition`
|
|
72
|
-
| `QualificationProjection` | type | `number \| boolean \| Readonly<Record<string, unknown>>`
|
|
73
|
-
| `QualificationContext` | type | `Readonly<Record<string, QualificationProjection>>`
|
|
74
|
-
| `RulingInput` | interface | `{ scope?, message? }`
|
|
75
|
-
| `QualificationInput` | interface | `{ description?, rulings?, metadata? }`
|
|
76
|
-
| `Ruling` | interface | `{ id, pass, rule, effect, scope?, message? }`
|
|
77
|
-
| `Premise` | interface | `{ field?, label?, description?, comparison?, expected?, actual?, met? }`
|
|
78
|
-
| `Finding` | interface | `{ id, pass, rule, effect, scope?, applied, message?, premises }`
|
|
79
|
-
| `Derivation` | interface | `{ id, value, success, trace, errors }`
|
|
80
|
-
| `QualificationDefinition` | interface | `{ id, name, description?, passes, rulings?, metadata? }`
|
|
81
|
-
| `QualificationResult` | interface | `{ id, name, eligibility, scopes, findings, derivations, success, trace, errors }`
|
|
82
|
-
| `QualifierErrorCode` | type | `'DEFINITION' \| 'MISMATCH' \| 'DESTROYED' \| 'ENGINE'`
|
|
83
|
-
| `QualifierErrorContext` | interface | `{ pass?, definition?, cause? }`
|
|
84
|
-
| `QualifierEventMap` | type | `{ derive
|
|
85
|
-
| `QualifierOptions` | interface | `{ engine?, validate?, labels?, on?, error? }`
|
|
86
|
-
| `QualifierInterface` | interface | `{ emitter
|
|
67
|
+
| Name | Kind | Signature | Summary |
|
|
68
|
+
| ------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
|
69
|
+
| `Eligibility` | type | `'eligible' \| 'ineligible' \| 'referral'` | Represents the eligibility outcome axis. |
|
|
70
|
+
| `QualificationEffect` | type | `'restriction' \| 'referral' \| 'condition'` | Represents an authored ruling's eligibility impact. |
|
|
71
|
+
| `QualificationPass` | type | `QuantitativeDefinition \| LogicalDefinition` | Represents one ordered derivation or rule pass. |
|
|
72
|
+
| `QualificationProjection` | type | `number \| boolean \| Readonly<Record<string, unknown>>` | Represents one pass's internal working projection. |
|
|
73
|
+
| `QualificationContext` | type | `Readonly<Record<string, QualificationProjection>>` | Represents the internal projection record stored under `QUALIFICATION_KEY`. |
|
|
74
|
+
| `RulingInput` | interface | `{ scope?, message? }` | Carries the optional fields `createRuling` accepts. |
|
|
75
|
+
| `QualificationInput` | interface | `{ description?, rulings?, metadata? }` | Carries the optional fields `createQualificationDefinition` accepts. |
|
|
76
|
+
| `Ruling` | interface | `{ id, pass, rule, effect, scope?, message? }` | Represents an authored consequence for one rule in one logical pass. |
|
|
77
|
+
| `Premise` | interface | `{ field?, label?, description?, comparison?, expected?, actual?, met? }` | Represents display-neutral evidence for one condition, authored as a checked or a described premise. |
|
|
78
|
+
| `Finding` | interface | `{ id, pass, rule, effect, scope?, applied, message?, premises }` | Represents one resolved ruling. |
|
|
79
|
+
| `Derivation` | interface | `{ id, value, success, trace, errors }` | Represents one quantitative pass's audit result. |
|
|
80
|
+
| `QualificationDefinition` | interface | `{ id, name, description?, passes, rulings?, metadata? }` | Represents a pure authored qualification definition. |
|
|
81
|
+
| `QualificationResult` | interface | `{ id, name, eligibility, scopes, findings, derivations, success, trace, errors }` | Represents one subject's complete qualification outcome. |
|
|
82
|
+
| `QualifierErrorCode` | type | `'DEFINITION' \| 'MISMATCH' \| 'DESTROYED' \| 'ENGINE'` | Represents a coded `QualifierError` programmer-error code. |
|
|
83
|
+
| `QualifierErrorContext` | interface | `{ pass?, definition?, cause? }` | Represents the structured payload a `QualifierError` carries. |
|
|
84
|
+
| `QualifierEventMap` | type | `{ readonly derive: readonly [derivation: Derivation]; readonly finding: readonly [finding: Finding]; readonly qualify: readonly [result: QualificationResult]; readonly destroy: readonly []; }` | Represents the push observation surface of a `QualifierInterface`. |
|
|
85
|
+
| `QualifierOptions` | interface | `{ engine?, validate?, labels?, on?, error? }` | Carries the options for `createQualifier` and the `Qualifier` constructor. |
|
|
86
|
+
| `QualifierInterface` | interface | `{ emitter, qualify(), validate(), destroy() }` | Owns or borrows one reason engine and returns eligibility. |
|
|
87
87
|
|
|
88
88
|
Every public data member is `readonly`, every optional key is omitted rather than
|
|
89
89
|
`undefined`, and each name is single-word within its entity. Reason
|
|
@@ -96,10 +96,10 @@ types.
|
|
|
96
96
|
|
|
97
97
|
A `Shape` cell holds the constant's declared type.
|
|
98
98
|
|
|
99
|
-
|
|
|
99
|
+
| Name | Kind | Signature | Summary |
|
|
100
100
|
| ---------------------------- | ----- | ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
101
|
-
| `DEFAULT_QUALIFIER_VALIDATE` | const | `
|
|
102
|
-
| `QUALIFICATION_KEY` | const | `
|
|
101
|
+
| `DEFAULT_QUALIFIER_VALIDATE` | const | `true` | Holds the default definition validation policy for `createQualifier` and `Qualifier.qualify`, `true`. |
|
|
102
|
+
| `QUALIFICATION_KEY` | const | `"qualification"` | Names `'qualification'`, the reserved internal projection namespace a pass's working projection is written under. |
|
|
103
103
|
| `ELIGIBILITY_PRECEDENCE` | const | `readonly Eligibility[]` | Lists the eligibility severities most to least severe: `ineligible`, `referral`, `eligible`. |
|
|
104
104
|
| `EFFECT_ELIGIBILITIES` | const | `Readonly<Record<QualificationEffect, Eligibility>>` | Maps each `QualificationEffect` to its eligibility impact — `restriction` to `ineligible`, `referral` to `referral`, and `condition` to `eligible`. |
|
|
105
105
|
|
|
@@ -108,10 +108,10 @@ its subject, so a conditional ruling contributes evidence without changing eligi
|
|
|
108
108
|
|
|
109
109
|
### Errors
|
|
110
110
|
|
|
111
|
-
|
|
|
112
|
-
| ------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
113
|
-
| `QualifierError` | class | Represents a coded programmer error thrown by the qualifier layer, carrying a `QualifierErrorCode` and an optional context record. |
|
|
114
|
-
| `isQualifierError` | function | Narrows a caught value to a `QualifierError`. |
|
|
111
|
+
| Name | Kind | Signature | Summary |
|
|
112
|
+
| ------------------ | -------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
113
|
+
| `QualifierError` | class | `new (code: QualifierErrorCode, message: string, context?: QualifierErrorContext) => QualifierError` | Represents a coded programmer error thrown by the qualifier layer, carrying a `QualifierErrorCode` and an optional context record. |
|
|
114
|
+
| `isQualifierError` | function | `(value: unknown) => value is QualifierError` | Narrows a caught value to a `QualifierError`. |
|
|
115
115
|
|
|
116
116
|
`context` is a `QualifierErrorContext` or `undefined`, so a caught error's payload
|
|
117
117
|
needs no narrowing of its own. `ENGINE` marks an underlying reason engine throw that
|
|
@@ -153,18 +153,18 @@ that package.
|
|
|
153
153
|
|
|
154
154
|
In a guard table a `Shape` cell holds the type the guard narrows to.
|
|
155
155
|
|
|
156
|
-
|
|
|
157
|
-
| --------------------------- | -------- |
|
|
158
|
-
| `isEligibility` | const | `
|
|
159
|
-
| `isQualificationEffect` | const | `
|
|
160
|
-
| `isEligibilityRecord` | function | `Readonly<Record<string, Eligibility>>`
|
|
161
|
-
| `isPremise` | function | `Premise`
|
|
162
|
-
| `isFinding` | function | `Finding`
|
|
163
|
-
| `isDerivation` | function | `Derivation`
|
|
164
|
-
| `isQualificationResult` | function | `QualificationResult`
|
|
165
|
-
| `isRuling` | function | `Ruling`
|
|
166
|
-
| `isQualificationPass` | function | `QualificationPass`
|
|
167
|
-
| `isQualificationDefinition` | function | `QualificationDefinition`
|
|
156
|
+
| Name | Kind | Signature | Summary |
|
|
157
|
+
| --------------------------- | -------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
|
|
158
|
+
| `isEligibility` | const | `import("@orkestrel/contract").Guard<"eligible" \| "ineligible" \| "referral">` | Determines whether a value is an `Eligibility` literal. |
|
|
159
|
+
| `isQualificationEffect` | const | `import("@orkestrel/contract").Guard<"condition" \| "referral" \| "restriction">` | Determines whether a value is a `QualificationEffect` literal. |
|
|
160
|
+
| `isEligibilityRecord` | function | `(value: unknown) => value is Readonly<Record<string, Eligibility>>` | Determines whether a value is an open string-keyed record of `Eligibility` values. |
|
|
161
|
+
| `isPremise` | function | `(value: unknown) => value is Premise` | Determines whether a value is an open result-side `Premise`. |
|
|
162
|
+
| `isFinding` | function | `(value: unknown) => value is Finding` | Determines whether a value is an open result-side `Finding`. |
|
|
163
|
+
| `isDerivation` | function | `(value: unknown) => value is Derivation` | Determines whether a value is an open result-side `Derivation`. |
|
|
164
|
+
| `isQualificationResult` | function | `(value: unknown) => value is QualificationResult` | Determines whether a value is an open `QualificationResult` returned by a qualifier. |
|
|
165
|
+
| `isRuling` | function | `(value: unknown) => value is Ruling` | Determines whether a value is an exact `Ruling` record. |
|
|
166
|
+
| `isQualificationPass` | function | `(value: unknown) => value is QualificationPass` | Determines whether a value is a `QualificationPass` (a quantitative or logical definition). |
|
|
167
|
+
| `isQualificationDefinition` | function | `(value: unknown) => value is QualificationDefinition` | Determines whether a value is an exact `QualificationDefinition` record. |
|
|
168
168
|
|
|
169
169
|
```ts
|
|
170
170
|
import {
|
|
@@ -215,29 +215,29 @@ isQualificationDefinition({ id: 'd', name: 'D', passes: [] }) // true
|
|
|
215
215
|
Pure exported helpers form the functional core. `Qualifier` retains only the ordered
|
|
216
216
|
orchestration and ownership lifecycle.
|
|
217
217
|
|
|
218
|
-
|
|
|
219
|
-
| -------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
220
|
-
| `interpolateMessage` | function | Interpolates `{{dotted.path}}` tokens in a message template against a subject. |
|
|
221
|
-
| `renderComparison` | function | Renders a `Premise` comparison as a display-neutral verb phrase. |
|
|
222
|
-
| `renderValue` | function | Renders a structured or scalar expected value display-neutrally. |
|
|
223
|
-
| `renderPremise` | function | Renders one `Premise` into a display-neutral sentence. |
|
|
224
|
-
| `checkToPremise` | function | Builds a `Premise` from an authored `Check` and its evaluated `CheckResult`. |
|
|
225
|
-
| `ruleToPremises` | function | Builds rich premises for one fired `Rule` by walking its premise atoms and re-evaluating each against the working subject. |
|
|
226
|
-
| `findRule` | function | Locates an authored `Rule` by id. |
|
|
227
|
-
| `reasonResultToProjection` | function | Projects one reason result into the internal qualification namespace. |
|
|
228
|
-
| `quantitativeResultToDerivation` | function | Projects a quantitative result into a `Derivation` audit record. |
|
|
229
|
-
| `qualificationToRecord` | function | Wraps a `QualificationContext` under `QUALIFICATION_KEY`. |
|
|
230
|
-
| `mergeQualificationContext` | function | Merges one pass projection into the context, copy-on-write. |
|
|
231
|
-
| `rulingToFinding` | function | Joins a ruling, its logical rule result, the pass, the pre-projection subject, and an evaluator into a `Finding`. |
|
|
232
|
-
| `deriveFindingEligibility` | function | Derives global eligibility from applied, unscoped findings. |
|
|
233
|
-
| `combineEligibilities` | function | Returns the most severe `Eligibility` in a list. |
|
|
234
|
-
| `deriveScopeEligibilities` | function | Derives one eligibility per finding scope. |
|
|
235
|
-
| `describeMissingReferences` | function | Describes each ruling whose pass or rule does not exist or whose pass is not logical, and each pass id shadowing the reserved `QUALIFICATION_KEY`. |
|
|
236
|
-
| `hasReservedKey` | function | Determines whether a subject already owns the reserved `QUALIFICATION_KEY`. |
|
|
237
|
-
| `assertSubject` | function | Asserts a value is a valid qualification `Subject`, narrowing it in place. |
|
|
238
|
-
| `mapEngineError` | function | Maps an engine throw caught while running one pass to a typed `QualifierError`. |
|
|
239
|
-
| `describeEmptyLogicalPasses` | function | Describes each logical pass carrying no rulings. |
|
|
240
|
-
| `describeUnreadDerivations` | function | Describes each quantitative pass never read by a later pass. |
|
|
218
|
+
| Name | Kind | Signature | Summary |
|
|
219
|
+
| -------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
220
|
+
| `interpolateMessage` | function | `(template: string, subject: Readonly<Record<string, unknown>>) => string` | Interpolates `{{dotted.path}}` tokens in a message template against a subject. |
|
|
221
|
+
| `renderComparison` | function | `(comparison: NonNullable<Premise['comparison']>) => string` | Renders a `Premise` comparison as a display-neutral verb phrase. |
|
|
222
|
+
| `renderValue` | function | `(value: unknown) => string` | Renders a structured or scalar expected value display-neutrally. |
|
|
223
|
+
| `renderPremise` | function | `(entry: Premise, labels?: Readonly<Record<string, string>>) => string` | Renders one `Premise` into a display-neutral sentence. |
|
|
224
|
+
| `checkToPremise` | function | `(check: Check, result: CheckResult, labels?: Readonly<Record<string, string>>) => Premise` | Builds a `Premise` from an authored `Check` and its evaluated `CheckResult`. |
|
|
225
|
+
| `ruleToPremises` | function | `(rule: Rule, working: Subject, evaluator: EvaluatorInterface, labels?: Readonly<Record<string, string>>) => readonly Premise[]` | Builds rich premises for one fired `Rule` by walking its premise atoms and re-evaluating each against the working subject. |
|
|
226
|
+
| `findRule` | function | `(definition: LogicalDefinition, id: string) => Rule \| undefined` | Locates an authored `Rule` by id. |
|
|
227
|
+
| `reasonResultToProjection` | function | `(definition: QualificationPass, result: ReasonResult) => QualificationProjection` | Projects one reason result into the internal qualification namespace. |
|
|
228
|
+
| `quantitativeResultToDerivation` | function | `(id: string, result: QuantitativeResult) => Derivation` | Projects a quantitative result into a `Derivation` audit record. |
|
|
229
|
+
| `qualificationToRecord` | function | `(context: QualificationContext) => Readonly<Record<string, QualificationContext>>` | Wraps a `QualificationContext` under `QUALIFICATION_KEY`. |
|
|
230
|
+
| `mergeQualificationContext` | function | `(context: QualificationContext, id: string, projection: QualificationProjection) => QualificationContext` | Merges one pass projection into the context, copy-on-write. |
|
|
231
|
+
| `rulingToFinding` | function | `(ruling: Ruling, pass: QualificationPass, result: LogicalResult, subject: Subject, evaluator: EvaluatorInterface, labels?: Readonly<Record<string, string>>) => Finding` | Joins a ruling, its logical rule result, the pass, the pre-projection subject, and an evaluator into a `Finding`. |
|
|
232
|
+
| `deriveFindingEligibility` | function | `(findings: readonly Finding[], failed?: boolean) => Eligibility` | Derives global eligibility from applied, unscoped findings. |
|
|
233
|
+
| `combineEligibilities` | function | `(eligibilities: readonly Eligibility[]) => Eligibility` | Returns the most severe `Eligibility` in a list. |
|
|
234
|
+
| `deriveScopeEligibilities` | function | `(findings: readonly Finding[]) => Readonly<Record<string, Eligibility>>` | Derives one eligibility per finding scope. |
|
|
235
|
+
| `describeMissingReferences` | function | `(definition: QualificationDefinition) => readonly string[]` | Describes each ruling whose pass or rule does not exist or whose pass is not logical, and each pass id shadowing the reserved `QUALIFICATION_KEY`. |
|
|
236
|
+
| `hasReservedKey` | function | `(subject: Subject) => boolean` | Determines whether a subject already owns the reserved `QUALIFICATION_KEY`. |
|
|
237
|
+
| `assertSubject` | function | `(value: unknown) => asserts value is Subject` | Asserts a value is a valid qualification `Subject`, narrowing it in place. |
|
|
238
|
+
| `mapEngineError` | function | `(error: unknown, pass: string) => QualifierError` | Maps an engine throw caught while running one pass to a typed `QualifierError`. |
|
|
239
|
+
| `describeEmptyLogicalPasses` | function | `(definition: QualificationDefinition) => readonly string[]` | Describes each logical pass carrying no rulings. |
|
|
240
|
+
| `describeUnreadDerivations` | function | `(definition: QualificationDefinition) => readonly string[]` | Describes each quantitative pass never read by a later pass. |
|
|
241
241
|
|
|
242
242
|
Every helper carries a worked `@example` in source and is composed by `Qualifier`
|
|
243
243
|
rather than reimplemented by it.
|
|
@@ -339,11 +339,11 @@ assertSubject({ id: 's1' }) // narrows to Subject; throws QualifierError('MISMAT
|
|
|
339
339
|
|
|
340
340
|
### Factories
|
|
341
341
|
|
|
342
|
-
|
|
|
343
|
-
| ------------------------------- | -------- | ------------------------------------------------------------------------------ |
|
|
344
|
-
| `createQualifier` | function | Creates one `QualifierInterface` over a reason engine. |
|
|
345
|
-
| `createQualificationDefinition` | function | Creates a fresh `QualificationDefinition`, omitting every absent optional key. |
|
|
346
|
-
| `createRuling` | function | Creates a fresh `Ruling` from the rule it reacts to and the effect it applies. |
|
|
342
|
+
| Name | Kind | Signature | Summary |
|
|
343
|
+
| ------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
|
|
344
|
+
| `createQualifier` | function | `(options?: QualifierOptions) => QualifierInterface` | Creates one `QualifierInterface` over a reason engine. |
|
|
345
|
+
| `createQualificationDefinition` | function | `(id: string, name: string, passes: readonly QualificationPass[], input?: QualificationInput) => QualificationDefinition` | Creates a fresh `QualificationDefinition`, omitting every absent optional key. |
|
|
346
|
+
| `createRuling` | function | `(id: string, pass: string, rule: string, effect: QualificationEffect, input?: RulingInput) => Ruling` | Creates a fresh `Ruling` from the rule it reacts to and the effect it applies. |
|
|
347
347
|
|
|
348
348
|
#### Create a qualifier
|
|
349
349
|
|
|
@@ -388,9 +388,9 @@ Every factory returns a fresh value and omits absent optional keys.
|
|
|
388
388
|
|
|
389
389
|
### Classes
|
|
390
390
|
|
|
391
|
-
|
|
|
392
|
-
| ----------- | ----- | ------------------------------------------------------------------- |
|
|
393
|
-
| `Qualifier` | class | Runs ordered passes over one reason engine and returns eligibility. |
|
|
391
|
+
| Name | Kind | Signature | Summary |
|
|
392
|
+
| ----------- | ----- | -------------------------------------------------------- | ------------------------------------------------------------------- |
|
|
393
|
+
| `Qualifier` | class | `new (options?: QualifierOptions) => QualifierInterface` | Runs ordered passes over one reason engine and returns eligibility. |
|
|
394
394
|
|
|
395
395
|
## Methods
|
|
396
396
|
|