feat(web): "Assistants IA" page (tokens, connection help, action journal) (#205) #218

Open
maximus wants to merge 10 commits from issue-205-assistants-page into issue-204-mcp-list-tag-tools

10 commits

Author SHA1 Message Date
le king fu
9afd2b5586 docs(web): control 3 of the probe is expected at zero, and the day a recurrence moves
REVIEW.md still said that lien_tache_supprimee "is not zero in normal
times", read against the baseline posted on #176. Since #196 a task
delete removes its links and migration 0004 removed the older ones:
REVIEW.md (« Sync ») and the header of web/scripts/probe.sql expect 0,
and a non-zero count means the defect is back. The sentence that would
have presented it as normal at the deployment of #207 now says so.
Asked by /pr-review on PR #211 (comment 34739, item 2).

The header of web/src/lib/recurrence.ts said that a recurrence computed
in UTC moves its local time by one hour across a clock change. Near
midnight that hour also moves the day (March 7, 2026 at 23:30 daily:
March 9 at 0:30 on the site, March 8 at 23:30 in the app). The header
now gives the case, and cites the decision of Max of 2026-11-19 that
accepts both gaps (PR #213, comment 35011).

Refs #196
Refs #201
Refs #205

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 20:10:37 -05:00
le king fu
979f52009a test(web): probe control 12 counts a revoked token's line by its row
The header of web/scripts/probe.sql and REVIEW.md said that a journal
line without a token, or whose row matches nothing, "does not count".
The query does better, and nothing pinned it: a line whose token was
revoked since still counts when the row it touched belongs to another
account, the row being the only trace left. Applied to the letter (WHERE
a.token_id IS NOT NULL AND (...)), the sentence left every test green,
and the critical control fell back to 0 once the token was revoked.

Two tests now pin both halves: a line of A with a revoked token on a
task, a list or a tag of B counts (3 tests red under the mutation of
the review), and a line of A with a token of B on a row that matches
nothing counts (1 red when such lines are left out). The two
descriptions now say that a revoked token makes a line neither count
nor not count.

Asked by /pr-review on PR #211 (comment 34739, item 1).

Refs #199
Refs #205

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 20:10:29 -05:00
le king fu
8cc4aaf343 fix(web): revoking an agent token takes effect outside the pilot
DELETE /api/agent-tokens/[id] went through requireAssistantsSession,
which answers 404 outside the pilot, the same answer as for an unknown
token, and the page takes any 404 for "already revoked". After an
emergency switch (MCP_ALLOWED_SUBS emptied), revoking from a page opened
before it revoked nothing, showed no error, and the token was valid
again once the pilot reopened.

agentAccess.ts splits the guard: requireSiteSession keeps its first two
checks (401 to any Authorization header, before anything else; 401
without a session of the site), and requireAssistantsSession adds the
pilot on top of it. The revocation alone uses requireSiteSession; its
account, Origin and rate limit checks are unchanged, and listing or
creating a token, or reading the journal, still answer 404 outside the
pilot.

Decision of Max of 2026-11-19, relayed by /pr-review on PR #218
(comment 35020).

Refs #200
Refs #205

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 20:10:18 -05:00
le king fu
dff17f7d99 fix(mcp): write tools treat a task left in a deleted list as missing
Deleting a list marks the list alone, in the app as on the site, and its
tasks stay live on the server. get_task and list_tasks already hid them
(loadAccountTask wants a live list of the account), but the write tools
accepted them for an assistant that had kept their id: complete_task
created the next occurrence of a recurring task in the deleted list,
create_task with parent_id created a subtask that get_task then could not
find, update_task with list_id brought the task back into a live list.

The write tools now answer for such a task as get_task does (not_found,
or parent_not_found for a parent), and so for a task of the account
filed in a list of another account. taskWrites.ts gets visibleTask, the
condition of loadAccountTask built on the transaction; createTask (for
its parent), updateTask and setTaskTags, which serve the tools alone,
always use it. completeTask and reopenTask, shared with PUT
/api/tasks/[id], take a scope: the tools pass 'visible', the site passes
nothing and keeps 'account', its behavior unchanged.

Decision of Max of 2026-11-19, relayed by /pr-review on PR #216
(comment 35015).

Refs #203
Refs #205

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 20:10:02 -05:00
le king fu
5d0a7e8e1b style(web): the copy button keeps the width of its label (#205)
With `flex` the button was a block as wide as its frame; `inline-flex`
sizes it like the other primary buttons of the site.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-16 20:50:31 -05:00
le king fu
7c73f8c8ac fix(web): the journal reads the answer of the route field by field (#205)
"Plus anciennes" cast the JSON of GET /api/agent-actions to a page and
rendered it. readJournalPage() now reads each field as the scalar it must
be, keeps nothing else, and gives null for any other shape: the journal
then shows its load error instead of handing an object to the JSX or an
invalid date to the formatter.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-16 20:50:31 -05:00
le king fu
67d390cc37 style(web): fewer layout classes new to the site on the assistants page (#205)
The value of a new token sits in a paragraph instead of a block-level code
element, and the connection helps space their content with the class the
other blocks use.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-16 20:50:31 -05:00
le king fu
bef10d8614 test(web): the parity test names the keys in fault in its messages (#205)
A failure of parity.test.ts now carries the keys in the message of the
assertion itself ("keys of fr.json missing in en.json: ..."), not only in
the diff the default reporter prints.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-16 20:50:31 -05:00
le king fu
6b90d4ad22 docs(review): name the journal route behind requireAssistantsSession() (#205)
GET /api/agent-actions is the fourth route behind this guard: the two
sentences that listed the routes of the agent tokens alone now name it,
with its cursor check. The "Niveaux" section is untouched.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-16 20:50:31 -05:00
le king fu
e42a5eb0b4 feat(web): "Assistants IA" page: tokens, connection help, action journal (#205)
The page where a user of the pilot creates, limits and revokes agent
tokens, finds how to connect an assistant, and sees what each token wrote.

- app/(app)/assistants/page.tsx: server component; no session redirects to
  /auth, an account outside the pilot gets notFound() before anything is
  read; it reads the tokens and the first 50 lines of the journal at one
  instant and sends plain data to the client components.
- components/Assistants*.tsx: five blocks (warning, tokens and creation
  form, the token just created, connection help, journal). The value of a
  token lives in the state of AssistantsPanel only.
- GET /api/agent-actions: requireAssistantsSession(), the `read` limit, a
  validated `?before=` cursor (400 when it is not one), 50 lines per page.
- lib/assistants.ts: label keys, connection templates, what the browser
  receives, the journal cursor, and the dates as pure functions of the
  instant, the locale and the time zone. Type-only imports: it goes to the
  browser.
- Header.tsx: `showAssistants` adds the menu entry, which (app)/layout.tsx
  sets from mcpAllowed().
- i18n: the 65 texts of the issue under `assistants`, generated from its
  two tables; parity.test.ts compares fr.json and en.json.

Resolves #205

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-16 20:50:31 -05:00