Extract shared network policy types from the proxy crate (#63986)

## Why

The protocol and feature configuration crates depend on the network proxy
crate for data types. Give them a smaller dependency that contains the
shared definitions.

## What changed

Move environment network policies, domain and Unix socket permissions,
policy decisions and their sources, and credential provider definitions
into `codex-network-policy-types`. Use the new crate directly from
`codex-protocol` and `codex-features`.

Re-export the moved types from `codex-network-proxy` and keep environment
policy conversion and application, along with credential provider
validation, in the proxy crate.

GitOrigin-RevId: 8af684da746830bce45ac00135aed8052dba3824
This commit is contained in:
jif
2026-11-25 16:09:51 +00:00
committed by copyberry
parent 06f334aa4b
commit c6bbf8a413
28 changed files with 392 additions and 335 deletions
@@ -474,7 +474,7 @@ async fn late_network_denial_grace_observes_cancellation_after_exit() -> anyhow:
use crate::tools::network_approval::build_blocked_request_observer;
use codex_network_proxy::BlockedRequest;
use codex_network_proxy::BlockedRequestArgs;
use codex_network_proxy::EnvironmentNetworkPolicy;
use codex_network_proxy::environment_policy_from_config;
use codex_tools::ToolName;
let (session, mut turn) = crate::session::tests::make_session_and_context().await;
@@ -498,7 +498,7 @@ async fn late_network_denial_grace_observes_cancellation_after_exit() -> anyhow:
codex_protocol::models::PermissionProfileSnapshot::legacy(
codex_protocol::models::PermissionProfile::workspace_write(),
);
remote.config_mut().network_policy = Some(EnvironmentNetworkPolicy::from_config(
remote.config_mut().network_policy = Some(environment_policy_from_config(
&codex_network_proxy::NetworkProxyConfig {
enabled: true,
..Default::default()
@@ -4,6 +4,7 @@ use super::*;
use crate::session::tests::make_session_and_context;
use codex_network_proxy::NetworkMode;
use codex_network_proxy::NetworkProxyConfig;
use codex_network_proxy::environment_policy_from_config;
use codex_protocol::config_types::WindowsSandboxLevel;
use codex_protocol::models::PermissionProfileSnapshot;
use codex_protocol::permissions::FileSystemAccessMode;
@@ -148,7 +149,7 @@ async fn captured_network_changes_require_review() -> anyhow::Result<()> {
);
insta::assert_snapshot!("network_mode", permissions.approval_reason(expected)?);
environment.config_mut().network_policy = Some(EnvironmentNetworkPolicy::from_config(
environment.config_mut().network_policy = Some(environment_policy_from_config(
&proxy, /*managed_allowed_domains_only*/ false,
));
let current = TerminalPolicy::capture(