Intent

Source: original

Stabilize Billing API/app

6 files staged, ready to commit.

Agents

Billing endpoints

Invoice workflow

Regression suite

Context

API contract

Migration plan

Test matrix

Changes

route.tsapp/api/billing+64−18

billing-service.tssrc/services+128−24

20260428_add_invoices.sqlmigrations+52

invoice-worker.tssrc/jobs+83−11

billing.test.tstests/api+146

fixtures.tstests/helpers+31−4

Files

Activity

Agent finished1m

Updated spec1m

FILES / auth.ts

1

typescript

2

typescript

3

typescript

4

typescript

5

typescript

6

typescript

7

typescript

8

typescript

9

typescript

10

typescript

11

typescript

12

typescript

13

typescript

14

typescript

15

typescript

16

typescript

17

typescript

18

typescript

19

typescript

20

typescript

21

typescript

22

typescript

23

typescript

24

typescript

25

typescript

26

typescript

27

typescript

28

typescript

29

typescript

30

typescript

31

typescript

Read session.ts, jwt.ts

I'll create auth.ts to handle JWT authentication with refresh token rotation—short-lived access tokens (15m) paired with rotating refresh tokens stored server-side.

Created auth.ts

Added verifyAndRotate() to handle expired tokens—if the access token is expired but the refresh token is valid, it issues new tokens automatically.

1 file changed+41-0

Auth flow

Plan

Sonnet 4.5

Terminal

Backend

Start with the API path. Let agents clear the edges.