* Get the sandbox proxy config for routing HTTP hook requests through the * sandbox network proxy when sandboxing is enabled. * * Uses dynamic import to avoid a static import cycle * (sandbox-adapter -> settings -> ... -> hooks -> execHttpHook).
()
| 19 | * (sandbox-adapter -> settings -> ... -> hooks -> execHttpHook). |
| 20 | */ |
| 21 | async function getSandboxProxyConfig(): Promise< |
| 22 | { host: string; port: number; protocol: string } | undefined |
| 23 | > { |
| 24 | const { SandboxManager } = await import('../sandbox/sandbox-adapter.js') |
| 25 | |
| 26 | if (!SandboxManager.isSandboxingEnabled()) { |
| 27 | return undefined |
| 28 | } |
| 29 | |
| 30 | // Wait for the sandbox network proxy to finish initializing. In REPL mode, |
| 31 | // SandboxManager.initialize() is fire-and-forget so the proxy may not be |
| 32 | // ready yet when the first hook fires. |
| 33 | await SandboxManager.waitForNetworkInitialization() |
| 34 | |
| 35 | const proxyPort = SandboxManager.getProxyPort() |
| 36 | if (!proxyPort) { |
| 37 | return undefined |
| 38 | } |
| 39 | |
| 40 | return { host: '127.0.0.1', port: proxyPort, protocol: 'http' } |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Read HTTP hook allowlist restrictions from merged settings (all sources). |
no test coverage detected