Commit Graph

41 Commits

Author SHA1 Message Date
Rob Colbert
01c84ba5a0 crash fix 2026-05-11 19:15:02 -04:00
Rob Colbert
c5add0fc7d subagent processing updates and fixes 2026-05-11 19:07:48 -04:00
Rob Colbert
9418d95e35 fix: resolve build errors in session-stability branch
1. Vite config: make HTTPS conditional on SSL cert/key files existing
   (pre-existing issue, broke builds when certs not present)
2. Drone reconnect handler: use socket.io Manager-level 'reconnect'
   event (this.socket.io.on) instead of Socket-level event, and add
   explicit type annotation for attemptNumber parameter
2026-05-11 17:46:09 -04:00
Rob Colbert
009863cf2b fix: resolve drone heartbeat timeouts and JWT expiration bugs
This commit addresses two interrelated issues causing drones to
de-register and users to be forcibly signed out:

## Heartbeat Timeout Fixes

1. Move heartbeat interval to a Web Worker (not subject to browser
   tab throttling). Chrome throttles setInterval in background tabs
   to ~1/min, which causes the 19s heartbeat to miss the drone's
   timeout timer. The Web Worker fires reliably regardless of tab
   visibility.

2. Add visibilitychange handler: when the tab becomes visible again,
   send an immediate heartbeat to reset the drone's timer after any
   throttling that may have occurred.

3. Fix onReleaseSessionLock to clear the heartbeat timer. Previously,
   releasing the lock left the 60s timer running, causing a spurious
   timeout and status emit after the lock was already released.

4. Increase drone heartbeat timeout from 60s to 120s. With the Web
   Worker fix, heartbeats should be reliable, but doubling the timeout
   provides a generous safety margin.

5. Add socket disconnect/reconnect handlers on the drone side. On
   disconnect, clear the heartbeat timer. On reconnect, re-emit drone
   status so the platform knows the drone is alive.

6. Configure Socket.IO pingInterval/pingTimeout explicitly (25s/60s)
   instead of relying on defaults.

## JWT Expiration Fixes

1. Increase WebToken DB record expiration from 1 hour to 7 days. The
   1-hour expiration was the real session lifetime gate (the JWT crypto
   exp was already 24h), and it was far too aggressive for a dev tool.

2. Fix web /auth/renew-token endpoint to use req.user from the session
   cookie instead of verifyJsonWebToken(req.body.token). This eliminates
   the catch-22 where an expired token cannot be used to request its
   own renewal.

3. Fix token refresh response parsing. The API v1 renew-token endpoint
   returns { success: true, token } at the top level, but the frontend
   was looking for json.data?.token, causing every refresh to fail.

4. Add proactive token refresh: check the JWT exp claim before each
   request and refresh if expiring within 5 minutes. This avoids
   unnecessary 401 errors and the resulting socket disconnections.

5. Update socket JWT on token renewal via a callback registered in
   App.tsx. This ensures that future socket reconnections use the new
   token instead of the expired one.

## Files Modified

- gadget-code/frontend/src/workers/heartbeat.worker.ts (NEW)
- gadget-code/frontend/src/lib/socket.ts
- gadget-code/frontend/src/lib/api.ts
- gadget-code/frontend/src/App.tsx
- gadget-code/src/services/session.ts
- gadget-code/src/controllers/auth.ts
- gadget-code/src/services/socket.ts
- gadget-drone/src/gadget-drone.ts
2026-05-11 17:46:09 -04:00
Rob Colbert
d7f694fa8c a pile of small fixes 2026-05-11 07:08:18 -04:00
Rob Colbert
0df6661fc5 chat interface fixes and cleanup
The Chat View area of the view was growing in width (unbounded), and has
been fixed. From the agent:

> The root cause was a flexbox sizing rule: in ChatSessionView.tsx:768
the parent row flex-1 flex bg-bg-primary overflow-hidden relative has
two children — the content area and the sidebar. The content area (line
777) was flex-1 flex flex-col relative, which as a flex child defaults
to min-width: auto. This means its intrinsic content width (driven by
the wide <pre>) is used as a minimum, forcing the flex item to expand
the whole row beyond the viewport.
>
> Adding min-w-0 overrides min-width: auto to min-width: 0, letting the
flex item shrink below its content's natural width. Now the
overflow-x-auto on the markdown wrapper actually has somewhere to scroll
into.
2026-05-10 10:49:16 -04:00
Rob Colbert
73c5345879 Re-build Agentic Workflow Loop
The ridiculousness of trying to maintain the previous agent's work got
out of hand, so we had this one re-build it - and got a better result.
2026-05-09 21:04:18 -04:00
Rob Colbert
931359b674 stream response handling and correctness 2026-05-09 11:51:09 -04:00
Rob Colbert
d26624ab93 chat session auto-naming with IDE update 2026-05-09 09:58:47 -04:00
Rob Colbert
d7924a9d6f GadgetLogTransportSocket and the drone-to-IDE log 2026-05-09 07:16:50 -04:00
Rob Colbert
1019c675e8 add navigation to return to Project Manager 2026-05-08 16:54:41 -04:00
Rob Colbert
af200c8c3a chat session heartbeat and session unlock 2026-05-08 14:27:37 -04:00
Rob Colbert
8eff66dcec user settings 2026-05-08 14:08:49 -04:00
Rob Colbert
9e9bc5267a rework provider/model selection with save/cancel pattern; add editable session name with cog icon
Replace the broken provider/model <select> elements (which sent empty model
on provider change, rejected by backend) with a cog-icon-driven edit flow:
- Default view shows current provider/model as text labels with a cog icon
- Clicking cog enters edit mode with <select> elements + checkmark/cancel
- Save atomically sends both provider and model; Save disabled until both set
- Cancel restores original values; whole view grays out during edit

