Name: [FIX] viin_ai_base: provider-native outgoing message adapter (#59)

State: Killed finished in 354m

PR State: merged

PR Author: David Tran

PR Author Email:

PR: #61

Committer: David Tran

Committer Email: davidtran.hp@gmail.com

Commit: dbd2cfb607a3cd875bac3bb94b76f61a0e1d8dab

Description:

                                            [FIX] viin_ai_base: provider-native outgoing message adapter (#59)

The agentic tool loop shipped turn-2 canonical history (assistant tool_calls,
tool role tool_results) to the wire verbatim - no outgoing adapter existed, only
an incoming normalizer. A real tool-using turn returned HTTP 400 on
anthropic_native/openai_compat and silently dropped the tool result on
google_native. The same payload builder dropped the system prompt on all 3
protocols, and the PII redactor skipped tool-turn free-text (tool_calls
arguments, tool_results result/error).

Add a data-driven, UI-editable viin.ai.message.adapter (protocol-keyed with an
optional vendor override, noupdate seed) that reshapes the canonical history into
each provider's native wire format via vetted code primitives - zero eval/template
on the BYOK egress path. A write-time coherence constraint rejects incoherent
(protocol, shape/strategy) admin edits. System-prompt placement is handled per
protocol (anthropic top-level system, google systemInstruction, openai
role=system) with the system kwarg as the single source of truth, which also
fixes viin_ai_search Path B on anthropic/google. PII redaction is extended to
tool-turn free-text and runs before the adapt step (redact-then-adapt).

Add honest tests that stub only the transport seam and assert the built outgoing
payload per protocol (the seam #59 slipped through), plus data-driven,
coherence-gate, and PII-redaction tests.

Claude-Session: https://claude.ai/code/session_0128GTfwboHEZqJZ5xgfkxoL
                                            

Branch: 17.0

Instance ID: 0

Age:

Up-time: