=== tlloancy Secrétaire ===
Contributors: tlloancy
Donate link: https://donorbox.org/wordpress-plugins
Tags: paperwork, documents, admin, ai, abilities
Requires at least: 6.4
Tested up to: 7.1
Stable tag: 1.1.0
Requires PHP: 7.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

A home desk for paperwork. The connector writes; you file. Past is the dated archive.

== Description ==

**tlloancy Secrétaire** is a desk inside wp-admin: the **WordPress AI connector** writes a paper, you **file** it, and **Past** keeps the pile — search, print, mail, import. That is the difference with a normal chat: the draft is not lost in a thread. No key is stored in this plugin. If no connector is ready, the paper **templates** still work.

Five drawers: **Papers** (any document you name: CV, cover letter, minutes, invoice, a letter), **Training**, **Taxes**, **Fines**, **Disputes**. No drawer names an office, a form, or a standard. Nothing is filed with an authority. You send the paper.

### The house
- **Drawers** hold folders. **Papers** is one tile: name the folder, write, file. The other drawers hold the papers that kind of file usually needs.
- **Rules**. Each drawer takes the texts you work from — the quality standard your organism follows, your tax office’s page on claims, the notice you received. The connector writes with their wording and names an office or a law only when your notes or your rule name it.
- **Folders** historize who / what / when. A Fines folder can open a linked Disputes folder.
- **Import** on Past is the backup: HTML, text, PDF, or a ZIP of papers you already have.

### Training
Quote, needs analysis, attendance sheet, certificate, quiz, dated **watch note**, accessibility mentions. File the quality standard you follow on the drawer; nothing is fetched from the public web.

### WordPress AI
Uses `wp_supports_ai()` / `wp_ai_client_prompt()`. Choose the connector under **Settings → Connectors**. Abilities: `secretaire/list-drawers`, `secretaire/list-folders`, `secretaire/draft-paper`.

Guides: `docs/USER-GUIDE.md` (EN) and `docs/MODE-DEMPLOI.md` (FR).

== External services ==

When a **WordPress AI connector** is active, prompts, folder notes, and any working papers you filed on a drawer are sent to **that** provider (the one you configured). This plugin does not pick a vendor. It does not request third-party websites.

== Installation ==

1. Upload the `tlloancy-secretaire` folder to `/wp-content/plugins/`.
2. Activate **tlloancy Secrétaire**.
3. Open the **tlloancy Secrétaire** menu. In **Papers**, name a paper and file it — or open Training, Taxes, Fines, Disputes.
4. Optional: **Settings → Connectors** — install the AI plugin if needed, add a connector, then use **Ask the connector** on a folder.

== Frequently Asked Questions ==

= How is this different from chatting with the AI connector? =
The connector writes. This desk **files** the draft in a dated folder. **Past** is the archive: search, print, mail, import. A chat does not keep that pile.

= What is Papers? =
One drawer for any paper you name (CV, letter, minutes…). **Import** files you already have. The other drawers are for files that usually need several papers.

= Where are the offices, forms, and standards of my country? =
In the rule you file on the drawer. A drawer never names one. File the standard, the office page, or the notice, and the connector uses its wording. That text stays current because you choose it.

= Who can use the desk? =
Users with the `manage_secretaire` capability. Administrators have it. Give it to another role with a role editor or `add_cap()`. Settings need `manage_options`.

= Do I need an AI connector? =
No. Every paper has a template. The connector fills it from your notes.

= Where do I put an API key? =
Not here. **Settings → Connectors**, on the WordPress AI plugin.

= Why did it call a connector I did not check? =
It must not. **Connector Approvals** is the list for this plugin. Only checked cards are used. Unchecked cards (a dead Compatible Endpoint, Ollama, OpenRouter…) are skipped.

= The connector replies with nothing, or takes a minute =
That is a **connector** setting, not tlloancy Secrétaire. Open **Settings → Connectors**, edit the OpenAI-compatible (or Ollama) card, and turn on **Disable thinking**. Context length lives there too. If the draft is still empty, file the **template**.

= Can the connector style the paper? =
Yes. The draft may include a `<style>` block for that document (letterhead, table, totals). Scripts, remote fonts, `@import`, and external stylesheets are stripped. Plugin CSS stays in files (`paper.css`) and is printed through WordPress. The brief is still facts; you may mention a look (invoice, letter) if you want.

= Is this legal or tax advice? =
No. Drafts to edit. Deadlines and official texts are yours to check.

= How do I write a quote? =
Open **Training**. Click **Quote**. You land on the folder. **New folder** is only for another session.

= Where was I? =
**Desk** shows the drawer vignettes. The last drawer stays marked. Folders remember the last paper. Opening a paper and going back to the desk stays on the same page.

