Kit · 可选业务库
配置、清单与策略
| 符号 | 类别 | 用途 |
|---|---|---|
AgentCatalogPorts | interface | Ports the catalog reads from the App's registries. |
CatalogGoal | interface | Goal as the catalog sees it: an id plus its declared delegates. |
CatalogScope | interface | Scope as the catalog sees it: an id plus the tools it may use. |
CatalogTask | interface | The goal currently accepted for the request, used to narrow the catalog. |
CatalogTool | interface | Tool facts the catalog needs, independent of lifecycle details. |
defineAgentCatalog | function | Compile a catalog projection over the App's live registries. The actual registries determine availability and relationships. No parallel capability list exists: goalIds filters by tool support, modelCatalog narrows to the currently accepted task when restrictToTask is enabled, and scope tool ids are filtered to tools that exist. |
definePolicySet | function | Compile a policy set that reports every matching reason. Collect every matching reason; a configured mode cannot silently override a mandatory policy. assess returns the matched ids and deduplicated kinds rather than a single verdict, so callers keep the ordering information they need for messages and diagnostics. |
defineRecoveryChain | function | Compile an ordered recovery chain. A handler reports whether it handled the input; handled undefined values remain explicit. The first handler that reports handled ends the walk, so declaration order is the precedence, and { handled: false } is the only way to fall through. |
DescribedTool | interface | Model- or host-facing description of one tool. |
Policies | constant | |
PolicyAssessment | interface | Result of assessing every registered policy against one input. |
PolicyDefinition | interface | One declarative policy. |
RecoveryDefinition | interface | One recovery handler in an ordered chain. |
RecoveryResult | type | Outcome of one recovery handler, or of the whole chain. |
分支与版本管理
| 符号 | 类别 | 用途 |
|---|---|---|
AgentFamily | interface | Compiled family API. Every mutation returns the record after the write. |
defineAgentFamily | function | Compile a versioned family backed by an App-owned compare-and-swap store. Every mutation reads the record, verifies the caller's expected revision, then commits with a compare-and-swap, so concurrent writers fail with a revision conflict rather than overwriting each other. Reads are also treated as policy checks because the App binds its read rules into the store it supplies. |
Family | constant | |
FamilyDefinition | interface | App-owned hooks and limits for one family. |
FamilyOperation | type | One of the four family mutations. |
familyOperations | constant | |
FamilyRecord | interface | A whole family: its versions and which version is currently active. |
FamilyStore | interface | CAS must cover every writer and the active pointer in one real storage commit. |
FamilyVersion | interface | Immutable snapshot of App state at one point on a branch. |
过程观察与诊断
| 符号 | 类别 | 用途 |
|---|---|---|
AgentOutputEvent | type | One output event of a delivered reply. |
publishReplyEvents | function | Stream one reply as paced text chunks and bubble separators. Publish a validated reply without exposing its internal boundary to consumers. The pacing options are upper bounds, not exact timings: the pause and interval are clamped against maxDurationMs, so added delay never exceeds the budget while every chunk is still emitted. |
REPLY_BUBBLE_BOUNDARY | constant | |
ReplyBubbleInput | interface | Reply pieces accepted by the bubble helpers; non-string entries are ignored. |
replyBubbleTexts | function | Collect the non-empty-text parts of a reply. |
ReplyDeliveryOptions | interface | Host-controlled delivery of already validated text; not upstream model generation. |
serializeOutputEvents | function | Serialize the event protocol for callers using a text stream. preview events are dropped because they are not final text; bubbles become the boundary character again, so a consumer can re-split the stream. |
textOutputEvents | function | Wrap already-chunked text as text events. |
共同合同与辅助入口
| 符号 | 类别 | 用途 |
|---|---|---|
Aggregation | constant | |
Candidates | constant | |
CandidateSelectionDefinition | interface | Declares the alternative-proposal envelope. A value without the declared field is treated as a single implicit candidate. |
ContentProjection | interface | Projection output. |
ContentProjectionOptions | interface | Candidate strategy for content projection. |
createIntentRegistry | function | Create and seal a complete catalog; use the constructor for incremental installation. |
defineCandidateSelection | function | Compile an alternative-proposal envelope contract. Alternative proposals are bounded and shallow; accepting a task closes this capability. A value that is not an object, or that does not carry the candidate field, is treated as a single implicit candidate and returned as-is. Once the envelope is present it must contain only that field, and its array must hold between minCandidates (default 1) and maxCandidates distinct candidate objects that do not themselves repeat the field. |
defineContentProjection | function | Compile a JSON-preserving projector. Keep valid JSON while reducing prose before dropping records; budgets are caller policy. The candidate list is tried in order (outer counts, inner lengths), so callers control whether trimming text or dropping items is preferred, and the configured fallback is used only when no candidate fits. |
defineDelivery | function | Compile a delivery pipeline from its declared stages. Stages are registered once, in declaration order, and must have unique non-blank ids. A stage without a handle is a named hook only, so beforeStage can observe it. |
defineNormalization | function | Compile an ordered normalization pipeline. Steps run in declaration order. Each step may be skipped by its when predicate, receives the value produced by the previous step, and isComplete can stop the walk early, so the usual contract is "first completion wins" rather than "always run everything". |
defineQueryAggregation | function | Compile one ordered read plan over a list of inputs. Ordered synchronous queries with optional stable-key merging; each real read stays host-owned. Inputs run sequentially in the given order, so a host can rely on a deterministic visit sequence. Without key every item is kept; with key the last write wins per key but the position of the first occurrence is retained. |
defineTextSkillLoader | function | Compile a loader that validates registrations and reads their documents. The default contract is narrow by design: ids are lower-case words joined by hyphens (up to maxIdChars, default 64), each entry lives at <id>/SKILL.md, the kind is text-workflow, and the document starts with name/description front matter. |
defineTreeProjection | function | Compile a depth-limited tree transform. Traverse synchronously in property/array order; only undefined omits a result. Because a visitor returns a new value instead of mutating, an omitted branch disappears from arrays and objects the same way, and maxDepth bounds both cycles and cost. |
Delivery | constant | |
DeliveryOptions | interface | Pipeline construction options. |
DeliveryStage | interface | One pipeline stage, identified for reporting and optional observation. |
IntentDescription | type | Registered domain Tool with its delegates widened to the definition's delegate literals. |
IntentId | type | Union of the ids of a definition set, or string when it cannot be narrowed. |
IntentPolicy | interface | Registration rules for one intent registry. |
IntentRegistry | class | Goal semantics and allowed values are configuration; the registry owns their common lifecycle. Registration order is preserved by ids, definitions, values and entries; once seal() is called the set is final and further registration is rejected. |
IntentTool | interface | One domain Tool. |
IntentToolRegistration | type | Configuration form; object arguments and a Tool proposal are the registration defaults. |
mergeByKey | function | Merge duplicates without moving their first position; selection policy remains host-owned. The first occurrence of a key fixes the output position; select decides which item that position finally holds, so callers can prefer the newest or the most complete duplicate. |
ModelBinding | interface | App-defined I/O. Registered literal IDs determine input and output types. |
ModelCalls | class | Frozen catalog of model bindings plus a checked invocation entry point. Registration happens once in the constructor; the catalog is never mutated afterwards, so a caller cannot swap a provider in the middle of a run. |
ModelInvocationContext | interface | One take consumes one binding invocation attempt, independent of batch size or chat tokens. |
ModelInvocationRequest | interface | One model call: registered binding id, the input to hand over and its timeout. |
Normalization | constant | |
NormalizationOptions | interface | Pipeline options. |
NormalizationStep | interface | One ordered transformation. |
projectContinuousExcerpt | function | Project a continuous excerpt of a body by binary-searching the longest prefix that fits. Binary-search a continuous prefix and keep an existing surrogate pair intact. render receives the prefix length, not the text, so the caller decides how the excerpt is framed. |
Projection | constant | |
QueryAggregationOptions | interface | Query aggregation contract: several ordered reads collapsed into one item list. Place in the package: an optional App-side helper for merging results of the same query shape run against several inputs. The Kit owns ordering and optional stable-key merging; every real read, the merge policy and the meaning of an item stay with the App. Exports: QueryAggregationOptions. |
RegisteredIntent | type | Frozen registration view: list fields are frozen copies, helper methods are dropped. |
splitTextBlocks | function | Split long plain text on structural boundaries. Headings and horizontal rules start a new block, blank lines end the current one, and all other lines break only when the target size would be exceeded. A single line longer than the target becomes its own block so that paging can cut it into fragments later without splitting the line into unrelated sections. Concatenating every block reproduces the input exactly: no truncation, padding or dropped whitespace. The input must be plain text; binaries and rich documents are read elsewhere. |
TextBlock | interface | One structure-aware block of a long text. |
TextBlockOptions | interface | Splitting options. |
TextBlocks | constant | |
TextSkill | interface | Loaded skill: registration plus the parsed document text. |
TextSkillHeader | interface | Header every skill document must carry. |
TextSkillLoader | interface | Compiled loader. |
TextSkillLoaderDefinition | interface | Loader limits, parsing hooks and rejection wording. |
TextSkillReadPorts | interface | Host port that reads one skill document by path. |
TextSkillRegistration | interface | Catalog entry of one text skill, before its document is read. |
TextSkills | constant | |
TreeProjectionOptions | interface | Depth- and record-level traversal options for tree projection. |
uniqueBy | function | Stable deduplication preserves the original values; the host chooses equivalence. The first occurrence of each key wins and the input order is kept, so callers can rely on deduplication never reordering their list. |
知识、问答与呈现
| 符号 | 类别 | 用途 |
|---|---|---|
AnswerCheck | interface | Result of one local or review check over a generated answer. |
AnswerChecker | interface | One named check applied to a generated answer value. |
AnswerFlowDefinition | interface | Static handlers and limits; signal, diagnostics and App dependencies arrive at run. |
Answering | constant | |
AnswerIssue | interface | Validation problem produced while checking a generated answer. |
AnswerItem | interface | One unit an answer batch must produce. |
AnswerReader | interface | App-owned reader that gathers evidence for one task. |
AnswerResult | interface | Final outcome for one item. |
AnswerTaskDefinition | interface | Static binding of one answerable task. |
AnswerTaskPorts | interface | Registries a task catalog validates its references against. |
CompiledReplyFormat | interface | A resolved format with its checks bound; callers only inspect replies using it. |
defineAnswerCheckCatalog | function | Compile a checker catalog. A checker may return a replacement value; it is threaded into the next checker, so the selected ids behave like an ordered chain rather than independent assertions. |
defineAnswerFlow | function | Compile a reusable answer workflow. Reusable answer workflow. Requests own cells and repair budgets; models remain caller-owned. The flow runs at most maxRepairs + 1 rounds: one generation pass, then one repair round per failing item set, and finally an explicit accepted/fallback/blocked result per item. |
defineAnswerReaderCatalog | function | Compile a reader catalog. |
defineAnswerTaskCatalog | function | Compile the answer task catalog from its declarations and shared ports. Task ids, schemas, readers, outputs and checks have one compiled authority: a task can only reference a reader or check that the ports actually registered, and metadata is cloned and frozen so later mutation by the caller cannot change a registered task. |
defineKnowledgeCatalog | function | Compile a knowledge catalog from document declarations. Reads are declarative: document returns the whole text, self returns exactly the named sections and subtree includes their nested sections. Section ids are validated up front, so a typo fails at read time instead of silently returning partial content. |
defineKnowledgePublication | function | Compile a publication lifecycle over one App-owned atomic record. Candidate preparation and publication share the same compiler and an App-owned atomic revision. propose compiles and validates a candidate but leaves published documents alone; publish re-verifies sources and the base revision before swapping, so a stale candidate can never overwrite newer content. |
defineOutputCatalog | function | Compile output definitions into one catalog. Compilation is where most mistakes surface: group membership is checked for cycles, master templates must have exactly one slot per field, and every bound/semantic field must name a registered provider. Composition then trusts the compiled catalog. |
defineReplyFormats | function | Compile reply formats so that checks run only for templates the current turn uses. |
defineSemanticSlots | function | Models select public semantic keys; hosts retain private values and selection policy. A text is valid when it uses at most maxOccurrences namespaced slots, every name is a declared key, and no malformed {{namespace remnant is left behind — the last check stops partial or misspelled placeholders from reaching the template engine. |
defineTextTemplate | function | The program owns the master; inserted model text is a value and is substituted once only. Substitution is single-pass String.replace: a value that itself contains {{slot}} is left as literal text, so a slot value cannot inject further substitutions. |
Knowledge | constant | |
KnowledgeCandidate | interface | A proposed document awaiting publish or reject. |
KnowledgeCatalog | interface | Compiled catalog of knowledge documents. |
KnowledgeCatalogOptions | interface | Catalog construction options. |
KnowledgeDocument | interface | One versioned document as supplied by the App. |
KnowledgePart | type | Document content: a text leaf or a nested section. |
KnowledgePublication | interface | Compiled publication workflow. |
knowledgePublicationOperations | constant | |
KnowledgePublicationOptions | interface | App-owned guards, store and limits for a publication workflow. |
KnowledgePublicationRecord | interface | Stored publication state: one published revision plus pending candidates. |
KnowledgePublicationStore | interface | Single-writer store for the publication record. |
KnowledgeRead | interface | A request for one document selection. |
KnowledgeSection | interface | A named section that may contain text and further sections. |
KnowledgeSnapshot | interface | Materialized read result. |
KnowledgeSourceReference | interface | Citation of the material a candidate was derived from. |
mergeReplyBubbles | function | Normalize a reply that has no declared format: drop blank bubbles and merge overflow into the last allowed one. Text content is preserved. |
OutputCatalogOptions | interface | Catalog construction options. |
OutputComposeInput | interface | Input for composing one output: model values plus program-assigned group members. |
OutputDefinition | interface | One output shape. |
OutputField | interface | One field of an output definition. |
OutputIssue | interface | Output problem with a guaranteed field path. |
OutputProvider | interface | App-owned value provider for bound and semantic fields. |
OutputResult | interface | Composed output value. |
parseKnowledgeDocument | function | Paired, nestable anchors are one text adapter. Other sources supply the same document contract directly. |
Presentation | constant | |
ReplyFormatCheck | interface | One check a template declares, evaluated against the rendered bubbles. |
replyFormatChecks | constant | |
ReplyFormatDefinition | interface | A template-bound reply format, matched against per-turn facts. |
ReplyFormatOptions | interface | Declaration input for defineReplyFormats. |
resolvePreference | function | Resolve the preferred candidate. Highest priority wins; order breaks ties with the later entry first, so recency can be encoded without touching priority. The input array is copied before sorting. |
SectionSelection | type | Which part of a document a read returns. |
selectVariant | function | Pick one variant, avoiding an immediate repeat when alternatives exist. When every candidate equals previous, the full list is used again, so a single-value set still yields a result instead of failing. |
SemanticSlotDefinition | interface | Declares the {{namespace:key}} slots a model may use, and how often. |
TextTemplateOptions | interface | Text template construction options. |
validateAnswerBatch | function | Validate that one batch is well formed and fully covered. |
产物与恢复
| 符号 | 类别 | 用途 |
|---|---|---|
ArtifactReference | interface | References locate artifacts; only the App resolver establishes access and current validity. |
ArtifactResolver | interface | App-registered resolver that turns a reference into an App value. |
Artifacts | constant | |
defineArtifactCatalog | function | Compile a catalog of artifact resolvers plus a checked resolve entry point. |
defineDurableTask | function | Compile a durable task definition into a resumable runner. Each run call locks the task id in the store, loads the checkpoint and resumes at nextStepIndex. A checkpoint from another definition id or revision, or one that fails the predicates below, is rejected instead of being repaired, because silently accepting it would replay App side effects under a different contract. |
Durable | constant | |
DurableCheckpoint | interface | Persisted task progress; the only state a resume reads back. |
durableReplayPolicies | constant | |
durableStatuses | constant | |
DurableStep | interface | One step of a durable task. |
DurableStepContext | interface | Execution facts handed to a durable step. |
DurableStore | interface | App implements an exclusive lock across every writer and validates/serializes stored state. |
DurableTask | interface | Compiled task: resumes from the store and returns the final state. |
DurableTaskDefinition | interface | Task definition, including the App hooks that guard every resume. |
DurableTaskOptions | interface | Runtime options for a compiled durable task. |
模型与交互
| 符号 | 类别 | 用途 |
|---|---|---|
bindInteraction | function | Bind every registered transfer command to a local handler. Models cannot add handlers. |
Command | interface | Compiled command. |
CommandCatalog | class | Mode and cross-protocol field ownership checks are shared by all receiving hosts. The catalog seals itself as soon as construction finishes, so a run cannot register a new command later; set remains available only for the superclass installation pass. |
CommandCatalogOptions | interface | Envelope-level options for a command catalog. |
CommandDefinition | interface | Declarative command shape before compilation. |
commandSchema | function | Build a JSON schema for one command id. Prefer compiled schemas; retain the existing open-schema contract for dynamic host protocols. A protocol without fieldSchemas falls back to an open object that only pins the discriminator, which keeps legacy hosts working without weakening compiled ones. |
compileCommands | function | Compile a whole catalog with shared envelope fields. Applications declare only their own data and handlers. Defaults are merged in this order: unrelated default keys, then the command's own keys, with fields, checks and tags concatenated so shared envelope checks always run before per-command checks. |
defineCommand | function | Compile declarations once. Parsing is synchronous and never executes a registered tool. Two schemas are produced from one declaration: modelJsonSchema marks only fields the model must fill, while inputJsonSchema marks every required field. A discriminator, when present, is prepended as a required constant field. |
defineCommandCatalog | function | Compile definitions and wrap them in a sealed catalog. |
defineInteractionProtocol | function | Construct a protocol from one definition. |
INTERACTION_CATEGORIES | constant | |
InteractionCategory | type | Interaction purpose, never an authorization level or an assertion of execution success. |
InteractionDescriptor | interface | Catalog metadata for one command, independent of its field shape. |
InteractionHandlers | type | Handler map keyed by command id; each handler receives the parsed value and App context. |
InteractionProtocol | class | Web/AI payload family. HTTP/SSE framing and actual command execution remain separate ports. Every command registered here gets the envelope's discriminator forced to its own id, so a payload cannot claim one command while carrying another command's data. |
InteractionProtocolDefinition | type | Transfer envelope plus its registered command family; no change to HTTP or SSE framing. |
ProtocolCheck | interface | One declarative rejection rule. |
ProtocolField | interface | Field presence, schema and ownership are declared together; schemas describe model input. |
ProtocolPredicate | type | Predicate evaluated during validation; any truthy result counts as a failure. |
ProtocolReason | type | Lazy rejection wording: a fixed message, a pre-built error, or a factory bound to the value. |
ProtocolShape | interface | Custom protocols may derive dynamic keys without supplying a compiled schema. |
RegisteredProtocol | interface | Runtime extension contract; hosts retain their own version values and validation context. |
MockGPT · 模拟模型与调试
| 符号 | 类别 | 用途 |
|---|---|---|
CallRecord | interface | Detached snapshot of one accepted call, exposed through MockGPT.records. |
createMockHandler | function | Create a bare Node request listener backed by the mock. |
createMockServer | function | Create a self-contained mock HTTP server with explicit listen/close control. No UI or static assets are served: only the model routes answer, everything else is a 404. |
encodeModelResponse | function | Optional app-owned codec; validation and encoding consume the same snapshots. Thin public wrapper over encodeModel: re-validates identity arguments and re-snapshots both the request and the model output, so callers that build replies themselves get identical validation and cannot mutate the mock's state afterwards. |
Generated | type | What a rule may produce: plain data, or a descriptor that changes transport behaviour. |
GenerationContext | interface | Everything a rule or generator may read for one accepted call. The context is frozen; the only mutable side channel is report, and only while the call is still pending. |
GenerationInput | interface | Input of MockGPT.generate. Normalized exactly like an HTTP request body, so a rule matches identically through both entry points; only model and messages are required. |
GenerationOptions | interface | Per-call options of MockGPT.generate. |
Generator | type | A rule's output: either a fixed value (deep-copied and frozen when the instance is built) or a function evaluated per call. A function may be async and is awaited under cancellation. |
generatorNames | constant | |
generators | constant | |
HandlerOptions | interface | Options shared by the standalone server and the bare request handler. |
HttpFault | interface | A simulated HTTP-level failure returned instead of a model reply. |
isPublicAddress | function | Decide whether an address is an acceptable public destination. |
JsonValue | type | Any value accepted by the package's JSON snapshot rules: strings, finite numbers, booleans, null, arrays and plain objects. |
LoadedPage | interface | A fetched page body plus the metadata needed for decoding and diagnostics. |
Message | type | One entry of an OpenAI chat conversation. The runtime validates role against the OpenAI role set and validates the outer shape of content; every other field is retained verbatim so vendor extensions flow through. |
MockGPT | class | Configurable mock model instance. Create one per test or per mock server. |
MockGPTError | class | Error type carrying a stable machine-readable code plus optional HTTP status and details. The HTTP adapter maps status onto the response and serializes code/details into the OpenAI-style error body, so codes are part of the public contract. |
MockGPTOptions | interface | Construction options of a MockGPT instance. |
ModelOutput | interface | The model-authored part of a reply, before it becomes JSON or SSE frames. |
ModelRequest | interface | A normalized /chat/completions request, produced by snapshotRequest. Optional undefined fields have already been dropped and stream is already defaulted, so rules always observe the same shape regardless of whether the caller used generate or the injected fetch. |
OutputOptions | interface | Transport-level knobs of a generated response. All values are simulated: they affect framing and timing of the mock reply, not real model behaviour. |
ResponseDescription | class | Wrapper that distinguishes a transport instruction from ordinary generator data. kind: 'model' carries a ModelOutput, 'http' an HttpFault response, and 'reject' a message used to simulate a network failure. Instances are recognized by brand rather than by instanceof alone, so descriptors survive crossing the ESM/CJS boundary. |
responses | constant | |
routes | constant | |
Rule | interface | One ordered matching rule of a MockGPT instance. |
ServerOptions | interface | Options of createMockServer, adding shutdown behaviour. |
sources | constant | |
TextOptions | interface | Common options of the text generators. |
TextSource | type | Text supplied to a text generator. A function may be async; it receives the per-call context so a source can depend on the prompt or on the call index. |
ToolCall | interface | A tool call the mocked assistant emits instead of executing. |
Usage | interface | Token accounting reported by the OpenAI API; validated for internal consistency. |
WebOptions | interface | Configuration of sources.web. |
WebProfile | type | Name of an entry in webHeaderProfiles. |
意图与范围
| 符号 | 类别 | 用途 |
|---|---|---|
createScopeRegistry | function | Create and seal a complete catalog; use the constructor for incremental installation. |
RegisteredScope | type | Frozen registration view: every list is a frozen copy, evidence entries are projected. |
RegisteredScopeEvidence | type | Registered evidence entry: public data only, frozen by the registry. |
ScopeDefinition | interface | One declarable scope. Ids and aliases share one namespace and must be unique. |
ScopeDescription | type | Plain description with mutable arrays, for documentation and model-facing catalogs. |
ScopeRegistry | class | Generic scope relationships; categories, intent policy and extra fields belong to the host. A scope is addressable by its id or by any of its aliases; aliases resolve to the declaring scope, and a name may be claimed only once across both namespaces. |
ScopeRegistryPolicy | interface | Registration rules for one scope registry. |
检索与证据
| 符号 | 类别 | 用途 |
|---|---|---|
defineEvidenceChecklist | function | Compile a reusable completion checklist over actual observations. A requirement is satisfied when at least one observation satisfies the provider registered for its kind; isComplete requires every requirement to be satisfied, and missing returns those that are not. Hosts define evidence semantics. |
defineEvidenceProjection | function | Compile a projection that keeps only the sources a caller asked to see. No selection retains the complete evidence; a selection narrows registered source-bearing results. Observations whose tool has no provider pass through untouched, so the projection can only ever remove sources it knows how to name. |
defineRetrieval | function | Compile a retrieval runner from its declared ports and effects. Rejected queries stay in the caller's seen set, so a retry is reported as a duplicate instead of silently repeating the adapter call; only successful results increment the query count. |
Evidence | constant | |
EvidenceProjectionDefinition | interface | Projection configuration, keyed by the tool that produced an observation. |
EvidenceProjectionProvider | interface | Describes which sources an observation can cite, and how to narrow it to cited ones. |
EvidenceProvider | interface | Adjudicates one evidence kind against real observations. |
EvidenceRequirement | interface | Requirements describe evidence that must already exist, never a model's assertion of success. |
FusedRank | interface | One fused result with the per-source ranks that produced its score. |
RankedList | interface | One retriever's ordered result, optionally weighted. |
reciprocalRankFusion | function | Fuse ranked lists with one-based reciprocal rank fusion. Raw retriever scores are intentionally not mixed. Ties break on id, so the output is deterministic for a given input. |
Retrieval | constant | |
RetrievalDefinition | type | Retrieval ports specialized to an App operation context. |
RetrievalEffect | interface | One effect applied after a successful query, in declaration order. |
RetrievalPorts | interface | Host ports and policy for one retrieval kind. |
RetrievalReason | type | Lazy rejection wording: a fixed message, a pre-built error, or a factory bound to the query. |
RetrievalReceipt | interface | Facts of one accepted query. |
RetrievalResult | interface | Adapter output for one accepted query; the Kit renames each source before returning it. |
RetrievalRunner | interface | Compiled retrieval runner. |
RetrievalSource | interface | Request-local citation reference; the App may separately carry its content entity id. |
RetrievalState | interface | Request-owned state. Clearing current evidence must not replenish spent budgets or seen keys. |
TextSearch | class | Optional App-side full-text index. No storage, identity, model calls or Core dependencies. Only declared fields are indexed and only storedFields come back with a hit, so a document never leaks extra properties into search results. |
TextSearchHit | interface | One ranked match; terms are post-tokenization and only stored fields are returned. |
TextSearchOptions | interface | App supplies fields, tokenizer and its own schema/tokenizer revision. |
TextSearchQuery | interface | Search input: a hard result limit and an App-owned filter, both required on every query. |
TextSearchSnapshot | interface | Serialized index; the revision pair proves the snapshot matches the current configuration. |
VectorSearch | class | Exact cosine search for a bounded embedded corpus. Identity and metadata are App-owned. Vectors arrive as plain arrays and are stored normalized in Float32Array form, so query time only needs a dot product per candidate. |
VectorSearchHit | interface | One search hit; the document is a cloned snapshot, not the indexed instance. |
VectorSearchQuery | interface | Search options excluding the query vector, which search takes alongside them. |
VectorSearchSpace | interface | Embedding space identity and width; vectors from another space must never be mixed in. |
日志复盘与证据报告
| 符号 | 类别 | 用途 |
|---|---|---|
defineReflection | function | Compile a reflection task. Model-driven investigation through ordinary registered tools and the existing Core loop. The task always reports persisted: false: storing a report is the App's decision. Observed findings must cite evidence ids that were actually returned in this run, which is what keeps the report tied to real observations instead of model recall. |
defineReflectionLogSource | function | Build a reflection source over a log reader. Coverage is reported as best-effort: a page is only complete when the reader exhausted the run without capture gaps or omitted issues, and every gap or issue code is surfaced instead of being silently dropped. |
Reflection | constant | |
ReflectionDefinition | interface | Configuration for compiling a reflection task. |
ReflectionEvidence | interface | Explicit metadata projection, not an arbitrary original event/payload. |
ReflectionFinding | interface | One finding, always tied to the evidence it rests on. |
reflectionFindingKinds | constant | |
reflectionIdentityFields | constant | |
ReflectionLogReader | interface | Structural port: the App supplies its own FileLogReader, trusted scope and current authorization. |
ReflectionPage | interface | One page of evidence plus an honest statement of its coverage. |
ReflectionQuery | interface | One evidence query. |
ReflectionReport | interface | Request-local reflection result. |
ReflectionSource | interface | App-owned evidence source, including its own authorization. |
ReflectionTask | interface | Compiled reflection task. |
工具与能力
| 符号 | 类别 | 用途 |
|---|---|---|
LifecycleHooks | interface | Everything one tool declares for a request. Declaring id turns the tool into an invocation owner, so protocol and call become required in practice; the registry rejects a partial declaration. Every other hook is optional and returning nothing expresses "no opinion". |
LifecycleProtocol | interface | Output protocol carried by a tool lifecycle. |
Policy | interface | Registration policy shared by every tool in the registry. |
RegisteredToolDefinition | type | Registered snapshot with frozen goal ids and projected hooks. |
Tool | interface | A registered tool: model metadata plus one optional lifecycle block. |
ToolFinalizer | type | Converts an executed decision into the tool result; must be synchronous. |
ToolLifecycleRegistry | class | Registry of tools whose lifecycle, protocols and context contributions the App declares. Registration is only possible before seal(); afterwards the catalog is read-only, so a run cannot change which tools exist. Every hook is optional and is applied in registration order, which is why registerAll preserves iteration order. |
ToolModelField | interface | One model-context field contributed by a tool. |
ToolNormalizer | type | Converts untrusted input into a decision; must be synchronous. |
ToolProtocol | type | Protocol type of a tool's lifecycle invocation. |
ToolRegistration | type | Declaration form; the registry derives the ModelTool projection from existing handlers. |
ToolRuntimeTypes | interface | One schema binds lifecycle handler types without introducing platform fields into core. |
ToolsOptions | interface | Construction options for a tool registry. |