Shared contracts & helpers
Core · Interfaces & runtime guarantees · Back to layer index
| Symbol | Kind | Purpose |
|---|---|---|
AgentErrorInfo | interface | Stable error metadata for App diagnostics. Unknown retryability is deliberately omitted. |
AsyncSink | type | Awaitable sink for an ordered stream. A rejection propagates to the emitter. |
BudgetError | class | A configured allowance (rounds, model calls, attempts) is exhausted. The optional message states which allowance ran out; code is the stable marker. |
CheckResult | interface | Verdict of one registered check. unavailable and not-run are not verdicts on the value: they state that the check could not produce an answer, so callers must not treat them as failures. |
commonPrefixLength | function | Length of the longest common prefix of two strings. Implemented as a binary search over slice comparisons so long prompts stay on the native string comparison path instead of running a JavaScript character loop. |
configureBreakWhile | function | Install the host-owned break observer. No logging or persistence is enabled by default; passing no argument (or an empty config) removes any previously installed observer. |
DurationMs | type | Elapsed time in milliseconds; never an absolute instant. |
ErrorContext | interface | Boundary metadata is recorded internally, without replacing the original thrown value. |
ExecutionContext | interface | Required execution facts available inside a running call. |
ExecutionOptions | interface | Optional controls accepted by any public Core call. |
getErrorInfo | function | Produce a frozen diagnostic view of any thrown value. Inspection is guarded: an exotic error (revoked proxy, throwing getter, null prototype) degrades to UNKNOWN_ERROR instead of raising a second failure while handling the first. |
Id | type | Opaque identifier. Format and meaning belong to the App or to the registering module. |
InvocationMetadata | interface | Identity and timing shared by every invocation receipt. |
InvocationResult | interface | A produced value together with the receipt of the invocation that produced it. |
InvocationStatus | type | Terminal state of one invocation; cancelled is distinct from a failure. |
Issue | interface | One validation problem, locatable by code and, when available, by field path. |
JsonSchema | type | JSON Schema as consumed by the App's validator; Core never interprets its contents. |
MaybePromise | type | A value that may already be resolved or still pending. |
ModelCallRecord | interface | Receipt of a model call that returned successfully. |
ModelResult | type | Model call result with its model-call receipt. |
Observer | type | Notification callback. A rejected promise propagates to the emitter. |
OperationContext | interface | Execution context plus the App-owned host object. app carries services, identity and per-request dependencies supplied by the host; Core treats it as opaque and must not depend on application-specific fields. |
ProtocolRegistry | class | Append-only protocol registry. Extending Map keeps lookup semantics familiar while set rejects every invalid registration, which makes the instance effectively immutable after wiring. |
ReadonlyCatalog | interface | Read-only projection of a definition set; the implementation owns ordering and validation. |
Registry | interface | Mutable catalog. Registrations append; seal freezes the set against later writes. |
retrievalQueryKey | function | Serialize a query into a stable structural key. Object keys are sorted recursively while array positions are preserved. Values that JSON cannot represent, such as functions or undefined, make JSON.stringify return undefined and therefore produce an error instead of a colliding key. |
SchemaAdapter | interface | Compiled schema pair: the JSON form shown to the model and the runtime parser. |
SearchHit | interface | One search result. score semantics stay algorithm-specific (direction and scale are not part of this contract), and document may be a projection that only exposes stored fields rather than the full record. |
TimestampMs | type | Wall-clock instant in milliseconds since the Unix epoch. |
ToolCallRecord | interface | Receipt of a tool call that returned successfully. |
ToolResult | type | Tool call result with its tool-call receipt. |
ValidationError | class | Rejected input or output that failed one or more registered checks. The message is fixed; consumers should read issues for the actual reasons. |
WorkflowContractError | class | The workflow definition violates Core's execution contract, as opposed to failing business logic. Examples: unknown model binding, asynchronous predicate, unmatched route, missing state field. It is a programming error, so callers should not treat it as retryable. |