= Can I import papers or a whole folder? =
Yes. **Past → Import**. HTML, text, PDF, or a **ZIP**. On the desk, a ZIP becomes a folder; loose files become a new folder. Inside a folder, files (and ZIP contents) become papers.

= How do I know what a folder still needs? =
Open the folder. **Past** lists each expected paper as **Filed** or **Missing**. The desk shows **Complete** or the missing names on each folder. File a **rule** on the drawer (your quality standard for Training, your office’s page for Taxes…) so the list follows your text. Without a file, the built-in papers are used.

= How do I send or destroy a filed paper? =
In **Past**: **Send** on a paper mails that sheet (body + PDF). **Send** on a folder (envelope mark) mails the whole chemise — the list in the body, one PDF per filed paper. **Shred** (shredder mark) deletes that one paper or folder. **Fireplace** (hearth mark) burns the whole pile — every paper in the folder, or every folder in the drawer. A hint under each mark says which. Permanent, no trash.

= Is the admin in French? =
The source language is English. Every UI string is gettext (`tlloancy-secretaire`). A complete **French** catalog ships in `languages/`. Set the site language to Français (`fr_FR`). If a leftover `wp-content/languages/plugins/tlloancy-secretaire-fr_FR.*` is mixed English/French, delete those files and reload.

= How many papers does Ask write? =
As many as the notes need, up to 16 in one request. They are filed as they finish. One paper of the current kind still lands in the editor for you to File. How many write at once is **Settings → Quills at once** (1–8). A folder can hold more than 16; that cap is one Ask.

== Changelog ==

= 1.1.0 =
* The desk no longer asks for a country. Five drawers for everyone: Papers, Training, Taxes, Fines, Disputes. The France pack and the Address setting are gone; the connector names an office, a form, a standard, or a law only when your notes or a filed rule name it.
* Training no longer carries Qualiopi labels. File your own quality standard as the drawer's rule and the papers use its words.
* A dedicated capability, manage_secretaire, opens the desk. Administrators receive it on activation; grant it to other roles with add_cap. Settings stay with manage_options.
* Without a connector, Ask falls back to the template instead of showing the AI SDK's error, and the folder report says where to add a connector key.
* Fines link to Disputes (was Justice).
* French translation rebuilt: plural forms restored, duplicate entries removed, Disputes drawer translated.

= 1.0.6 =
* On the desk, each folder shows how many sheets it holds. Open that count for the first five titles.
* A sheet that fails stays on the folder. Resume writes only those, one at a time. Empty the list drops the follow-up.
* Clicking a filed paper opens it in Source and Preview. Ask can revise it.
* A folder you already named keeps its name. With no name, the connector chooses one and a Connector mark shows that.
* When an Ask finishes, the report stays until you leave it or dismiss it.
* A sun or moon follows the site clock on the desk.

= 1.0.5 =
* Folder health is a collapsible Complete · n/n list.
* Ask may write several papers (16 per request) and file them as they finish. Parallel quills: Settings.

= 1.0.4 =
* Ask may lay out the paper with a sanitized `<style>` block (no scripts, no remote CSS). Desk and print keep a paper stylesheet in plugin files.

= 1.0.3 =
* After Ask finishes, the quill stops and File / Ask work again. A late job poll no longer freezes the form on “writing”.

= 1.0.2 =
* Ask the connector only on cards **checked** for this plugin in Connector Approvals. Unchecked providers are never called.
* Fix: Ask actually calls Google. A `method_exists` check skipped the AI client’s magic methods and always fell back to the template.
* Admin menu icon is a 20px silhouette so it stays sharp on the dark menu.

= 1.0.1 =
* Fix: desk CSS and JS load on the admin screens (menu slug is still `secretaire`). Icons stay 24px.
* General address: any paper you name (CV, letter, minutes…). Import stays the backup.
* Display name **tlloancy Secrétaire**. Connector readiness uses the public AI API only.

= 1.0.0 =
* Desk: France drawers, folders, print, connector drafts, abilities.
* Country packs: BE, CH, DE, ES, IT, GB, US, CA (Québec) — each with its own offices and papers.
* English source strings, French translation (`languages/tlloancy-secretaire-fr_FR`).

== Upgrade Notice ==

= 1.0.6 =
Desk sheet counts, unfinished titles you can resume, and a filed sheet you can open and revise.

= 1.0.4 =
Drafts can include document CSS. Scripts and remote stylesheets stay blocked.

= 1.0.3 =
The quill no longer stays busy after the draft is on the paper.

= 1.0.2 =
Drafts use only the connectors you checked for this plugin.

= 1.0.1 =
Desk styles load again. General papers. Name is tlloancy Secrétaire.
