// Copyright 2024-2026 Tymofii Pidlisnyi. Apache-2.0 license. See LICENSE.
/**
 * Google ADK Adapter — primitive mappings between ADK plugin contexts
 * and APS action descriptors.
 *
 * ADK pattern: before_action(context) → action → after_action(context, result)
 *
 * This module is a pure mapping layer. Stateful runtime (pending-intent
 * tracking, audit trail) lives in the gateway.
 */
import { scopeAuthorizes } from '../core/delegation.js';
/** Map an ADK tool context to an APS action descriptor. */
export function adkContextToAction(ctx) {
    return {
        type: `adk:tool:${ctx.tool_name}`,
        target: ctx.tool_name,
        scopeRequired: `tool:${ctx.tool_name}`,
        metadata: { agent: ctx.agent_name, session: ctx.session_id, ...ctx.tool_input },
    };
}
/** Derive the APS scope string an ADK tool call requires. */
export function adkToolToScope(toolName) {
    return `tool:${toolName}`;
}
/** Check whether a delegation authorizes a given ADK tool call. */
export function adkAuthorizes(delegationScopes, toolName) {
    return scopeAuthorizes(delegationScopes, adkToolToScope(toolName));
}
//# sourceMappingURL=adk.js.map