agentgui 1.0.989 → 1.0.990
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/lib/agent-discovery.js +0 -62
- package/lib/server-startup.js +0 -1
- package/package.json +1 -1
- package/server.js +1 -1
package/lib/agent-discovery.js
CHANGED
|
@@ -66,57 +66,6 @@ export function findCommand(cmd, rootDir) {
|
|
|
66
66
|
return null;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
export async function queryACPServerAgents(baseUrl) {
|
|
70
|
-
const endpoint = baseUrl.endsWith('/') ? baseUrl + 'agents/search' : baseUrl + '/agents/search';
|
|
71
|
-
try {
|
|
72
|
-
const response = await fetch(endpoint, {
|
|
73
|
-
method: 'POST',
|
|
74
|
-
headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' },
|
|
75
|
-
body: JSON.stringify({}),
|
|
76
|
-
signal: AbortSignal.timeout(5000)
|
|
77
|
-
});
|
|
78
|
-
if (!response.ok) {
|
|
79
|
-
console.error(`Failed to query ACP agents from ${baseUrl}: ${response.status}`);
|
|
80
|
-
return [];
|
|
81
|
-
}
|
|
82
|
-
const data = await response.json();
|
|
83
|
-
if (!data?.agents || !Array.isArray(data.agents)) {
|
|
84
|
-
console.error(`Invalid agents response from ${baseUrl}`);
|
|
85
|
-
return [];
|
|
86
|
-
}
|
|
87
|
-
return data.agents.map(agent => ({
|
|
88
|
-
id: agent.agent_id || agent.id,
|
|
89
|
-
name: agent.metadata?.ref?.name || agent.name || 'Unknown Agent',
|
|
90
|
-
metadata: {
|
|
91
|
-
ref: {
|
|
92
|
-
name: agent.metadata?.ref?.name,
|
|
93
|
-
version: agent.metadata?.ref?.version,
|
|
94
|
-
url: agent.metadata?.ref?.url,
|
|
95
|
-
tags: agent.metadata?.ref?.tags
|
|
96
|
-
},
|
|
97
|
-
description: agent.metadata?.description,
|
|
98
|
-
author: agent.metadata?.author,
|
|
99
|
-
license: agent.metadata?.license
|
|
100
|
-
},
|
|
101
|
-
specs: agent.specs ? {
|
|
102
|
-
capabilities: agent.specs.capabilities,
|
|
103
|
-
input_schema: agent.specs.input_schema || agent.specs.input,
|
|
104
|
-
output_schema: agent.specs.output_schema || agent.specs.output,
|
|
105
|
-
thread_state_schema: agent.specs.thread_state_schema || agent.specs.thread_state,
|
|
106
|
-
config_schema: agent.specs.config_schema || agent.specs.config,
|
|
107
|
-
custom_streaming_update_schema: agent.specs.custom_streaming_update_schema || agent.specs.custom_streaming_update
|
|
108
|
-
} : null,
|
|
109
|
-
custom_data: agent.custom_data,
|
|
110
|
-
icon: agent.metadata?.ref?.name?.charAt(0) || 'A',
|
|
111
|
-
protocol: 'acp',
|
|
112
|
-
path: baseUrl
|
|
113
|
-
}));
|
|
114
|
-
} catch (error) {
|
|
115
|
-
console.error(`ACP agents query failed for ${baseUrl}: ${error.message}`);
|
|
116
|
-
return [];
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
69
|
export function discoverAgents(rootDir) {
|
|
121
70
|
const agents = [];
|
|
122
71
|
for (const bin of BINARIES) {
|
|
@@ -145,17 +94,6 @@ export function discoverAgents(rootDir) {
|
|
|
145
94
|
return filtered;
|
|
146
95
|
}
|
|
147
96
|
|
|
148
|
-
export async function discoverExternalACPServers(discoveredAgents) {
|
|
149
|
-
const externalAgents = [];
|
|
150
|
-
for (const agent of discoveredAgents.filter(a => a.protocol === 'acp' && a.acpPort)) {
|
|
151
|
-
try {
|
|
152
|
-
const agents = await queryACPServerAgents(`http://localhost:${agent.acpPort}`);
|
|
153
|
-
externalAgents.push(...agents);
|
|
154
|
-
} catch (_) {}
|
|
155
|
-
}
|
|
156
|
-
return externalAgents;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
97
|
export async function initializeAgentDiscovery(discoveredAgents, rootDir, logError) {
|
|
160
98
|
try {
|
|
161
99
|
const agents = discoverAgents(rootDir);
|
package/lib/server-startup.js
CHANGED
|
@@ -41,7 +41,6 @@ export function createOnServerReady({ queries, broadcastSync, warmAssetCache, st
|
|
|
41
41
|
console.log('[ACP] On-demand startup enabled (ACP tools start when first used)');
|
|
42
42
|
setTimeout(() => {
|
|
43
43
|
const acpStatus = getACPStatus();
|
|
44
|
-
for (const s of acpStatus) { if (s.healthy) { const agent = discoveredAgents.find(a => a.id === s.id); if (agent) agent.acpPort = s.port; } }
|
|
45
44
|
if (acpStatus.length > 0) console.log(`[ACP] Tools ready: ${acpStatus.filter(s => s.healthy).map(s => s.id + ':' + s.port).join(', ') || 'none healthy yet'}`);
|
|
46
45
|
}, 6000);
|
|
47
46
|
}).catch(err => console.error('[ACP] Startup error:', err.message));
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -9,7 +9,7 @@ import { createHistoryRouter } from 'ccsniff';
|
|
|
9
9
|
import { queries } from './database.js';
|
|
10
10
|
import { runClaudeWithStreaming } from './lib/claude-runner-run.js';
|
|
11
11
|
import { initializeDescriptors, getAgentDescriptor } from './lib/agent-descriptors.js';
|
|
12
|
-
import {
|
|
12
|
+
import { initializeAgentDiscovery } from './lib/agent-discovery.js';
|
|
13
13
|
import { register as registerWsHandlers } from './lib/ws-handlers-util.js';
|
|
14
14
|
import { BROADCAST_TYPES } from './lib/broadcast.js';
|
|
15
15
|
import { WSOptimizer } from './lib/ws-optimizer.js';
|