Shared contracts & helpers
Kit · Optional business libraries · Back to layer index
| Symbol | Kind | Purpose |
|---|---|---|
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. |