|
oc_connect
|
Classes | |
| class | WorkspaceNotFoundError |
Functions | |
| Path | _resolved (str|Path path) |
| Path | find_workspace_root (str|Path|None start=None) |
| Path | resolve_root (str|Path|None root=None) |
| Path|None | _from_env (str name, str|Path|None root) |
| Path | state_dir (str|Path|None root=None) |
| Path | credential_path (str|Path|None root=None) |
| Path | comms_root (str|Path|None root=None) |
Variables | |
| str | WORKSPACE_MARKER = ".option_c_workspace.json" |
| str | PROJECT_MARKER = ".option_c" |
| tuple | STATE_SUBPATH = (".option_c", "orchestration", "oc_connect") |
| tuple | CREDENTIAL_SUBPATH = (".option_c", "connector_secrets.json") |
| str | COMMS_ANCHOR = "oc_chat" |
| tuple | COMMS_SUBPATH = (".option_c", "comms") |
| str | STATE_DIR_ENV = "OC_CONNECT_STATE_DIR" |
| str | CREDENTIAL_ENV = "OC_CONNECT_SECRETS" |
Workspace-anchored path resolution for every piece of connector state. CONNECT-02 defect 1 (proposal V1 §7). Before this module the state directory was a module-level ``Path(os.environ.get(..., ".option_c/orchestration/oc_connect"))`` evaluated once at import time and interpreted against the *current working directory*. Two failures followed from the one expression: a send issued from any subdirectory looked for connector state in a directory that has none and died with ``Telegram destination 'operator' is not configured``, and the value could not be re-resolved after import even when the process changed directory. Resolution here is per call and anchored by marker walk, the way OCT's own project-root discovery works: 1. an absolute ``OC_CONNECT_STATE_DIR`` wins outright (an explicit operator override needs no discovery); 2. otherwise walk upward from *start* for ``.option_c_workspace.json`` — the workspace marker wins even when a nearer subproject carries its own ``.option_c/``, because connector authority is workspace-wide, not per-subproject; 3. failing that, the nearest ancestor holding an ``.option_c/`` directory; 4. failing that, raise. Guessing a root would put operator grants somewhere the operator cannot find them. A *relative* ``OC_CONNECT_STATE_DIR`` resolves against the workspace root, not the cwd — reinstating cwd-relative behaviour through the override would reintroduce exactly the defect this module removes. Dependencies ------------ - oc_diagnostics (_dbg structured logger)
|
protected |
Definition at line 104 of file workspace.py.
|
protected |
| Path oc_connect.workspace.comms_root | ( | str | Path | None | root = None | ) |
Return the comms bus root for this workspace.
Definition at line 130 of file workspace.py.
| Path oc_connect.workspace.credential_path | ( | str | Path | None | root = None | ) |
Return the credential sidecar path, anchored the same way as state.
Definition at line 122 of file workspace.py.
| Path oc_connect.workspace.find_workspace_root | ( | str | Path | None | start = None | ) |
Return the workspace root above *start*, failing loudly when absent.
Definition at line 67 of file workspace.py.
| Path oc_connect.workspace.resolve_root | ( | str | Path | None | root = None | ) |
Return an explicit root when given, otherwise discover one.
Definition at line 97 of file workspace.py.
| Path oc_connect.workspace.state_dir | ( | str | Path | None | root = None | ) |
Return the connector state directory for grants and destinations.
Definition at line 114 of file workspace.py.
| str oc_connect.workspace.COMMS_ANCHOR = "oc_chat" |
Definition at line 48 of file workspace.py.
| tuple oc_connect.workspace.COMMS_SUBPATH = (".option_c", "comms") |
Definition at line 49 of file workspace.py.
| str oc_connect.workspace.CREDENTIAL_ENV = "OC_CONNECT_SECRETS" |
Definition at line 52 of file workspace.py.
| tuple oc_connect.workspace.CREDENTIAL_SUBPATH = (".option_c", "connector_secrets.json") |
Definition at line 42 of file workspace.py.
| str oc_connect.workspace.PROJECT_MARKER = ".option_c" |
Definition at line 40 of file workspace.py.
| str oc_connect.workspace.STATE_DIR_ENV = "OC_CONNECT_STATE_DIR" |
Definition at line 51 of file workspace.py.
| tuple oc_connect.workspace.STATE_SUBPATH = (".option_c", "orchestration", "oc_connect") |
Definition at line 41 of file workspace.py.
| str oc_connect.workspace.WORKSPACE_MARKER = ".option_c_workspace.json" |
Definition at line 39 of file workspace.py.