Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
feat(cli): re-enable daemon standby mode for desktop app flow
Genere810d7d50239
diff --git a/src/cli/daemon/daemon.test.ts b/src/cli/daemon/daemon.test.tsindex 1bcc5912e..89e7c43b0 100644--- a/src/cli/daemon/daemon.test.ts+++ b/src/cli/daemon/daemon.test.ts@@ -1118,7 +1118,7 @@ describe("daemon startup failures release pidfile", () => {for (const t of intervalTimers) realClearInterval(t);});- it("exits when no workspaces are configured", async () => {+ it("starts in standby mode when no workspaces are configured", async () => {vi.mocked(loadCLIConfigForProfile).mockReturnValue({server_url: "",watched_workspaces: [],@@ -1126,7 +1126,7 @@ describe("daemon startup failures release pidfile", () => {await startDaemon();- expect(mockProcessExit).toHaveBeenCalledWith(1);+ expect(mockProcessExit).not.toHaveBeenCalled();});it("registers an exit handler that releases the pidfile", async () => {@@ -2502,7 +2502,7 @@ describe("daemon SIGHUP reload", () => {for (const t of intervalTimers) realClearInterval(t);});- it("exits when no workspaces are configured", async () => {+ it("starts in standby mode when no workspaces are configured", async () => {vi.mocked(loadCLIConfigForProfile).mockReturnValue({server_url: "",watched_workspaces: [],@@ -2510,7 +2510,7 @@ describe("daemon SIGHUP reload", () => {await startDaemon();- expect(mockProcessExit).toHaveBeenCalledWith(1);+ expect(mockProcessExit).not.toHaveBeenCalled();});it("after SIGHUP, new workspace is registered", async () => {diff --git a/src/cli/daemon/daemon.ts b/src/cli/daemon/daemon.tsindex 85b1bfab0..a88a63547 100644--- a/src/cli/daemon/daemon.ts+++ b/src/cli/daemon/daemon.ts@@ -255,19 +255,19 @@ export async function startDaemon(const workspaces = allEntries.filter((ws): ws is typeof ws & { id: string; name: string } => ws.status !== "deleted" && !!ws.id);if (workspaces.length === 0) {- log.error("No workspaces configured. Register a workspace first.");- process.exit(1);- return;+ log.info("No workspaces configured — daemon starting in standby mode. Register a workspace to begin.");}// Validate: each active workspace must have its own token- const hasPerWorkspaceTokens = workspaces.every((ws) => !!ws.token);- if (!hasPerWorkspaceTokens) {- log.error(- `Config uses old format. Run '${cmdPrefix()} register --token <token>' for each workspace to upgrade.`,- );- process.exit(1);- return;+ if (workspaces.length > 0) {+ const hasPerWorkspaceTokens = workspaces.every((ws) => !!ws.token);+ if (!hasPerWorkspaceTokens) {+ log.error(+ `Config uses old format. Run '${cmdPrefix()} register --token <token>' for each workspace to upgrade.`,+ );+ process.exit(1);+ return;+ }}// Use server_url from first workspace's config if available@@ -300,7 +300,7 @@ export async function startDaemon(const workspaceStates: WorkspaceState[] = [];const runtimeIndex = new Map<string, RuntimeData>();- const hadWorkspaces = true;+ let hadWorkspaces = workspaces.length > 0;for (const ws of workspaces) {const runtimes = providers.map((p) => ({@@ -341,7 +341,7 @@ export async function startDaemon(}}- if (workspaceStates.length === 0 && workspaces.length > 0) {+ if (workspaceStates.length === 0 && hadWorkspaces) {log.error("No workspaces registered successfully.");process.exit(1);return;@@ -778,6 +778,7 @@ export async function startDaemon(}if (newWorkspaces.length > 0) {+ hadWorkspaces = true;health.setRuntimeCount(workspaceStates.reduce((sum, w) => sum + w.runtimeIds.length, 0),);