@openclawcity/openclawcity 1.0.12 → 1.0.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.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
2
+ export declare function sanitizeReplyText(text: string): string | null;
2
3
  declare const plugin: {
3
4
  id: string;
4
5
  name: string;
package/dist/index.js CHANGED
@@ -4085,6 +4085,12 @@ function deriveApiBase(gatewayUrl) {
4085
4085
  return DEFAULT_API_BASE;
4086
4086
  }
4087
4087
  }
4088
+ var TOOL_CALL_MARKUP_RE = /<PLHD\d*>[\s\S]*?<PLHD\d*>/g;
4089
+ function sanitizeReplyText(text) {
4090
+ let cleaned = text.replace(TOOL_CALL_MARKUP_RE, "");
4091
+ cleaned = cleaned.trim();
4092
+ return cleaned || null;
4093
+ }
4088
4094
  var adapters = /* @__PURE__ */ new Map();
4089
4095
  var heartbeatCache = /* @__PURE__ */ new Map();
4090
4096
  async function fetchHeartbeatContext(apiBase, jwt, accountId, log) {
@@ -4156,10 +4162,13 @@ var occPlugin = {
4156
4162
  if (!adapter) {
4157
4163
  return { ok: false };
4158
4164
  }
4165
+ const text = sanitizeReplyText(ctx.text ?? "");
4166
+ if (!text)
4167
+ return { ok: true };
4159
4168
  const reply = {
4160
4169
  type: "agent_reply",
4161
4170
  action: "dm_reply",
4162
- text: ctx.text,
4171
+ text,
4163
4172
  conversationId: ctx.to
4164
4173
  };
4165
4174
  adapter.sendReply(reply);
@@ -4269,8 +4278,12 @@ ${envelope.content.text}`;
4269
4278
  ctx: msgCtx,
4270
4279
  cfg,
4271
4280
  dispatcherOptions: {
4272
- deliver: async (payload) => {
4273
- const text = payload.text;
4281
+ deliver: async (payload, info) => {
4282
+ if (info.kind === "tool") {
4283
+ log?.info?.(`[OCC] Deliver callback: skipping tool-kind payload`);
4284
+ return;
4285
+ }
4286
+ const text = sanitizeReplyText(payload.text ?? "");
4274
4287
  log?.info?.(`[OCC] Deliver callback: text=${text ? text.slice(0, 80) + "..." : "(empty)"}`);
4275
4288
  if (!text)
4276
4289
  return;
@@ -4389,5 +4402,6 @@ var plugin = {
4389
4402
  };
4390
4403
  var index_default = plugin;
4391
4404
  export {
4392
- index_default as default
4405
+ index_default as default,
4406
+ sanitizeReplyText
4393
4407
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclawcity/openclawcity",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "OpenClawCity channel plugin for OpenClaw — live city events for AI agents",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",