| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | package policy |
| 4 | |
| 5 | // RunModePolicy defines runtime-mode behavior gates injected from composition root. |
| 6 | type RunModePolicy struct { |
| 7 | IsTerminal bool |
| 8 | AutoEnableDiscovered bool |
| 9 | UseFileStatusPersistence bool |
| 10 | EnableServiceDiscovery bool |
| 11 | EnableRuntimeCharts bool |
| 12 | } |
| 13 | |
| 14 | // Agent returns the shared defaults for long-lived agent processes. |
| 15 | func Agent(isTerminal bool) RunModePolicy { |
| 16 | return RunModePolicy{ |
| 17 | IsTerminal: isTerminal, |
| 18 | AutoEnableDiscovered: isTerminal, |
| 19 | UseFileStatusPersistence: !isTerminal, |
| 20 | EnableServiceDiscovery: !isTerminal, |
| 21 | EnableRuntimeCharts: !isTerminal, |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | // FunctionCLI returns the shared defaults for one-shot function execution. |
| 26 | func FunctionCLI() RunModePolicy { |
| 27 | return RunModePolicy{ |
| 28 | IsTerminal: false, |
| 29 | AutoEnableDiscovered: true, |
| 30 | UseFileStatusPersistence: true, |
| 31 | EnableServiceDiscovery: false, |
| 32 | EnableRuntimeCharts: false, |
| 33 | } |
| 34 | } |