oc_chat
Loading...
Searching...
No Matches
__init__.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3# oc_chat/__init__.py
4
5"""
6OC Chat — interactive CLI client with a ReAct agentic loop.
7
8Purpose
9-------
10Top-level package marker. Features streaming chat with reasoning
11(chain-of-thought), tool use, session management, context
12compression, and agentic multi-step planning. Provider-agnostic
13since Phase C — the active backend is selected via the
14``OC_CHAT_PROVIDER`` env var (default ``deepseek``).
15
16Responsibilities
17----------------
18- Mark ``oc_chat/`` as a Python package.
19- Hold the engine subpackages: ``core`` (provider-agnostic engine),
20 ``tools`` (filesystem / shell / web / memory / planner / oct),
21 ``tests`` (unit + integration suites).
22- Provide ``main.py`` as the REPL entry point.
23
24Diagnostics
25-----------
26Domain: OC_CHAT.MAIN
27Levels:
28 L2 — lifecycle events
29 L3 — semantic details
30 L4 — deep tracing
31
32Contracts
33---------
34- Module-level L4 ``_dbg`` is a diagnostics-coverage marker; it
35 emits nothing at default verbosity (domain default is L2).
36
37Dependencies
38------------
39- oc_diagnostics (structured debug logging via _dbg)
40- oc_chat._env_guard (load_dotenv_guarded - loads .env at package import, refusing the security-authority vars)
41"""
42
43from oc_diagnostics import _dbg
44
45# Load .env at package import so module-level env-var reads (e.g.
46# persistence.DEFAULT_SESSIONS_DIR) see values from the repo-local
47# .env file regardless of which oc_chat.* module the entry point
48# imports first. Idempotent: a second call from oc_chat.core.config
49# is a no-op for already-set vars.
50# M8.0 (F33/F72): a workspace .env may NOT set security-authority vars
51# (OC_CHAT_PROFILE, provider *_BASE_URL, OC_CHAT_ALLOW_REMOTE_ENDPOINTS,
52# proxy/cert, package-index) -- those are operator-out-of-band only.
53from oc_chat._env_guard import load_dotenv_guarded
54load_dotenv_guarded()
55
56_dbg("OC_CHAT.MAIN", "module", "loaded", 4)