Remove legacy host auto-connect state
This commit is contained in:
@@ -648,7 +648,6 @@ export default function SettingsScreen() {
|
|||||||
const created = await addDaemon({
|
const created = await addDaemon({
|
||||||
label: deriveDaemonLabel(trimmedUrl),
|
label: deriveDaemonLabel(trimmedUrl),
|
||||||
wsUrl: trimmedUrl,
|
wsUrl: trimmedUrl,
|
||||||
autoConnect: true,
|
|
||||||
});
|
});
|
||||||
setSelectedDaemonId(created.id);
|
setSelectedDaemonId(created.id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,48 +1,15 @@
|
|||||||
import { useEffect, useMemo, useRef } from "react";
|
|
||||||
import { SessionProvider } from "@/contexts/session-context";
|
import { SessionProvider } from "@/contexts/session-context";
|
||||||
import { useDaemonRegistry, type DaemonProfile } from "@/contexts/daemon-registry-context";
|
import { useDaemonRegistry } from "@/contexts/daemon-registry-context";
|
||||||
|
|
||||||
export function MultiDaemonSessionHost() {
|
export function MultiDaemonSessionHost() {
|
||||||
const { daemons } = useDaemonRegistry();
|
const { daemons } = useDaemonRegistry();
|
||||||
const autoConnectStatesRef = useRef<Map<string, boolean>>(new Map());
|
if (daemons.length === 0) {
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const trackedStates = autoConnectStatesRef.current;
|
|
||||||
const activeIds = new Set<string>();
|
|
||||||
|
|
||||||
for (const daemon of daemons) {
|
|
||||||
activeIds.add(daemon.id);
|
|
||||||
const previousAutoConnect = trackedStates.get(daemon.id);
|
|
||||||
if (daemon.autoConnect === false && previousAutoConnect !== false) {
|
|
||||||
console.info("[DaemonConnection]", {
|
|
||||||
event: "auto_connect_skip",
|
|
||||||
daemonId: daemon.id,
|
|
||||||
label: daemon.label,
|
|
||||||
reason: "autoConnect disabled",
|
|
||||||
timestamp: new Date().toISOString(),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
trackedStates.set(daemon.id, daemon.autoConnect);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const daemonId of Array.from(trackedStates.keys())) {
|
|
||||||
if (!activeIds.has(daemonId)) {
|
|
||||||
trackedStates.delete(daemonId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, [daemons]);
|
|
||||||
|
|
||||||
const connectedDaemons = useMemo<DaemonProfile[]>(() => {
|
|
||||||
return daemons.filter((daemon) => daemon.autoConnect !== false);
|
|
||||||
}, [daemons]);
|
|
||||||
|
|
||||||
if (connectedDaemons.length === 0) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{connectedDaemons.map((daemon) => (
|
{daemons.map((daemon) => (
|
||||||
<SessionProvider key={daemon.id} serverUrl={daemon.wsUrl} serverId={daemon.id}>
|
<SessionProvider key={daemon.id} serverUrl={daemon.wsUrl} serverId={daemon.id}>
|
||||||
{null}
|
{null}
|
||||||
</SessionProvider>
|
</SessionProvider>
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ export type DaemonProfile = {
|
|||||||
label: string;
|
label: string;
|
||||||
wsUrl: string;
|
wsUrl: string;
|
||||||
restUrl?: string | null;
|
restUrl?: string | null;
|
||||||
autoConnect: boolean;
|
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
metadata?: Record<string, unknown> | null;
|
metadata?: Record<string, unknown> | null;
|
||||||
@@ -23,7 +22,6 @@ type CreateDaemonInput = {
|
|||||||
label: string;
|
label: string;
|
||||||
wsUrl: string;
|
wsUrl: string;
|
||||||
restUrl?: string | null;
|
restUrl?: string | null;
|
||||||
autoConnect?: boolean;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type UpdateDaemonInput = Partial<Omit<DaemonProfile, "id" | "createdAt">>;
|
type UpdateDaemonInput = Partial<Omit<DaemonProfile, "id" | "createdAt">>;
|
||||||
@@ -76,7 +74,6 @@ export function DaemonRegistryProvider({ children }: { children: ReactNode }) {
|
|||||||
label: input.label.trim() || deriveLabelFromUrl(input.wsUrl),
|
label: input.label.trim() || deriveLabelFromUrl(input.wsUrl),
|
||||||
wsUrl: input.wsUrl,
|
wsUrl: input.wsUrl,
|
||||||
restUrl: input.restUrl ?? null,
|
restUrl: input.restUrl ?? null,
|
||||||
autoConnect: input.autoConnect ?? true,
|
|
||||||
createdAt: timestamp,
|
createdAt: timestamp,
|
||||||
updatedAt: timestamp,
|
updatedAt: timestamp,
|
||||||
metadata: null,
|
metadata: null,
|
||||||
@@ -143,7 +140,6 @@ function createProfile(label: string, wsUrl: string): DaemonProfile {
|
|||||||
label,
|
label,
|
||||||
wsUrl,
|
wsUrl,
|
||||||
restUrl: null,
|
restUrl: null,
|
||||||
autoConnect: true,
|
|
||||||
createdAt: timestamp,
|
createdAt: timestamp,
|
||||||
updatedAt: timestamp,
|
updatedAt: timestamp,
|
||||||
metadata: null,
|
metadata: null,
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export function useDaemonSession(serverId?: string | null, options?: UseDaemonSe
|
|||||||
const label = connection?.daemon.label ?? serverId;
|
const label = connection?.daemon.label ?? serverId;
|
||||||
const status = connection?.status ?? "unknown";
|
const status = connection?.status ?? "unknown";
|
||||||
const lastError = connection?.lastError ? `\n${connection.lastError}` : "";
|
const lastError = connection?.lastError ? `\n${connection.lastError}` : "";
|
||||||
const message = `${label} isn't connected yet (${status}). Switch to it or enable auto-connect so Paseo can reach it.${lastError}`;
|
const message = `${label} isn't connected yet (${status}). Switch to it and wait for Paseo to reconnect automatically.${lastError}`;
|
||||||
|
|
||||||
if (!suppressUnavailableAlert && !alertedDaemonsRef.current.has(serverId)) {
|
if (!suppressUnavailableAlert && !alertedDaemonsRef.current.has(serverId)) {
|
||||||
alertedDaemonsRef.current.add(serverId);
|
alertedDaemonsRef.current.add(serverId);
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ The multi-daemon infrastructure is in place: session directory with daemon-scope
|
|||||||
- Context: Remaining "daemon" labels in git diff, file explorer, and agent detail screens now say "host" (updated `packages/app/src/app/git-diff.tsx`, `file-explorer.tsx`, `agent/[id].tsx`, and `agent/[serverId]/[agentId].tsx`).
|
- Context: Remaining "daemon" labels in git diff, file explorer, and agent detail screens now say "host" (updated `packages/app/src/app/git-diff.tsx`, `file-explorer.tsx`, `agent/[id].tsx`, and `agent/[serverId]/[agentId].tsx`).
|
||||||
- Review: Confirmed the agent redirect, file explorer, and git diff screens reflect the updated host wording with no lingering user-facing "daemon" strings.
|
- Review: Confirmed the agent redirect, file explorer, and git diff screens reflect the updated host wording with no lingering user-facing "daemon" strings.
|
||||||
- Review follow-up: Git Diff screen still showed the selected host as "Server"; updated the meta labels to "Host" to keep UI text consistent (`packages/app/src/app/git-diff.tsx`).
|
- Review follow-up: Git Diff screen still showed the selected host as "Server"; updated the meta labels to "Host" to keep UI text consistent (`packages/app/src/app/git-diff.tsx`).
|
||||||
|
- Review follow-up (current): Found that the Git Diff header still surfaced the internal host ID instead of the friendly label; updated `GitDiffContent` to accept the computed `serverLabel` and verified via `npm run typecheck --workspace=@paseo/app`.
|
||||||
|
|
||||||
### 2. Remove Active/Primary/Auto-Connect Concepts
|
### 2. Remove Active/Primary/Auto-Connect Concepts
|
||||||
- [x] Remove the concept of "active daemon" from the UI and simplify to just "hosts".
|
- [x] Remove the concept of "active daemon" from the UI and simplify to just "hosts".
|
||||||
@@ -30,7 +31,8 @@ The multi-daemon infrastructure is in place: session directory with daemon-scope
|
|||||||
- Eliminated the persisted `activeDaemonId`, flattened the session directory, and refactored `_layout`, realtime, settings, and agent UI to always resolve hosts explicitly so every host gets its own `SessionProvider`; verified via `npm run typecheck --workspace=@paseo/app`.
|
- Eliminated the persisted `activeDaemonId`, flattened the session directory, and refactored `_layout`, realtime, settings, and agent UI to always resolve hosts explicitly so every host gets its own `SessionProvider`; verified via `npm run typecheck --workspace=@paseo/app`.
|
||||||
- [x] Remove the "auto-connect" toggle from host settings—hosts always auto-connect when added.
|
- [x] Remove the "auto-connect" toggle from host settings—hosts always auto-connect when added.
|
||||||
- Removed the toggle from the host form so entries always auto-connect and verified with `npm run typecheck --workspace=@paseo/app`.
|
- Removed the toggle from the host form so entries always auto-connect and verified with `npm run typecheck --workspace=@paseo/app`.
|
||||||
- [ ] Clean up any related state/UI that exposes these concepts to users.
|
- [x] Clean up any related state/UI that exposes these concepts to users.
|
||||||
|
- Removed the legacy autoConnect state from daemon profiles and session hosts so every host hydrates automatically, refreshed the host-unavailable messaging/docs, and verified via `npm run typecheck --workspace=@paseo/app`.
|
||||||
|
|
||||||
### Review: No Silent Defaults
|
### Review: No Silent Defaults
|
||||||
- [ ] Review the changes to ensure we didn't just replace "active daemon" with "first host" (e.g., `hosts[0]}`. The goal is explicit user choice, not a hidden default.
|
- [ ] Review the changes to ensure we didn't just replace "active daemon" with "first host" (e.g., `hosts[0]}`. The goal is explicit user choice, not a hidden default.
|
||||||
|
|||||||
Reference in New Issue
Block a user