export const keyboardSubmitInputDependencyDeclarations = [
    {
        dependencyId: "runtime.execEngine.computeruse.keyboardAction",
        kind: "runtime",
        required: true,
        description: "Runtime-owned keyboard action support exposed through BaseToolExecutorPort.computeruse.keyboardAction.",
    },
    {
        dependencyId: "runtime.governancePlane.toolInvocationGrant",
        kind: "permission",
        required: true,
        description: "dryRun:false requires an affirmative runtime guard before submit keyboard event dispatch.",
    },
    {
        dependencyId: "runtime.focusManager.keyboardTarget",
        kind: "runtime",
        required: true,
        description: "Runtime owns focus, active target resolution, platform input backend, event emission, and cleanup.",
    },
];
export function createRuntimeKeyboardSubmitInputProvider(executor) {
    const keyboardAction = executor?.computeruse?.keyboardAction;
    if (keyboardAction === undefined)
        return undefined;
    return async (request) => {
        const result = await keyboardAction({
            action: "submit",
            keys: [request.target.submitKey],
            metadata: {
                runtimeId: request.context.runtimeId,
                sessionId: request.context.sessionId,
                invocationId: request.context.invocationId,
                targetHint: request.target.targetHint,
                submitKey: request.target.submitKey,
                repeat: request.target.repeat,
                actionIndex: request.actionIndex,
                runtimeGuardAccepted: true,
                auditMetadata: request.context.auditMetadata,
            },
        });
        if (!result.ok) {
            throw new Error(`PUBLIC_SAFE_PROVIDER_FAILURE:${result.error.message}`);
        }
        return {
            actionId: result.output.actionId,
            metadata: {
                ...(result.output.metadata ?? {}),
                ...(result.metadata ?? {}),
            },
        };
    };
}
