akemon 0.2.22 → 0.2.23

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.
@@ -11,7 +11,7 @@
11
11
  import { readFile } from "fs/promises";
12
12
  import { SIG, sig } from "./types.js";
13
13
  import { selfDir, biosPath, localNow, loadBioState, saveBioState, syncEnergyFromTokens, loadAgentConfig, getDueUserTasks, loadTaskRuns, saveTaskRuns, loadDirectives, buildDirectivesPrompt, appendTaskHistory, notifyOwner, updateHungerDecay, updateNaturalDecay, resetTokenCountIfNewDay, computeSociability, appendBioEvent, bioStatePromptModifier, feedHunger, SHOP_ITEMS, logBioStatus, logBioDecision, } from "./self.js";
14
- import { appendMessage, resolveConvId } from "./context.js";
14
+ import { appendMessage } from "./context.js";
15
15
  import { buildRoleContext } from "./role-module.js";
16
16
  // ---------------------------------------------------------------------------
17
17
  // Config
@@ -254,7 +254,7 @@ export class TaskModule {
254
254
  const filtered = [];
255
255
  for (const item of items) {
256
256
  const itemLabel = item.type === "order"
257
- ? `order:${item.data.product_name || item.data.buyer_agent_name || item.id}`
257
+ ? `order:${item.data.product_name || item.data.buyer_name || item.id}`
258
258
  : item.type === "user_task" ? `user_task:${item.data.key || item.id}` : `relay_task:${item.id}`;
259
259
  const isUrgent = item.quadrant === 1;
260
260
  // Fear avoidance (urgent items bypass)
@@ -296,7 +296,7 @@ export class TaskModule {
296
296
  return;
297
297
  const { workdir, agentName, bus } = this.ctx;
298
298
  const relay = this.getRelay();
299
- const orderLabel = `order:${order.product_name || order.buyer_agent_name || order.id}`;
299
+ const orderLabel = `order:${order.product_name || order.buyer_name || order.id}`;
300
300
  const orderPrice = order.price || order.offer_price || 1;
301
301
  const startTime = Date.now();
302
302
  try {
@@ -323,7 +323,7 @@ Relay API (use curl with -H "Authorization: Bearer ${this.secretKey}" -H "Conten
323
323
  Accept order: POST ${this.relayHttp}/v1/orders/${order.id}/accept
324
324
  Deliver order: POST ${this.relayHttp}/v1/orders/${order.id}/deliver -d '{"result":"your response"}'
325
325
  Extend order: PUT ${this.relayHttp}/v1/orders/${order.id}/extend`;
326
- const question = `[Order id=${order.id} status=${order.status}] ${order.product_name ? `Product: ${order.product_name}\n` : ""}Buyer: ${order.buyer_agent_name || order.buyer_ip || "?"}\nRequest: ${order.buyer_task || "(no specific request)"}
326
+ const question = `[Order id=${order.id} status=${order.status}] ${order.product_name ? `Product: ${order.product_name}\n` : ""}Buyer: ${order.buyer_name || order.buyer_ip || "?"}\nRequest: ${order.buyer_task || "(no specific request)"}
327
327
 
328
328
  Steps:
329
329
  1. If order status is "pending", accept it first (POST .../accept)
@@ -332,8 +332,12 @@ Steps:
332
332
 
333
333
  RESPOND IN THE SAME LANGUAGE AS THE REQUEST.`;
334
334
  // Write user message to conversation immediately (before engine runs)
335
- const orderBuyer = order.buyer_agent_name || order.buyer_ip || "anonymous";
336
- const orderConvId = resolveConvId(orderBuyer, order.id);
335
+ // buyer_name = agent name (from JOIN), buyer_ip = publisher ID or IP
336
+ const orderBuyer = order.buyer_name || order.buyer_ip || "anonymous";
337
+ // Product orders get isolated conversations; ad-hoc chats share one conv per buyer
338
+ const buyerPubId = orderBuyer;
339
+ const productScope = order.product_id ? `:prod_${order.product_id}` : "";
340
+ const orderConvId = `pub_${buyerPubId}${productScope}`;
337
341
  const orderUserMsg = order.buyer_task || "(no message)";
338
342
  await appendMessage(workdir, agentName, orderConvId, "User", orderUserMsg);
339
343
  console.log(`[task] Fulfilling order ${order.id}...`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akemon",
3
- "version": "0.2.22",
3
+ "version": "0.2.23",
4
4
  "description": "Agent work marketplace — train your agent, let it work for others",
5
5
  "type": "module",
6
6
  "license": "MIT",