summaryrefslogtreecommitdiffhomepage
path: root/packages/frontend/src/lib/config.ts
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-05-22 20:54:19 +0900
committerAdam Malczewski <[email protected]>2026-05-22 20:54:19 +0900
commitc47346cc6237044ecb60ff22c4011d89744af581 (patch)
tree2359a25e687e1290ba5180fd60eae83b03b53a23 /packages/frontend/src/lib/config.ts
parent288b21cec98421fda57028a0c8c9d835cfbb14b0 (diff)
downloaddispatch-c47346cc6237044ecb60ff22c4011d89744af581.tar.gz
dispatch-c47346cc6237044ecb60ff22c4011d89744af581.zip
feat: message queue/interrupt system, CORS fix, mobile fixes, chat splitting
- Add message queue allowing users to send messages while agent is running - Queue messages are injected into tool results as [USER INTERRUPT] - Retrieve tool interrupted via Promise.race when user message arrives - Queued messages show with 'queued' badge and cancel button - Consumed messages repositioned and chat splits at interrupt point - New assistant message block created after interrupt for clean flow - Add POST /chat/cancel endpoint for cancelling queued messages - Fix CORS to allow any origin (Tailscale/LAN access) - Fix crypto.randomUUID fallback for non-secure contexts (HTTP) - Fix frontend API URL derivation from page hostname - Auto-create DB tab if missing on processMessage (foreign key fix) - Add error logging to processMessage catch block - Fix working directory input sync on agent switch - Fix agent mode button to re-apply agent settings
Diffstat (limited to 'packages/frontend/src/lib/config.ts')
-rw-r--r--packages/frontend/src/lib/config.ts12
1 files changed, 11 insertions, 1 deletions
diff --git a/packages/frontend/src/lib/config.ts b/packages/frontend/src/lib/config.ts
index c8f4d9f..0565367 100644
--- a/packages/frontend/src/lib/config.ts
+++ b/packages/frontend/src/lib/config.ts
@@ -1,5 +1,15 @@
const STORAGE_KEY = "dispatch-api-url";
-const DEFAULT_API_BASE = import.meta.env.VITE_API_URL ?? "http://localhost:3000";
+
+function getDefaultApiBase(): string {
+ if (import.meta.env.VITE_API_URL) return import.meta.env.VITE_API_URL;
+ // Derive from current page hostname so it works over Tailscale/LAN
+ if (typeof window !== "undefined" && window.location.hostname !== "localhost") {
+ return `http://${window.location.hostname}:3000`;
+ }
+ return "http://localhost:3000";
+}
+
+const DEFAULT_API_BASE = getDefaultApiBase();
function loadApiBase(): string {
if (typeof localStorage !== "undefined") {