@ronakgajjar/paperclip-plugin-gchat 0.1.2 → 0.1.4
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 +8 -10
- package/dist/manifest.js.map +2 -2
- package/dist/worker.js +9 -5
- package/dist/worker.js.map +2 -2
- package/package.json +1 -1
package/dist/manifest.js
CHANGED
|
@@ -4,18 +4,16 @@ var manifest = {
|
|
|
4
4
|
apiVersion: 1,
|
|
5
5
|
version: "0.1.0",
|
|
6
6
|
displayName: "Google Chat Notifier",
|
|
7
|
-
description: "Sends agent
|
|
7
|
+
description: "Sends agent run summaries to a Google Chat space via webhook",
|
|
8
8
|
author: "Your Name",
|
|
9
9
|
categories: ["connector"],
|
|
10
|
-
capabilities: ["plugin.state.read", "plugin.state.write", "ui.dashboardWidget.register"],
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
required: ["webhookUrl"]
|
|
18
|
-
}
|
|
10
|
+
capabilities: ["events.subscribe", "http.outbound", "plugin.state.read", "plugin.state.write", "ui.dashboardWidget.register"],
|
|
11
|
+
instanceConfigSchema: {
|
|
12
|
+
type: "object",
|
|
13
|
+
properties: {
|
|
14
|
+
webhookUrl: { type: "string", title: "Google Chat Webhook URL" }
|
|
15
|
+
},
|
|
16
|
+
required: ["webhookUrl"]
|
|
19
17
|
},
|
|
20
18
|
entrypoints: { worker: "./dist/worker.js", ui: "./dist/ui" },
|
|
21
19
|
ui: {
|
package/dist/manifest.js.map
CHANGED
|
@@ -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.0\",\n displayName: \"Google Chat Notifier\",\n description: \"Sends agent
|
|
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,qBAAqB,sBAAsB,6BAA6B;AAAA,
|
|
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.0\",\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;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/worker.js
CHANGED
|
@@ -29343,16 +29343,20 @@ function startWorkerRpcHost(options) {
|
|
|
29343
29343
|
// src/worker.ts
|
|
29344
29344
|
var plugin = definePlugin({
|
|
29345
29345
|
async setup(ctx) {
|
|
29346
|
-
ctx.
|
|
29347
|
-
const
|
|
29346
|
+
ctx.events.on("agent.run.finished", async (event) => {
|
|
29347
|
+
const companyId = event.companyId;
|
|
29348
29348
|
const config2 = await ctx.config.get(companyId);
|
|
29349
29349
|
const webhookUrl = config2.webhookUrl;
|
|
29350
|
-
|
|
29350
|
+
if (!webhookUrl) return;
|
|
29351
|
+
const agentName = event.payload?.agentName ?? "An agent";
|
|
29352
|
+
const summary = event.payload?.summary ?? "finished a run.";
|
|
29353
|
+
const text = `*${agentName}*: ${summary}`;
|
|
29354
|
+
await fetch(webhookUrl, {
|
|
29351
29355
|
method: "POST",
|
|
29352
29356
|
headers: { "Content-Type": "application/json" },
|
|
29353
|
-
body: JSON.stringify({ text
|
|
29357
|
+
body: JSON.stringify({ text })
|
|
29354
29358
|
});
|
|
29355
|
-
|
|
29359
|
+
ctx.logger.info("Sent Google Chat notification", { companyId });
|
|
29356
29360
|
});
|
|
29357
29361
|
ctx.data.register("health", async () => ({ status: "ok", checkedAt: (/* @__PURE__ */ new Date()).toISOString() }));
|
|
29358
29362
|
},
|