clearclaw 0.6.0 → 0.6.1

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.
@@ -168,6 +168,19 @@ export class SlackChannel extends EventEmitter {
168
168
  const chunks = splitMessage(text);
169
169
  const handles = [];
170
170
  const threadTs = opts?.replyToMessageId;
171
+ /** Post a chunk with mrkdwn blocks, falling back to plain text on failure. */
172
+ const postChunk = async (chunk, extra = {}) => {
173
+ const blocks = mrkdwnBlocks(chunk);
174
+ try {
175
+ const r = await this.app.client.chat.postMessage({ channel, text: chunk, blocks, ...extra });
176
+ return r.ts;
177
+ }
178
+ catch {
179
+ log.warn("[channel] postMessage failed with mrkdwn, retrying as plain text");
180
+ const r = await this.app.client.chat.postMessage({ channel, text: chunk, ...extra });
181
+ return r.ts;
182
+ }
183
+ };
171
184
  // Consume typing placeholder only when not posting as a thread reply
172
185
  const consumeTyping = !threadTs && opts?.consumeTyping !== false;
173
186
  const typingTs = consumeTyping ? this.typingMessageTs.get(chatId) : undefined;
@@ -182,22 +195,16 @@ export class SlackChannel extends EventEmitter {
182
195
  handles.push(typingTs);
183
196
  }
184
197
  catch {
185
- // Placeholder was deleted externally — fall back to posting
186
- const result = await this.app.client.chat.postMessage({
187
- channel, text: firstChunk, blocks,
188
- });
189
- if (result.ts)
190
- handles.push(result.ts);
198
+ // Placeholder was deleted externally or mrkdwn invalid — post instead
199
+ const ts = await postChunk(firstChunk);
200
+ if (ts)
201
+ handles.push(ts);
191
202
  }
192
203
  }
193
204
  for (const chunk of chunks) {
194
- const blocks = mrkdwnBlocks(chunk);
195
- const result = await this.app.client.chat.postMessage({
196
- channel, text: chunk, blocks,
197
- ...(threadTs && { thread_ts: threadTs }),
198
- });
199
- if (result.ts)
200
- handles.push(result.ts);
205
+ const ts = await postChunk(chunk, threadTs ? { thread_ts: threadTs } : {});
206
+ if (ts)
207
+ handles.push(ts);
201
208
  }
202
209
  return handles;
203
210
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clearclaw",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Your coding agent, from your phone — personal assistant + project workspaces on your machine, built on the CLI's permissions, config, and memory instead of replacing them.",
5
5
  "type": "module",
6
6
  "license": "MIT",