@ronakgajjar/paperclip-plugin-gchat 0.1.0 → 0.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ronakgajjar/paperclip-plugin-gchat",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "description": "A Paperclip plugin",
6
6
  "scripts": {
@@ -40,5 +40,9 @@
40
40
  },
41
41
  "allowScripts": {
42
42
  "esbuild@0.27.7": true
43
- }
43
+ },
44
+ "files": [
45
+ "dist",
46
+ "README.md"
47
+ ]
44
48
  }
@@ -1,17 +0,0 @@
1
- import esbuild from "esbuild";
2
- import { createPluginBundlerPresets } from "@paperclipai/plugin-sdk/bundlers";
3
-
4
- const presets = createPluginBundlerPresets({ uiEntry: "src/ui/index.tsx" });
5
- const watch = process.argv.includes("--watch");
6
-
7
- const workerCtx = await esbuild.context(presets.esbuild.worker);
8
- const manifestCtx = await esbuild.context(presets.esbuild.manifest);
9
- const uiCtx = await esbuild.context(presets.esbuild.ui);
10
-
11
- if (watch) {
12
- await Promise.all([workerCtx.watch(), manifestCtx.watch(), uiCtx.watch()]);
13
- console.log("esbuild watch mode enabled for worker, manifest, and ui");
14
- } else {
15
- await Promise.all([workerCtx.rebuild(), manifestCtx.rebuild(), uiCtx.rebuild()]);
16
- await Promise.all([workerCtx.dispose(), manifestCtx.dispose(), uiCtx.dispose()]);
17
- }
package/rollup.config.mjs DELETED
@@ -1,28 +0,0 @@
1
- import { nodeResolve } from "@rollup/plugin-node-resolve";
2
- import typescript from "@rollup/plugin-typescript";
3
- import { createPluginBundlerPresets } from "@paperclipai/plugin-sdk/bundlers";
4
-
5
- const presets = createPluginBundlerPresets({ uiEntry: "src/ui/index.tsx" });
6
-
7
- function withPlugins(config) {
8
- if (!config) return null;
9
- return {
10
- ...config,
11
- plugins: [
12
- nodeResolve({
13
- extensions: [".ts", ".tsx", ".js", ".jsx", ".mjs"],
14
- }),
15
- typescript({
16
- tsconfig: "./tsconfig.json",
17
- declaration: false,
18
- declarationMap: false,
19
- }),
20
- ],
21
- };
22
- }
23
-
24
- export default [
25
- withPlugins(presets.rollup.manifest),
26
- withPlugins(presets.rollup.worker),
27
- withPlugins(presets.rollup.ui),
28
- ].filter(Boolean);
package/src/manifest.ts DELETED
@@ -1,33 +0,0 @@
1
- import type { PaperclipPluginManifestV1 } from "@paperclipai/plugin-sdk";
2
-
3
- const manifest: PaperclipPluginManifestV1 = {
4
- id: "paperclip-plugin-gchat",
5
- apiVersion: 1,
6
- version: "0.1.0",
7
- displayName: "Google Chat Notifier",
8
- description: "Sends agent output to a Google Chat space via webhook",
9
- author: "Your Name",
10
- categories: ["connector"],
11
- capabilities: [
12
- "events.subscribe",
13
- "plugin.state.read",
14
- "plugin.state.write",
15
- "secrets.read",
16
- "ui.dashboardWidget.register"
17
- ],
18
- entrypoints: {
19
- worker: "./dist/worker.js",
20
- ui: "./dist/ui"
21
- },
22
- ui: {
23
- slots: [
24
- {
25
- type: "dashboardWidget",
26
- id: "health-widget",
27
- displayName: "Google Chat Plugin Health",
28
- exportName: "DashboardWidget"
29
- }
30
- ]
31
- }
32
- };
33
- export default manifest;
package/src/ui/index.tsx DELETED
@@ -1,23 +0,0 @@
1
- import { usePluginAction, usePluginData, type PluginWidgetProps } from "@paperclipai/plugin-sdk/ui";
2
-
3
- type HealthData = {
4
- status: "ok" | "degraded" | "error";
5
- checkedAt: string;
6
- };
7
-
8
- export function DashboardWidget(_props: PluginWidgetProps) {
9
- const { data, loading, error } = usePluginData<HealthData>("health");
10
- const ping = usePluginAction("ping");
11
-
12
- if (loading) return <div>Loading plugin health...</div>;
13
- if (error) return <div>Plugin error: {error.message}</div>;
14
-
15
- return (
16
- <div style={{ display: "grid", gap: "0.5rem" }}>
17
- <strong>My Gchat Plugin</strong>
18
- <div>Health: {data?.status ?? "unknown"}</div>
19
- <div>Checked: {data?.checkedAt ?? "never"}</div>
20
- <button onClick={() => void ping()}>Ping Worker</button>
21
- </div>
22
- );
23
- }
package/src/worker.ts DELETED
@@ -1,27 +0,0 @@
1
- import { definePlugin, runWorker } from "@paperclipai/plugin-sdk";
2
-
3
- const plugin = definePlugin({
4
- async setup(ctx) {
5
- ctx.actions.register("send_google_chat", async (params) => {
6
- const { message } = params as { message: string };
7
- const webhookUrl = await ctx.secrets.get("GOOGLE_CHAT_WEBHOOK_URL");
8
- const res = await fetch(webhookUrl, {
9
- method: "POST",
10
- headers: { "Content-Type": "application/json" },
11
- body: JSON.stringify({ text: message })
12
- });
13
- ctx.logger.info("Sent Google Chat message", { ok: res.ok });
14
- return { sent: res.ok };
15
- });
16
-
17
- ctx.data.register("health", async () => {
18
- return { status: "ok", checkedAt: new Date().toISOString() };
19
- });
20
- },
21
- async onHealth() {
22
- return { status: "ok", message: "Google Chat plugin worker is running" };
23
- }
24
- });
25
-
26
- export default plugin;
27
- runWorker(plugin, import.meta.url);
@@ -1,25 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { createTestHarness } from "@paperclipai/plugin-sdk/testing";
3
- import manifest from "../src/manifest.js";
4
- import plugin from "../src/worker.js";
5
-
6
- describe("plugin scaffold", () => {
7
- it("declares capabilities for its manifest features", () => {
8
- expect(manifest.capabilities).toContain("events.subscribe");
9
- expect(manifest.capabilities).toContain("ui.dashboardWidget.register");
10
- });
11
-
12
- it("registers data + actions and handles events", async () => {
13
- const harness = createTestHarness({ manifest, capabilities: [...manifest.capabilities, "events.emit"] });
14
- await plugin.definition.setup(harness.ctx);
15
-
16
- await harness.emit("issue.created", { issueId: "iss_1" }, { entityId: "iss_1", entityType: "issue" });
17
- expect(harness.getState({ scopeKind: "issue", scopeId: "iss_1", stateKey: "seen" })).toBe(true);
18
-
19
- const data = await harness.getData<{ status: string }>("health");
20
- expect(data.status).toBe("ok");
21
-
22
- const action = await harness.performAction<{ pong: boolean }>("ping");
23
- expect(action.pong).toBe(true);
24
- });
25
- });
package/tsconfig.json DELETED
@@ -1,27 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "NodeNext",
5
- "moduleResolution": "NodeNext",
6
- "lib": [
7
- "ES2022",
8
- "DOM"
9
- ],
10
- "jsx": "react-jsx",
11
- "strict": true,
12
- "skipLibCheck": true,
13
- "declaration": true,
14
- "declarationMap": true,
15
- "sourceMap": true,
16
- "outDir": "dist",
17
- "rootDir": "."
18
- },
19
- "include": [
20
- "src",
21
- "tests"
22
- ],
23
- "exclude": [
24
- "dist",
25
- "node_modules"
26
- ]
27
- }
package/vitest.config.ts DELETED
@@ -1,8 +0,0 @@
1
- import { defineConfig } from "vitest/config";
2
-
3
- export default defineConfig({
4
- test: {
5
- include: ["tests/**/*.spec.ts"],
6
- environment: "node",
7
- },
8
- });