@kendoo.agentdesk/agentdesk 0.4.7 → 0.5.0

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.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # AgentDesk
2
2
 
3
- AI team orchestrator. Run collaborative agent sessions from your terminal and watch them live on [agentdesk.live](https://agentdesk.live).
3
+ AI team orchestrator for [Claude Code](https://claude.ai/code). Run collaborative agent sessions from your terminal and watch them live on [agentdesk.live](https://agentdesk.live).
4
4
 
5
- AgentDesk spawns a team of 7 specialized AI agents that collaborate on your tasks:
5
+ AgentDesk spawns a team of 7 specialized AI agents inside Claude Code that collaborate on your tasks:
6
6
 
7
7
  | Agent | Role |
8
8
  |-------|------|
@@ -122,5 +122,6 @@ agentdesk team -d "..." Describe what you want — task created a
122
122
 
123
123
  ## Requirements
124
124
 
125
+ - [Claude Code](https://claude.ai/code) installed and configured
125
126
  - [Node.js](https://nodejs.org/) 18+
126
127
  - An AgentDesk account at [agentdesk.live](https://agentdesk.live)
package/bin/agentdesk.mjs CHANGED
@@ -33,7 +33,7 @@ const command = args[0];
33
33
 
34
34
  if (!command || command === "help" || command === "--help") {
35
35
  console.log(`
36
- AgentDesk — AI team orchestrator
36
+ AgentDesk — AI team orchestrator for Claude Code
37
37
 
38
38
  Getting started:
39
39
  1. agentdesk login Sign in to your account
package/cli/config.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // .agentdesk.json config loader
2
- // Place this file in your project root to customize agent behavior
2
+ // Loads from: DEFAULTS server settings local .agentdesk.json (local overrides server)
3
3
 
4
4
  import { existsSync, readFileSync } from "fs";
5
5
  import { join } from "path";
@@ -37,28 +37,59 @@ const DEFAULTS = {
37
37
 
38
38
  // Existing agents/bots in the project — declare them so the team knows about them
39
39
  // Each entry: { name, role, when, how }
40
- // - name: Agent/bot name (e.g., "ReviewBot", "DataSync Agent")
41
- // - role: What it does (e.g., "Automated code review on PR creation")
42
- // - when: When to use or expect it (e.g., "Triggers on every PR", "Run manually via npm run agent:sync")
43
- // - how: How to interact with it (e.g., "Comment /review on a PR", "Set INPUT_MODE=dry-run for testing")
44
40
  projectAgents: [],
45
41
 
46
42
  // Extra prompt instructions appended to the team prompt
47
43
  instructions: null,
48
44
  };
49
45
 
50
- export function loadConfig(dir) {
46
+ async function fetchServerConfig(projectName, apiKey, serverUrl) {
47
+ if (!projectName || !apiKey || !serverUrl) return null;
48
+ try {
49
+ const res = await fetch(`${serverUrl}/api/projects/${projectName}/settings`, {
50
+ headers: { "x-api-key": apiKey },
51
+ signal: AbortSignal.timeout(5000),
52
+ });
53
+ if (!res.ok) return null;
54
+ const data = await res.json();
55
+ return Object.keys(data).length > 0 ? data : null;
56
+ } catch {
57
+ return null;
58
+ }
59
+ }
60
+
61
+ export async function loadConfig(dir, opts = {}) {
62
+ const { apiKey, serverUrl, projectName } = opts;
63
+
64
+ // Load local .agentdesk.json
51
65
  const configPath = join(dir, ".agentdesk.json");
66
+ let localConfig = null;
67
+ if (existsSync(configPath)) {
68
+ try {
69
+ localConfig = JSON.parse(readFileSync(configPath, "utf-8"));
70
+ } catch (err) {
71
+ console.error(`Warning: Failed to parse .agentdesk.json: ${err.message}`);
72
+ }
73
+ }
52
74
 
53
- if (!existsSync(configPath)) return { ...DEFAULTS };
75
+ // Fetch server settings
76
+ const serverConfig = await fetchServerConfig(projectName, apiKey, serverUrl);
54
77
 
55
- try {
56
- const raw = JSON.parse(readFileSync(configPath, "utf-8"));
57
- return deepMerge(DEFAULTS, raw);
58
- } catch (err) {
59
- console.error(`Warning: Failed to parse .agentdesk.json: ${err.message}`);
60
- return { ...DEFAULTS };
78
+ // Merge: DEFAULTS ← server ← local (local overrides server)
79
+ let config = { ...DEFAULTS };
80
+ if (serverConfig) config = deepMerge(config, serverConfig);
81
+ if (localConfig) config = deepMerge(config, localConfig);
82
+
83
+ // Auto-sync: if local config exists but server is empty, push local to server
84
+ if (localConfig && !serverConfig && apiKey && serverUrl && projectName) {
85
+ fetch(`${serverUrl}/api/projects/${projectName}/settings`, {
86
+ method: "PUT",
87
+ headers: { "Content-Type": "application/json", "x-api-key": apiKey },
88
+ body: JSON.stringify(localConfig),
89
+ }).catch(() => {});
61
90
  }
91
+
92
+ return config;
62
93
  }
63
94
 
64
95
  function deepMerge(defaults, overrides) {
package/cli/init.mjs CHANGED
@@ -141,6 +141,15 @@ export async function runInit(cwd) {
141
141
  if (res.ok) {
142
142
  console.log(" Registered with agentdesk.live");
143
143
  }
144
+ // Push settings to server
145
+ const key = loadApiKey(cwd);
146
+ if (key) {
147
+ await fetch(`${SERVER}/api/projects/${projectId}/settings`, {
148
+ method: "PUT",
149
+ headers: { "Content-Type": "application/json", "x-api-key": key },
150
+ body: JSON.stringify(merged),
151
+ }).catch(() => {});
152
+ }
144
153
  } catch {
145
154
  // Server not available
146
155
  }
package/cli/team.mjs CHANGED
@@ -33,9 +33,13 @@ export async function runTeam(taskId, opts = {}) {
33
33
  const cwd = opts.cwd || process.cwd();
34
34
  const description = opts.description || "";
35
35
 
36
- // Detect project and load config
36
+ // Detect project and resolve API key early (needed for server config fetch)
37
37
  const project = detectProject(cwd);
38
- const config = loadConfig(cwd);
38
+ const projectEnv = loadDotEnv(cwd);
39
+ const apiKey = projectEnv.AGENTDESK_API_KEY || process.env.AGENTDESK_API_KEY || getStoredApiKey() || null;
40
+ const agentdeskServer = process.env.AGENTDESK_SERVER || "https://agentdesk.live";
41
+
42
+ const config = await loadConfig(cwd, { apiKey, serverUrl: agentdeskServer, projectName: project.name });
39
43
  const tracker = config.tracker || (project.hasLinear ? "linear" : null);
40
44
 
41
45
  // If no task ID, handle based on tracker
@@ -135,10 +139,7 @@ export async function runTeam(taskId, opts = {}) {
135
139
  prompt += `\n\n## ADDITIONAL INSTRUCTIONS\n\n${config.instructions}\n`;
136
140
  }
137
141
 
138
- // --- AgentDesk config ---
139
- const projectEnv = loadDotEnv(cwd);
140
- const apiKey = projectEnv.AGENTDESK_API_KEY || process.env.AGENTDESK_API_KEY || getStoredApiKey() || null;
141
- const agentdeskServer = process.env.AGENTDESK_SERVER || "https://agentdesk.live";
142
+ // --- AgentDesk WebSocket config ---
142
143
  const AGENTDESK_URL = process.env.AGENTDESK_URL || "wss://agentdesk.live/ws/agent";
143
144
  const sessionId = `${taskId}-${randomUUID().slice(0, 8)}`;
144
145
  const inboxUrl = `${agentdeskServer}/api/sessions/${sessionId}/inbox`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kendoo.agentdesk/agentdesk",
3
- "version": "0.4.7",
3
+ "version": "0.5.0",
4
4
  "description": "AI team orchestrator for Claude Code — run collaborative agent sessions from your terminal",
5
5
  "type": "module",
6
6
  "bin": {