pour application android simpl-liste
  • TypeScript 78.5%
  • JavaScript 19.3%
  • Python 2%
  • Dockerfile 0.1%
  • CSS 0.1%
Find a file
le king fu 45595eaee3 feat(web): personal agent tokens, their management routes and the pilot (#200)
An AI assistant will reach an account through a personal token created by a
user signed in on the site. This commit issues, verifies and revokes those
tokens, and adds the pilot switch. The MCP route (#202) and the page (#205)
come later in the stack.

- origin.ts: the list of allowed origins, moved as is from ws.ts, and
  isAllowedOrigin(). ws.ts imports it; no origin check reads request.url,
  whose origin is the container's in production.
- accountLock.ts: lockAccount(tx, userId), a transaction advisory lock per
  account.
- agentAccess.ts: mcpAllowed() reads MCP_ALLOWED_SUBS at every call (absent
  or empty: nobody; `*`: everyone; else a comma-separated list).
  requireAssistantsSession() guards the management routes: any Authorization
  header answers 401 first, then 401 without a site session, then 404 outside
  the pilot.
- agentTokens.ts: slmcp_ + 43 base64url characters; only the SHA-256 and the
  last four characters are stored. Ten tokens per account, counted under the
  account lock; expiry of 90 days, one year (same UTC day) or never;
  verifyAgentToken() accepts the exact Bearer shape only, refuses an expired
  token and writes last_used_at at most once per minute.
- GET and POST /api/agent-tokens, DELETE /api/agent-tokens/[id]: guard, rate
  limit, Origin on writes (403), body, action. Only the 201 of the POST
  carries the token; the eleventh token answers 409 token_limit.
- requireAuth() answers 401 to a Bearer that starts with slmcp_, before any
  call to Logto.
- .env.template: MCP_ALLOWED_SUBS, empty.

Tests: the real requireAuth with next/headers replaced and fetch spied, the
real /api/sync route with an agent token, the three routes on PGlite (two
accounts, cap, Origin with a request URL on the container's host, any
Authorization header, pilot, what the responses and the columns hold), the
token and pilot modules, the shared origin list and the WebSocket upgrade.

Resolves #200

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-15 00:12:28 -05:00
.claude docs(skills): eas-build resumes an interrupted release 2026-11-07 20:34:25 -05:00
.vscode Initial commit 2026-02-20 19:08:56 -05:00
app feat(sync): listen to the companion WebSocket for instant web-to-app sync (#175) 2026-11-08 15:35:45 +00:00
assets feat: add custom app icon and adjust medium widget to 2x4 2026-02-21 14:12:22 -05:00
patches perf(widget): cut expand/collapse tap latency (native patches + light headless path) 2026-07-19 16:41:47 -04:00
scripts feat(sync): listen to the companion WebSocket for instant web-to-app sync (#175) 2026-11-08 15:35:45 +00:00
src fix(sync): keep the notice window on its timer and survive a throwing WebSocket (#175) 2026-11-08 15:35:45 +00:00
tests test(sync): pin the canSync check after the ticket and the timer cleanup on stop (#175) 2026-11-08 15:35:45 +00:00
web feat(web): personal agent tokens, their management routes and the pilot (#200) 2026-11-15 00:12:28 -05:00
.gitignore chore: ignore .next/ and reports/ 2026-09-27 15:52:56 -04:00
app.json chore: bump version to 1.8.0 (versionCode 20) 2026-11-04 21:35:40 -05:00
babel.config.js feat: initial Simpl-Liste MVP 2026-02-20 19:28:42 -05:00
CLAUDE.md docs(decisions): seed the product decisions register 2026-10-30 01:45:16 +00:00
DECISIONS.md decisions: MCP plan-run answers (due date hour, token management, consent, EFVP, page location) 2026-11-14 15:31:17 -05:00
drizzle.config.ts feat: initial Simpl-Liste MVP 2026-02-20 19:28:42 -05:00
eas.json feat: initial Simpl-Liste MVP 2026-02-20 19:28:42 -05:00
index.js feat: add Android widget for task overview (3 sizes) 2026-02-21 09:47:15 -05:00
masterplan.md docs: add CLAUDE.md and masterplan for project reference 2026-02-20 21:50:45 -05:00
metro.config.js fix: list navigation, crypto polyfill, SQL transformer, dark mode priorities 2026-02-20 20:15:49 -05:00
nativewind-env.d.ts feat: initial Simpl-Liste MVP 2026-02-20 19:28:42 -05:00
package-lock.json chore: bump version to 1.8.0 (versionCode 20) 2026-11-04 21:35:40 -05:00
package.json feat(sync): listen to the companion WebSocket for instant web-to-app sync (#175) 2026-11-08 15:35:45 +00:00
REVIEW.md docs(review): the production probe returns twelve lines (#199) 2026-11-14 23:40:57 -05:00
SECURITY.md docs(security): seed STATE.md and SECURITY.md after vuln remediation 2026-04-24 07:30:41 -04:00
spec-decisions-mcp-agents.md docs(spec): review and plan-run outcome for the MCP agents plan 2026-11-14 15:34:13 -05:00
spec-decisions-sync-suites.md docs(spec): add sync-suites decisions and plan 2026-10-24 13:31:35 -04:00
spec-plan-mcp-agents.md docs(spec): add the execution section of the MCP agents plan 2026-11-14 15:34:39 -05:00
spec-plan-sync-delai-comptes-etiquettes.md docs(spec): plan for sync delay, account switch and companion tags 2026-11-02 20:35:18 -05:00
spec-plan-sync-suites.md docs(spec): add sync-suites decisions and plan 2026-10-24 13:31:35 -04:00
spec-plan-sync-ws-tests-sonde.md spec: plan the WebSocket, sync harness, prod probe and esbuild milestone 2026-11-07 20:47:41 -05:00
spec-simpl-liste-web.md docs: archive spec-simpl-liste-web (milestone 12/12 done) 2026-04-19 15:57:00 -04:00
sql-transformer.js fix: list navigation, crypto polyfill, SQL transformer, dark mode priorities 2026-02-20 20:15:49 -05:00
STATE.md state: planned-2026-11-07-sync-ws-tests-sonde merged (4/4) 2026-11-08 10:37:11 -05:00
tailwind.config.js feat: initial Simpl-Liste MVP 2026-02-20 19:28:42 -05:00
tsconfig.json fix: resolve Logto auth crash on web — remove illegal cookie set in layout 2026-04-08 13:12:59 -04:00