feat(web): schema for agent tokens and the agent action journal (#199) #211

Open
maximus wants to merge 2 commits from issue-199-agent-schema into master

2 commits

Author SHA1 Message Date
le king fu
f23b7aceab docs(review): the production probe returns twelve lines (#199)
"Déploiement web": the probe now also reads the journal of the AI
assistants. Twelve lines instead of ten at both places, with the two new
controls and their severity: journal_plus_de_90_jours (anomaly) and
journal_autre_compte (critical).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-16 20:50:30 -05:00
le king fu
6fddded0ea feat(web): schema for agent tokens and the agent action journal (#199)
Add the two tables behind the MCP server of the companion: sl_agent_tokens
(personal tokens, only the SHA-256 hash is stored, unique; scope limited to
read or write by a CHECK constraint) and sl_agent_actions (journal of what
each token wrote; the token link falls to null when the token is deleted,
the token name stays). No existing column changes.

- schema.ts: the two tables, as specified by the issue.
- 0005_agent_tokens.sql, meta/0005_snapshot.json and the journal entry are
  the untouched output of `drizzle-kit generate --name agent_tokens`.
- probe.sql: controls 11 (journal_plus_de_90_jours, journal lines older than
  91 days) and 12 (journal_autre_compte, lines whose token or touched row
  belongs to another account, critical). The read-only contract is unchanged.
- probe.test.ts: twelve controls, a journal in the healthy base, one test
  per new anomaly.
- agentSchema.test.ts (new): constraints of the two tables through the
  drizzle schema, and the migrations through the drizzle migrator, on an
  empty database and on a populated database at migration 0004.

Resolves #199

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