@kendoo.agentdesk/agentdesk 0.4.0 → 0.4.2

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/bin/agentdesk.mjs CHANGED
@@ -2,6 +2,27 @@
2
2
 
3
3
  // AgentDesk CLI — AI team orchestrator
4
4
 
5
+ import { readFileSync } from "fs";
6
+ import { fileURLToPath } from "url";
7
+ import { dirname, join } from "path";
8
+
9
+ const __filename = fileURLToPath(import.meta.url);
10
+ const __dirname = dirname(__filename);
11
+ const pkg = JSON.parse(readFileSync(join(__dirname, "../package.json"), "utf-8"));
12
+
13
+ // Non-blocking update check — runs in background, never delays startup
14
+ (async () => {
15
+ try {
16
+ const res = await fetch(`https://registry.npmjs.org/${pkg.name}/latest`, { signal: AbortSignal.timeout(3000) });
17
+ if (!res.ok) return;
18
+ const { version } = await res.json();
19
+ if (version !== pkg.version) {
20
+ console.log(`\n Update available: ${pkg.version} → ${version}`);
21
+ console.log(` Run: npm i -g ${pkg.name}\n`);
22
+ }
23
+ } catch {}
24
+ })();
25
+
5
26
  const args = process.argv.slice(2);
6
27
  const command = args[0];
7
28
 
package/cli/team.mjs CHANGED
@@ -139,8 +139,7 @@ export async function runTeam(taskId, opts = {}) {
139
139
  const projectEnv = loadDotEnv(cwd);
140
140
  const apiKey = projectEnv.AGENTDESK_API_KEY || process.env.AGENTDESK_API_KEY || getStoredApiKey() || null;
141
141
  const agentdeskServer = process.env.AGENTDESK_SERVER || "https://agentdesk.live";
142
- const baseUrl = process.env.AGENTDESK_URL || "wss://agentdesk.live/ws/agent";
143
- const AGENTDESK_URL = apiKey ? `${baseUrl}?api_key=${apiKey}` : baseUrl;
142
+ const AGENTDESK_URL = process.env.AGENTDESK_URL || "wss://agentdesk.live/ws/agent";
144
143
  const sessionId = `${taskId}-${randomUUID().slice(0, 8)}`;
145
144
  const inboxUrl = `${agentdeskServer}/api/sessions/${sessionId}/inbox`;
146
145
 
@@ -177,33 +176,40 @@ export async function runTeam(taskId, opts = {}) {
177
176
  try {
178
177
  vizWs = new WebSocket(AGENTDESK_URL);
179
178
  vizWs.on("open", () => {
180
- vizConnected = true;
181
- console.log("AgentDesk: connected");
182
- vizSend({
183
- type: "session:start",
184
- taskId,
185
- taskLink,
186
- title: description || taskId,
187
- project: project.name || null,
188
- sessionNumber: 1,
189
- agents: ["Jane", "Dennis", "Bart", "Vera", "Sam", "Luna", "Mark"],
190
- });
191
- while (vizQueue.length > 0 && vizWs.readyState === WebSocket.OPEN) {
192
- vizWs.send(vizQueue.shift());
179
+ // Authenticate via first message (proxy-safe — query params can be stripped)
180
+ if (apiKey) {
181
+ vizWs.send(JSON.stringify({ type: "auth", apiKey }));
182
+ }
183
+ });
184
+ vizWs.on("message", (raw) => {
185
+ let msg;
186
+ try { msg = JSON.parse(raw.toString()); } catch { return; }
187
+ if (msg.type === "auth:ok") {
188
+ vizConnected = true;
189
+ console.log("AgentDesk: connected");
190
+ vizSend({
191
+ type: "session:start",
192
+ taskId,
193
+ taskLink,
194
+ title: description || taskId,
195
+ project: project.name || null,
196
+ sessionNumber: 1,
197
+ agents: ["Jane", "Dennis", "Bart", "Vera", "Sam", "Luna", "Mark"],
198
+ });
199
+ while (vizQueue.length > 0 && vizWs.readyState === WebSocket.OPEN) {
200
+ vizWs.send(vizQueue.shift());
201
+ }
202
+ } else if (msg.type === "auth:error") {
203
+ console.log("AgentDesk: authentication failed — run 'agentdesk login'");
204
+ vizConnected = false;
193
205
  }
194
206
  });
195
207
  vizWs.on("error", () => { vizConnected = false; });
196
208
  vizWs.on("close", (code) => {
197
209
  vizConnected = false;
198
- if (code === 1006 && !vizConnected) {
199
- console.log("AgentDesk: not connected — run 'agentdesk login' to authenticate");
200
- }
201
- });
202
- vizWs.on("unexpected-response", (_req, res) => {
203
- if (res.statusCode === 401) {
210
+ if (code === 4001) {
204
211
  console.log("AgentDesk: authentication required — run 'agentdesk login'");
205
212
  }
206
- vizConnected = false;
207
213
  });
208
214
  } catch {
209
215
  // AgentDesk not running
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kendoo.agentdesk/agentdesk",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "AI team orchestrator for Claude Code — run collaborative agent sessions from your terminal",
5
5
  "type": "module",
6
6
  "bin": {