paperclip-plugin-mattermost 0.18.2 → 0.18.3

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.2 -m v0.18.2 && git push origin main v0.18.2
88
+ git tag -a v0.18.3 -m v0.18.3 && git push origin main v0.18.3
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.2",
87
+ version: "0.18.3",
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
@@ -45365,6 +45365,8 @@ var STATUS_WORDS = {
45365
45365
  };
45366
45366
  var WorkLinks = class {
45367
45367
  d;
45368
+ /** One task's updates, one at a time: Paperclip sends several at once and each would report the change. */
45369
+ queue = /* @__PURE__ */ new Map();
45368
45370
  constructor(deps) {
45369
45371
  this.d = deps;
45370
45372
  }
@@ -45394,12 +45396,25 @@ ${body}`;
45394
45396
  }
45395
45397
  await this.d.post(hit.link.agentId, hit.channelId, "", c.authorAgentId === hit.link.agentId ? body : quoted);
45396
45398
  }
45399
+ serial(key, run) {
45400
+ const next = (this.queue.get(key) ?? Promise.resolve()).catch(() => {
45401
+ }).then(run);
45402
+ this.queue.set(key, next);
45403
+ void next.catch(() => {
45404
+ }).finally(() => {
45405
+ if (this.queue.get(key) === next) this.queue.delete(key);
45406
+ });
45407
+ return next;
45408
+ }
45397
45409
  /**
45398
45410
  * A task asked for in a Mattermost thread (created by the agent while answering there): when it is
45399
45411
  * done, cancelled or blocked, its outcome (the last comment) is posted back in that thread, so the
45400
45412
  * result always reaches the conversation it came from.
45401
45413
  */
45402
- async threadUpdate(issueId) {
45414
+ threadUpdate(issueId) {
45415
+ return this.serial(`thread:${issueId}`, () => this.reportToThread(issueId));
45416
+ }
45417
+ async reportToThread(issueId) {
45403
45418
  const at = await this.d.store.get(`issuethread:${issueId}`);
45404
45419
  if (!at) return;
45405
45420
  const task2 = await this.d.task(issueId);
@@ -45420,7 +45435,10 @@ ${last.length > 3e3 ? last.slice(0, 3e3) + "\u2026" : last}` : "";
45420
45435
  }
45421
45436
  }
45422
45437
  /** The task changed: note a new status; on done or cancelled, archive and report back. */
45423
- async updated(issueId) {
45438
+ updated(issueId) {
45439
+ return this.serial(`link:${issueId}`, () => this.followLink(issueId));
45440
+ }
45441
+ async followLink(issueId) {
45424
45442
  const hit = await this.linked(issueId);
45425
45443
  if (!hit) return;
45426
45444
  const task2 = await this.d.task(issueId);
@@ -46376,7 +46394,7 @@ var route = (routeKey, method, path3) => ({ routeKey, method, path: path3, auth:
46376
46394
  var manifest = {
46377
46395
  id: "mattermost-bridge",
46378
46396
  apiVersion: 1,
46379
- version: "0.18.2",
46397
+ version: "0.18.3",
46380
46398
  displayName: "Mattermost",
46381
46399
  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.",
46382
46400
  author: "Haseeb Azhar",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paperclip-plugin-mattermost",
3
- "version": "0.18.2",
3
+ "version": "0.18.3",
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",