@pnds/pond 0.2.0 → 1.0.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnds/pond",
3
- "version": "0.2.0",
3
+ "version": "1.0.0",
4
4
  "description": "OpenClaw channel plugin for Pond IM",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -14,7 +14,7 @@
14
14
  "openclaw.plugin.json"
15
15
  ],
16
16
  "dependencies": {
17
- "@pnds/sdk": "^0.1.1"
17
+ "@pnds/sdk": "1.0.0"
18
18
  },
19
19
  "devDependencies": {
20
20
  "typescript": "^5.7.0"
package/src/gateway.ts CHANGED
@@ -56,6 +56,7 @@ async function dispatchToAgent(opts: {
56
56
  }) {
57
57
  const { core, cfg, client, config, agentUserId, accountId, chatId, messageId, inboundCtx, log } = opts;
58
58
  let thinkingSent = false;
59
+ let runIdPromise: Promise<string | undefined> | undefined;
59
60
  try {
60
61
  await core.channel.reply.dispatchReplyWithBufferedBlockDispatcher({
61
62
  ctx: inboundCtx,
@@ -64,15 +65,18 @@ async function dispatchToAgent(opts: {
64
65
  deliver: async (payload: { text?: string }) => {
65
66
  const replyText = payload.text?.trim();
66
67
  if (!replyText) return;
68
+ // Wait for run creation to complete before sending
69
+ const runId = runIdPromise ? await runIdPromise : undefined;
67
70
  await client.sendMessage(config.org_id, chatId, {
68
71
  message_type: "text",
69
72
  content: { text: replyText },
73
+ agent_run_id: runId,
70
74
  });
71
75
  },
72
76
  onReplyStart: () => {
73
77
  if (thinkingSent) return;
74
78
  thinkingSent = true;
75
- (async () => {
79
+ runIdPromise = (async () => {
76
80
  try {
77
81
  const run = await client.createAgentRun(config.org_id, agentUserId, {
78
82
  trigger_type: "mention",
@@ -85,8 +89,10 @@ async function dispatchToAgent(opts: {
85
89
  step_type: "thinking",
86
90
  content: { text: "" },
87
91
  });
92
+ return run.id;
88
93
  } catch (err) {
89
94
  log?.warn(`pond[${accountId}]: failed to create agent run: ${String(err)}`);
95
+ return undefined;
90
96
  }
91
97
  })();
92
98
  },
package/src/outbound.ts CHANGED
@@ -25,6 +25,7 @@ export const pondOutbound: ChannelOutboundAdapter = {
25
25
  const req: SendMessageRequest = {
26
26
  message_type: "text",
27
27
  content: { text },
28
+ agent_run_id: state?.activeRunId,
28
29
  };
29
30
  const msg = await client.sendMessage(orgId, chatId, req);
30
31
  return { channel: "pond", messageId: msg.id, channelId: chatId };