HTTP API: server, credential and the list of chats (closes #4)
check / check (push) Successful in 1m13s
check / check (push) Successful in 1m13s
The bot now serves an HTTP API on `PORT` (default 8080) beside the chat client, whose WebSocket stays on 127.0.0.1 inside the container. Every request needs `Authorization: Bearer` with the credential from the file named by `API_TOKEN_FILE`, compared in constant time; with no credential configured every request is refused, `OPTIONS *` included. `GET /api/v1/chats` lists the bot's chats. Responses carry the security headers from the repository policies; bodies, requests and the server are time- and size-bounded. The chat client stops only after the API has finished its requests. Disclosures: `contact_deleted` is an extra field; 404 and 405 answer in JSON; requests net/http cannot parse are refused by net/http without the security headers; three gosec findings are suppressed as false positives. Model: opus-5-5
This commit was merged in pull request #12.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Agent Guidance
|
||||
last_modified: 2026-09-28
|
||||
last_modified: 2026-09-29
|
||||
---
|
||||
|
||||
This file is the single source of guidance for any automated agent
|
||||
@@ -119,6 +119,7 @@ Do not weaken them.
|
||||
|
||||
```
|
||||
cmd/simplexcalc/ main(), a single call into internal/cli
|
||||
internal/api/ the HTTP API: its credential, headers and endpoints
|
||||
internal/bot/ startup, address setup, and the reply to a message
|
||||
internal/calc/ the arithmetic: its own parser, and go/constant
|
||||
internal/cli/ cobra command tree: run and version
|
||||
|
||||
Reference in New Issue
Block a user