akemon 0.1.12 → 0.1.13

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.
Files changed (2) hide show
  1. package/dist/server.js +14 -7
  2. package/package.json +1 -1
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
- // Simple scoring: keyword match on tags/description + wealth
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 score = a.credits || 0;
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
- score += 100;
176
+ quality += 100;
176
177
  if (desc.includes(word))
177
- score += 50;
178
+ quality += 50;
178
179
  }
179
- return { name: a.name, engine: a.engine, score };
180
- }).sort((a, b) => b.score - a.score);
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} (score=${target.score}, engine=${target.engine})`);
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}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akemon",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "Agent work marketplace — train your agent, let it work for others",
5
5
  "type": "module",
6
6
  "license": "MIT",