@agentchatme/openclaw 0.9.1 → 0.9.2

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.
@@ -1,4 +1,4 @@
1
- export { p as agentchatSetupEntry, o as agentchatSetupPlugin, p as default } from './setup-entry-Dh6dRH2F.cjs';
1
+ export { p as agentchatSetupEntry, o as agentchatSetupPlugin, p as default } from './setup-entry-sXnwmV8K.cjs';
2
2
  import 'openclaw/plugin-sdk/channel-core';
3
3
  import 'agentchatme';
4
4
  import 'zod';
@@ -1,4 +1,4 @@
1
- export { p as agentchatSetupEntry, o as agentchatSetupPlugin, p as default } from './setup-entry-Dh6dRH2F.js';
1
+ export { p as agentchatSetupEntry, o as agentchatSetupPlugin, p as default } from './setup-entry-sXnwmV8K.js';
2
2
  import 'openclaw/plugin-sdk/channel-core';
3
3
  import 'agentchatme';
4
4
  import 'zod';
@@ -105,7 +105,7 @@ function applyAgentchatAccountPatch(cfg, accountId, patch) {
105
105
  }
106
106
 
107
107
  // src/version.ts
108
- var PACKAGE_VERSION = "0.9.1";
108
+ var PACKAGE_VERSION = "0.9.2";
109
109
 
110
110
  // src/client-identity.ts
111
111
  var AGENTCHAT_CLIENT_NAME = "openclaw";
@@ -401,7 +401,7 @@ function wakeTurnPrompt(texts, conversationId) {
401
401
  ${conversationLine(conversationId)}`;
402
402
  }
403
403
  function conversationLine(conversationId) {
404
- return `Conversation to answer in this turn: ${conversationId}. The gate decided reply; its card is still on the tray while you work, and the reply verdict for it is recorded for you when this turn completes (recording it yourself with ${DECIDE_TOOL} is idempotent) \u2014 open it with ${GET_CONVERSATION_TOOL} and reply.`;
404
+ return `Conversation to answer in this turn: ${conversationId}. The gate decided reply; its card is still on the tray while you work, and the reply verdict for it is recorded for you when this turn completes unless you record one yourself with ${DECIDE_TOOL} (reply after your answer is sent, or dismiss if you read and choose not to answer) \u2014 open it with ${GET_CONVERSATION_TOOL} and reply.`;
405
405
  }
406
406
  function inviteTurnPrompt(texts) {
407
407
  return texts.invite_prompt.trim();
@@ -2831,6 +2831,13 @@ var AgentInvoker = class {
2831
2831
  );
2832
2832
  return;
2833
2833
  }
2834
+ if (await this.decidedInTurn(reply)) {
2835
+ this.logger.info(
2836
+ { sessionKey, conversationId: reply.conversationId },
2837
+ "the turn recorded its own verdict \u2014 reply not recorded again"
2838
+ );
2839
+ return;
2840
+ }
2834
2841
  await this.recordReply(sessionKey, reply);
2835
2842
  } finally {
2836
2843
  this.replyTurnEnded(reply.conversationId);
@@ -2858,6 +2865,28 @@ var AgentInvoker = class {
2858
2865
  this.coalescer.wake();
2859
2866
  }
2860
2867
  }
2868
+ /**
2869
+ * Whether the completed turn recorded a verdict for its conversation
2870
+ * itself, seen on one fresh tray read. A card that left the tray was read
2871
+ * (a verdict or a mark-read) or hidden by a `defer` — by the turn, since
2872
+ * the host had recorded nothing for it. A card still there whose
2873
+ * `your_last_decision` differs from the gate's copy got a verdict in the
2874
+ * turn (a newer message keeps it on the tray). A card still there,
2875
+ * unchanged, got nothing. A failed read, or a missing card past a
2876
+ * truncated tray, claims nothing: `reply` is recorded as before.
2877
+ */
2878
+ async decidedInTurn(reply) {
2879
+ let tray;
2880
+ try {
2881
+ tray = await this.client.inbox.tray({ waitMs: 0, limit: POST_TURN_TRAY_LIMIT });
2882
+ } catch (err) {
2883
+ this.logger.info({ conversationId: reply.conversationId, err: describe4(err) }, "tray re-read after the turn failed \u2014 recording reply");
2884
+ return false;
2885
+ }
2886
+ const card = gate.cardsOf(tray).find((c) => c.conversation_id === reply.conversationId);
2887
+ if (!card) return tray.truncated !== true;
2888
+ return lastDecisionAt(card) !== lastDecisionAt(reply.card);
2889
+ }
2861
2890
  /** The `reply` verdict for a completed turn. A record the server refuses leaves the conversation unread; the ladder re-wakes. */
2862
2891
  async recordReply(sessionKey, reply) {
2863
2892
  try {
@@ -2923,6 +2952,11 @@ var AgentInvoker = class {
2923
2952
  }
2924
2953
  }
2925
2954
  };
2955
+ var POST_TURN_TRAY_LIMIT = 50;
2956
+ function lastDecisionAt(card) {
2957
+ const at = card.your_last_decision?.at;
2958
+ return typeof at === "string" && at.length > 0 ? at : null;
2959
+ }
2926
2960
  function describe4(err) {
2927
2961
  return err instanceof Error ? err.message : String(err);
2928
2962
  }