@townco/ui 0.1.101 → 0.1.103

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -121,8 +121,8 @@ export function useSubagentStream(options) {
121
121
  });
122
122
  }
123
123
  }, [scheduleUpdate]);
124
- const connectToSubagent = useCallback(async (port, sessionId, host) => {
125
- const baseUrl = `http://${host}:${port}`;
124
+ const connectToSubagent = useCallback(async (port, sessionId, host, protocol) => {
125
+ const baseUrl = `${protocol}//${host}:${port}`;
126
126
  logger.info("Connecting to sub-agent SSE", { baseUrl, sessionId });
127
127
  setIsStreaming(true);
128
128
  setError(null);
@@ -224,7 +224,9 @@ export function useSubagentStream(options) {
224
224
  // Extract values from options (memoized to avoid dependency issues)
225
225
  const port = options?.port;
226
226
  const sessionId = options?.sessionId;
227
- const host = options?.host ?? "localhost";
227
+ const host = options?.host ??
228
+ (typeof window !== "undefined" ? window.location.hostname : "localhost");
229
+ const protocol = typeof window !== "undefined" ? window.location.protocol : "http:";
228
230
  // Connect when options change
229
231
  useEffect(() => {
230
232
  if (!port || !sessionId) {
@@ -235,7 +237,7 @@ export function useSubagentStream(options) {
235
237
  setError(null);
236
238
  setHasCompleted(false);
237
239
  setIsStreaming(true);
238
- connectToSubagent(port, sessionId, host);
240
+ connectToSubagent(port, sessionId, host, protocol);
239
241
  // Cleanup on unmount or options change
240
242
  return () => {
241
243
  if (abortControllerRef.current) {
@@ -247,7 +249,7 @@ export function useSubagentStream(options) {
247
249
  updateTimeoutRef.current = null;
248
250
  }
249
251
  };
250
- }, [port, sessionId, host, connectToSubagent]);
252
+ }, [port, sessionId, host, protocol, connectToSubagent]);
251
253
  // Derive streaming status: streaming if we haven't completed yet
252
254
  const effectiveIsStreaming = !hasCompleted;
253
255
  return { messages, isStreaming: effectiveIsStreaming, error };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@townco/ui",
3
- "version": "0.1.101",
3
+ "version": "0.1.103",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -49,7 +49,7 @@
49
49
  "@radix-ui/react-slot": "^1.2.4",
50
50
  "@radix-ui/react-tabs": "^1.1.13",
51
51
  "@radix-ui/react-tooltip": "^1.2.8",
52
- "@townco/core": "0.0.79",
52
+ "@townco/core": "0.0.81",
53
53
  "@types/mdast": "^4.0.4",
54
54
  "@uiw/react-json-view": "^2.0.0-alpha.39",
55
55
  "class-variance-authority": "^0.7.1",
@@ -67,7 +67,7 @@
67
67
  "zustand": "^5.0.8"
68
68
  },
69
69
  "devDependencies": {
70
- "@townco/tsconfig": "0.1.98",
70
+ "@townco/tsconfig": "0.1.100",
71
71
  "@types/node": "^24.10.0",
72
72
  "@types/react": "^19.2.2",
73
73
  "@types/unist": "^3.0.3",