Skip to content
中文

Context & journals ​

Support · Recommended implementations & strategies · Back to layer index

SymbolKindPurpose
ContextAssemblyOptionsinterfaceAssembly options for placement-based projections.
ContextBuilderinterfaceCompiled builder. It holds no request state and may be shared across invocations.
ContextBuilderOptionsinterfaceShared builder options.
ContextCompressionCallinterfaceOne compression request.
ContextCompressorinterfaceRegistered compressor handler.
ContextFragmentConfiginterfaceSelf-describing fragment declaration: metadata plus a formatter.
contextHandlerCallsfunction
ContextHandlerReferenceinterfaceReference to a registered compressor or selector handler.
ContextHistoryGroupingtypeHow a message history is split into groups for trimming.
contextHistoryStrategiesconstant
ContextModelCallinterfaceSame runner and same fixed invocation result as public model calls.
ContextModelRequestinterfaceOne model call made on behalf of a selector or compressor.
ContextNodeResultinterfaceOutcome of one context node: the built input, its prepared model call and the change report.
ContextPolicytypeDeclared context policy for one stage.
contextPolicyCatalogconstant
ContextProcessingNodeDefinitiontypeDefinition accepted by createContextProcessingNode. It is a normal Core WorkflowNode except that the node body is declared here: plan builds the context, update decides the committed state, and policy/handlers/timeout are validated when the node is created.
ContextProcessingOptionsinterfaceRuntime inputs for one processing run.
ContextProcessingReportinterfaceFacts recorded for one processing run.
ContextProjectiontypeOne declared projection: a single fragment or a placement expanded into fragments.
ContextRecentHistoryinterfaceRecent history that compression must keep verbatim.
ContextReductiontypeOne declared reduction step.
contextReductionCatalogconstant
ContextReductionNodeDefinitiontypeDefinition of a reduction node: one registered step is applied per node run. stepId may be fixed or derived from state, which lets a graph route over several steps.
ContextSelectiontypeSelection is independent of ownership; omitted selection preserves ordered execution.
ContextSelectionCallinterfaceEverything a selector may inspect for one decision.
ContextSelectionCandidateinterfaceCandidate step considered by selection, with its measured cost.
contextSelectionCatalogconstant
ContextSelectionNodeDefinitiontypeDefinition of a selection node: like a processing node, but update receives chosen step IDs.
ContextSelectionResultinterfaceSelection stage result: the chosen step IDs plus the unchanged stage snapshot.
ContextSelectorinterfaceModel or local selector that chooses which reductions to apply.
ContextStageResultinterfaceResult of a selection or reduction stage, before the node's update commits chosen fields.
ContextStrategyinterfaceValidated inputs ready to pass to a context processing node.
ContextStrategyOptionstypeOne history declaration that generates a step, or an explicit step list with optional history fields (fragment, field, preset, targetChars, keepGroups, grouping).
ContextStrategySettingstypeShared reduce-policy settings applied to the whole strategy. Trigger and target fields follow the Core policy contract; omitted values fall back to the plan budget or to the trigger. Supplying steps disables generation and uses the explicit list.
ContextTokenMeasurementinterfaceInjected token measurement for token-triggered policies.
createContextCompressorfunctionBuild a compressor that asks a model to rewrite one fragment. The request pairs a system instruction with a user message carrying the fragment ID, its current value and the target character count. Only the model's parsed value is returned; the caller decides whether the result fits the reduction contract.
createContextProcessingNodefunctionCreate one node that runs the complete context policy and returns the built context. Use this when the graph does not need to route between selection and reduction phases.
createContextReductionNodefunctionCreate a node that applies exactly one registered reduction step. Partial plans keep the full budget until final assembly, so intermediate nodes do not shrink the allowance reserved for the reply.
createContextSelectionNodefunctionCreate an ordinary node that selects reduction steps without executing them. The node reports the registered step IDs so the graph can route to reduction nodes itself.
createContextSelectorfunctionBuild a selector that asks a model to pick reduction steps. Without a custom parser the model must answer with a JSON object containing a stepIds array; with a custom parser the application owns that contract but must still return step IDs.
createContextStrategyfunctionBuild a reduction policy from one or more history declarations. recent keeps a window of recent groups; continuity summarizes older groups while preserving the most recent originals. Neither preset claims semantic quality, only bounded input size.
defineContextAssemblyfunctionCompile ordered context projections into a builder. A projection is either a single fragment (with its own formatter) or a placement whose contribution handler expands to any number of fragments at request time.
defineContextFragmentsfunctionCompile self-describing fragment declarations into a builder. Each definition carries its own trust, lifetime and size metadata, so no separate metadata catalog is needed. The budget may be a constant or a function of the request input.
processContextfunctionRun a complete context policy in one call: snapshot, execute and finalize.
reservedContextCallsfunction
selectContextStepsfunctionChoose steps that fit the remaining call budget. Feasibility uses exact trim previews and declared call ceilings; the reply reserve and the selector's own allowance are subtracted before candidates are considered, so neither can be spent on reductions.
transformContextTextfunctionApply a text transform to a fragment value, including strings nested inside objects. Structured values are walked through a JSON round trip, which is what the budget measurement serializes later; values that JSON cannot represent are therefore not preserved.
validateContextPolicyfunctionValidate a complete context policy and every handler it can reference. Handler IDs must be unique and each handler must declare a non-negative integer call ceiling. Reduction targets and selection modes are checked by their own catalog entries.
validateContextSelectionfunctionValidate selector declarations and the selection mode they serve.

API reference, usage examples and developer guides.