@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.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { L as Logger } from './setup-entry-Dh6dRH2F.cjs';
2
- export { A as AgentInvoker, a as AgentInvokerOptions, b as AgentchatChannelConfig, c as AgentchatResolvedAccount, C as CreateMetricsOptions, d as CycleOutcome, e as CycleResult, G as GroupInvite, I as IntegrationSocket, f as IntegrationSocketOptions, g as InviteLedger, M as MetricsRecorder, h as MetricsSnapshot, P as PromFactory, i as PromRegistryLike, S as SocketBlocked, j as SocketDisconnect, k as SocketHandlers, l as SocketHealth, m as SocketState, W as WakeSource, n as agentchatChannelEntry, o as agentchatPlugin, p as agentchatSetupEntry, o as agentchatSetupPlugin, q as createInMemoryMetrics, r as createMetrics, s as createNoopMetrics, n as default, t as groupInviteFromRecord, u as parseChannelConfig, v as realtimeOptionsFor } from './setup-entry-Dh6dRH2F.cjs';
1
+ import { L as Logger } from './setup-entry-sXnwmV8K.cjs';
2
+ export { A as AgentInvoker, a as AgentInvokerOptions, b as AgentchatChannelConfig, c as AgentchatResolvedAccount, C as CreateMetricsOptions, d as CycleOutcome, e as CycleResult, G as GroupInvite, I as IntegrationSocket, f as IntegrationSocketOptions, g as InviteLedger, M as MetricsRecorder, h as MetricsSnapshot, P as PromFactory, i as PromRegistryLike, S as SocketBlocked, j as SocketDisconnect, k as SocketHandlers, l as SocketHealth, m as SocketState, W as WakeSource, n as agentchatChannelEntry, o as agentchatPlugin, p as agentchatSetupEntry, o as agentchatSetupPlugin, q as createInMemoryMetrics, r as createMetrics, s as createNoopMetrics, n as default, t as groupInviteFromRecord, u as parseChannelConfig, v as realtimeOptionsFor } from './setup-entry-sXnwmV8K.cjs';
3
3
  export { hasAgentChatConfiguredState } from './configured-state.cjs';
4
4
  import { AgentChatClient, Texts, ToolNamer } from 'agentchatme';
5
5
  import 'openclaw/plugin-sdk/channel-core';
@@ -241,9 +241,11 @@ declare function spellToolsForOpenClaw(text: string): string;
241
241
  * the gate decided a specific conversation, one factual line naming it. The
242
242
  * `reply` verdict is recorded when the turn has completed — never at its
243
243
  * start — so while the turn runs the conversation is still unread and its
244
- * card still on the tray; the line says so, names the conversation to open,
245
- * and says the verdict is taken care of (recording it in the turn as well is
246
- * idempotent).
244
+ * card still on the tray; the line says so and names the conversation to
245
+ * open. The model may record its own verdict in the turn (the served texts
246
+ * tell it to record `reply` after its send, or `dismiss` when it read and
247
+ * chose not to answer); the invoker then records nothing more for it. Only
248
+ * a turn that recorded none gets `reply` from the host when it completes.
247
249
  */
248
250
  declare function wakeTurnPrompt(texts: Pick<Texts, 'wake_instruction'>, conversationId?: string): string;
249
251
  /** The prompt a group-invite turn starts with: the served invite prompt. */
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { L as Logger } from './setup-entry-Dh6dRH2F.js';
2
- export { A as AgentInvoker, a as AgentInvokerOptions, b as AgentchatChannelConfig, c as AgentchatResolvedAccount, C as CreateMetricsOptions, d as CycleOutcome, e as CycleResult, G as GroupInvite, I as IntegrationSocket, f as IntegrationSocketOptions, g as InviteLedger, M as MetricsRecorder, h as MetricsSnapshot, P as PromFactory, i as PromRegistryLike, S as SocketBlocked, j as SocketDisconnect, k as SocketHandlers, l as SocketHealth, m as SocketState, W as WakeSource, n as agentchatChannelEntry, o as agentchatPlugin, p as agentchatSetupEntry, o as agentchatSetupPlugin, q as createInMemoryMetrics, r as createMetrics, s as createNoopMetrics, n as default, t as groupInviteFromRecord, u as parseChannelConfig, v as realtimeOptionsFor } from './setup-entry-Dh6dRH2F.js';
1
+ import { L as Logger } from './setup-entry-sXnwmV8K.js';
2
+ export { A as AgentInvoker, a as AgentInvokerOptions, b as AgentchatChannelConfig, c as AgentchatResolvedAccount, C as CreateMetricsOptions, d as CycleOutcome, e as CycleResult, G as GroupInvite, I as IntegrationSocket, f as IntegrationSocketOptions, g as InviteLedger, M as MetricsRecorder, h as MetricsSnapshot, P as PromFactory, i as PromRegistryLike, S as SocketBlocked, j as SocketDisconnect, k as SocketHandlers, l as SocketHealth, m as SocketState, W as WakeSource, n as agentchatChannelEntry, o as agentchatPlugin, p as agentchatSetupEntry, o as agentchatSetupPlugin, q as createInMemoryMetrics, r as createMetrics, s as createNoopMetrics, n as default, t as groupInviteFromRecord, u as parseChannelConfig, v as realtimeOptionsFor } from './setup-entry-sXnwmV8K.js';
3
3
  export { hasAgentChatConfiguredState } from './configured-state.js';
