paperclip-plugin-mattermost 0.18.1 → 0.18.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/README.md CHANGED
@@ -85,7 +85,7 @@ PAPERCLIP_REF=<commit> node build.mjs # build for another Paperclip version
85
85
  Bump `version` in `package.json` and `src/manifest.ts`, commit, then tag and push:
86
86
 
87
87
  ```bash
88
- git tag -a v0.18.1 -m v0.18.1 && git push origin main v0.18.1
88
+ git tag -a v0.18.2 -m v0.18.2 && git push origin main v0.18.2
89
89
  ```
90
90
 
91
91
  GitHub Actions builds, tests and publishes to npm through npm trusted publishing, so no npm token is involved.
package/dist/manifest.js CHANGED
@@ -84,7 +84,7 @@ var route = (routeKey, method, path) => ({ routeKey, method, path, auth: "agent"
84
84
  var manifest = {
85
85
  id: "mattermost-bridge",
86
86
  apiVersion: 1,
87
- version: "0.18.1",
87
+ version: "0.18.2",
88
88
  displayName: "Mattermost",
89
89
  description: "Every agent becomes its own Mattermost bot. DM an agent or mention it in a channel and it answers in the thread, showing its steps as it works; follow-ups continue the conversation. Paperclip approvals arrive with Approve / Reject buttons.",
90
90
  author: "Haseeb Azhar",
package/dist/worker.js CHANGED
@@ -45383,11 +45383,16 @@ var WorkLinks = class {
45383
45383
  const c = (await this.d.comments(issueId)).find((x) => x.id === commentId);
45384
45384
  if (!c?.body?.trim()) return;
45385
45385
  const body = c.body.trim().slice(0, 12e3);
45386
- const own2 = c.authorAgentId && this.d.hasBot(c.authorAgentId);
45387
- const text2 = own2 ? body : `**${c.authorAgentId ? this.d.agentName(c.authorAgentId) : "A team member"}** commented on ${this.label(hit.link)}:
45386
+ const quoted = `**${c.authorAgentId ? this.d.agentName(c.authorAgentId) : "A team member"}** commented on ${this.label(hit.link)}:
45388
45387
 
45389
45388
  ${body}`;
45390
- await this.d.post(own2 ? c.authorAgentId : hit.link.agentId, hit.channelId, "", text2);
45389
+ if (c.authorAgentId && c.authorAgentId !== hit.link.agentId && this.d.hasBot(c.authorAgentId)) {
45390
+ try {
45391
+ return await this.d.post(c.authorAgentId, hit.channelId, "", body);
45392
+ } catch {
45393
+ }
45394
+ }
45395
+ await this.d.post(hit.link.agentId, hit.channelId, "", c.authorAgentId === hit.link.agentId ? body : quoted);
45391
45396
  }
45392
45397
  /**
45393
45398
  * A task asked for in a Mattermost thread (created by the agent while answering there): when it is
@@ -45399,14 +45404,20 @@ ${body}`;
45399
45404
  if (!at) return;
45400
45405
  const task2 = await this.d.task(issueId);
45401
45406
  if (!task2 || task2.status === at.status || !THREAD_REPORTS[task2.status]) return;
45407
+ const by = [at.agentId, task2.assigneeAgentId].find((a) => Boolean(a && this.d.hasBot(a)));
45408
+ if (!by) return;
45402
45409
  await this.d.store.set(`issuethread:${issueId}`, { ...at, status: task2.status });
45403
45410
  const last = (await this.d.comments(issueId)).at(-1)?.body?.trim();
45404
45411
  const outcome = last ? `
45405
45412
 
45406
45413
  ${last.length > 3e3 ? last.slice(0, 3e3) + "\u2026" : last}` : "";
45407
- const by = [task2.assigneeAgentId, at.agentId].find((a) => Boolean(a && this.d.hasBot(a)));
45408
- if (!by) return;
45409
- await this.d.post(by, at.channelId, at.rootId, `${THREAD_REPORTS[task2.status]} **${task2.identifier ?? "The task"}** ${task2.title}${outcome}`);
45414
+ const doer = task2.assigneeAgentId && task2.assigneeAgentId !== by ? ` _(by ${this.d.agentName(task2.assigneeAgentId)})_` : "";
45415
+ try {
45416
+ await this.d.post(by, at.channelId, at.rootId, `${THREAD_REPORTS[task2.status]} **${task2.identifier ?? "The task"}** ${task2.title}${doer}${outcome}`);
45417
+ } catch (err) {
45418
+ await this.d.store.set(`issuethread:${issueId}`, at);
45419
+ throw err;
45420
+ }
45410
45421
  }
45411
45422
  /** The task changed: note a new status; on done or cancelled, archive and report back. */
45412
45423
  async updated(issueId) {
@@ -46365,7 +46376,7 @@ var route = (routeKey, method, path3) => ({ routeKey, method, path: path3, auth:
46365
46376
  var manifest = {
46366
46377
  id: "mattermost-bridge",
46367
46378
  apiVersion: 1,
46368
- version: "0.18.1",
46379
+ version: "0.18.2",
46369
46380
  displayName: "Mattermost",
46370
46381
  description: "Every agent becomes its own Mattermost bot. DM an agent or mention it in a channel and it answers in the thread, showing its steps as it works; follow-ups continue the conversation. Paperclip approvals arrive with Approve / Reject buttons.",
46371
46382
  author: "Haseeb Azhar",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paperclip-plugin-mattermost",
3
- "version": "0.18.1",
3
+ "version": "0.18.2",
4
4
  "description": "Paperclip agents in Mattermost: a bot per agent, live progress, files, approval and decision buttons, and per-person access, for each Paperclip company.",
5
5
  "type": "module",
6
6
  "license": "MIT",