agentgui 1.0.990 → 1.0.992
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/acp-sdk-manager.js +0 -6
- package/lib/acp-server-machine.js +0 -4
- package/lib/agent-descriptors.js +0 -3
- package/lib/agent-discovery.js +2 -20
- package/lib/asset-server.js +0 -37
- package/lib/claude-runner-run.js +0 -2
- package/lib/execution-machine.js +0 -11
- package/lib/gm-agent-configs.js +0 -11
- package/lib/process-message.js +2 -4
- package/lib/server-utils.js +1 -9
- package/package.json +1 -1
- package/test.js +7 -7
package/lib/acp-sdk-manager.js
CHANGED
|
@@ -179,12 +179,6 @@ export function getPort(agentId) {
|
|
|
179
179
|
return acpMachine.isHealthy(agentId) ? (ACP_TOOLS.find(t => t.id === agentId)?.port || null) : null;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
export function getRunningPorts() {
|
|
183
|
-
const ports = {};
|
|
184
|
-
for (const tool of ACP_TOOLS) { if (acpMachine.isHealthy(tool.id)) ports[tool.id] = tool.port; }
|
|
185
|
-
return ports;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
182
|
export async function restart(agentId) {
|
|
189
183
|
const tool = ACP_TOOLS.find(t => t.id === agentId);
|
|
190
184
|
if (!tool) return false;
|
|
@@ -160,10 +160,6 @@ export function getBackoffDelay(toolId) {
|
|
|
160
160
|
return calcBackoff(purgeOldRestarts(s.context.restarts));
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
export function getMachineActors() {
|
|
164
|
-
return actors;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
163
|
export function stopAll() {
|
|
168
164
|
for (const [, actor] of actors) actor.stop();
|
|
169
165
|
actors.clear();
|
package/lib/agent-descriptors.js
CHANGED
package/lib/agent-discovery.js
CHANGED
|
@@ -23,13 +23,6 @@ const BINARIES = [
|
|
|
23
23
|
{ cmd: 'hermes', id: 'hermes', name: 'Hermes Agent', icon: 'h', protocol: 'acp' },
|
|
24
24
|
];
|
|
25
25
|
|
|
26
|
-
const CLI_WRAPPERS = [
|
|
27
|
-
{ id: 'cli-opencode', name: 'OpenCode', icon: 'O', protocol: 'cli-wrapper', acpId: 'opencode' },
|
|
28
|
-
{ id: 'cli-gemini', name: 'Gemini', icon: 'G', protocol: 'cli-wrapper', acpId: 'gemini' },
|
|
29
|
-
{ id: 'cli-kilo', name: 'Kilo', icon: 'K', protocol: 'cli-wrapper', acpId: 'kilo' },
|
|
30
|
-
{ id: 'cli-codex', name: 'Codex', icon: 'X', protocol: 'cli-wrapper', acpId: 'codex' },
|
|
31
|
-
];
|
|
32
|
-
|
|
33
26
|
export function findCommand(cmd, rootDir) {
|
|
34
27
|
if (!cmd) return null;
|
|
35
28
|
const isWindows = os.platform() === 'win32';
|
|
@@ -79,19 +72,8 @@ export function discoverAgents(rootDir) {
|
|
|
79
72
|
}
|
|
80
73
|
}
|
|
81
74
|
|
|
82
|
-
console.log('[discoverAgents]
|
|
83
|
-
|
|
84
|
-
if (agents.some(a => a.id === wrapper.acpId)) {
|
|
85
|
-
console.log(`[discoverAgents] Adding CLI wrapper for ${wrapper.id}`);
|
|
86
|
-
agents.push(wrapper);
|
|
87
|
-
} else {
|
|
88
|
-
console.log(`[discoverAgents] Skipping CLI wrapper ${wrapper.id} (ACP agent ${wrapper.acpId} not found)`);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
const wrappedAcpIds = new Set(CLI_WRAPPERS.filter(w => agents.some(a => a.id === w.acpId)).map(w => w.acpId));
|
|
92
|
-
const filtered = agents.filter(a => !wrappedAcpIds.has(a.id));
|
|
93
|
-
console.log('[discoverAgents] Final agent count:', filtered.length, 'Agent IDs:', filtered.map(a => a.id).join(', '));
|
|
94
|
-
return filtered;
|
|
75
|
+
console.log('[discoverAgents] Final agent count:', agents.length, 'Agent IDs:', agents.map(a => a.id).join(', '));
|
|
76
|
+
return agents;
|
|
95
77
|
}
|
|
96
78
|
|
|
97
79
|
export async function initializeAgentDiscovery(discoveredAgents, rootDir, logError) {
|
package/lib/asset-server.js
CHANGED
|
@@ -124,40 +124,3 @@ export function serveFile(filePath, res, req, { compressAndSend, acceptsEncoding
|
|
|
124
124
|
});
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
-
|
|
128
|
-
export function createChunkBatcher(queries, debugLog) {
|
|
129
|
-
const pending = [];
|
|
130
|
-
let timer = null;
|
|
131
|
-
const BATCH_SIZE = 10;
|
|
132
|
-
const BATCH_INTERVAL = 50;
|
|
133
|
-
|
|
134
|
-
function flush() {
|
|
135
|
-
if (pending.length === 0) return;
|
|
136
|
-
const batch = pending.splice(0);
|
|
137
|
-
try {
|
|
138
|
-
const tx = queries._db ? queries._db.transaction(() => {
|
|
139
|
-
for (const c of batch) queries.createChunk(c.sessionId, c.conversationId, c.sequence, c.type, c.data);
|
|
140
|
-
}) : null;
|
|
141
|
-
if (tx) { tx(); } else {
|
|
142
|
-
for (const c of batch) {
|
|
143
|
-
try { queries.createChunk(c.sessionId, c.conversationId, c.sequence, c.type, c.data); } catch (e) { debugLog(`[chunk] ${e.message}`); }
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
} catch (err) {
|
|
147
|
-
debugLog(`[chunk-batch] Batch write failed: ${err.message}`);
|
|
148
|
-
for (const c of batch) {
|
|
149
|
-
try { queries.createChunk(c.sessionId, c.conversationId, c.sequence, c.type, c.data); } catch (_) {}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
function add(sessionId, conversationId, sequence, blockType, blockData) {
|
|
155
|
-
pending.push({ sessionId, conversationId, sequence, type: blockType, data: blockData });
|
|
156
|
-
if (pending.length >= BATCH_SIZE) { if (timer) { clearTimeout(timer); timer = null; } flush(); }
|
|
157
|
-
else if (!timer) { timer = setTimeout(() => { timer = null; flush(); }, BATCH_INTERVAL); }
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function drain() { if (timer) { clearTimeout(timer); timer = null; } flush(); }
|
|
161
|
-
|
|
162
|
-
return { add, drain };
|
|
163
|
-
}
|
package/lib/claude-runner-run.js
CHANGED
|
@@ -43,6 +43,4 @@ export async function runClaudeWithStreaming(prompt, cwd, agentId = 'claude-code
|
|
|
43
43
|
return agent.run(prompt, cwd, enhancedConfig);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
export function getRegisteredAgents() { return registry.list(); }
|
|
47
|
-
export function isAgentRegistered(agentId) { return registry.has(agentId); }
|
|
48
46
|
export default runClaudeWithStreaming;
|
package/lib/execution-machine.js
CHANGED
|
@@ -140,17 +140,6 @@ export function snapshot(convId) {
|
|
|
140
140
|
return actor ? actor.getSnapshot() : null;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
export function isStreaming(convId) {
|
|
144
|
-
const s = snapshot(convId);
|
|
145
|
-
return s ? s.value === 'streaming' || s.value === 'rate_limited' : false;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export function isActive(convId) {
|
|
149
|
-
const s = snapshot(convId);
|
|
150
|
-
if (!s) return false;
|
|
151
|
-
return s.value === 'streaming' || s.value === 'rate_limited' || s.value === 'draining';
|
|
152
|
-
}
|
|
153
|
-
|
|
154
143
|
export function getContext(convId) {
|
|
155
144
|
const s = snapshot(convId);
|
|
156
145
|
return s ? s.context : null;
|
package/lib/gm-agent-configs.js
CHANGED
|
@@ -64,14 +64,3 @@ export async function installGMAgentConfigs() {
|
|
|
64
64
|
});
|
|
65
65
|
log('results: ' + summary.join(', '));
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
export async function forceReinstallGMAgentConfigs() {
|
|
69
|
-
log('force reinstalling all agent configs');
|
|
70
|
-
const results = await Promise.allSettled(GM_PACKAGES.map(p => runInstaller(p.pkg)));
|
|
71
|
-
const summary = GM_PACKAGES.map((p, i) => {
|
|
72
|
-
const r = results[i];
|
|
73
|
-
const ok = r.status === 'fulfilled' && r.value;
|
|
74
|
-
return p.pkg + ': ' + (ok ? 'ok' : 'failed');
|
|
75
|
-
});
|
|
76
|
-
log('results: ' + summary.join(', '));
|
|
77
|
-
}
|
package/lib/process-message.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function createProcessMessage({ queries, activeExecutions, rateLimitState, execMachine, broadcastSync, runClaudeWithStreaming, cleanupExecution,
|
|
1
|
+
export function createProcessMessage({ queries, activeExecutions, rateLimitState, execMachine, broadcastSync, runClaudeWithStreaming, cleanupExecution, STARTUP_CWD, buildSystemPrompt, parseRateLimitResetTime, touchACP, getJsonlWatcher, debugLog, logError, scheduleRetry, drainMessageQueue, createEventHandler }) {
|
|
2
2
|
async function processMessageWithStreaming(conversationId, messageId, sessionId, content, agentId, model, subAgent) {
|
|
3
3
|
const startTime = Date.now();
|
|
4
4
|
touchACP(agentId);
|
|
@@ -31,9 +31,7 @@ export function createProcessMessage({ queries, activeExecutions, rateLimitState
|
|
|
31
31
|
// Resolve agent before building stateRef so isJsonlBacked can be set correctly.
|
|
32
32
|
// claude-code (protocol: direct) writes JSONL -> JsonlParser owns event broadcasting.
|
|
33
33
|
// All other agents (protocol: acp) rely solely on onEvent for streaming.
|
|
34
|
-
|
|
35
|
-
const wrapperAgent = discoveredAgents.find(a => a.id === resolvedAgentId && a.protocol === 'cli-wrapper' && a.acpId);
|
|
36
|
-
if (wrapperAgent) resolvedAgentId = wrapperAgent.acpId;
|
|
34
|
+
const resolvedAgentId = agentId || 'claude-code';
|
|
37
35
|
const isJsonlBacked = resolvedAgentId === 'claude-code';
|
|
38
36
|
// stateRef tracks eventCount (for session response metadata) and resumeSessionId
|
|
39
37
|
const stateRef = { eventCount: 0, resumeSessionId: conv?.claudeSessionId || null };
|
package/lib/server-utils.js
CHANGED
|
@@ -45,18 +45,10 @@ export function makeGetModelsForAgent(deps) {
|
|
|
45
45
|
{ id: 'opus', label: 'Opus' }
|
|
46
46
|
];
|
|
47
47
|
} else {
|
|
48
|
-
|
|
49
|
-
// but discoverAgents() replaces each found ACP agent with its cli-wrapper
|
|
50
|
-
// entry whose own id is prefixed ('cli-opencode') and whose acpId carries
|
|
51
|
-
// the original id. Match on acpId too so model discovery resolves the
|
|
52
|
-
// wrapper instead of finding nothing and silently returning [] models.
|
|
53
|
-
const agent = discoveredAgents.find(a => a.id === agentId || a.acpId === agentId);
|
|
48
|
+
const agent = discoveredAgents.find(a => a.id === agentId);
|
|
54
49
|
if (agent?.protocol === 'acp') {
|
|
55
50
|
await ensureRunning(agentId);
|
|
56
51
|
try { models = await queryACPModels(agentId); } catch (_) {}
|
|
57
|
-
} else if (agent?.protocol === 'cli-wrapper' && agent.acpId) {
|
|
58
|
-
await ensureRunning(agent.acpId);
|
|
59
|
-
try { models = await queryACPModels(agent.acpId); } catch (_) {}
|
|
60
52
|
}
|
|
61
53
|
}
|
|
62
54
|
modelCache.set(agentId, { models, timestamp: Date.now() });
|
package/package.json
CHANGED
package/test.js
CHANGED
|
@@ -340,13 +340,13 @@ await ok('cross-tab-storage: "updated in another tab" banner on stale load', ()
|
|
|
340
340
|
}
|
|
341
341
|
});
|
|
342
342
|
|
|
343
|
-
await ok('agents.models:
|
|
344
|
-
//
|
|
345
|
-
//
|
|
346
|
-
//
|
|
347
|
-
//
|
|
343
|
+
await ok('agents.models: ACP agent reaches ensureRunning + queryACPModels (not empty)', async () => {
|
|
344
|
+
// discoveredAgents and the client both use the canonical registry id
|
|
345
|
+
// ('opencode', protocol 'acp'). getModelsForAgent must start the ACP server
|
|
346
|
+
// and query it - a regression once silently returned [] for every ACP agent
|
|
347
|
+
// because of an id-scheme mismatch.
|
|
348
348
|
const { makeGetModelsForAgent } = await import('./lib/server-utils.js');
|
|
349
|
-
const discoveredAgents = [{ id: '
|
|
349
|
+
const discoveredAgents = [{ id: 'opencode', protocol: 'acp' }];
|
|
350
350
|
const calls = [];
|
|
351
351
|
const getModels = makeGetModelsForAgent({
|
|
352
352
|
modelCache: new Map(),
|
|
@@ -355,7 +355,7 @@ await ok('agents.models: resolves cli-wrapper by acpId (registry id, not wrapper
|
|
|
355
355
|
queryACPModels: async (id) => { calls.push(['query', id]); return [{ id: 'm1', label: 'M1' }]; },
|
|
356
356
|
});
|
|
357
357
|
const models = await getModels('opencode');
|
|
358
|
-
assert.deepEqual(calls, [['ensure', 'opencode'], ['query', 'opencode']], 'should ensureRunning + query
|
|
358
|
+
assert.deepEqual(calls, [['ensure', 'opencode'], ['query', 'opencode']], 'should ensureRunning + query the ACP agent');
|
|
359
359
|
assert.equal(models.length, 1, 'should return the ACP-provided models, not an empty list');
|
|
360
360
|
});
|
|
361
361
|
|