@omnixal/openclaw-nats-plugin 0.2.1 → 0.2.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.
Files changed (41) hide show
  1. package/cli/setup.ts +27 -0
  2. package/dashboard/bun.lock +253 -0
  3. package/dashboard/components.json +16 -0
  4. package/dashboard/index.html +22 -0
  5. package/dashboard/package.json +24 -0
  6. package/dashboard/src/App.svelte +107 -0
  7. package/dashboard/src/app.css +232 -0
  8. package/dashboard/src/lib/ConfigPanel.svelte +35 -0
  9. package/dashboard/src/lib/CronPanel.svelte +255 -0
  10. package/dashboard/src/lib/HealthCards.svelte +68 -0
  11. package/dashboard/src/lib/MetricsPanel.svelte +60 -0
  12. package/dashboard/src/lib/PendingTable.svelte +73 -0
  13. package/dashboard/src/lib/RoutesPanel.svelte +178 -0
  14. package/dashboard/src/lib/ThemeToggle.svelte +54 -0
  15. package/dashboard/src/lib/api.ts +141 -0
  16. package/dashboard/src/lib/components/ui/badge/badge.svelte +50 -0
  17. package/dashboard/src/lib/components/ui/badge/index.ts +2 -0
  18. package/dashboard/src/lib/components/ui/button/button.svelte +82 -0
  19. package/dashboard/src/lib/components/ui/button/index.ts +17 -0
  20. package/dashboard/src/lib/components/ui/card/card-action.svelte +20 -0
  21. package/dashboard/src/lib/components/ui/card/card-content.svelte +15 -0
  22. package/dashboard/src/lib/components/ui/card/card-description.svelte +20 -0
  23. package/dashboard/src/lib/components/ui/card/card-footer.svelte +20 -0
  24. package/dashboard/src/lib/components/ui/card/card-header.svelte +23 -0
  25. package/dashboard/src/lib/components/ui/card/card-title.svelte +20 -0
  26. package/dashboard/src/lib/components/ui/card/card.svelte +23 -0
  27. package/dashboard/src/lib/components/ui/card/index.ts +25 -0
  28. package/dashboard/src/lib/components/ui/table/index.ts +28 -0
  29. package/dashboard/src/lib/components/ui/table/table-body.svelte +20 -0
  30. package/dashboard/src/lib/components/ui/table/table-caption.svelte +20 -0
  31. package/dashboard/src/lib/components/ui/table/table-cell.svelte +23 -0
  32. package/dashboard/src/lib/components/ui/table/table-footer.svelte +20 -0
  33. package/dashboard/src/lib/components/ui/table/table-head.svelte +23 -0
  34. package/dashboard/src/lib/components/ui/table/table-header.svelte +20 -0
  35. package/dashboard/src/lib/components/ui/table/table-row.svelte +23 -0
  36. package/dashboard/src/lib/components/ui/table/table.svelte +22 -0
  37. package/dashboard/src/lib/utils.ts +29 -0
  38. package/dashboard/src/main.ts +7 -0
  39. package/dashboard/tsconfig.json +19 -0
  40. package/dashboard/vite.config.ts +30 -0
  41. package/package.json +5 -4
