The Conversations page calls aimsight-libredesk's conversations/pulling.py (formerly pompage.py, renamed with that repository's English translation); docs follow (pull.sh, pulling.py)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-25 11:45:39 +01:00
1 parent f0470295fa
commit cccdeae67e
5 files changed
+15 -15

No files matched your search

+2 -2
View File
@@ -2,10 +2,10 @@
aimsight-app: the control station of the AIMsight diagnostic (`README.md`): the web app, and the launching of processes whose code lives elsewhere. A camera follows targets on a structure; the detectors read the displacement series of the stations and flag the moments when the curves must not be trusted (rain, fog, spider web, turbulence…) or a real movement. The architecture of the repositories: `docs/architecture.drawio`.
- **The processes**: the Analysis tab launches `agents:analyst` (plugin `agents/`) on a range, with `instructions/analyst.md` and `DETECTORS: no` (labels and report in `labeling/auto/analyses/<STATION>_<start>_<end>/`, submitted to `labeling/auto/<STATION>.jsonl`); "Optimize the detectors" launches `/optimize` in `optimizer/` on the analysis (its request in `app/server/analysis.py`, its summary in `optimizer/sessions/<analysis>_<time>/summary.md`), which commits the detectors in `detectors/` and the reading tools in `tools/`; the Support tab launches `agents:support` on a range with a question and `instructions/support.md` (its answer in `labeling/auto/support/<STATION>_<start>_<end>/answer.md`; it may launch the analyst itself; nothing submitted); the Conversations page launches `libredesk/conversations/pomper.sh` (read-only on LibreDesk, its key in `~/aimsight-libredesk/.env`), each conversation in `labeling/auto/conversations/<reference>/` (`transcript.md`, `messages.json`, `attachments/`). The Points page launches nothing: the user sets each measurement of a range valid or not, mainly on the runs of the emulator (`<SERIAL>@<run>`), in `labeling/points/<STATION>_<start>_<end>.csv` (`app/server/validity.py`).
- **The processes**: the Analysis tab launches `agents:analyst` (plugin `agents/`) on a range, with `instructions/analyst.md` and `DETECTORS: no` (labels and report in `labeling/auto/analyses/<STATION>_<start>_<end>/`, submitted to `labeling/auto/<STATION>.jsonl`); "Optimize the detectors" launches `/optimize` in `optimizer/` on the analysis (its request in `app/server/analysis.py`, its summary in `optimizer/sessions/<analysis>_<time>/summary.md`), which commits the detectors in `detectors/` and the reading tools in `tools/`; the Support tab launches `agents:support` on a range with a question and `instructions/support.md` (its answer in `labeling/auto/support/<STATION>_<start>_<end>/answer.md`; it may launch the analyst itself; nothing submitted); the Conversations page launches `libredesk/conversations/pull.sh` (read-only on LibreDesk, its key in `~/aimsight-libredesk/.env`), each conversation in `labeling/auto/conversations/<reference>/` (`transcript.md`, `messages.json`, `attachments/`). The Points page launches nothing: the user sets each measurement of a range valid or not, mainly on the runs of the emulator (`<SERIAL>@<run>`), in `labeling/points/<STATION>_<start>_<end>.csv` (`app/server/validity.py`).
- **The links** (ignored by git, one copy of each repository on the workstation): `data/`, `labeling/`, `detectors/`, `tools/`, `agents/`, `optimizer/`, `models/` (the pilot of learned detectors), `libredesk/` (the LibreDesk conversations); each thing is committed in its own repository, never here. This repository carries no agent, no reading tool, no workflow.
- **The truth**: the labels of `labeling/auto/`; the labeling knowledge is in `labeling/`.
- **The contracts**: the app calls the methods of the other repositories and holds no domain logic: with the detectors, `detectors/CLAUDE.md` (`categories.window`, `bench/score.py`); with the labels, `labeling/CLAUDE.md` (`scripts/validate.py` `check`, `scripts/ids.py` `assign`, `scripts/client.py`, `scripts/points.py` for the point labels); with the data, `~/aimsight-data` (`extraction/pumping.py`; the weather is pumped into `data/<STATION>/weather/`; the runs of `data_diff/<SERIAL>/runs/<run>/` are stations `<SERIAL>@<run>` of the Data page, with the labels of `<SERIAL>`, not for the agents); with the agents, `agents/README.md` (the requests of the analyst and of the support); with Optimizer, `optimizer/README.md` (the request of `/optimize`); with LibreDesk, `libredesk/conversations/pompage.py` (`start`, `running`, `log`). A renaming over there requires the change here. One reader of the measurements, `tools/scripts/data.py`, for the Data page, the tools and the detectors (benchmark and Optimizer included): a reading fix there changes the benchmark.
- **The contracts**: the app calls the methods of the other repositories and holds no domain logic: with the detectors, `detectors/CLAUDE.md` (`categories.window`, `bench/score.py`); with the labels, `labeling/CLAUDE.md` (`scripts/validate.py` `check`, `scripts/ids.py` `assign`, `scripts/client.py`, `scripts/points.py` for the point labels); with the data, `~/aimsight-data` (`extraction/pumping.py`; the weather is pumped into `data/<STATION>/weather/`; the runs of `data_diff/<SERIAL>/runs/<run>/` are stations `<SERIAL>@<run>` of the Data page, with the labels of `<SERIAL>`, not for the agents); with the agents, `agents/README.md` (the requests of the analyst and of the support); with Optimizer, `optimizer/README.md` (the request of `/optimize`); with LibreDesk, `libredesk/conversations/pulling.py` (`start`, `running`, `log`). A renaming over there requires the change here. One reader of the measurements, `tools/scripts/data.py`, for the Data page, the tools and the detectors (benchmark and Optimizer included): a reading fix there changes the benchmark.
- **The benchmark**: `python3 detectors/bench/regression.py --labels labeling/auto --data data` (~1 min); the score of a range: `python3 detectors/bench/score.py data/<STATION> --labels labeling/auto/<STATION>.jsonl --from YYYY-MM-DD --to YYYY-MM-DD` (`--to` excluded).
- **The pumping**: in `~/aimsight-data` (`extraction/pump.sh`, VS Code tasks **pump**, **pump a range**), read-only on the platform; user guide `~/aimsight-data/extraction/README.md`. Claude may launch it on small ranges; a long range or a history, outside busy hours.
- **Check a change of the app**: `.venv/bin/python app/server/check.py`, then `cd app/web && npm run build` and launch the server. The labels: `python3 labeling/validate.py`.
+1 -1
View File
@@ -26,7 +26,7 @@ And eight links, ignored by git, to the neighbouring repositories (a single copy
| `tools/` | `~/aimsight-tools` | reads the data through `tools/scripts/data.py`; the analyst uses it, the upgrader writes in it (Optimizer) |
| `agents/` | `~/aimsight-agents` | the plugin of the agents (`--plugin-dir agents`, `--agent agents:analyst`) |
| `optimizer/` | `~/aimsight-optimizer` | launches `/optimize` there; reads the summaries in `optimizer/sessions/` |
| `libredesk/` | `~/aimsight-libredesk` | pumps the LibreDesk conversations (`conversations/pompage.py`, its key in its `.env`) into `labeling/auto/conversations/` |
| `libredesk/` | `~/aimsight-libredesk` | pumps the LibreDesk conversations (`conversations/pulling.py`, its key in its `.env`) into `labeling/auto/conversations/` |
| `models/` | `~/aimsight-models` | nothing yet: the pilot of learned detectors (Visibility, Obstruction), measured with the benchmark |
Each thing is committed in its own repository: the labels in `~/aimsight-labeling`, the detectors in `~/aimsight-detectors` (the optimization session does it, without pushing), the tools in `~/aimsight-tools` (the same session, through the upgrader).
+2 -2
View File
@@ -48,7 +48,7 @@ The page opens on `http://127.0.0.1:8770`. Settings by variables: `AIMSIGHT_DATA
## The Conversations page
The LibreDesk conversations (`helpdesk.sensima.ch`), every inbox and status, private notes included, pumped **read-only** by `~/aimsight-libredesk` (link `libredesk/`, `conversations/pomper.sh` through `conversations/pompage.py`; the app only calls it, the read key stays in that repository's `.env`) into `labeling/auto/conversations/<reference>/`: `conversation.json`, `messages.json`, `attachments/`, and `transcript.md`, the readable thread.
The LibreDesk conversations (`helpdesk.sensima.ch`), every inbox and status, private notes included, pumped **read-only** by `~/aimsight-libredesk` (link `libredesk/`, `conversations/pull.sh` through `conversations/pulling.py`; the app only calls it, the read key stays in that repository's `.env`) into `labeling/auto/conversations/<reference>/`: `conversation.json`, `messages.json`, `attachments/`, and `transcript.md`, the readable thread.
- **Pump**: without dates, what changed since the last complete pumping (`pumped.json`; the first time, the whole history, at a quiet hour); with dates, the conversations updated in that range (To excluded). One at a time; the end of `out/conversations.log` of that repository read every 2 s. The commit of `auto/conversations/` in `~/aimsight-labeling` is the user's.
- **The list**: the pumped conversations, the most recent message first, searched on subject, contact and reference; a click shows the transcript.
@@ -60,7 +60,7 @@ The LibreDesk conversations (`helpdesk.sensima.ch`), every inbox and status, pri
- `server/station.py`: the data of the Data page; read-only on `data/` (through `tools/scripts/data.py`), writes only in `labeling/{auto,manual}/`.
- `server/analysis.py`: the Analysis tab; launches `claude` with the agent `agents:analyst` (Read, Write, Bash allowed without asking); and the optimization, `/optimize` in Optimizer (Read, Write, Edit, Bash, Agent).
- `server/support.py`: the Support tab; launches `claude` with the agent `agents:support` (Read, Write, Edit, Bash, Glob, Grep allowed without asking), through `analysis.run`.
- `server/conversations.py`: the Conversations page; calls `libredesk/conversations/pompage.py`, lists `labeling/auto/conversations/`, renders a transcript safely.
- `server/conversations.py`: the Conversations page; calls `libredesk/conversations/pulling.py`, lists `labeling/auto/conversations/`, renders a transcript safely.
- `server/check.py`: checks, without calling claude: `.venv/bin/python app/server/check.py`.
- `web/`: React (Vite) and Mantine; `src/App.jsx` (header, sidebar, address), `src/pages/Data.jsx` (the page), `src/pages/Images.jsx` (the images, in Data), `src/common.jsx` (requests, selector), `src/main.jsx` (theme). Plotly, dressed in Mantine's colours, loads only with Data. `dist/` and `node_modules/` outside git.
+3 -3
View File
@@ -415,15 +415,15 @@ def check_conversations():
assert "img-src 'self'" in server.conversation_transcript("42").headers["content-security-policy"]
refuses(conversations.transcript, "../analyses", False)
refuses(server.conversation_file, "42", "../../etc/passwd")
if conversations.pompage: # ~/aimsight-libredesk may be on a branch without conversations/ yet
if conversations.pulling: # ~/aimsight-libredesk may be on a branch without conversations/ yet
assert "From and To" in refuses(conversations.pump, {"start": "2026-11-01"})
assert set(conversations.pump_state()) == {"running", "log"}
pompage, conversations.pompage = conversations.pompage, None # no libredesk/ link: the app still runs
pulling, conversations.pulling = conversations.pulling, None # no libredesk/ link: the app still runs
try:
assert "libredesk/" in refuses(conversations.pump, {})
assert conversations.pump_state()["running"] is False and "libredesk/" in conversations.pump_state()["log"][0]
finally:
conversations.pompage = pompage
conversations.pulling = pulling
finally:
conversations.FOLDER = before
shutil.rmtree(root)
+7 -7
View File
@@ -1,5 +1,5 @@
"""The Conversations page: the LibreDesk conversations, pumped read-only by ~/aimsight-libredesk (link libredesk/,
conversations/pompage.py, called as it is; its key stays in its .env) into labeling/auto/conversations/<reference>/
conversations/pulling.py, called as it is; its key stays in its .env) into labeling/auto/conversations/<reference>/
(conversation.json, messages.json, attachments/, transcript.md). The app lists them and shows a transcript safely: the text
escaped before Markdown (a client's <script> stays text), served with a strict CSP (no script, no remote image), the
attachments other than plain images as downloads.
@@ -15,25 +15,25 @@ FOLDER = station.LABELS / "auto" / "conversations"
LIBREDESK = station.ROOT / "libredesk"
sys.path.append(str(LIBREDESK / "conversations"))
try:
import pompage # noqa: E402
import pulling # noqa: E402
except ImportError: # the page is not core: without the link, the rest of the app runs
pompage = None
pulling = None
MISSING = "no libredesk/ link to ~/aimsight-libredesk with conversations/ (README)"
INLINE = {".png", ".jpg", ".jpeg", ".gif", ".webp"} # shown in the page; any other attachment is downloaded
def pump_state():
if not pompage:
if not pulling:
return {"running": False, "log": [MISSING]}
return {"running": pompage.running(), "log": pompage.log()}
return {"running": pulling.running(), "log": pulling.log()}
def pump(body):
if not pompage:
if not pulling:
raise station.Refusal(MISSING)
try:
pompage.start(body.get("start") or "", body.get("end") or "", str(FOLDER))
pulling.start(body.get("start") or "", body.get("end") or "", str(FOLDER))
except ValueError as e:
raise station.Refusal(str(e)) from e
return pump_state()