4
4
  import { AgentChatClient, Texts, ToolNamer } from 'agentchatme';
5
5
  import 'openclaw/plugin-sdk/channel-core';
@@ -241,9 +241,11 @@ declare function spellToolsForOpenClaw(text: string): string;
241
241
  * the gate decided a specific conversation, one factual line naming it. The
242
242
  * `reply` verdict is recorded when the turn has completed — never at its
243
243
  * start — so while the turn runs the conversation is still unread and its
244
- * card still on the tray; the line says so, names the conversation to open,
245
- * and says the verdict is taken care of (recording it in the turn as well is
246
- * idempotent).
244
+ * card still on the tray; the line says so and names the conversation to
245
+ * open. The model may record its own verdict in the turn (the served texts
246
+ * tell it to record `reply` after its send, or `dismiss` when it read and
247
+ * chose not to answer); the invoker then records nothing more for it. Only
248
+ * a turn that recorded none gets `reply` from the host when it completes.
247
249
  */
248
250
  declare function wakeTurnPrompt(texts: Pick<Texts, 'wake_instruction'>, conversationId?: string): string;
249
251
  /** The prompt a group-invite turn starts with: the served invite prompt. */
package/dist/index.js CHANGED
@@ -119,7 +119,7 @@ var AgentChatChannelError = class extends Error {
119
119
  };
120
120
 
121
121
  // src/version.ts
122
- var PACKAGE_VERSION = "0.9.1";
122
+ var PACKAGE_VERSION = "0.9.2";
123
123
 
124
124
  // src/client-identity.ts
125
125
  var AGENTCHAT_CLIENT_NAME = "openclaw";
@@ -423,7 +423,7 @@ function wakeTurnPrompt(texts, conversationId) {
423
423
  ${conversationLine(conversationId)}`;
424
424
  }
425
425
  function conversationLine(conversationId) {
426
- 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.`;
426
+ 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.`;
427
427
  }
428
428
  function inviteTurnPrompt(texts) {
429
429
  return texts.invite_prompt.trim();
@@ -2901,6 +2901,13 @@ var AgentInvoker = class {
2901
2901
  );
2902
2902
  return;
2903
2903
  }
2904
+ if (await this.decidedInTurn(reply)) {
2905
+ this.logger.info(
2906
+ { sessionKey, conversationId: reply.conversationId },
2907
+ "the turn recorded its own verdict \u2014 reply not recorded again"
2908
+ );
2909
+ return;
2910
+ }
2904
2911
  await this.recordReply(sessionKey, reply);
2905
2912
  } finally {
2906
2913
  this.replyTurnEnded(reply.conversationId);
@@ -2928,6 +2935,28 @@ var AgentInvoker = class {
2928
2935
  this.coalescer.wake();
2929
2936
  }
2930
2937
  }
2938
+ /**
2939
+ * Whether the completed turn recorded a verdict for its conversation
2940
+ * itself, seen on one fresh tray read. A card that left the tray was read
2941
+ * (a verdict or a mark-read) or hidden by a `defer` — by the turn, since
2942
+ * the host had recorded nothing for it. A card still there whose
2943
+ * `your_last_decision` differs from the gate's copy got a verdict in the
2944
+ * turn (a newer message keeps it on the tray). A card still there,
2945
+ * unchanged, got nothing. A failed read, or a missing card past a
2946
+ * truncated tray, claims nothing: `reply` is recorded as before.
2947
+ */
2948
+ async decidedInTurn(reply) {
2949
+ let tray;
2950
+ try {
2951
+ tray = await this.client.inbox.tray({ waitMs: 0, limit: POST_TURN_TRAY_LIMIT });
2952
+ } catch (err) {
2953
+ this.logger.info({ conversationId: reply.conversationId, err: describe4(err) }, "tray re-read after the turn failed \u2014 recording reply");
2954
+ return false;
2955
+ }
2956
+ const card = gate.cardsOf(tray).find((c) => c.conversation_id === reply.conversationId);
2957
+ if (!card) return tray.truncated !== true;
2958
+ return lastDecisionAt(card) !== lastDecisionAt(reply.card);
2959
+ }
2931
2960
  /** The `reply` verdict for a completed turn. A record the server refuses leaves the conversation unread; the ladder re-wakes. */
2932
2961
  async recordReply(sessionKey, reply) {
2933
2962
  try {
@@ -2993,6 +3022,11 @@ var AgentInvoker = class {
2993
3022
  }
2994
3023
  }
2995
3024
  };
3025
+ var POST_TURN_TRAY_LIMIT = 50;
3026
+ function lastDecisionAt(card) {
3027
+ const at = card.your_last_decision?.at;
3028
+ return typeof at === "string" && at.length > 0 ? at : null;
3029
+ }
2996
3030
  function describe4(err) {
2997
3031
  return err instanceof Error ? err.message : String(err);
2998
3032
  }