Fix adapters to follow the same template.

fix: restore adapter_build() contract, revert function renames

Both adapters now export adapter_build() and adapter_translate_*() as
the uniform public contract. scripts/build.sh sources one adapter and
calls adapter_build uniformly. Private helpers (_oc_*) and vocabulary
tables (cc_capability_to_tools, oc_capability_to_permission, etc.)
retain their prefixes. CC regression and OC unit tests all pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

fix(tests): restore test_oc_ prefix on adapter_build end-to-end test
This commit is contained in:
nunziati
2026-04-08 22:24:15 +00:00
parent 3f5d89bee3
commit e2767a7399
2 changed files with 12 additions and 13 deletions

View File

@@ -211,10 +211,9 @@ adapter_translate_agents() {
local caps; caps="$(parse_capabilities "$agent")"
# Build tools allowlist by expanding each capability.
# read → Read (only); Glob and Grep are appended at the end if read is present.
local tools="" has_read=0
# read → Read, Glob, Grep; other capabilities follow.
local tools=""
for cap in $caps; do
[[ "$cap" == "read" ]] && has_read=1
local expansion; expansion="$(cc_capability_to_tools "$cap")"
[[ -n "$expansion" ]] || continue
for tool in $expansion; do
@@ -224,11 +223,11 @@ adapter_translate_agents() {
tools="$tools, $tool"
fi
done
# If this was "read", immediately append Glob and Grep
if [[ "$cap" == "read" ]]; then
tools="$tools, Glob, Grep"
fi
done
# Append Glob and Grep after all other tools when read capability is present
if [[ $has_read -eq 1 ]]; then
tools="$tools, Glob, Grep"
fi
local out_file="$out_dir/$(basename "$agent")"
{