Conversations spec and plan: the key under LIBREDESK_API_KEY / LIBREDESK_API_SECRET

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-18 15:34:12 +01:00
1 parent f58db178c7
commit 0e6e671caa
2 files changed
+4 -4

No files matched your search

@@ -14,7 +14,7 @@
- LibreDesk: only `GET`, only `/api/v1/conversations/all`, `/api/v1/conversations/{uuid}/messages`, and the `attachments[].url` the messages carry; never a URL found in a message's text. - LibreDesk: only `GET`, only `/api/v1/conversations/all`, `/api/v1/conversations/{uuid}/messages`, and the `attachments[].url` the messages carry; never a URL found in a message's text.
- `Authorization: token <key>:<secret>` only to the LibreDesk host (`add_unredirected_header`, host compared as in `snippets/envoyer.py`); attachments on another host (S3) downloaded without it. - `Authorization: token <key>:<secret>` only to the LibreDesk host (`add_unredirected_header`, host compared as in `snippets/envoyer.py`); attachments on another host (S3) downloaded without it.
- Key: `LIBREDESK_LECTURE_KEY`, `LIBREDESK_LECTURE_SECRET` in `~/aimsight-libredesk/.env`; URL `LIBREDESK_URL`, default `https://helpdesk.sensima.ch`. Claude never reads a `.env`. - Key: `LIBREDESK_API_KEY`, `LIBREDESK_API_SECRET` in `~/aimsight-libredesk/.env`; URL `LIBREDESK_URL`, default `https://helpdesk.sensima.ch`. Claude never reads a `.env`.
- Every conversation: all inboxes, all statuses, private notes included, no filter. - Every conversation: all inboxes, all statuses, private notes included, no filter.
- `~/aimsight-libredesk`: standard library only, code/comments/commits in French. The app: English. - `~/aimsight-libredesk`: standard library only, code/comments/commits in French. The app: English.
- Every time in UTC. Commits by path, never `git add -A`; each message ends with a blank line then `Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>`. Nothing pushed. - Every time in UTC. Commits by path, never `git add -A`; each message ends with a blank line then `Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>`. Nothing pushed.
@@ -112,7 +112,7 @@ git commit -m "Conversations : le transcript lisible d'une conversation (texte s
- Produces: - Produces:
- `class Lecteur(url: str, cle: str, secret: str)`: `conversations() -> Iterator[dict]` (pages of `/api/v1/conversations/all?page=N&page_size=100&order_by=updated_at&order=desc` until `page >= total_pages`), `messages(uuid: str) -> list[dict]` (every page of `/api/v1/conversations/{uuid}/messages?page=N&page_size=100`, then sorted by `created_at`), `telecharger(url: str, chemin: Path) -> None` (relative URL joined to `self.url`; header only if same scheme+host as `self.url`). HTTP errors raise (no `sys.exit` inside: the caller decides). - `class Lecteur(url: str, cle: str, secret: str)`: `conversations() -> Iterator[dict]` (pages of `/api/v1/conversations/all?page=N&page_size=100&order_by=updated_at&order=desc` until `page >= total_pages`), `messages(uuid: str) -> list[dict]` (every page of `/api/v1/conversations/{uuid}/messages?page=N&page_size=100`, then sorted by `created_at`), `telecharger(url: str, chemin: Path) -> None` (relative URL joined to `self.url`; header only if same scheme+host as `self.url`). HTTP errors raise (no `sys.exit` inside: the caller decides).
- `pomper(lecteur: Lecteur, sortie: Path, depuis: str | None = None, jusqu_a: str | None = None, journal=print) -> int` (number of conversations written). - `pomper(lecteur: Lecteur, sortie: Path, depuis: str | None = None, jusqu_a: str | None = None, journal=print) -> int` (number of conversations written).
- CLI: `python3 -m conversations.pomper --sortie <folder> [--depuis YYYY-MM-DD --jusqu-a YYYY-MM-DD]`, env `LIBREDESK_URL`, `LIBREDESK_LECTURE_KEY`, `LIBREDESK_LECTURE_SECRET`; exit 1 with a one-line message on a missing key or an HTTP error. - CLI: `python3 -m conversations.pomper --sortie <folder> [--depuis YYYY-MM-DD --jusqu-a YYYY-MM-DD]`, env `LIBREDESK_URL`, `LIBREDESK_API_KEY`, `LIBREDESK_API_SECRET`; exit 1 with a one-line message on a missing key or an HTTP error.
Rules of `pomper` (from the spec): Rules of `pomper` (from the spec):
- No range: mark = `sortie/pumped.json` `{"until": ISO}`; walk `conversations()`, stop at the first with `updated_at < until - 1 h`; at the end only, write `{"until": <UTC time at the start of the run>}`. No file: walk everything. - No range: mark = `sortie/pumped.json` `{"until": ISO}`; walk `conversations()`, stop at the first with `updated_at < until - 1 h`; at the end only, write `{"until": <UTC time at the start of the run>}`. No file: walk everything.
@@ -251,7 +251,7 @@ git commit -m "Conversations page: pump, search, read the transcript; docs and t
### Task 6: The first real pumping (gated on the user) ### Task 6: The first real pumping (gated on the user)
- [ ] **Step 1:** The user creates in LibreDesk the agent « Lecture conversations », a role with only `conversations:read_all` and `messages:read`, its API key, and adds `export LIBREDESK_LECTURE_KEY=…` / `export LIBREDESK_LECTURE_SECRET=…` to `~/aimsight-libredesk/.env`. Wait for their word. - [ ] **Step 1:** The user creates in LibreDesk the agent « Lecture conversations », a role with only `conversations:read_all` and `messages:read`, its API key, and adds `export LIBREDESK_API_KEY=…` / `export LIBREDESK_API_SECRET=…` to `~/aimsight-libredesk/.env`. Wait for their word.
- [ ] **Step 2:** From the page, a range of the last 3 days. Check the log ends with `=== … fin` and no error; open two transcripts. - [ ] **Step 2:** From the page, a range of the last 3 days. Check the log ends with `=== … fin` and no error; open two transcripts.
- [ ] **Step 3:** On one `messages.json`, confirm the attachment fields (`name`, `content_type`, `size`, `url`, `uuid`) and whether `updated_at` moved with the last message; if a field differs, fix `pomper.py` and the fake data of `test_pomper.py`, rerun the tests, commit in aimsight-libredesk. - [ ] **Step 3:** On one `messages.json`, confirm the attachment fields (`name`, `content_type`, `size`, `url`, `uuid`) and whether `updated_at` moved with the last message; if a field differs, fix `pomper.py` and the fake data of `test_pomper.py`, rerun the tests, commit in aimsight-libredesk.
- [ ] **Step 4:** Hand over to the user: the folders to look at, and that the whole history (Pump without dates) is for a quiet hour, then their commit of `auto/conversations/` in `~/aimsight-labeling`. - [ ] **Step 4:** Hand over to the user: the folders to look at, and that the whole history (Pump without dates) is for a quiet hour, then their commit of `auto/conversations/` in `~/aimsight-labeling`.
@@ -15,7 +15,7 @@ The client requests arrive by mail in LibreDesk (`helpdesk.sensima.ch`, v2.9.0).
## Constraints ## Constraints
- Read-only on LibreDesk, enforced by a guard test in `~/aimsight-libredesk`, like `tests/test_garde_fou_snippets.py` for the snippets. - Read-only on LibreDesk, enforced by a guard test in `~/aimsight-libredesk`, like `tests/test_garde_fou_snippets.py` for the snippets.
- The key: a dedicated LibreDesk agent "Lecture conversations" whose role has only `conversations:read_all` and `messages:read`, created by the user; its key and secret in `~/aimsight-libredesk/.env` (`LIBREDESK_LECTURE_KEY`, `LIBREDESK_LECTURE_SECRET`), never read by Claude. The `Authorization: token <key>:<secret>` header goes only to the LibreDesk host (`add_unredirected_header`, as in `snippets/envoyer.py`). - The key: a dedicated LibreDesk agent "Lecture conversations" whose role has only `conversations:read_all` and `messages:read`, created by the user; its key and secret in `~/aimsight-libredesk/.env` (`LIBREDESK_API_KEY`, `LIBREDESK_API_SECRET`), never read by Claude. The `Authorization: token <key>:<secret>` header goes only to the LibreDesk host (`add_unredirected_header`, as in `snippets/envoyer.py`).
- Standard library only in `~/aimsight-libredesk` (its rule); its code and docs in French (its language); the app in English. - Standard library only in `~/aimsight-libredesk` (its rule); its code and docs in French (its language); the app in English.
- The app holds no domain logic: it calls the pumping of `~/aimsight-libredesk` as it calls `extraction/pumping.py` of `~/aimsight-data`. - The app holds no domain logic: it calls the pumping of `~/aimsight-libredesk` as it calls `extraction/pumping.py` of `~/aimsight-data`.
- Every conversation, by the user's decision: all the inboxes, all the statuses, no filter. - Every conversation, by the user's decision: all the inboxes, all the statuses, no filter.