Skip to content
中文

Shared contracts & helpers ​

Core · Interfaces & runtime guarantees · Back to layer index

SymbolKindPurpose
AgentErrorInfointerfaceStable error metadata for App diagnostics. Unknown retryability is deliberately omitted.
AsyncSinktypeAwaitable sink for an ordered stream. A rejection propagates to the emitter.
BudgetErrorclassA configured allowance (rounds, model calls, attempts) is exhausted. The optional message states which allowance ran out; code is the stable marker.
CheckResultinterfaceVerdict 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.
commonPrefixLengthfunctionLength 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.
configureBreakWhilefunctionInstall 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.
DurationMstypeElapsed time in milliseconds; never an absolute instant.
ErrorContextinterfaceBoundary metadata is recorded internally, without replacing the original thrown value.
ExecutionContextinterfaceRequired execution facts available inside a running call.
ExecutionOptionsinterfaceOptional controls accepted by any public Core call.
getErrorInfofunctionProduce 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.
IdtypeOpaque identifier. Format and meaning belong to the App or to the registering module.
InvocationMetadatainterfaceIdentity and timing shared by every invocation receipt.
InvocationResultinterfaceA produced value together with the receipt of the invocation that produced it.
InvocationStatustypeTerminal state of one invocation; cancelled is distinct from a failure.
IssueinterfaceOne validation problem, locatable by code and, when available, by field path.
JsonSchematypeJSON Schema as consumed by the App's validator; Core never interprets its contents.
MaybePromisetypeA value that may already be resolved or still pending.
ModelCallRecordinterfaceReceipt of a model call that returned successfully.
ModelResulttypeModel call result with its model-call receipt.
ObservertypeNotification callback. A rejected promise propagates to the emitter.
OperationContextinterfaceExecution 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.
ProtocolRegistryclassAppend-only protocol registry. Extending Map keeps lookup semantics familiar while set rejects every invalid registration, which makes the instance effectively immutable after wiring.
ReadonlyCataloginterfaceRead-only projection of a definition set; the implementation owns ordering and validation.
RegistryinterfaceMutable catalog. Registrations append; seal freezes the set against later writes.
retrievalQueryKeyfunctionSerialize 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.
SchemaAdapterinterfaceCompiled schema pair: the JSON form shown to the model and the runtime parser.
SearchHitinterfaceOne 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.
TimestampMstypeWall-clock instant in milliseconds since the Unix epoch.
ToolCallRecordinterfaceReceipt of a tool call that returned successfully.
ToolResulttypeTool call result with its tool-call receipt.
ValidationErrorclassRejected input or output that failed one or more registered checks. The message is fixed; consumers should read issues for the actual reasons.
WorkflowContractErrorclassThe 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.

API reference, usage examples and developer guides.