symfonic.agent.middleware.fabrication_wiring¶
fabrication_wiring ¶
Engine-side wiring for the fabrication verdict (v7.0 T11).
Keeps the hot-path integration outside engine.py (which sits under
the documented v7.1-T01 size waiver). Centralises the
fabrication_check_mode dispatch table so the engine can call one
function per turn.
v7.0.7: typed :class:~symfonic.core.contracts.callbacks.FabricationDetectedEvent
dispatch. The previous ExtensionEvent(type='fabrication_detected'|
'fabrication_blocked') payload is preserved as a DEPRECATED back-compat
path for one release -- it will be removed in v7.1. See
docs/releases/v7.0.7.md.
FabricationOutcome
dataclass
¶
FabricationOutcome(
findings: list[FabricationFinding],
replacement_draft: str | None = None,
forced_metacog_verdict: str | None = None,
emitted_event: bool = False,
)
Result of the fabrication-mode dispatch.
Attributes:
| Name | Type | Description |
|---|---|---|
findings |
list[FabricationFinding]
|
All flagged identifiers (empty when clean). |
replacement_draft |
str | None
|
Non-None when the caller should replace
|
forced_metacog_verdict |
str | None
|
When the caller runs the
MetacognitiveMiddleware, whether the fabrication finding
should force a |
emitted_event |
bool
|
True when an |
apply_fabrication_check
async
¶
apply_fabrication_check(
*,
config: FrameworkConfig,
response_text: str | None,
tool_calls_this_turn: list[dict[str, Any]] | None,
hydrated_context: str,
user_message: str,
identifier_keys: list[str] | None,
callbacks: Sequence[Any] | None,
intent_verdict: IntentVerdict | None = None,
run_id: str = "",
) -> FabricationOutcome
Run the fabrication detector per fabrication_check_mode.
Returns an outcome the caller can consult to decide whether to
replace the draft (refuse), force a metacog revise verdict,
or simply log telemetry (observe). Does nothing and returns a
zero-cost empty outcome when the mode is off.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
intent_verdict
|
IntentVerdict | None
|
v7.0.6 -- when supplied, enables the
language-agnostic |
None
|
run_id
|
str
|
v7.0.7 -- threaded into |
''
|
Source code in src/symfonic/agent/middleware/fabrication_wiring.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |