Class: PolicyEngine
Defined in: packages/core/src/state-sync/PolicyEngine.ts:42
Constructors
Constructor
ts
new PolicyEngine(policies, defaults?): PolicyEngine;Defined in: packages/core/src/state-sync/PolicyEngine.ts:72
Construct a PolicyEngine with eager validation.
Parameters
| Parameter | Type | Description |
|---|---|---|
policies | readonly SyncPolicy[] | Policy rules, evaluated in declaration order |
defaults? | { cacheControl?: CacheDirective; } | Fallback applied when no policy matches |
defaults.cacheControl? | CacheDirective | - |
Returns
PolicyEngine
Throws
If any policy or default is invalid
Methods
resolve()
ts
resolve(toolName): ResolvedPolicy | null;Defined in: packages/core/src/state-sync/PolicyEngine.ts:102
Resolve the applicable policy for a tool name.
First matching policy wins. Falls back to defaults if no match. Returns null if no policy matches and no defaults are configured.
Results are cached — repeated calls for the same tool name are O(1).
Parameters
| Parameter | Type |
|---|---|
toolName | string |
Returns
ResolvedPolicy | null