Interface: ScopedRuleBuilder
Defined in: builders/scoped-rule-builder.ts:13
Fluent builder for partition- or effect-scoped rules (P.scopedRule(idOrSource)).
Compiles inline or frontmatter-sourced scoped rules with .when() activation predicates, .directive() prompt blocks, and optional .enforceBeforeStop() check gates.
Extends
Methods
directive()
directive(directiveSource): ScopedRuleBuilder;Defined in: builders/scoped-rule-builder.ts:37
Sets the rule directive text or SourceASTNode<string> injected when when matches.
Normalizes inline strings and source builders into a passive SourceValue<string>.
Parameters
| Parameter | Type | Description |
|---|---|---|
directiveSource | MaybeSource<string> | Inline directive string or source node/builder. |
Returns
ScopedRuleBuilder
New immutable scoped rule builder.
enforceBeforeStop()
enforceBeforeStop<THandle>(...checks): ScopedRuleBuilder;Defined in: builders/scoped-rule-builder.ts:50
Attaches deterministic CheckASTNode gates enforced during beforeStop when this rule is active and scope mutations occur.
Appends checks in declaration order to the rule's enforceBeforeStopChecks list.
Type Parameters
| Type Parameter | Default type | Description |
|---|---|---|
THandle | unknown | Isolation scope handle type. |
Parameters
| Parameter | Type | Description |
|---|---|---|
...checks | readonly MaybeBuilder<BuiltInCheckASTNode<THandle>>[] | Deterministic check AST nodes or builders. |
Returns
ScopedRuleBuilder
New immutable scoped rule builder.
toAST()
toAST(): ScopedRuleNode;Defined in: ast/ast-builder.ts:20
Compiles the current builder configuration into a deeply frozen passive AST node.
Validates required builder invariants at compilation time and returns an immutable plain-object AST representation containing zero execution methods.
Returns
Deeply frozen passive AST node.
Inherited from
when()
when(predicate): ScopedRuleBuilder;Defined in: builders/scoped-rule-builder.ts:26
Configures the partition and/or reactive tool-effect predicate triggering rule injection.
Rules matching predicate.partitions are injected pre-flight at Turn 0; rules matching predicate.effects are injected post-call.
Parameters
| Parameter | Type | Description |
|---|---|---|
predicate | ScopePredicateInput | Partition list and optional effect matcher. |
Returns
ScopedRuleBuilder
New immutable scoped rule builder.
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
id | readonly | string | Unique identifier of the scoped rule. | builders/scoped-rule-builder.ts:15 |