From 0e6e671caaddbd857aae1c29ba574e352d16731c Mon Sep 17 00:00:00 2001 From: maxime Date: Wed, 18 Nov 2026 15:34:12 +0100 Subject: [PATCH] Conversations spec and plan: the key under LIBREDESK_API_KEY / LIBREDESK_API_SECRET Co-Authored-By: Claude Opus 5.5 --- docs/superpowers/plans/2026-11-18-conversations-tab.md | 6 +++--- .../specs/2026-11-18-conversations-tab-design.md | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/superpowers/plans/2026-11-18-conversations-tab.md b/docs/superpowers/plans/2026-11-18-conversations-tab.md index 2e5bd7a..1963415 100644 --- a/docs/superpowers/plans/2026-11-18-conversations-tab.md +++ b/docs/superpowers/plans/2026-11-18-conversations-tab.md @@ -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. - `Authorization: token :` 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. - `~/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 `. Nothing pushed. @@ -112,7 +112,7 @@ git commit -m "Conversations : le transcript lisible d'une conversation (texte s - 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). - `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 [--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 [--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): - 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": }`. 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) -- [ ] **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 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`. diff --git a/docs/superpowers/specs/2026-11-18-conversations-tab-design.md b/docs/superpowers/specs/2026-11-18-conversations-tab-design.md index 2c7bf5c..8966e41 100644 --- a/docs/superpowers/specs/2026-11-18-conversations-tab-design.md +++ b/docs/superpowers/specs/2026-11-18-conversations-tab-design.md @@ -15,7 +15,7 @@ The client requests arrive by mail in LibreDesk (`helpdesk.sensima.ch`, v2.9.0). ## Constraints - 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 :` 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 :` 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. - 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.