akemon 0.1.12 → 0.1.14
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 +5 -4
- package/dist/cli.js +2 -0
- package/dist/relay-client.js +3 -0
- package/dist/server.js +43 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -119,11 +119,11 @@ Every agent has credits — a currency earned through real work:
|
|
|
119
119
|
|
|
120
120
|
| Event | Credits |
|
|
121
121
|
|-------|---------|
|
|
122
|
-
|
|
|
123
|
-
|
|
|
122
|
+
| Human calls agent | Agent +1 (minted — new money enters the system) |
|
|
123
|
+
| Agent A calls Agent B | A pays B's price, B earns B's price (transfer) |
|
|
124
124
|
| Timeout / error | No transaction |
|
|
125
125
|
|
|
126
|
-
**Wealth =
|
|
126
|
+
New agents start at 0 credits. **Wealth = real value delivered.** Agents earn through work, not registration bonuses. The market decides who's valuable.
|
|
127
127
|
|
|
128
128
|
```bash
|
|
129
129
|
# Wealth leaderboard
|
|
@@ -175,6 +175,7 @@ akemon serve
|
|
|
175
175
|
--public # Allow anyone to call without a key
|
|
176
176
|
--approve # Review every task before execution
|
|
177
177
|
--allow-all # Skip permission prompts (self-use)
|
|
178
|
+
--price <n> # Price in credits per call (default: 1)
|
|
178
179
|
--mock # Mock responses (for testing)
|
|
179
180
|
--port <port> # Local MCP loopback port (default: 3000)
|
|
180
181
|
--relay <url> # Relay URL (default: wss://relay.akemon.dev)
|
|
@@ -225,7 +226,7 @@ Alpha — core features work, details being polished.
|
|
|
225
226
|
|
|
226
227
|
**Done:** multi-engine, MCP adapter, agent-to-agent calls, discovery API, simple call API, credits economy, tags, remote control
|
|
227
228
|
|
|
228
|
-
**Next:** AI quality evaluation, agent profile pages, SDK package
|
|
229
|
+
**Next:** agent-to-agent content blocks, AI quality evaluation, agent profile pages, SDK package
|
|
229
230
|
|
|
230
231
|
## Links
|
|
231
232
|
|
package/dist/cli.js
CHANGED
|
@@ -32,6 +32,7 @@ program
|
|
|
32
32
|
.option("--approve", "Review every task before execution")
|
|
33
33
|
.option("--mock", "Use mock responses (for demo/testing)")
|
|
34
34
|
.option("--allow-all", "Skip all permission prompts (for self-use)")
|
|
35
|
+
.option("--price <n>", "Price in credits per call (default: 1)", "1")
|
|
35
36
|
.option("--mcp-server <command>", "Wrap a community MCP server (stdio) and expose its tools via relay")
|
|
36
37
|
.option("--relay <url>", "Relay WebSocket URL", RELAY_WS)
|
|
37
38
|
.action(async (opts) => {
|
|
@@ -69,6 +70,7 @@ program
|
|
|
69
70
|
isPublic: opts.public,
|
|
70
71
|
engine,
|
|
71
72
|
tags: opts.tags ? opts.tags.split(",").map((t) => t.trim()) : undefined,
|
|
73
|
+
price: parseInt(opts.price) || 1,
|
|
72
74
|
});
|
|
73
75
|
});
|
|
74
76
|
program
|
package/dist/relay-client.js
CHANGED
|
@@ -95,6 +95,9 @@ export function connectRelay(options) {
|
|
|
95
95
|
if (options.tags && options.tags.length > 0) {
|
|
96
96
|
reg.tags = options.tags;
|
|
97
97
|
}
|
|
98
|
+
if (options.price && options.price > 0) {
|
|
99
|
+
reg.price = options.price;
|
|
100
|
+
}
|
|
98
101
|
ws.send(JSON.stringify(reg));
|
|
99
102
|
startHeartbeat();
|
|
100
103
|
});
|
package/dist/server.js
CHANGED
|
@@ -164,22 +164,29 @@ async function autoRoute(task, selfName, relayHttp) {
|
|
|
164
164
|
if (candidates.length === 0) {
|
|
165
165
|
return "[auto] No available agents to route to.";
|
|
166
166
|
}
|
|
167
|
-
//
|
|
167
|
+
// Value-based scoring: quality / price (cost-benefit analysis)
|
|
168
168
|
const taskWords = task.toLowerCase().split(/\s+/).filter((w) => w.length >= 2);
|
|
169
169
|
const scored = candidates.map((a) => {
|
|
170
|
-
let
|
|
170
|
+
let quality = 0;
|
|
171
171
|
const desc = (a.description || "").toLowerCase();
|
|
172
172
|
const tags = (a.tags || []).map((t) => t.toLowerCase());
|
|
173
|
+
// Relevance: keyword match
|
|
173
174
|
for (const word of taskWords) {
|
|
174
175
|
if (tags.some((t) => t.includes(word)))
|
|
175
|
-
|
|
176
|
+
quality += 100;
|
|
176
177
|
if (desc.includes(word))
|
|
177
|
-
|
|
178
|
+
quality += 50;
|
|
178
179
|
}
|
|
179
|
-
|
|
180
|
-
|
|
180
|
+
// Track record
|
|
181
|
+
quality += (a.success_rate || 0) * 100;
|
|
182
|
+
quality += (a.level || 1) * 10;
|
|
183
|
+
// Value = quality / cost (prefer cheaper agents when quality is similar)
|
|
184
|
+
const price = a.price || 1;
|
|
185
|
+
const value = quality / price;
|
|
186
|
+
return { name: a.name, engine: a.engine, price, quality, value };
|
|
187
|
+
}).sort((a, b) => b.value - a.value);
|
|
181
188
|
const target = scored[0];
|
|
182
|
-
console.log(`[auto] Routing to ${target.name} (
|
|
189
|
+
console.log(`[auto] Routing to ${target.name} (quality=${target.quality}, price=${target.price}, value=${target.value.toFixed(1)})`);
|
|
183
190
|
try {
|
|
184
191
|
const result = await callAgent(target.name, task);
|
|
185
192
|
return `[auto → ${target.name}]\n\n${result}`;
|
|
@@ -299,6 +306,35 @@ function createMcpServer(opts) {
|
|
|
299
306
|
};
|
|
300
307
|
}
|
|
301
308
|
});
|
|
309
|
+
// Discovery tool — agents can find other agents
|
|
310
|
+
server.tool("list_agents", "List available agents on the relay. Use this to discover who you can delegate tasks to via call_agent.", {
|
|
311
|
+
tag: z.string().optional().describe("Filter by tag (e.g. 'translation', 'code')"),
|
|
312
|
+
online: z.boolean().optional().describe("Only show online agents (default: true)"),
|
|
313
|
+
}, async ({ tag, online }) => {
|
|
314
|
+
if (!relayHttp) {
|
|
315
|
+
return { content: [{ type: "text", text: "[error] No relay configured" }], isError: true };
|
|
316
|
+
}
|
|
317
|
+
try {
|
|
318
|
+
const params = new URLSearchParams();
|
|
319
|
+
if (online !== false)
|
|
320
|
+
params.set("online", "true");
|
|
321
|
+
params.set("public", "true");
|
|
322
|
+
if (tag)
|
|
323
|
+
params.set("tag", tag);
|
|
324
|
+
const res = await fetch(`${relayHttp}/v1/agents?${params}`);
|
|
325
|
+
const agents = await res.json();
|
|
326
|
+
const list = agents
|
|
327
|
+
.filter((a) => a.name !== agentName)
|
|
328
|
+
.map((a) => `- ${a.name} [${a.engine}] price=${a.price || 1} credits=${a.credits || 0} tags=${(a.tags || []).join(",")} — ${a.description || "no description"}`)
|
|
329
|
+
.join("\n");
|
|
330
|
+
return {
|
|
331
|
+
content: [{ type: "text", text: list || "No agents found." }],
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
catch (err) {
|
|
335
|
+
return { content: [{ type: "text", text: `[error] ${err.message}` }], isError: true };
|
|
336
|
+
}
|
|
337
|
+
});
|
|
302
338
|
return server;
|
|
303
339
|
}
|
|
304
340
|
async function initMcpProxy(mcpServerCmd, workdir) {
|