@@ -0,0 +1,23 @@
1
+ <script lang="ts">
2
+ import { cn, type WithElementRef } from "$lib/utils.js";
3
+ import type { HTMLAttributes } from "svelte/elements";
4
+
5
+ let {
6
+ ref = $bindable(null),
7
+ class: className,
8
+ children,
9
+ ...restProps
10
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
11
+ </script>
12
+
13
+ <div
14
+ bind:this={ref}
15
+ data-slot="card-header"
16
+ class={cn(
17
+ "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
18
+ className
19
+ )}
20
+ {...restProps}
21
+ >
22
+ {@render children?.()}
23
+ </div>
@@ -0,0 +1,20 @@
1
+ <script lang="ts">
2
+ import type { HTMLAttributes } from "svelte/elements";
3
+ import { cn, type WithElementRef } from "$lib/utils.js";
4
+
5
+ let {
6
+ ref = $bindable(null),
7
+ class: className,
8
+ children,
9
+ ...restProps
10
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
11
+ </script>
12
+
13
+ <div
14
+ bind:this={ref}
15
+ data-slot="card-title"
16
+ class={cn("leading-none font-semibold", className)}
17
+ {...restProps}
18
+ >
19
+ {@render children?.()}
20
+ </div>
@@ -0,0 +1,23 @@
1
+ <script lang="ts">
2
+ import type { HTMLAttributes } from "svelte/elements";
3
+ import { cn, type WithElementRef } from "$lib/utils.js";
4
+
5
+ let {
6
+ ref = $bindable(null),
7
+ class: className,
8
+ children,
9
+ ...restProps
10
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
11
+ </script>
12
+
13
+ <div
14
+ bind:this={ref}
15
+ data-slot="card"
16
+ class={cn(
17
+ "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
18
+ className
19
+ )}
20
+ {...restProps}
21
+ >
22
+ {@render children?.()}
23
+ </div>
@@ -0,0 +1,25 @@
1
+ import Root from "./card.svelte";
2
+ import Content from "./card-content.svelte";
3
+ import Description from "./card-description.svelte";
4
+ import Footer from "./card-footer.svelte";
5
+ import Header from "./card-header.svelte";
6
+ import Title from "./card-title.svelte";
7
+ import Action from "./card-action.svelte";
8
+
9
+ export {
10
+ Root,
11
+ Content,
12
+ Description,
13
+ Footer,
14
+ Header,
15
+ Title,
16
+ Action,
17
+ //
18
+ Root as Card,
19
+ Content as CardContent,
20
+ Description as CardDescription,
21
+ Footer as CardFooter,
22
+ Header as CardHeader,
23
+ Title as CardTitle,
24
+ Action as CardAction,
25
+ };
@@ -0,0 +1,28 @@
1
+ import Root from "./table.svelte";
2
+ import Body from "./table-body.svelte";
3
+ import Caption from "./table-caption.svelte";
4
+ import Cell from "./table-cell.svelte";
5
+ import Footer from "./table-footer.svelte";
6
+ import Head from "./table-head.svelte";
7
+ import Header from "./table-header.svelte";
8
+ import Row from "./table-row.svelte";
9
+
10
+ export {
11
+ Root,
12
+ Body,
13
+ Caption,
14
+ Cell,
15
+ Footer,
16
+ Head,
17
+ Header,
18
+ Row,
19
+ //
20
+ Root as Table,
21
+ Body as TableBody,
22
+ Caption as TableCaption,
23
+ Cell as TableCell,
24
+ Footer as TableFooter,
25
+ Head as TableHead,
26
+ Header as TableHeader,
27
+ Row as TableRow,
28
+ };
@@ -0,0 +1,20 @@
1
+ <script lang="ts">
2
+ import { cn, type WithElementRef } from "$lib/utils.js";
3
+ import type { HTMLAttributes } from "svelte/elements";
4
+
5
+ let {
6
+ ref = $bindable(null),
7
+ class: className,
8
+ children,
9
+ ...restProps
10
+ }: WithElementRef<HTMLAttributes<HTMLTableSectionElement>> = $props();
11
+ </script>
12
+
13
+ <tbody
14
+ bind:this={ref}
15
+ data-slot="table-body"
16
+ class={cn("[&_tr:last-child]:border-0", className)}
17
+ {...restProps}
18
+ >
19
+ {@render children?.()}
20
+ </tbody>
@@ -0,0 +1,20 @@
1
+ <script lang="ts">
2
+ import { cn, type WithElementRef } from "$lib/utils.js";
3
+ import type { HTMLAttributes } from "svelte/elements";
4
+
5
+ let {
6
+ ref = $bindable(null),
7
+ class: className,
8
+ children,
9
+ ...restProps
10
+ }: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
11
+ </script>
12
+
13
+ <caption
14
+ bind:this={ref}
15
+ data-slot="table-caption"
16
+ class={cn("text-muted-foreground mt-4 text-sm", className)}
17
+ {...restProps}
18
+ >
19
+ {@render children?.()}
20
+ </caption>
@@ -0,0 +1,23 @@
1
+ <script lang="ts">
2
+ import { cn, type WithElementRef } from "$lib/utils.js";
3
+ import type { HTMLTdAttributes } from "svelte/elements";
4
+
5
+ let {
6
+ ref = $bindable(null),
7
+ class: className,
8
+ children,
9
+ ...restProps
10
+ }: WithElementRef<HTMLTdAttributes> = $props();
11
+ </script>
12
+
13
+ <td
14
+ bind:this={ref}
15
+ data-slot="table-cell"
16
+ class={cn(
17
+ "bg-clip-padding p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pe-0",
18
+ className
19
+ )}
20
+ {...restProps}
21
+ >
22
+ {@render children?.()}
23
+ </td>
@@ -0,0 +1,20 @@
1
+ <script lang="ts">
2
+ import { cn, type WithElementRef } from "$lib/utils.js";
3
+ import type { HTMLAttributes } from "svelte/elements";
4
+
5
+ let {
6
+ ref = $bindable(null),
7
+ class: className,
8
+ children,
9
+ ...restProps
10
+ }: WithElementRef<HTMLAttributes<HTMLTableSectionElement>> = $props();
11
+ </script>
12
+
13
+ <tfoot
14
+ bind:this={ref}
15
+ data-slot="table-footer"
16
+ class={cn("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0", className)}
17
+ {...restProps}
18
+ >
19
+ {@render children?.()}
20
+ </tfoot>
@@ -0,0 +1,23 @@
1
+ <script lang="ts">
2
+ import { cn, type WithElementRef } from "$lib/utils.js";
3
+ import type { HTMLThAttributes } from "svelte/elements";
4
+
5
+ let {
6
+ ref = $bindable(null),
7
+ class: className,
8
+ children,
9
+ ...restProps
10
+ }: WithElementRef<HTMLThAttributes> = $props();
11
+ </script>
12
+
13
+ <th
14
+ bind:this={ref}
15
+ data-slot="table-head"
16
+ class={cn(
17
+ "text-foreground h-10 bg-clip-padding px-2 text-start align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pe-0",
18
+ className
19
+ )}
20
+ {...restProps}
21
+ >
22
+ {@render children?.()}
23
+ </th>
@@ -0,0 +1,20 @@
1
+ <script lang="ts">
2
+ import { cn, type WithElementRef } from "$lib/utils.js";
3
+ import type { HTMLAttributes } from "svelte/elements";
4
+
5
+ let {
6
+ ref = $bindable(null),
7
+ class: className,
8
+ children,
9
+ ...restProps
10
+ }: WithElementRef<HTMLAttributes<HTMLTableSectionElement>> = $props();
11
+ </script>
12
+
13
+ <thead
14
+ bind:this={ref}
15
+ data-slot="table-header"
16
+ class={cn("[&_tr]:border-b", className)}
17
+ {...restProps}
18
+ >
19
+ {@render children?.()}
20
+ </thead>
@@ -0,0 +1,23 @@
1
+ <script lang="ts">
2
+ import { cn, type WithElementRef } from "$lib/utils.js";
3
+ import type { HTMLAttributes } from "svelte/elements";
4
+
5
+ let {
6
+ ref = $bindable(null),
7
+ class: className,
8
+ children,
9
+ ...restProps
10
+ }: WithElementRef<HTMLAttributes<HTMLTableRowElement>> = $props();
11
+ </script>
12
+
13
+ <tr
14
+ bind:this={ref}
15
+ data-slot="table-row"
16
+ class={cn(
17
+ "hover:[&,&>svelte-css-wrapper]:[&>th,td]:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
18
+ className
19
+ )}
20
+ {...restProps}
21
+ >
22
+ {@render children?.()}
23
+ </tr>
@@ -0,0 +1,22 @@
1
+ <script lang="ts">
2
+ import type { HTMLTableAttributes } from "svelte/elements";
3
+ import { cn, type WithElementRef } from "$lib/utils.js";
4
+
5
+ let {
6
+ ref = $bindable(null),
7
+ class: className,
8
+ children,
9
+ ...restProps
10
+ }: WithElementRef<HTMLTableAttributes> = $props();
11
+ </script>
12
+
13
+ <div data-slot="table-container" class="relative w-full overflow-x-auto">
14
+ <table
15
+ bind:this={ref}
16
+ data-slot="table"
17
+ class={cn("w-full caption-bottom text-sm", className)}
18
+ {...restProps}
19
+ >
20
+ {@render children?.()}
21
+ </table>
22
+ </div>
@@ -0,0 +1,29 @@
1
+ import { clsx, type ClassValue } from "clsx";
2
+ import { twMerge } from "tailwind-merge";
3
+
4
+ export function cn(...inputs: ClassValue[]) {
5
+ return twMerge(clsx(inputs));
6
+ }
7
+
8
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
+ export type WithoutChild<T> = T extends { child?: any } ? Omit<T, "child"> : T;
10
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
+ export type WithoutChildren<T> = T extends { children?: any } ? Omit<T, "children"> : T;
12
+ export type WithoutChildrenOrChild<T> = WithoutChildren<WithoutChild<T>>;
13
+ export type WithElementRef<T, U extends HTMLElement = HTMLElement> = T & { ref?: U | null };
14
+
15
+ export function relativeAge(ts: number | null): string {
16
+ if (!ts) return '\u2014';
17
+ const seconds = Math.floor((Date.now() - ts) / 1000);
18
+ if (seconds < 60) return `${seconds}s ago`;
19
+ if (seconds < 3600) return `${Math.floor(seconds / 60)}m ago`;
20
+ return `${Math.floor(seconds / 3600)}h ago`;
21
+ }
22
+
23
+ export function formatDuration(ms: number | null): string {
24
+ if (ms === null) return '\u2014';
25
+ const seconds = Math.floor(ms / 1000);
26
+ if (seconds < 60) return `${seconds}s`;
27
+ if (seconds < 3600) return `${Math.floor(seconds / 60)}m`;
28
+ return `${Math.floor(seconds / 3600)}h`;
29
+ }
@@ -0,0 +1,7 @@
1
+ import './app.css';
2
+ import App from './App.svelte';
3
+ import { mount } from 'svelte';
4
+
5
+ const app = mount(App, { target: document.getElementById('app')! });
6
+
7
+ export default app;
@@ -0,0 +1,19 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "strict": true,
7
+ "esModuleInterop": true,
8
+ "skipLibCheck": true,
9
+ "forceConsistentCasingInFileNames": true,
10
+ "resolveJsonModule": true,
11
+ "isolatedModules": true,
12
+ "baseUrl": ".",
13
+ "paths": {
14
+ "$lib": ["./src/lib"],
15
+ "$lib/*": ["./src/lib/*"]
16
+ }
17
+ },
18
+ "include": ["src/**/*"]
19
+ }
@@ -0,0 +1,30 @@
1
+ import { defineConfig } from 'vite';
2
+ import { svelte } from '@sveltejs/vite-plugin-svelte';
3
+ import tailwindcss from '@tailwindcss/vite';
4
+ import path from 'node:path';
5
+
6
+ const BACKEND_PORT = process.env.BACKEND_PORT || 3104;
7
+
8
+ export default defineConfig({
9
+ plugins: [svelte(), tailwindcss()],
10
+ base: '/nats-dashboard/',
11
+ resolve: {
12
+ alias: {
13
+ $lib: path.resolve('./src/lib'),
14
+ },
15
+ },
16
+ server: {
17
+ proxy: {
18
+ '/nats-dashboard/api': {
19
+ target: `http://localhost:${BACKEND_PORT}`,
20
+ rewrite: (path) => path.replace('/nats-dashboard/api', '/api'),
21
+ changeOrigin: true,
22
+ headers: { Authorization: 'Bearer dev-nats-plugin-key' },
23
+ },
24
+ },
25
+ },
26
+ build: {
27
+ outDir: 'dist',
28
+ emptyDirFirst: true,
29
+ },
30
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnixal/openclaw-nats-plugin",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "NATS JetStream event-driven plugin for OpenClaw",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -9,8 +9,7 @@
9
9
  "nats-plugin": "./bin/cli.ts"
10
10
  },
11
11
  "scripts": {
12
- "build:dashboard": "cd dashboard && bun run build",
13
- "prepublishOnly": "bun run build:dashboard",
12
+ "build:dashboard": "cd dashboard && bun install --frozen-lockfile && bun run build",
14
13
  "nats": "docker run -d --name nats -p 4222:4222 nats:2.10-alpine -js"
15
14
  },
16
15
  "files": [
@@ -22,7 +21,9 @@
22
21
  "sidecar/",
23
22
  "skills/",
24
23
  "docker/",
25
- "dashboard/dist/",
24
+ "dashboard/",
25
+ "!dashboard/node_modules",
26
+ "!dashboard/dist",
26
27
  "openclaw.plugin.json",
27
28
  "PLUGIN.md",
28
29
  "!**/*.test.ts",