Apply the same cog metaphor to the session Name field — inline text edit
with save/cancel, Enter to confirm, Escape to cancel. No global gray-out.
2026-05-08 14:08:05 -04:00
Rob Colbert
2613acf00d password_hash => password (display string); formatting 2026-05-08 11:51:52 -04:00
Rob Colbert
49ef6de30c new sign-in form and presentation 2026-05-08 11:44:27 -04:00
Rob Colbert
11bdd5e3b0 make reasoning effort configurable; remove sign up concept
- Implemented reasoning effort setting in SESSION panel of Chat Sessio
View
- Removed all ability to "sign up" for an account
2026-05-08 11:40:30 -04:00
Rob Colbert
e0df415237 streaming response fixes (Ollama) 2026-05-08 02:02:17 -04:00
Rob Colbert
61ba0e4412 streaming responses (see ./docs/streaming-responses.md) 2026-05-07 21:36:01 -04:00
Rob Colbert
819654e20a provider, model, and mode selections
User can now update the AI Provider, selected model on that provider,
and chat session mode.
2026-05-05 20:49:13 -04:00
Rob Colbert
cb73d276a3 more progress along ChatTurn processing
The agent has been failing and failing and failing, so I:
1. Swapped models
2. Did some by-hand enhancements
3. Set this checkpoint for continuing
2026-05-05 14:34:52 -04:00
Rob Colbert
09ebacc711 agent's progress on ChatTurn 2026-05-05 13:18:15 -04:00
Rob Colbert
3a8f2e4f44 agent's progress on ChatTurn component 2026-05-05 13:18:06 -04:00
Rob Colbert
dca21cf762 status message display fix (agent) 2026-05-03 04:34:36 -04:00
Rob Colbert
bab0b1810f many fixes
- JWT refresh logic to prevent dead sessions
- drone status messages now arrive in IDE for display
- WorkspaceService.deployProject method added to clone into a repo or
create the directory (new project not yet in git)
2026-05-03 04:15:48 -04:00
Rob Colbert
c5e5d16a51 workspace mode management; drone status message socket events added 2026-05-03 03:05:06 -04:00
Rob Colbert
5c56f95cd6 Implement workspace mode switching with validation
- Add isProcessingWorkOrder flag to track Agent work order processing
- Update onRequestWorkspaceMode with mode transition matrix validation
  - Idle → User/Agent: Always allowed
  - User → Agent: Always allowed (file editor checks for future)
  - Agent → User: Only if !isProcessingWorkOrder
  - All other transitions: Rejected with reason
- Extend RequestWorkspaceModeCallback with optional reason parameter
- Update frontend socket client to capture rejection reason
- Update handleWorkspaceModeChange to display rejection reason in toast
- Update WorkspaceModeIndicator to allow mode transitions per matrix
- Fix FilesPanel RW/RO indicator swap bug
- Document mode transition matrix and behavior in workspace-management.md
2026-05-02 18:13:31 -04:00
Rob Colbert
8b5df3827b workspace management progress 2026-05-02 16:38:49 -04:00
Rob Colbert
4ec31764d5 workspace management checkpoint while agents are working on it 2026-05-02 15:34:26 -04:00
Rob Colbert
4642609d06 socket message and drone workspace cleanup 2026-05-02 02:46:45 -04:00
Rob Colbert
0bb789ea6b welcome to The Grid 2026-05-01 22:28:22 -04:00
Rob Colbert
056dcd9601 return to Home on sign out 2026-05-01 20:15:34 -04:00
Rob Colbert
50b9618d4e project manager and chat session progress 2026-05-01 08:13:22 -04:00
Rob Colbert
c6d0c66563 drone manager created (wip) 2026-04-30 09:40:27 -04:00
Rob Colbert
ce0c7d2b27 wrap-up on Project Manager correctness 2026-04-30 04:43:42 -04:00
Rob Colbert
089a5b5fab checkpoint 2026-04-29 18:59:42 -04:00
Rob Colbert
db0d1586d6 front-end progress; Socket.IO messaging API; inquirer for credentials 2026-04-29 00:24:38 -04:00
Rob Colbert
56ba613cc7 theme enforced and correctly implemented; e2e tests added for theme 2026-04-28 17:43:05 -04:00
Rob Colbert
0bc47e60a5 Fix: Darken border colors to match dark industrial theme
- border-default: #27272a (was #2a2a2a)
- border-highlight: #2a2a2a (was #3a3a3a)

Previous bright borders (~#d4d4d4) are now neutral dark grays.
2026-04-28 17:27:39 -04:00
Rob Colbert
2e9571a74e Implement dark industrial theme, Project Manager, and JWT authentication
- Add dark industrial theme with brand color #c20600 and CSS variables
- Create Header component with version display and user dropdown menu
- Create StatusBar with connection indicator and project/session display
- Create ProjectManager page with CRUD, list view, and inspector
- Add JWT Bearer token to API requests for authenticated endpoints
- Add project API endpoints (GET/POST/PUT/DELETE /api/v1/projects)
- Add ProjectService methods: findById, findBySlug, delete
- Add unit tests for project API endpoints
- Add Playwright E2E tests for projects flow
- Update UI design guide with implementation details
- Fix: empty JSON body parsing in web-app.ts middleware
2026-04-28 17:13:49 -04:00
Rob Colbert
1edc3a85b8 created by merging gadget-code and gadget-drone 2026-04-28 09:20:37 -04:00