@agentplat/inference-control 0.3.0-beta.2 → 0.3.0-beta.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/README.md +360 -0
- package/dist/anytime-semantic-guarantees.d.ts +216 -0
- package/dist/anytime-semantic-guarantees.d.ts.map +1 -0
- package/dist/anytime-semantic-guarantees.js +817 -0
- package/dist/anytime-semantic-guarantees.js.map +1 -0
- package/dist/assessor-ensemble-contracts.d.ts +145 -0
- package/dist/assessor-ensemble-contracts.d.ts.map +1 -0
- package/dist/assessor-ensemble-contracts.js +29 -0
- package/dist/assessor-ensemble-contracts.js.map +1 -0
- package/dist/assessor-ensemble-runtime.d.ts +55 -0
- package/dist/assessor-ensemble-runtime.d.ts.map +1 -0
- package/dist/assessor-ensemble-runtime.js +308 -0
- package/dist/assessor-ensemble-runtime.js.map +1 -0
- package/dist/assessor-ensemble-validation.d.ts +12 -0
- package/dist/assessor-ensemble-validation.d.ts.map +1 -0
- package/dist/assessor-ensemble-validation.js +156 -0
- package/dist/assessor-ensemble-validation.js.map +1 -0
- package/dist/assessor-ensemble.d.ts +4 -0
- package/dist/assessor-ensemble.d.ts.map +1 -0
- package/dist/assessor-ensemble.js +4 -0
- package/dist/assessor-ensemble.js.map +1 -0
- package/dist/cognitive-adapters.d.ts +92 -0
- package/dist/cognitive-adapters.d.ts.map +1 -0
- package/dist/cognitive-adapters.js +263 -0
- package/dist/cognitive-adapters.js.map +1 -0
- package/dist/context-integrity-analyzers.d.ts +35 -0
- package/dist/context-integrity-analyzers.d.ts.map +1 -0
- package/dist/context-integrity-analyzers.js +387 -0
- package/dist/context-integrity-analyzers.js.map +1 -0
- package/dist/context-integrity-contracts.d.ts +304 -0
- package/dist/context-integrity-contracts.d.ts.map +1 -0
- package/dist/context-integrity-contracts.js +24 -0
- package/dist/context-integrity-contracts.js.map +1 -0
- package/dist/context-integrity-model.d.ts +25 -0
- package/dist/context-integrity-model.d.ts.map +1 -0
- package/dist/context-integrity-model.js +192 -0
- package/dist/context-integrity-model.js.map +1 -0
- package/dist/context-integrity-portable-agent.d.ts +79 -0
- package/dist/context-integrity-portable-agent.d.ts.map +1 -0
- package/dist/context-integrity-portable-agent.js +511 -0
- package/dist/context-integrity-portable-agent.js.map +1 -0
- package/dist/context-integrity-role-alignment.d.ts +28 -0
- package/dist/context-integrity-role-alignment.d.ts.map +1 -0
- package/dist/context-integrity-role-alignment.js +95 -0
- package/dist/context-integrity-role-alignment.js.map +1 -0
- package/dist/context-integrity-runtime.d.ts +95 -0
- package/dist/context-integrity-runtime.d.ts.map +1 -0
- package/dist/context-integrity-runtime.js +1512 -0
- package/dist/context-integrity-runtime.js.map +1 -0
- package/dist/context-integrity.d.ts +5 -0
- package/dist/context-integrity.d.ts.map +1 -0
- package/dist/context-integrity.js +5 -0
- package/dist/context-integrity.js.map +1 -0
- package/dist/governed-role-evolution.d.ts +172 -0
- package/dist/governed-role-evolution.d.ts.map +1 -0
- package/dist/governed-role-evolution.js +613 -0
- package/dist/governed-role-evolution.js.map +1 -0
- package/dist/heterogeneous-agent-composition.d.ts +96 -0
- package/dist/heterogeneous-agent-composition.d.ts.map +1 -0
- package/dist/heterogeneous-agent-composition.js +512 -0
- package/dist/heterogeneous-agent-composition.js.map +1 -0
- package/dist/index.d.ts +21 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -13
- package/dist/index.js.map +1 -1
- package/dist/intervention-adapters.d.ts +29 -0
- package/dist/intervention-adapters.d.ts.map +1 -0
- package/dist/intervention-adapters.js +107 -0
- package/dist/intervention-adapters.js.map +1 -0
- package/dist/intervention-contracts.d.ts +311 -0
- package/dist/intervention-contracts.d.ts.map +1 -0
- package/dist/intervention-contracts.js +28 -0
- package/dist/intervention-contracts.js.map +1 -0
- package/dist/intervention-runtime.d.ts +86 -0
- package/dist/intervention-runtime.d.ts.map +1 -0
- package/dist/intervention-runtime.js +958 -0
- package/dist/intervention-runtime.js.map +1 -0
- package/dist/intervention-validation.d.ts +27 -0
- package/dist/intervention-validation.d.ts.map +1 -0
- package/dist/intervention-validation.js +273 -0
- package/dist/intervention-validation.js.map +1 -0
- package/dist/intervention.d.ts +6 -0
- package/dist/intervention.d.ts.map +1 -0
- package/dist/intervention.js +6 -0
- package/dist/intervention.js.map +1 -0
- package/dist/model.d.ts +18 -0
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +60 -2
- package/dist/model.js.map +1 -1
- package/dist/operational-cognitive-control.d.ts +208 -0
- package/dist/operational-cognitive-control.d.ts.map +1 -0
- package/dist/operational-cognitive-control.js +590 -0
- package/dist/operational-cognitive-control.js.map +1 -0
- package/dist/portable-agent.d.ts +50 -0
- package/dist/portable-agent.d.ts.map +1 -0
- package/dist/portable-agent.js +243 -0
- package/dist/portable-agent.js.map +1 -0
- package/dist/reference-controllers.d.ts +121 -0
- package/dist/reference-controllers.d.ts.map +1 -0
- package/dist/reference-controllers.js +411 -0
- package/dist/reference-controllers.js.map +1 -0
- package/dist/role-alignment-portable-agent.d.ts +145 -0
- package/dist/role-alignment-portable-agent.d.ts.map +1 -0
- package/dist/role-alignment-portable-agent.js +484 -0
- package/dist/role-alignment-portable-agent.js.map +1 -0
- package/dist/role-alignment.d.ts +226 -0
- package/dist/role-alignment.d.ts.map +1 -0
- package/dist/role-alignment.js +1074 -0
- package/dist/role-alignment.js.map +1 -0
- package/dist/role-realignment-portable-agent.d.ts +163 -0
- package/dist/role-realignment-portable-agent.d.ts.map +1 -0
- package/dist/role-realignment-portable-agent.js +634 -0
- package/dist/role-realignment-portable-agent.js.map +1 -0
- package/dist/role-realignment.d.ts +368 -0
- package/dist/role-realignment.d.ts.map +1 -0
- package/dist/role-realignment.js +1609 -0
- package/dist/role-realignment.js.map +1 -0
- package/dist/semantic-alignment-assessors.d.ts +12 -0
- package/dist/semantic-alignment-assessors.d.ts.map +1 -0
- package/dist/semantic-alignment-assessors.js +55 -0
- package/dist/semantic-alignment-assessors.js.map +1 -0
- package/dist/semantic-alignment-contracts.d.ts +385 -0
- package/dist/semantic-alignment-contracts.d.ts.map +1 -0
- package/dist/semantic-alignment-contracts.js +16 -0
- package/dist/semantic-alignment-contracts.js.map +1 -0
- package/dist/semantic-alignment-memory.d.ts +53 -0
- package/dist/semantic-alignment-memory.d.ts.map +1 -0
- package/dist/semantic-alignment-memory.js +170 -0
- package/dist/semantic-alignment-memory.js.map +1 -0
- package/dist/semantic-alignment-runtime.d.ts +67 -0
- package/dist/semantic-alignment-runtime.d.ts.map +1 -0
- package/dist/semantic-alignment-runtime.js +778 -0
- package/dist/semantic-alignment-runtime.js.map +1 -0
- package/dist/semantic-alignment-validation.d.ts +31 -0
- package/dist/semantic-alignment-validation.d.ts.map +1 -0
- package/dist/semantic-alignment-validation.js +477 -0
- package/dist/semantic-alignment-validation.js.map +1 -0
- package/dist/semantic-alignment.d.ts +8 -0
- package/dist/semantic-alignment.d.ts.map +1 -0
- package/dist/semantic-alignment.js +8 -0
- package/dist/semantic-alignment.js.map +1 -0
- package/dist/semantic-horizon-budget.d.ts +118 -0
- package/dist/semantic-horizon-budget.d.ts.map +1 -0
- package/dist/semantic-horizon-budget.js +536 -0
- package/dist/semantic-horizon-budget.js.map +1 -0
- package/dist/semantic-metric-engine.d.ts +96 -0
- package/dist/semantic-metric-engine.d.ts.map +1 -0
- package/dist/semantic-metric-engine.js +396 -0
- package/dist/semantic-metric-engine.js.map +1 -0
- package/package.json +79 -7
package/README.md
CHANGED
|
@@ -22,11 +22,55 @@ pnpm add @agentplat/inference-control@next
|
|
|
22
22
|
ledger and gateway.
|
|
23
23
|
- `@agentplat/inference-control/trust` — content-free outcome-to-Claim
|
|
24
24
|
conversion plus opt-in legacy and authenticated state-backed Trust gates.
|
|
25
|
+
- `@agentplat/inference-control/portable-agent` — fail-closed bridge from a
|
|
26
|
+
portable-agent session control point to a bound inference-control policy and
|
|
27
|
+
assessor. It maps `pre_step`, `post_output`, and `pre_action` to `pre_run`,
|
|
28
|
+
`post_run`, and `pre_tool`; it does not invoke a provider or grant actions.
|
|
29
|
+
- `@agentplat/inference-control/role-alignment` — deterministic longitudinal
|
|
30
|
+
role anchors, coherence signals, recovery hysteresis and bounded local
|
|
31
|
+
interventions.
|
|
32
|
+
- `@agentplat/inference-control/role-alignment/portable-agent` — stateful
|
|
33
|
+
Portable Agent controller plus checkpoint-handoff continuity.
|
|
34
|
+
- `@agentplat/inference-control/role-realignment` — content-free discovery,
|
|
35
|
+
trusted-catalog admission, deterministic selection, certificates and the
|
|
36
|
+
pure realignment reducer.
|
|
37
|
+
- `@agentplat/inference-control/role-realignment/portable-agent` — restart-safe
|
|
38
|
+
discovery-to-activation orchestration with Trust eligibility, exact Runtime
|
|
39
|
+
role updates and checkpoint-handoff continuity.
|
|
40
|
+
- `@agentplat/inference-control/context-integrity` — content-free longitudinal
|
|
41
|
+
context decisions, bounded CAS state, explainable reference analysis and
|
|
42
|
+
conservative analyzer composition.
|
|
43
|
+
- `@agentplat/inference-control/context-integrity/model` — exact pre-provider
|
|
44
|
+
filtering for immutable controlled-model context entries.
|
|
45
|
+
- `@agentplat/inference-control/context-integrity/portable-agent` — a
|
|
46
|
+
manifest-bound filtering wrapper for heterogeneous agents plus state handoff.
|
|
47
|
+
- `@agentplat/inference-control/intervention` — capability-negotiated,
|
|
48
|
+
content-free intervention gates for opaque APIs, token streams,
|
|
49
|
+
representation sidecars, portable agents and multimodal action agents.
|
|
50
|
+
- `@agentplat/inference-control/cognitive-adapters` — concrete cognitive-agent
|
|
51
|
+
adapters for black-box and representation-aware local inference, plus a
|
|
52
|
+
bounded HTTP chat-completions port for locally operated endpoints.
|
|
53
|
+
- `@agentplat/inference-control/operational-control` — executable cognitive
|
|
54
|
+
control loop for black-box and representation-aware inference, anytime
|
|
55
|
+
observations, safe stopping and immediate pre-tool/pre-effect fencing.
|
|
56
|
+
- `@agentplat/inference-control/assessor-ensemble` — request-bound,
|
|
57
|
+
independent-group assessment across heterogeneous surfaces and modalities.
|
|
58
|
+
- `@agentplat/inference-control/semantic-metrics` — provider-neutral vector
|
|
59
|
+
metrics and fixed-horizon descriptive bounds.
|
|
60
|
+
- `@agentplat/inference-control/semantic-guarantees` — durable, anytime-valid
|
|
61
|
+
confidence sequences with explicit error spending, missingness policies and
|
|
62
|
+
horizon/replanning decisions.
|
|
25
63
|
|
|
26
64
|
The root entry point has no Node runtime dependency and imports only
|
|
27
65
|
`@agentplat/core`. Adapter subpaths depend only on public AgentPlat contracts
|
|
28
66
|
and never import a vendor SDK.
|
|
29
67
|
|
|
68
|
+
The cognitive adapters keep context, memory and tool use behind the reference
|
|
69
|
+
control boundary. Representation-aware execution applies the configured
|
|
70
|
+
representation intervention before the embedded engine runs. Both forms emit
|
|
71
|
+
content-bound receipts for the collective cognitive runtime; neither model
|
|
72
|
+
output nor a transport response grants action authority.
|
|
73
|
+
|
|
30
74
|
## Minimal controlled model
|
|
31
75
|
|
|
32
76
|
Create a `CapabilityRegistryV1`, register the exact wrapper descriptor and
|
|
@@ -80,6 +124,117 @@ Context entries are immutable and digest-bound. Only `policy`, `objective` and
|
|
|
80
124
|
configured `local_trusted` entries may supply instructions; user, peer, tool,
|
|
81
125
|
retrieval, provider and assessor content remains ordinary untrusted data.
|
|
82
126
|
|
|
127
|
+
## Long-horizon context integrity
|
|
128
|
+
|
|
129
|
+
Context Integrity evaluates the complete original input set and returns an
|
|
130
|
+
item decision: `admit`, `restrict`, `isolate`, `require_corroboration` or
|
|
131
|
+
`deny`. An inference may continue with a reduced set only when the request and
|
|
132
|
+
policy contain the exact digest of the installed filtering implementation.
|
|
133
|
+
|
|
134
|
+
```js
|
|
135
|
+
import {
|
|
136
|
+
ContextIntegrityRuntimeV1,
|
|
137
|
+
createContextIntegrityReferenceAnalyzerV1,
|
|
138
|
+
} from "@agentplat/inference-control/context-integrity";
|
|
139
|
+
import { createContextIntegrityControlledModelGateV1 } from "@agentplat/inference-control/context-integrity/model";
|
|
140
|
+
|
|
141
|
+
const controller = new ContextIntegrityRuntimeV1({
|
|
142
|
+
controllerId: "context-integrity:local",
|
|
143
|
+
controllerVersion: 1,
|
|
144
|
+
implementationId: "context-integrity:local:v1",
|
|
145
|
+
policy: localContextIntegrityPolicy,
|
|
146
|
+
analyzer: createContextIntegrityReferenceAnalyzerV1({
|
|
147
|
+
analyzerId: "context-analyzer:local",
|
|
148
|
+
analyzerVersion: 1,
|
|
149
|
+
assessmentTtlMs: 5_000,
|
|
150
|
+
}),
|
|
151
|
+
store: durableContextIntegrityStore,
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
const contextGate = createContextIntegrityControlledModelGateV1({
|
|
155
|
+
controller,
|
|
156
|
+
filterId: "context-filter:model",
|
|
157
|
+
filterVersion: 1,
|
|
158
|
+
filterImplementationDigest,
|
|
159
|
+
itemTtlMs: 60_000,
|
|
160
|
+
logicalTimeMs: trustedLogicalClock,
|
|
161
|
+
});
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
The reference analyzer is a transparent baseline, not a universal injection
|
|
165
|
+
detector. Applications can compose model, classifier, semantic-entropy or
|
|
166
|
+
representation-probe analyzers. State and handoff envelopes retain only
|
|
167
|
+
digests, revisions, bounded scores and reason codes; raw content remains
|
|
168
|
+
ephemeral. See the [implementation plan](../../docs/inference-control/long-horizon-context-integrity-v1-implementation-plan.md),
|
|
169
|
+
[ADR](../../docs/adr/0020-long-horizon-context-integrity.md) and [threat
|
|
170
|
+
model](../../docs/security/long-horizon-context-integrity-threat-model.md).
|
|
171
|
+
|
|
172
|
+
## Continuous role alignment
|
|
173
|
+
|
|
174
|
+
The role-alignment controller turns exact checkpoint assessments into bounded
|
|
175
|
+
session history. It can allow a healthy step, reinforce the current role,
|
|
176
|
+
abstain on contradictory context, pause, request a successor role or deny. A
|
|
177
|
+
single healthy assessment does not erase accumulated degradation: recovery
|
|
178
|
+
requires the policy's consecutive healthy-signal threshold.
|
|
179
|
+
|
|
180
|
+
```js
|
|
181
|
+
import { createRoleAlignmentPortableAgentControlV1 } from "@agentplat/inference-control/role-alignment/portable-agent";
|
|
182
|
+
|
|
183
|
+
const control = createRoleAlignmentPortableAgentControlV1({
|
|
184
|
+
controlId: "alignment:local",
|
|
185
|
+
controlVersion: 1,
|
|
186
|
+
implementationId: "alignment:local:v1",
|
|
187
|
+
policy: localRoleAlignmentPolicy,
|
|
188
|
+
assessorBinding: localAssessorBinding,
|
|
189
|
+
assessor: localAssessor,
|
|
190
|
+
assessmentTtlMs: 5_000,
|
|
191
|
+
});
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
The scorer is deliberately application-provided. It may use deterministic
|
|
195
|
+
rules, another model, representation probes exposed by an open-weight adapter
|
|
196
|
+
or an ensemble, but its result never creates role or action authority. State is
|
|
197
|
+
content-free and can be exported alongside an exact Portable Agent checkpoint
|
|
198
|
+
transfer so a handoff cannot silently reset adverse history.
|
|
199
|
+
|
|
200
|
+
## Adaptive role realignment
|
|
201
|
+
|
|
202
|
+
The realignment controller consumes an exact `realignment_required` state and
|
|
203
|
+
can close the loop without accepting role instructions from a peer. Discovery
|
|
204
|
+
strategies propose only trusted catalog references. Independent Trust-eligible
|
|
205
|
+
evaluators score the resolved definitions, the pure reducer selects one with
|
|
206
|
+
integer arithmetic and a certificate gates installation of the exact successor
|
|
207
|
+
role revision.
|
|
208
|
+
|
|
209
|
+
```js
|
|
210
|
+
import { createRoleRealignmentPortableAgentV1 } from "@agentplat/inference-control/role-realignment/portable-agent";
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Definitions may narrow capabilities, resource classes, action budget or
|
|
214
|
+
validity, but cannot widen the request's authority ceiling. Runtime-first
|
|
215
|
+
activation is retryable: a process interruption after the role update does not
|
|
216
|
+
create a second revision. See the [integration guide](../../docs/inference-control/adaptive-role-realignment-v1.md).
|
|
217
|
+
|
|
218
|
+
## Heterogeneous inference intervention
|
|
219
|
+
|
|
220
|
+
The `./intervention` subpath provides one provider-neutral policy boundary for
|
|
221
|
+
pre-input and context assessment, trusted transformations, streamed token and
|
|
222
|
+
window checks, final-output release, tool/action gating and optional
|
|
223
|
+
representation-sidecar intervention. An adapter advertises a closed capability
|
|
224
|
+
set; construction fails when the policy requires a hook that the adapter cannot
|
|
225
|
+
enforce.
|
|
226
|
+
|
|
227
|
+
Durable state contains only identities, digests, counters, logical-time heads
|
|
228
|
+
and an invocation reservation. Raw inputs, context, multimodal payload handles,
|
|
229
|
+
tokens and model output remain volatile. A `modify` decision requires a trusted
|
|
230
|
+
transformation port and a verified receipt; otherwise the invocation is
|
|
231
|
+
blocked. Stable invocation IDs and CAS reservations make retries explicit and
|
|
232
|
+
prevent a conflicting request from reusing an invocation identity.
|
|
233
|
+
|
|
234
|
+
This boundary controls only calls routed through it. Provider cancellation,
|
|
235
|
+
distributed idempotency, monotonic storage anchors and downstream tool or
|
|
236
|
+
action fencing remain application responsibilities.
|
|
237
|
+
|
|
83
238
|
## Security boundary
|
|
84
239
|
|
|
85
240
|
Protection applies only to calls routed through the exact controlled executor
|
|
@@ -129,3 +284,208 @@ These gates remain opt-in and point-in-time. They do not issue assessments or
|
|
|
129
284
|
grants, replace idempotency/fencing, or claim atomic revocation after an
|
|
130
285
|
external effect has started. The legacy synchronous-resolver helpers remain
|
|
131
286
|
available unchanged for Alpha 3 compatibility.
|
|
287
|
+
|
|
288
|
+
## Heterogeneous assessor ensemble
|
|
289
|
+
|
|
290
|
+
Import `@agentplat/inference-control/assessor-ensemble` to combine bounded,
|
|
291
|
+
request-bound votes from rule, model, classifier, representation and multimodal
|
|
292
|
+
assessors. Policy requires both vote count and independent-group coverage for
|
|
293
|
+
the requested surface and modalities. Missing, timed-out, conflicting,
|
|
294
|
+
same-group divergent or uncovered evidence produces `unresolved`; the supplied
|
|
295
|
+
operation gate dispatches only on an exact `allow` verdict.
|
|
296
|
+
|
|
297
|
+
Invocations are prepared durably before assessor calls. An exact retry of an
|
|
298
|
+
active reservation never masquerades as a blocked verdict: it requires an
|
|
299
|
+
authenticated reconciliation. A `confirmed_not_applied` receipt durably
|
|
300
|
+
authorizes only that same invocation digest to reclaim the reservation and
|
|
301
|
+
retry; any competing or changed invocation still fails closed. Completed
|
|
302
|
+
verdicts are idempotent, and an external monotonic anchor detects rollback.
|
|
303
|
+
Independence labels and assessor quality remain deployment attestations rather
|
|
304
|
+
than facts inferred by the runtime.
|
|
305
|
+
|
|
306
|
+
Governed role catalogs are nominal runtimes. Closed host currentness paths use
|
|
307
|
+
the catalog's module-owned resolver and its construction-time mission identity;
|
|
308
|
+
plain structural adapters, prototype-only objects, instance method replacement,
|
|
309
|
+
subclass overrides and later option rebinding cannot create an active role
|
|
310
|
+
binding.
|
|
311
|
+
|
|
312
|
+
## Anytime semantic guarantees
|
|
313
|
+
|
|
314
|
+
Import `@agentplat/inference-control/semantic-guarantees` when a control loop
|
|
315
|
+
will inspect semantic or coherence evidence repeatedly. The engine allocates a
|
|
316
|
+
separate absolute error budget to every metric and an inverse-quadratic budget
|
|
317
|
+
to every observation count. Its intervals therefore remain simultaneous over
|
|
318
|
+
all configured metrics and all emitted observation counts, subject to the
|
|
319
|
+
digested bounded-martingale and pre-observation selection assumptions.
|
|
320
|
+
|
|
321
|
+
State contains integer accumulators, counters and evidence digests only. A CAS
|
|
322
|
+
store plus a monotonically anchored state digest makes restart, exact retry,
|
|
323
|
+
equivocation and rollback behavior explicit. `createSemanticHorizonControlV1`
|
|
324
|
+
binds to the exact guarantee-policy and assumption digests, then emits
|
|
325
|
+
`continue`, `shorten_horizon`, `replan` or `safe_stop` with a bounded horizon.
|
|
326
|
+
The concrete engine and horizon control are nominal, construction-time-bound
|
|
327
|
+
runtimes. Their module-owned invokers and ECMAScript-private state transitions
|
|
328
|
+
ignore instance replacement and subclass overrides. Exhaustive output
|
|
329
|
+
validation rejects unknown directives, malformed bounds, inconsistent error
|
|
330
|
+
budgets and mismatched state/policy/assumption bindings before control can
|
|
331
|
+
authorize a tool or effect.
|
|
332
|
+
|
|
333
|
+
Null metrics are never silently discarded. `fail_closed` permanently stops
|
|
334
|
+
the bound from authorizing continued operation after a missing observation;
|
|
335
|
+
`worst_case_imputation` inserts zero for benefit metrics and 10,000 for risk
|
|
336
|
+
metrics; `predictable_skip` requires an assumption-evidence digest and is valid
|
|
337
|
+
only when the skip decision is fixed before the unavailable value could be
|
|
338
|
+
observed. These confidence sequences target the average conditional mean, not
|
|
339
|
+
a stationary population mean, causal effect, future outcome or proof that an
|
|
340
|
+
assessor is calibrated. See the [statistical contract and limits](../../docs/inference-control/anytime-semantic-guarantees-v1.md).
|
|
341
|
+
|
|
342
|
+
## Operational cognitive control
|
|
343
|
+
|
|
344
|
+
`OperationalCognitiveControllerV1` closes the provider-neutral control loop by
|
|
345
|
+
composing the existing black-box controller, optional representation controller,
|
|
346
|
+
heterogeneous intervention runtime and anytime guarantee engine. Four explicit
|
|
347
|
+
observer ports report role coherence, objective alignment, context conflict and
|
|
348
|
+
uncertainty at `pre_turn`, `post_turn`, `pre_tool` and `pre_effect` checkpoints.
|
|
349
|
+
Their content-free metric sample is committed to the configured confidence
|
|
350
|
+
sequence before the associated operation can continue.
|
|
351
|
+
|
|
352
|
+
`runTurn` applies memory, context and tool constraints before the inference port
|
|
353
|
+
is called. In representation-aware mode it also verifies and controls the
|
|
354
|
+
activation before execution. Output remains withheld when the horizon controller
|
|
355
|
+
requires `replan` or `safe_stop`, or when the output intervention gate blocks it.
|
|
356
|
+
`runPreTool` and `runPreEffect` accept callbacks and invoke them only after the
|
|
357
|
+
final gate, keeping the check adjacent to dispatch instead of returning a
|
|
358
|
+
detached authorization boolean.
|
|
359
|
+
|
|
360
|
+
The controller snapshots both intervention gate functions at construction, so
|
|
361
|
+
later mutation or rebinding cannot replace them with allow-all callbacks. A
|
|
362
|
+
`shorten_horizon` decision installs a non-refilling operational budget. Actual
|
|
363
|
+
inference, tool dispatch and effect commit each consume one step; repeated
|
|
364
|
+
shortening decisions can reduce but never refill it. Exhaustion blocks the
|
|
365
|
+
callback and returns `replan_required` or `semantic_horizon_exhausted` while
|
|
366
|
+
preserving immediate `replan` and `safe_stop` behavior.
|
|
367
|
+
|
|
368
|
+
The budget is a hash-chained CAS ledger bound to the guarantee state, control
|
|
369
|
+
policy, assumptions and directive. Supplying `horizonBudgetStore`,
|
|
370
|
+
`horizonBudgetMonotonicAnchor` and `horizonBudgetStateKey` preserves the exact
|
|
371
|
+
remaining count across process reconstruction and detects rollback. The
|
|
372
|
+
in-memory implementations support local composition and restart tests; closed
|
|
373
|
+
reference stacks require explicit durable state and anchor repositories.
|
|
374
|
+
Consumption tombstones are retained as an exact retry window. When a newer
|
|
375
|
+
guarantee creates a new consumption epoch and that window reaches its bound,
|
|
376
|
+
older epochs are folded into a hash-chained count/digest accumulator. Exact
|
|
377
|
+
retries remain idempotent while present in the window and fail closed after
|
|
378
|
+
compaction; new current-epoch work can continue without refilling a finite
|
|
379
|
+
horizon.
|
|
380
|
+
|
|
381
|
+
Pre-effect consumption IDs include the checkpoint kind, preventing an earlier
|
|
382
|
+
tool debit from authorizing an effect with the same operation ID. A durable
|
|
383
|
+
effect saga can reconcile an exact retained pre-effect debit and resume only
|
|
384
|
+
its callback after a crash, even if the guarantee sequence has since advanced.
|
|
385
|
+
If the required tombstone has already been compacted, replay is ambiguous and
|
|
386
|
+
fails closed instead of re-observing an old sequence.
|
|
387
|
+
|
|
388
|
+
Generic operational compositions may still install provider ports, but every
|
|
389
|
+
guarantee and decision is exhaustively validated and malformed output fails
|
|
390
|
+
closed. `isOperationalCognitiveControllerBoundToSemanticGuaranteesV1` is true
|
|
391
|
+
only when the controller captured the concrete engine and horizon identities;
|
|
392
|
+
the closed reference host requires this stronger nominal binding.
|
|
393
|
+
|
|
394
|
+
```js
|
|
395
|
+
import { OperationalCognitiveControllerV1 } from "@agentplat/inference-control/operational-control";
|
|
396
|
+
|
|
397
|
+
const control = new OperationalCognitiveControllerV1({
|
|
398
|
+
controlId: "cognitive-control:primary",
|
|
399
|
+
mode: "black_box",
|
|
400
|
+
guaranteeStateKey: "semantic-guarantees:session-42",
|
|
401
|
+
blackBoxPolicy,
|
|
402
|
+
observers: { coherence, objective, context, uncertainty },
|
|
403
|
+
intervention,
|
|
404
|
+
guarantee,
|
|
405
|
+
horizonControl,
|
|
406
|
+
inference,
|
|
407
|
+
observationSink,
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
const turn = await control.runTurn(turnRequest);
|
|
411
|
+
const tool = await control.runPreTool(toolRequest, () =>
|
|
412
|
+
toolDispatcher(toolRequest),
|
|
413
|
+
);
|
|
414
|
+
const effect = await control.runPreEffect(effectRequest, () =>
|
|
415
|
+
effectSink(effectRequest),
|
|
416
|
+
);
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
Observation sequences are caller-supplied so durable deployments can preserve
|
|
420
|
+
ordering across restarts. A turn consumes its declared sequence at `pre_turn`
|
|
421
|
+
and the following sequence at `post_turn`; later tool and effect checkpoints
|
|
422
|
+
must use strictly later values. The in-memory guarantee store is development
|
|
423
|
+
support. Production use still requires a durable CAS store, external monotonic
|
|
424
|
+
anchor and downstream-atomic effect fencing.
|
|
425
|
+
|
|
426
|
+
## Collective capability closure
|
|
427
|
+
|
|
428
|
+
Semantic Alignment & Agility Control V1 and Heterogeneous Agent Composition V1
|
|
429
|
+
are control-plane inputs to the collective capability closure. They publish
|
|
430
|
+
bounded, provider-neutral assessment and intervention evidence; neither a
|
|
431
|
+
model result, assessor vote nor provider adapter can create assignment or
|
|
432
|
+
effect authority. Unresolved, stale, unsupported or conflicting results must
|
|
433
|
+
remain restrictive at the receiving control gate.
|
|
434
|
+
|
|
435
|
+
Semantic requests retain no provider material or action payload, but their
|
|
436
|
+
canonical digest includes `materialDigest` and the exact pre-action payload
|
|
437
|
+
digest. A replay with different material or payload is rejected before a
|
|
438
|
+
cached decision can be returned. Successful action dispatch receives a
|
|
439
|
+
`SemanticActionAuthorizationV1` receipt binding the allow decision, current
|
|
440
|
+
policy and assessor set, authority, effect consumer, exact `sinkId` and
|
|
441
|
+
`sinkKeyDigest`, full action target, material, payload, committed revision and
|
|
442
|
+
a bounded logical-time window. A raw
|
|
443
|
+
SHA is not authority: the runtime resolves and authenticates the receipt through
|
|
444
|
+
the configured `SemanticActionAuthorizationAuthorityV1` immediately before the
|
|
445
|
+
effect. Dispatch requires a `SemanticActionEffectSinkV1` that atomically keys
|
|
446
|
+
the external effect by `authorizationDigest`; an exact retry returns the
|
|
447
|
+
original authenticated `SemanticActionEffectReceiptV1` without repeating the
|
|
448
|
+
effect. A sink with a different ID or key digest is rejected. Replicas using
|
|
449
|
+
the authorized sink identity must share the same atomic idempotency store. The
|
|
450
|
+
included in-memory
|
|
451
|
+
authority is process-local development support; production deployments need a
|
|
452
|
+
durable signed or MAC-authenticated lookup.
|
|
453
|
+
|
|
454
|
+
Authorization windows are inclusive at `validUntilLogicalTimeMs`. Verification
|
|
455
|
+
rejects a caller clock below the semantic state's logical-time high-water and
|
|
456
|
+
requires the exact allow request/decision record to remain in bounded state.
|
|
457
|
+
Later decisions do not revoke a retained receipt by themselves; policy,
|
|
458
|
+
assessor-set, binding, consumer or sink-identity change, receipt eviction,
|
|
459
|
+
explicit authority revocation, or expiry does. Size
|
|
460
|
+
`maximumRetainedDecisions` for the maximum
|
|
461
|
+
delay and number of simultaneously dispatchable proposals.
|
|
462
|
+
|
|
463
|
+
Action payload bytes are bounded before hashing or assessor work. Exploration
|
|
464
|
+
requests with candidates or a selected course fail closed when diversity or
|
|
465
|
+
novelty lacks configured independent-group coverage, and course history
|
|
466
|
+
advances only for a pre-step course that may actually proceed.
|
|
467
|
+
|
|
468
|
+
Heterogeneous composition derives checkpoint ordering from the portable
|
|
469
|
+
session's bounded `stepSequence`, not its lifecycle revision. Construction
|
|
470
|
+
therefore rejects manifests whose maximum step count cannot fit both semantic
|
|
471
|
+
and intervention policy ceilings, and requires an explicit logical-time ceiling
|
|
472
|
+
that fits the semantic policy. Output/action item indexes are bounded and form
|
|
473
|
+
disjoint sequence ranges within each step. The composed portable control runs
|
|
474
|
+
role and intervention prerequisites before semantic authorization. Returned
|
|
475
|
+
action proposals remain inert; dispatch them only through
|
|
476
|
+
`composition.actionGateway`, which reauthenticates the stored receipt, checks
|
|
477
|
+
expiry/current revision, proves the portable step and proposal were durably
|
|
478
|
+
committed, and compares the canonically encoded full proposal (`actionId`,
|
|
479
|
+
class, input, risk and metadata) at the effect boundary. Both the explicit
|
|
480
|
+
`currentLogicalTimeMs` argument to `runtime.dispatchAction` and the gateway's
|
|
481
|
+
`currentLogicalTimeMs` must come from a trusted monotonic source, never from
|
|
482
|
+
`request.logicalTimeMs` or other caller-controlled request data. Exactly-once
|
|
483
|
+
external effects require the sink
|
|
484
|
+
to co-locate its authorization-digest compare-and-set with the effect; the
|
|
485
|
+
gateway does not claim atomicity across an arbitrary downstream service.
|
|
486
|
+
|
|
487
|
+
Production integrations own provider identity, input/output redaction,
|
|
488
|
+
durable idempotency, logical time, current policy binding and any model-specific
|
|
489
|
+
security properties. The package exposes no scheduler or global agent graph.
|
|
490
|
+
See [ADR 0042](../../docs/adr/0042-collective-capability-closure.md) and the
|
|
491
|
+
[architecture and threat model](../../docs/security/collective-capability-closure-v1.md).
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import type { SemanticMetricSampleV1 } from "./semantic-metric-engine.js";
|
|
2
|
+
export declare const ANYTIME_SEMANTIC_GUARANTEE_STATE_FORMAT_V1: "agentplat.inference-control.anytime-semantic-guarantee-state.v1";
|
|
3
|
+
export declare const SEMANTIC_GUARANTEE_METRICS_V1: readonly ["roleCoherence", "missionAlignment", "contextConflict", "uncertainty", "courseActionDiversity", "courseActionNovelty"];
|
|
4
|
+
export type SemanticGuaranteeMetricV1 = (typeof SEMANTIC_GUARANTEE_METRICS_V1)[number];
|
|
5
|
+
export type SemanticGuaranteeDirectionV1 = "higher_is_better" | "lower_is_better";
|
|
6
|
+
export type SemanticGuaranteeMissingnessV1 = "fail_closed" | "predictable_skip" | "worst_case_imputation";
|
|
7
|
+
export interface AnytimeSemanticAssumptionsV1 {
|
|
8
|
+
readonly schemaVersion: 1;
|
|
9
|
+
/** The guarantee targets the average conditional mean, not a stationary population mean. */
|
|
10
|
+
readonly estimand: "average_conditional_mean";
|
|
11
|
+
/** Supports adaptive histories when the centered observations form bounded martingale differences. */
|
|
12
|
+
readonly dependenceModel: "bounded_martingale_differences";
|
|
13
|
+
readonly observationRange: "basis_points_0_10000";
|
|
14
|
+
/** Sampling and skip decisions must be fixed before the current metric value is observed. */
|
|
15
|
+
readonly selectionTiming: "before_metric_observation";
|
|
16
|
+
readonly assumptionEvidenceDigests: readonly string[];
|
|
17
|
+
readonly assumptionsDigest: string;
|
|
18
|
+
}
|
|
19
|
+
export interface SemanticMetricGuaranteePolicyV1 {
|
|
20
|
+
readonly direction: SemanticGuaranteeDirectionV1;
|
|
21
|
+
/** Absolute family-wise error allocation for this metric, in parts per million. */
|
|
22
|
+
readonly errorBudgetPpm: number;
|
|
23
|
+
readonly missingness: SemanticGuaranteeMissingnessV1;
|
|
24
|
+
}
|
|
25
|
+
export interface AnytimeSemanticGuaranteePolicyV1 {
|
|
26
|
+
readonly schemaVersion: 1;
|
|
27
|
+
readonly policyId: string;
|
|
28
|
+
/** Upper bound on the sum of all metric error budgets. */
|
|
29
|
+
readonly familywiseErrorBudgetPpm: number;
|
|
30
|
+
readonly boundMethod: "hoeffding_azuma_two_sided";
|
|
31
|
+
readonly spendingSchedule: "inverse_quadratic_telescoping";
|
|
32
|
+
readonly minimumInferenceSamples: number;
|
|
33
|
+
readonly maximumRetainedEvidenceDigests: number;
|
|
34
|
+
readonly maximumCasAttempts: number;
|
|
35
|
+
readonly metrics: Readonly<Record<SemanticGuaranteeMetricV1, SemanticMetricGuaranteePolicyV1>>;
|
|
36
|
+
readonly assumptions: AnytimeSemanticAssumptionsV1;
|
|
37
|
+
readonly policyDigest: string;
|
|
38
|
+
}
|
|
39
|
+
export interface AnytimeSemanticAssumptionsInputV1 {
|
|
40
|
+
readonly assumptionEvidenceDigests: readonly string[];
|
|
41
|
+
}
|
|
42
|
+
export interface AnytimeSemanticGuaranteePolicyInputV1 {
|
|
43
|
+
readonly policyId: string;
|
|
44
|
+
readonly familywiseErrorBudgetPpm: number;
|
|
45
|
+
readonly minimumInferenceSamples: number;
|
|
46
|
+
readonly maximumRetainedEvidenceDigests?: number;
|
|
47
|
+
readonly maximumCasAttempts?: number;
|
|
48
|
+
readonly metrics: Readonly<Record<SemanticGuaranteeMetricV1, SemanticMetricGuaranteePolicyV1>>;
|
|
49
|
+
readonly assumptions: AnytimeSemanticAssumptionsInputV1;
|
|
50
|
+
}
|
|
51
|
+
export interface SemanticMetricAccumulatorV1 {
|
|
52
|
+
readonly reportedCount: number;
|
|
53
|
+
readonly missingCount: number;
|
|
54
|
+
/** Count after the declared missingness transformation. */
|
|
55
|
+
readonly inferenceCount: number;
|
|
56
|
+
readonly sumBasisPoints: number;
|
|
57
|
+
readonly latestWasMissing: boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface AnytimeSemanticGuaranteeStateV1 {
|
|
60
|
+
readonly format: typeof ANYTIME_SEMANTIC_GUARANTEE_STATE_FORMAT_V1;
|
|
61
|
+
readonly schemaVersion: 1;
|
|
62
|
+
readonly stateKey: string;
|
|
63
|
+
readonly policyDigest: string;
|
|
64
|
+
readonly assumptionsDigest: string;
|
|
65
|
+
readonly revision: number;
|
|
66
|
+
readonly sampleCount: number;
|
|
67
|
+
readonly sequenceHighWater: number;
|
|
68
|
+
readonly logicalTimeHighWaterMs: number;
|
|
69
|
+
readonly lastSampleDigest: string;
|
|
70
|
+
readonly metrics: Readonly<Record<SemanticGuaranteeMetricV1, SemanticMetricAccumulatorV1>>;
|
|
71
|
+
readonly recentEvidenceDigests: readonly string[];
|
|
72
|
+
readonly predecessorStateDigest: string | null;
|
|
73
|
+
readonly stateDigest: string;
|
|
74
|
+
}
|
|
75
|
+
export interface AnytimeSemanticGuaranteeStoreV1 {
|
|
76
|
+
load(stateKey: string): Promise<AnytimeSemanticGuaranteeStateV1 | null>;
|
|
77
|
+
/** Production implementations must atomically advance the rollback anchor. */
|
|
78
|
+
compareAndSet(input: {
|
|
79
|
+
readonly stateKey: string;
|
|
80
|
+
readonly expectedRevision: number | null;
|
|
81
|
+
readonly expectedStateDigest: string | null;
|
|
82
|
+
readonly next: AnytimeSemanticGuaranteeStateV1;
|
|
83
|
+
}): Promise<boolean>;
|
|
84
|
+
}
|
|
85
|
+
export interface AnytimeSemanticGuaranteeAnchorV1 {
|
|
86
|
+
readAnchor(stateKey: string): Promise<{
|
|
87
|
+
readonly revision: number;
|
|
88
|
+
readonly sequenceHighWater: number;
|
|
89
|
+
readonly logicalTimeHighWaterMs: number;
|
|
90
|
+
readonly stateDigest: string;
|
|
91
|
+
} | null>;
|
|
92
|
+
}
|
|
93
|
+
export interface AnytimeSemanticMetricBoundV1 {
|
|
94
|
+
readonly reportedCount: number;
|
|
95
|
+
readonly missingCount: number;
|
|
96
|
+
readonly inferenceCount: number;
|
|
97
|
+
/** Integer sufficient statistic used to verify every emitted bound. */
|
|
98
|
+
readonly sumBasisPoints: number;
|
|
99
|
+
readonly meanBasisPoints: number | null;
|
|
100
|
+
readonly lowerBasisPoints: number | null;
|
|
101
|
+
readonly upperBasisPoints: number | null;
|
|
102
|
+
readonly errorBudgetPpm: number;
|
|
103
|
+
/** Error allocated to the current inference count by the spending schedule. */
|
|
104
|
+
readonly currentLookErrorBudgetPpm: number | null;
|
|
105
|
+
readonly missingness: SemanticGuaranteeMissingnessV1;
|
|
106
|
+
readonly latestWasMissing: boolean;
|
|
107
|
+
}
|
|
108
|
+
export interface AnytimeSemanticGuaranteeV1 {
|
|
109
|
+
readonly schemaVersion: 1;
|
|
110
|
+
readonly stateKey: string;
|
|
111
|
+
readonly policyDigest: string;
|
|
112
|
+
readonly assumptionsDigest: string;
|
|
113
|
+
readonly stateDigest: string;
|
|
114
|
+
readonly throughSequence: number;
|
|
115
|
+
readonly throughLogicalTimeMs: number;
|
|
116
|
+
readonly familywiseErrorBudgetPpm: number;
|
|
117
|
+
readonly simultaneousConfidenceBasisPoints: number;
|
|
118
|
+
readonly minimumInferenceSamples: number;
|
|
119
|
+
readonly estimand: "average_conditional_mean";
|
|
120
|
+
readonly roleCoherence: AnytimeSemanticMetricBoundV1;
|
|
121
|
+
readonly missionAlignment: AnytimeSemanticMetricBoundV1;
|
|
122
|
+
readonly contextConflict: AnytimeSemanticMetricBoundV1;
|
|
123
|
+
readonly uncertainty: AnytimeSemanticMetricBoundV1;
|
|
124
|
+
readonly courseActionDiversity: AnytimeSemanticMetricBoundV1;
|
|
125
|
+
readonly courseActionNovelty: AnytimeSemanticMetricBoundV1;
|
|
126
|
+
readonly evidenceDigests: readonly string[];
|
|
127
|
+
}
|
|
128
|
+
export type SemanticHorizonDirectiveV1 = "continue" | "shorten_horizon" | "replan" | "safe_stop";
|
|
129
|
+
export interface SemanticHorizonThresholdV1 {
|
|
130
|
+
readonly thresholdBasisPoints: number;
|
|
131
|
+
readonly enabled: boolean;
|
|
132
|
+
}
|
|
133
|
+
export interface SemanticHorizonControlPolicyV1 {
|
|
134
|
+
readonly schemaVersion: 1;
|
|
135
|
+
readonly expectedGuaranteePolicyDigest: string;
|
|
136
|
+
readonly expectedAssumptionsDigest: string;
|
|
137
|
+
readonly nominalHorizonSteps: number;
|
|
138
|
+
readonly cautionHorizonSteps: number;
|
|
139
|
+
readonly replanHorizonSteps: number;
|
|
140
|
+
readonly thresholds: Readonly<Record<SemanticGuaranteeMetricV1, SemanticHorizonThresholdV1>>;
|
|
141
|
+
readonly controlPolicyDigest: string;
|
|
142
|
+
}
|
|
143
|
+
export type SemanticHorizonControlPolicyInputV1 = Omit<SemanticHorizonControlPolicyV1, "schemaVersion" | "controlPolicyDigest">;
|
|
144
|
+
export interface SemanticHorizonDecisionV1 {
|
|
145
|
+
readonly schemaVersion: 1;
|
|
146
|
+
readonly directive: SemanticHorizonDirectiveV1;
|
|
147
|
+
readonly recommendedHorizonSteps: number;
|
|
148
|
+
readonly replanRequired: boolean;
|
|
149
|
+
readonly reasonCodes: readonly string[];
|
|
150
|
+
readonly guaranteeStateDigest: string;
|
|
151
|
+
readonly policyDigest: string;
|
|
152
|
+
readonly assumptionsDigest: string;
|
|
153
|
+
readonly controlPolicyDigest: string;
|
|
154
|
+
}
|
|
155
|
+
export interface SemanticHorizonControlPortV1 {
|
|
156
|
+
decide(guarantee: AnytimeSemanticGuaranteeV1): SemanticHorizonDecisionV1;
|
|
157
|
+
}
|
|
158
|
+
type AnytimeSemanticGuaranteeAppendInputV1 = {
|
|
159
|
+
readonly stateKey: string;
|
|
160
|
+
readonly sample: SemanticMetricSampleV1;
|
|
161
|
+
};
|
|
162
|
+
export declare function createAnytimeSemanticAssumptionsV1(input: AnytimeSemanticAssumptionsInputV1): AnytimeSemanticAssumptionsV1;
|
|
163
|
+
export declare function createAnytimeSemanticGuaranteePolicyV1(input: AnytimeSemanticGuaranteePolicyInputV1): AnytimeSemanticGuaranteePolicyV1;
|
|
164
|
+
export declare class InMemoryAnytimeSemanticGuaranteeStoreV1 implements AnytimeSemanticGuaranteeStoreV1, AnytimeSemanticGuaranteeAnchorV1 {
|
|
165
|
+
#private;
|
|
166
|
+
load(stateKey: string): Promise<AnytimeSemanticGuaranteeStateV1 | null>;
|
|
167
|
+
readAnchor(stateKey: string): Promise<{
|
|
168
|
+
revision: number;
|
|
169
|
+
sequenceHighWater: number;
|
|
170
|
+
logicalTimeHighWaterMs: number;
|
|
171
|
+
stateDigest: string;
|
|
172
|
+
} | null>;
|
|
173
|
+
compareAndSet(input: {
|
|
174
|
+
readonly stateKey: string;
|
|
175
|
+
readonly expectedRevision: number | null;
|
|
176
|
+
readonly expectedStateDigest: string | null;
|
|
177
|
+
readonly next: AnytimeSemanticGuaranteeStateV1;
|
|
178
|
+
}): Promise<boolean>;
|
|
179
|
+
}
|
|
180
|
+
export interface AnytimeSemanticGuaranteeEngineOptionsV1 {
|
|
181
|
+
readonly policy: AnytimeSemanticGuaranteePolicyV1;
|
|
182
|
+
readonly store?: AnytimeSemanticGuaranteeStoreV1;
|
|
183
|
+
readonly monotonicAnchor?: AnytimeSemanticGuaranteeAnchorV1;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Portable confidence-sequence engine. It uses a fixed-time Hoeffding-Azuma
|
|
187
|
+
* bound at each inference count and an inverse-quadratic alpha-spending union
|
|
188
|
+
* bound, making all emitted intervals simultaneous across metrics and time.
|
|
189
|
+
*/
|
|
190
|
+
export declare class AnytimeSemanticGuaranteeEngineV1 {
|
|
191
|
+
#private;
|
|
192
|
+
readonly policy: AnytimeSemanticGuaranteePolicyV1;
|
|
193
|
+
readonly store: AnytimeSemanticGuaranteeStoreV1;
|
|
194
|
+
readonly anchor: AnytimeSemanticGuaranteeAnchorV1;
|
|
195
|
+
constructor(options: AnytimeSemanticGuaranteeEngineOptionsV1);
|
|
196
|
+
append(input: AnytimeSemanticGuaranteeAppendInputV1): Promise<AnytimeSemanticGuaranteeV1>;
|
|
197
|
+
current(stateKey: string): Promise<AnytimeSemanticGuaranteeV1>;
|
|
198
|
+
}
|
|
199
|
+
/** Nominal check for the concrete time-uniform guarantee engine. */
|
|
200
|
+
export declare function isAnytimeSemanticGuaranteeEngineV1(value: unknown): value is AnytimeSemanticGuaranteeEngineV1;
|
|
201
|
+
/** Appends through the construction-time engine closure. */
|
|
202
|
+
export declare function invokeAnytimeSemanticGuaranteeAppendV1(engine: AnytimeSemanticGuaranteeEngineV1, input: AnytimeSemanticGuaranteeAppendInputV1): Promise<AnytimeSemanticGuaranteeV1>;
|
|
203
|
+
/** Reads through the construction-time engine closure. */
|
|
204
|
+
export declare function invokeAnytimeSemanticGuaranteeCurrentV1(engine: AnytimeSemanticGuaranteeEngineV1, stateKey: string): Promise<AnytimeSemanticGuaranteeV1>;
|
|
205
|
+
/** Exhaustively validates a portable guarantee before it can authorize control. */
|
|
206
|
+
export declare function validateAnytimeSemanticGuaranteeV1(input: AnytimeSemanticGuaranteeV1): AnytimeSemanticGuaranteeV1;
|
|
207
|
+
/** Exhaustively validates a horizon decision and its exact guarantee binding. */
|
|
208
|
+
export declare function validateSemanticHorizonDecisionV1(input: SemanticHorizonDecisionV1, guarantee: AnytimeSemanticGuaranteeV1): SemanticHorizonDecisionV1;
|
|
209
|
+
export declare function createSemanticHorizonControlPolicyV1(input: SemanticHorizonControlPolicyInputV1): SemanticHorizonControlPolicyV1;
|
|
210
|
+
export declare function createSemanticHorizonControlV1(raw: SemanticHorizonControlPolicyV1): SemanticHorizonControlPortV1;
|
|
211
|
+
/** Nominal check for a library-created semantic horizon control. */
|
|
212
|
+
export declare function isSemanticHorizonControlV1(value: unknown): value is SemanticHorizonControlPortV1;
|
|
213
|
+
/** Decides through the immutable policy closure. */
|
|
214
|
+
export declare function invokeSemanticHorizonControlV1(control: SemanticHorizonControlPortV1, guarantee: AnytimeSemanticGuaranteeV1): SemanticHorizonDecisionV1;
|
|
215
|
+
export {};
|
|
216
|
+
//# sourceMappingURL=anytime-semantic-guarantees.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anytime-semantic-guarantees.d.ts","sourceRoot":"","sources":["../src/anytime-semantic-guarantees.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAG1E,eAAO,MAAM,0CAA0C,EACrD,iEAA0E,CAAC;AAE7E,eAAO,MAAM,6BAA6B,kIAO/B,CAAC;AAEZ,MAAM,MAAM,yBAAyB,GACnC,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,CAAC,CAAC;AACjD,MAAM,MAAM,4BAA4B,GACtC,kBAAkB,GAAG,iBAAiB,CAAC;AACzC,MAAM,MAAM,8BAA8B,GACxC,aAAa,GAAG,kBAAkB,GAAG,uBAAuB,CAAC;AAE/D,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC;IAC1B,4FAA4F;IAC5F,QAAQ,CAAC,QAAQ,EAAE,0BAA0B,CAAC;IAC9C,sGAAsG;IACtG,QAAQ,CAAC,eAAe,EAAE,gCAAgC,CAA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