@kendoo.agentdesk/agentdesk 0.7.0 → 0.7.1

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.
Files changed (2) hide show
  1. package/cli/daemon.mjs +29 -4
  2. package/package.json +1 -1
package/cli/daemon.mjs CHANGED
@@ -12,7 +12,7 @@ import { getStoredApiKey } from "./login.mjs";
12
12
  import { resolveTeam, generateTeamPrompt } from "./agents.mjs";
13
13
  import { buildPrompt } from "./prompt.mjs";
14
14
  import { createStreamParser } from "./stream-parser.mjs";
15
- import { getRegisteredProjects } from "./projects.mjs";
15
+ import { getRegisteredProjects, registerLocalProject } from "./projects.mjs";
16
16
 
17
17
  const CONFIG_DIR = join(process.env.HOME || process.env.USERPROFILE, ".agentdesk");
18
18
  const LOGS_DIR = join(CONFIG_DIR, "logs");
@@ -100,8 +100,34 @@ export async function runDaemon() {
100
100
  process.exit(1);
101
101
  }
102
102
 
103
- // 2. Load registered projects
104
- const allProjects = getRegisteredProjects();
103
+ // 2. Load registered projects — local registry first, then server fallback
104
+ const agentdeskServer = process.env.AGENTDESK_SERVER || "https://agentdesk.live";
105
+ let allProjects = getRegisteredProjects();
106
+
107
+ // Fallback: fetch from server if local registry is empty (pre-0.7.0 projects)
108
+ if (allProjects.length === 0) {
109
+ try {
110
+ const res = await fetch(`${agentdeskServer}/api/projects`, {
111
+ headers: { "x-api-key": apiKey },
112
+ signal: AbortSignal.timeout(5000),
113
+ });
114
+ if (res.ok) {
115
+ const serverProjects = await res.json();
116
+ if (Array.isArray(serverProjects) && serverProjects.length > 0) {
117
+ console.log(` ${dim}Syncing ${serverProjects.length} project(s) from server...${reset}`);
118
+ for (const sp of serverProjects) {
119
+ if (sp.path && existsSync(sp.path)) {
120
+ registerLocalProject(sp.id || sp.name, sp.name, sp.path);
121
+ }
122
+ }
123
+ allProjects = getRegisteredProjects();
124
+ }
125
+ }
126
+ } catch {
127
+ // Server not reachable — continue with local only
128
+ }
129
+ }
130
+
105
131
  const projects = allProjects.filter(p => {
106
132
  if (!existsSync(p.path)) return false;
107
133
  if (!existsSync(join(p.path, ".agentdesk.json"))) return false;
@@ -127,7 +153,6 @@ export async function runDaemon() {
127
153
  const DAEMON_URL = process.env.AGENTDESK_URL
128
154
  ? process.env.AGENTDESK_URL.replace("/ws/agent", "/ws/daemon")
129
155
  : "wss://agentdesk.live/ws/daemon";
130
- const agentdeskServer = process.env.AGENTDESK_SERVER || "https://agentdesk.live";
131
156
 
132
157
  // Enforce TLS in production — API key must not travel in cleartext
133
158
  if (!DAEMON_URL.startsWith("wss://") && !DAEMON_URL.startsWith("ws://localhost") && !DAEMON_URL.startsWith("ws://127.0.0.1")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kendoo.agentdesk/agentdesk",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "AI team orchestrator for Claude Code — run collaborative agent sessions from your terminal",
5
5
  "type": "module",
6
6
  "bin": {