reservedContextCalls
SUPPORT · function · Runtime value
Import
ts
import { reservedContextCalls } from '@jangts/agent-core/support';js
import { reservedContextCalls } from '@jangts/agent-core/support';Other public entry points:@jangts/agent-core/support, @jangts/agent-core/support/context.
Definition
Call
ts
reservedContextCalls(selection: ContextSelection): number| Parameter | Type | Passing | Description |
|---|---|---|---|
selection | ContextSelection | Required | — |
Optional shapes of Parameter selection: choose one shape; required fields for each branch are listed separately.
Branch 1
| Field | Type | Required | Description |
|---|---|---|---|
mode | "sequence" | Required | See the type definition and usage context. |
Branch 2
| Field | Type | Required | Description |
|---|---|---|---|
mode | "fixed" | Required | See the type definition and usage context. |
kind | "trim" | "compress" | Required | See the type definition and usage context. |
Branch 3
| Field | Type | Required | Description |
|---|---|---|---|
mode | "auto" | Required | See the type definition and usage context. |
maxTrimLossRatio | number | undefined | Optional | See the type definition and usage context. |
reserveCalls | number | undefined | Optional | See the type definition and usage context. |
Branch 4
| Field | Type | Required | Description |
|---|---|---|---|
mode | "model" | Required | See the type definition and usage context. |
reserveCalls | number | undefined | Optional | See the type definition and usage context. |
handlerId | string | Required | Read-only. Registered handler id; an unknown id is rejected before execution. |
Returns: number.
Examples
- Selecting reduction steps: sequence, fixed, automatic, or model: One typed policy set expresses multiple scenarios while preserving exact parameters and App-defined selection.
Process in registered order
Beginner · Node.js
ts
import { Support } from '@jangts/agent-core';
Support.validateContextSelection({ mode: 'sequence' }, []);
console.log(Object.keys(Support.contextSelectionCatalog));js
import { Support } from '@jangts/agent-core';
Support.validateContextSelection({ mode: 'sequence' }, []);
console.log(Object.keys(Support.contextSelectionCatalog));Choose a policy per scenario with exact overrides
Configuration · Node.js
ts
import { Support } from '@jangts/agent-core';
const localOnly = { mode: 'fixed' as const, kind: 'trim' as const };
const preserveMore = { mode: 'auto' as const, maxTrimLossRatio: 0.1, reserveCalls: 2 };
Support.validateContextSelection(localOnly, []);
Support.validateContextSelection(preserveMore, []);
console.log(localOnly, preserveMore);js
import { Support } from '@jangts/agent-core';
const localOnly = { mode: 'fixed', kind: 'trim' };
const preserveMore = { mode: 'auto', maxTrimLossRatio: 0.1, reserveCalls: 2 };
Support.validateContextSelection(localOnly, []);
Support.validateContextSelection(preserveMore, []);
console.log(localOnly, preserveMore);