Create an async progress callback for streaming agent output.
()
| 165 | border_style="yellow", |
| 166 | )) |
| 167 | if not typer.confirm("Trust this workspace and load its OpenOPC configuration?", default=False): |
| 168 | console.print("[warning]Workspace was not trusted; configuration was not loaded.[/warning]") |
| 169 | raise typer.Exit(code=2) from exc |
| 170 | # Parsing is allowed only after the explicit decision. Trust is bound |
| 171 | # to both the post-migration source bytes and normalized authority. |
| 172 | config = OPCConfig.load(config_dir, trusted_source=True) |
| 173 | WorkspaceTrustStore().trust(exc.workspace, config_dir, config) |
| 174 | config.bind_workspace_trust(exc.workspace, config_dir) |
| 175 | config.require_workspace_trust(include_effective=True) |
| 176 | console.print(f"[success]Trusted workspace:[/success] {exc.workspace}") |
| 177 | return config |
| 178 | |
| 179 | |
| 180 | def _channel_runtime_pid_path() -> Path: |
| 181 | from opc.core.config import get_opc_home |
| 182 | |
| 183 | return get_opc_home() / "run" / "channels.pid" |
| 184 | |
| 185 | |
| 186 | def _read_channel_runtime_state() -> dict | None: |
| 187 | path = _channel_runtime_pid_path() |
| 188 | if not path.exists(): |
| 189 | return None |
| 190 | try: |
| 191 | return json.loads(path.read_text()) |
| 192 | except Exception: |
| 193 | return None |
no outgoing calls