@ronakgajjar/paperclip-plugin-gchat 0.1.7 → 0.1.8

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
@@ -7,7 +7,7 @@ var manifest = {
7
7
  description: "Sends agent run summaries to a Google Chat space via webhook",
8
8
  author: "Your Name",
9
9
  categories: ["connector"],
10
- capabilities: ["events.subscribe", "http.outbound", "plugin.state.read", "plugin.state.write", "ui.dashboardWidget.register"],
10
+ capabilities: ["events.subscribe", "http.outbound", "plugin.state.read", "plugin.state.write", "issue.documents.read", "ui.dashboardWidget.register"],
11
11
  instanceConfigSchema: {
12
12
  type: "object",
13
13
  properties: {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/manifest.ts"],
4
- "sourcesContent": ["import type { PaperclipPluginManifestV1 } from \"@paperclipai/plugin-sdk\";\n\nconst manifest: PaperclipPluginManifestV1 = {\n id: \"paperclip-plugin-gchat\",\n apiVersion: 1,\n version: \"0.1.5\",\n displayName: \"Google Chat Notifier\",\n description: \"Sends agent run summaries to a Google Chat space via webhook\",\n author: \"Your Name\",\n categories: [\"connector\"],\n capabilities: [\"events.subscribe\", \"http.outbound\", \"plugin.state.read\", \"plugin.state.write\", \"ui.dashboardWidget.register\"],\n instanceConfigSchema: {\n type: \"object\",\n properties: {\n webhookUrl: { type: \"string\", title: \"Google Chat Webhook URL\" }\n },\n required: [\"webhookUrl\"]\n },\n entrypoints: { worker: \"./dist/worker.js\", ui: \"./dist/ui\" },\n ui: {\n slots: [{ type: \"dashboardWidget\", id: \"health-widget\", displayName: \"Google Chat Plugin Health\", exportName: \"DashboardWidget\" }]\n }\n};\nexport default manifest;\n"],
5
- "mappings": ";AAEA,IAAM,WAAsC;AAAA,EAC1C,IAAI;AAAA,EACJ,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,aAAa;AAAA,EACb,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,YAAY,CAAC,WAAW;AAAA,EACxB,cAAc,CAAC,oBAAoB,iBAAiB,qBAAqB,sBAAsB,6BAA6B;AAAA,EAC5H,sBAAsB;AAAA,IACpB,MAAM;AAAA,IACN,YAAY;AAAA,MACV,YAAY,EAAE,MAAM,UAAU,OAAO,0BAA0B;AAAA,IACjE;AAAA,IACA,UAAU,CAAC,YAAY;AAAA,EACzB;AAAA,EACA,aAAa,EAAE,QAAQ,oBAAoB,IAAI,YAAY;AAAA,EAC3D,IAAI;AAAA,IACF,OAAO,CAAC,EAAE,MAAM,mBAAmB,IAAI,iBAAiB,aAAa,6BAA6B,YAAY,kBAAkB,CAAC;AAAA,EACnI;AACF;AACA,IAAO,mBAAQ;",
4
+ "sourcesContent": ["import type { PaperclipPluginManifestV1 } from \"@paperclipai/plugin-sdk\";\n\nconst manifest: PaperclipPluginManifestV1 = {\n id: \"paperclip-plugin-gchat\",\n apiVersion: 1,\n version: \"0.1.5\",\n displayName: \"Google Chat Notifier\",\n description: \"Sends agent run summaries to a Google Chat space via webhook\",\n author: \"Your Name\",\n categories: [\"connector\"],\n capabilities: [\"events.subscribe\", \"http.outbound\", \"plugin.state.read\", \"plugin.state.write\", \"issue.documents.read\", \"ui.dashboardWidget.register\"],\n instanceConfigSchema: {\n type: \"object\",\n properties: {\n webhookUrl: { type: \"string\", title: \"Google Chat Webhook URL\" }\n },\n required: [\"webhookUrl\"]\n },\n entrypoints: { worker: \"./dist/worker.js\", ui: \"./dist/ui\" },\n ui: {\n slots: [{ type: \"dashboardWidget\", id: \"health-widget\", displayName: \"Google Chat Plugin Health\", exportName: \"DashboardWidget\" }]\n }\n};\nexport default manifest;\n"],
5
+ "mappings": ";AAEA,IAAM,WAAsC;AAAA,EAC1C,IAAI;AAAA,EACJ,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,aAAa;AAAA,EACb,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,YAAY,CAAC,WAAW;AAAA,EACxB,cAAc,CAAC,oBAAoB,iBAAiB,qBAAqB,sBAAsB,wBAAwB,6BAA6B;AAAA,EACpJ,sBAAsB;AAAA,IACpB,MAAM;AAAA,IACN,YAAY;AAAA,MACV,YAAY,EAAE,MAAM,UAAU,OAAO,0BAA0B;AAAA,IACjE;AAAA,IACA,UAAU,CAAC,YAAY;AAAA,EACzB;AAAA,EACA,aAAa,EAAE,QAAQ,oBAAoB,IAAI,YAAY;AAAA,EAC3D,IAAI;AAAA,IACF,OAAO,CAAC,EAAE,MAAM,mBAAmB,IAAI,iBAAiB,aAAa,6BAA6B,YAAY,kBAAkB,CAAC;AAAA,EACnI;AACF;AACA,IAAO,mBAAQ;",
6
6
  "names": []
7
7
  }
package/dist/worker.js CHANGED
@@ -29354,20 +29354,35 @@ var plugin = definePlugin({
29354
29354
  const agent = await ctx.agents.get(event.entityId, event.companyId);
29355
29355
  if (agent?.name) agentName = agent.name;
29356
29356
  }
29357
- } catch (err) {
29358
- ctx.logger.warn("Could not resolve agent name", { error: String(err) });
29357
+ } catch {
29359
29358
  }
29360
29359
  const status = p?.status ?? "finished a run";
29361
29360
  const taskId = p?.issueId ?? p?.taskId;
29362
29361
  let taskTitle;
29362
+ let reportBody;
29363
29363
  if (taskId) {
29364
29364
  try {
29365
29365
  const issue2 = await ctx.issues.get(taskId, event.companyId);
29366
29366
  taskTitle = issue2?.title;
29367
29367
  } catch {
29368
29368
  }
29369
+ try {
29370
+ const docs = await ctx.issues.documents.list(taskId, event.companyId);
29371
+ if (docs.length > 0) {
29372
+ const latest = docs[docs.length - 1];
29373
+ const full = await ctx.issues.documents.get(taskId, latest.key, event.companyId);
29374
+ reportBody = full?.body;
29375
+ }
29376
+ } catch {
29377
+ }
29378
+ }
29379
+ let text = taskTitle ? `*${agentName}* ${status}: ${taskTitle}` : `*${agentName}* ${status}.`;
29380
+ if (reportBody) {
29381
+ const trimmed = reportBody.length > 3500 ? reportBody.slice(0, 3500) + "\n...(truncated)" : reportBody;
29382
+ text += `
29383
+
29384
+ ${trimmed}`;
29369
29385
  }
29370
- const text = taskTitle ? `*${agentName}* ${status}: ${taskTitle}` : `*${agentName}* ${status}.`;
29371
29386
  await fetch(webhookUrl, {
29372
29387
  method: "POST",
29373
29388
  headers: { "Content-Type": "application/json" },