paperclip-plugin-mattermost 0.11.1 → 0.11.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/dist/manifest.js CHANGED
@@ -2,7 +2,7 @@
2
2
  var manifest = {
3
3
  id: "mattermost-bridge",
4
4
  apiVersion: 1,
5
- version: "0.11.1",
5
+ version: "0.11.2",
6
6
  displayName: "Mattermost",
7
7
  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.",
8
8
  author: "Haseeb Azhar",
package/dist/worker.js CHANGED
@@ -45683,7 +45683,7 @@ var AgentBots = class {
45683
45683
  var manifest = {
45684
45684
  id: "mattermost-bridge",
45685
45685
  apiVersion: 1,
45686
- version: "0.11.1",
45686
+ version: "0.11.2",
45687
45687
  displayName: "Mattermost",
45688
45688
  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.",
45689
45689
  author: "Haseeb Azhar",
@@ -45875,12 +45875,19 @@ var Tenant = class {
45875
45875
  await manager.request("PUT", `/posts/${postId}/patch`, { message: message2, props: this.tag(props) });
45876
45876
  },
45877
45877
  async channel(name) {
45878
- for (const team of await manager.request("GET", "/users/me/teams")) {
45878
+ const wanted = name.replace(/^[#~]/, "").trim();
45879
+ const teams = await manager.request("GET", "/users/me/teams");
45880
+ for (const team of teams) {
45879
45881
  try {
45880
- return (await manager.request("GET", `/teams/${team.id}/channels/name/${encodeURIComponent(name.replace(/^[#~]/, ""))}`)).id;
45882
+ return (await manager.request("GET", `/teams/${team.id}/channels/name/${encodeURIComponent(wanted.toLowerCase())}`)).id;
45881
45883
  } catch {
45882
45884
  }
45883
45885
  }
45886
+ for (const team of teams) {
45887
+ const list = await manager.request("GET", `/teams/${team.id}/channels?per_page=200`).catch(() => []);
45888
+ const hit = list.find((ch) => ch.display_name.trim().toLowerCase() === wanted.toLowerCase());
45889
+ if (hit) return hit.id;
45890
+ }
45884
45891
  return null;
45885
45892
  },
45886
45893
  async email(userId) {
@@ -46044,6 +46051,9 @@ async function saveBoot(companyId, config2) {
46044
46051
  await ctx.state.set(BOOT, all);
46045
46052
  }
46046
46053
  var plugin = definePlugin({
46054
+ // One worker serves every company, each with its own Mattermost (Tenant above).
46055
+ // Without this Paperclip refuses a second company's settings as a cross-tenant risk.
46056
+ multiCompanyConfig: true,
46047
46057
  async setup(c) {
46048
46058
  ctx = c;
46049
46059
  ctx.data.register("setup", async (params) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paperclip-plugin-mattermost",
3
- "version": "0.11.1",
3
+ "version": "0.11.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",