@checkstack/dashboard-frontend 0.5.1 → 0.6.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,199 @@
1
1
  # @checkstack/dashboard-frontend
2
2
 
3
+ ## 0.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 50e5f5f: Runtime plugin system: install + uninstall plugins from npm, GitHub releases
8
+ (including private GitHub Enterprise instances), or tarball uploads at
9
+ runtime, with multi-package bundles, dependency-derived compatibility checks,
10
+ multi-instance coordination via a Postgres artifact store, and
11
+ single-coordinator destructive cleanup.
12
+
13
+ Highlights:
14
+
15
+ - New `PluginSource` discriminated union and `PluginInstaller` /
16
+ `PluginInstallerRegistry` interfaces in `@checkstack/backend-api`. The
17
+ GitHub variant accepts an optional `apiBaseUrl` so deployments backed by
18
+ GitHub Enterprise can install from `https://ghe.example.com/api/v3`
19
+ instead of `api.github.com`.
20
+ - New `installPackageMetadataSchema` (Zod) in `@checkstack/common` validates
21
+ every plugin's `package.json` at install time. Required fields: `name`,
22
+ `version`, `description`, `author`, `license`, `checkstack.type`,
23
+ `checkstack.pluginId`. Optional: `checkstack.bundle`,
24
+ `checkstack.usageInstructions`, `checkstack.allowInstallScripts`.
25
+ - New `pluginManagerContract` in `@checkstack/pluginmanager-common` with
26
+ `list`, `previewInstall`, `install`, `previewUninstall`, `uninstall`, and
27
+ `events` procedures.
28
+ - New `@checkstack/pluginmanager-frontend` admin UI: installed-plugins list
29
+ with per-row uninstall (typed-confirmation modal, schema/configs/cascade
30
+ toggles), install page with NPM / Tarball Upload / GitHub Release tabs
31
+ (Catalog tab disabled — coming soon), and an events page surfacing the
32
+ install/uninstall audit log.
33
+ - New `bunx @checkstack/scripts plugin-pack` CLI for plugin authors —
34
+ per-package mode produces an npm-shaped tarball; `--bundle` mode produces
35
+ an outer tarball containing every sibling declared in
36
+ `package.json#checkstack.bundle`. Published to npm so external authors
37
+ can `bunx` it directly without a workspace checkout.
38
+ - Compatibility derived from `package.json#dependencies` ranges
39
+ (`semver.satisfies` against the platform's loaded `@checkstack/*`
40
+ versions) — no separate `compatibility` field.
41
+ - Multi-instance: originator persists artifacts + `plugins` rows + broadcasts
42
+ install/uninstall; receiving instances do in-process register/unregister
43
+ only. Destructive ops (drop schema, delete plugin_configs, delete
44
+ artifacts, delete `plugins` rows) run exactly once on the originator.
45
+ - Fresh-instance bootstrap: `loadPlugins()` hydrates any
46
+ `is_uninstallable=true` plugin missing from `node_modules` from the
47
+ artifact store before normal Phase 1 register.
48
+ - New schema: `plugin_artifacts` (tarball storage), `plugin_install_events`
49
+ (audit/error log). `plugins` extended with `version`, `metadata`,
50
+ `source`, `bundle_id`, `is_primary`. Local plugin sync now writes
51
+ `version` from each plugin's `package.json` so the admin UI shows real
52
+ versions instead of `—`.
53
+ - Tarball-upload endpoint (`POST /api/pluginmanager/upload-tarball`) for
54
+ the install UI; access-gated by `pluginmanager.plugin.manage`.
55
+ - Plugin Manager menu link added to the user menu (main grid, alongside
56
+ Profile / Notification Settings / etc.).
57
+
58
+ Cross-cutting changes:
59
+
60
+ - Backend request/response logging now flows through `rootLogger` (winston)
61
+ instead of `hono/logger`. 5xx responses include the response body inline
62
+ so swallowed early-return errors are visible in the log.
63
+ - The `/api/:pluginId/*` dispatcher now logs which core service is missing
64
+ or which `pluginId` had no metadata when it 500s.
65
+ - New `registerCorePluginMetadata` on `PluginManager` for core routers
66
+ (like the plugin manager itself) that need their metadata visible to the
67
+ RPC dispatcher without going through the full plugin lifecycle.
68
+ - ESLint: `unicorn/no-null` is now disabled globally. Drizzle distinguishes
69
+ between `null` (writes a real SQL NULL) and `undefined` (skip the column
70
+ on insert), so treating them as interchangeable produced latent bugs at
71
+ the persistence boundary. The bulk of the patch-bumped packages above
72
+ reflect lint-fix touches that landed when this rule was relaxed.
73
+ - Workspace-wide license normalization to `Elastic-2.0` (matches
74
+ `LICENSE.md`). Every `package.json` in the workspace now declares the
75
+ same SPDX identifier; the patch bumps capture this.
76
+
77
+ Plugin packages (every `plugins/*`): added a `pack` npm script
78
+ (`bunx @checkstack/scripts plugin-pack`), mirrored each plugin's
79
+ `pluginId` from `plugin-metadata.ts` into `package.json#checkstack.pluginId`
80
+ so install-time validation passes, stubbed any missing required metadata
81
+ fields (`description`, `author`, `license`), and added
82
+ `checkstack.bundle` to multi-package plugin primaries (telegram, rcon, ssh,
83
+ jira, queue-bullmq, queue-memory, cache-memory).
84
+
85
+ Breaking changes:
86
+
87
+ - The legacy single-method `PluginInstaller` interface (`install(packageName)`)
88
+ is removed. Callers must use `coreServices.pluginInstallerRegistry`.
89
+ - The old `pluginAdminContract` and `createPluginAdminRouter` are removed.
90
+ Replaced by `pluginManagerContract` in `@checkstack/pluginmanager-common`
91
+ and `createPluginManagerRouter` in `core/backend`.
92
+ - `@checkstack/test-utils-backend` no longer exports
93
+ `createMockPluginInstaller` / `MockPluginInstaller` (the legacy interface
94
+ it shimmed is gone).
95
+
96
+ Note: bumps are limited to `minor` (for packages with new public API
97
+ surface) and `patch` (for downstream consumers, license normalization,
98
+ and lint fixes). No `major` bumps despite the `PluginInstaller` removal —
99
+ the legacy interface had no third-party consumers in the wild before this
100
+ runtime plugin system landed, and the contract surface is the same shape
101
+ modulo the rename.
102
+
103
+ - Updated dependencies [50e5f5f]
104
+ - @checkstack/catalog-common@2.0.1
105
+ - @checkstack/catalog-frontend@0.9.1
106
+ - @checkstack/command-common@0.2.10
107
+ - @checkstack/common@0.8.0
108
+ - @checkstack/maintenance-common@1.0.1
109
+ - @checkstack/notification-frontend@0.3.1
110
+ - @checkstack/signal-frontend@0.1.1
111
+ - @checkstack/ui@1.7.1
112
+ - @checkstack/anomaly-common@1.0.1
113
+ - @checkstack/auth-frontend@0.5.33
114
+ - @checkstack/command-frontend@0.2.34
115
+ - @checkstack/frontend-api@0.4.2
116
+ - @checkstack/healthcheck-common@1.0.1
117
+ - @checkstack/incident-common@1.0.1
118
+ - @checkstack/notification-common@1.0.1
119
+ - @checkstack/queue-frontend@0.3.3
120
+
121
+ ## 0.6.0
122
+
123
+ ### Minor Changes
124
+
125
+ - 32d52c6: feat: unified notification-subscription manager dialog driven by spec registry
126
+
127
+ Replaces the bell-toggle UX (which only managed a single legacy
128
+ catalog group) with a modal that lists every notification type
129
+ registered against a target — system or group — and exposes both
130
+ per-type toggles and a bulk "Subscribe to all / Unsubscribe from all"
131
+ action. Both surfaces (system detail page header bell, dashboard group
132
+ header bell) now open the same `NotificationSubscriptionsManager`
133
+ component.
134
+
135
+ **Key change vs. the prior slot-based approach**: rows are now driven
136
+ by `notificationClient.listSubscriptionSpecs` — the backend's spec
137
+ registry is the single source of truth. Previously, a row only
138
+ appeared if a frontend plugin had remembered to register a
139
+ `createNotificationSubscriptionExtension`; this caused silent drift
140
+ (healthcheck and dependency registered backend specs without frontend
141
+ extensions, so the dialog counted them but never rendered rows). Now,
142
+ every spec the platform knows about renders a row using the spec's
143
+ `display` metadata (title, description, iconName resolved via
144
+ `DynamicIcon`).
145
+
146
+ **Sub-controls registry** (`@checkstack/notification-frontend`):
147
+ plugins that want sub-granularity (anomaly's per-field mute list,
148
+ future severity / channel filters) call
149
+ `registerSubscriptionSubControls(spec, Component)` at module load —
150
+ the manager looks the component up by `specId` when expanding a row.
151
+
152
+ **Removed (no compat)**:
153
+
154
+ - `createNotificationSubscriptionExtension` (replaced by the
155
+ spec-driven manager + the SubControls registry)
156
+ - `target.slot` field on `NotificationTarget` and the
157
+ `NotificationTargetInput.slot` parameter on
158
+ `defineNotificationTarget`
159
+ - `SystemNotificationSubscriptionsSlot` and
160
+ `GroupNotificationSubscriptionsSlot` from `@checkstack/catalog-common`
161
+ - `SystemNotificationsCard` from the system detail page's main column
162
+ - `SubscribeButton` wiring on dashboard group cards and the system
163
+ detail page header
164
+
165
+ **Migrated frontends**: anomaly (now registers `AnomalyFieldMuteList`
166
+ via the SubControls registry), incident, maintenance — all dropped
167
+ their `createNotificationSubscriptionExtension` calls. healthcheck and
168
+ dependency now show up automatically via the spec registry — no
169
+ frontend changes needed for them to render.
170
+
171
+ The trigger button reflects aggregate state — filled bell when at
172
+ least one spec is subscribed for the resource, ghost bell when none.
173
+
174
+ ### Patch Changes
175
+
176
+ - Updated dependencies [32d52c6]
177
+ - Updated dependencies [32d52c6]
178
+ - Updated dependencies [32d52c6]
179
+ - Updated dependencies [32d52c6]
180
+ - Updated dependencies [32d52c6]
181
+ - Updated dependencies [32d52c6]
182
+ - Updated dependencies [32d52c6]
183
+ - @checkstack/anomaly-common@1.0.0
184
+ - @checkstack/notification-common@1.0.0
185
+ - @checkstack/notification-frontend@0.3.0
186
+ - @checkstack/catalog-common@2.0.0
187
+ - @checkstack/catalog-frontend@0.9.0
188
+ - @checkstack/incident-common@1.0.0
189
+ - @checkstack/maintenance-common@1.0.0
190
+ - @checkstack/healthcheck-common@1.0.0
191
+ - @checkstack/frontend-api@0.4.1
192
+ - @checkstack/auth-frontend@0.5.32
193
+ - @checkstack/ui@1.7.0
194
+ - @checkstack/command-frontend@0.2.33
195
+ - @checkstack/queue-frontend@0.3.2
196
+
3
197
  ## 0.5.1
4
198
 
5
199
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@checkstack/dashboard-frontend",
3
- "version": "0.5.1",
3
+ "version": "0.6.1",
4
+ "license": "Elastic-2.0",
4
5
  "type": "module",
5
6
  "main": "src/index.tsx",
6
7
  "checkstack": {
@@ -8,26 +9,27 @@
8
9
  },
9
10
  "scripts": {
10
11
  "test": "bun test",
11
- "typecheck": "tsc --noEmit",
12
+ "typecheck": "tsgo -b",
12
13
  "lint": "bun run lint:code",
13
14
  "lint:code": "eslint . --max-warnings 0"
14
15
  },
15
16
  "dependencies": {
16
- "@checkstack/anomaly-common": "0.2.0",
17
- "@checkstack/auth-frontend": "0.5.30",
18
- "@checkstack/catalog-common": "1.5.2",
19
- "@checkstack/catalog-frontend": "0.8.6",
17
+ "@checkstack/anomaly-common": "1.0.0",
18
+ "@checkstack/auth-frontend": "0.5.32",
19
+ "@checkstack/catalog-common": "2.0.0",
20
+ "@checkstack/catalog-frontend": "0.9.0",
20
21
  "@checkstack/command-common": "0.2.9",
21
- "@checkstack/command-frontend": "0.2.31",
22
+ "@checkstack/command-frontend": "0.2.33",
22
23
  "@checkstack/common": "0.7.0",
23
- "@checkstack/frontend-api": "0.3.11",
24
- "@checkstack/healthcheck-common": "0.12.0",
25
- "@checkstack/incident-common": "0.4.9",
26
- "@checkstack/maintenance-common": "0.4.11",
27
- "@checkstack/notification-common": "0.2.9",
28
- "@checkstack/queue-frontend": "0.3.0",
29
- "@checkstack/signal-frontend": "0.0.16",
30
- "@checkstack/ui": "1.6.0",
24
+ "@checkstack/frontend-api": "0.4.1",
25
+ "@checkstack/healthcheck-common": "1.0.0",
26
+ "@checkstack/incident-common": "1.0.0",
27
+ "@checkstack/maintenance-common": "1.0.0",
28
+ "@checkstack/notification-common": "1.0.0",
29
+ "@checkstack/notification-frontend": "0.3.0",
30
+ "@checkstack/queue-frontend": "0.3.2",
31
+ "@checkstack/signal-frontend": "0.1.0",
32
+ "@checkstack/ui": "1.7.0",
31
33
  "date-fns": "^4.1.0",
32
34
  "lucide-react": "^0.344.0",
33
35
  "react": "^18.2.0",
@@ -36,7 +38,7 @@
36
38
  "devDependencies": {
37
39
  "typescript": "^5.0.0",
38
40
  "@types/react": "^18.2.0",
39
- "@checkstack/tsconfig": "0.0.5",
41
+ "@checkstack/tsconfig": "0.0.6",
40
42
  "@checkstack/scripts": "0.1.2"
41
43
  }
42
44
  }
package/src/Dashboard.tsx CHANGED
@@ -11,12 +11,10 @@ import {
11
11
  SystemStateBadgesSlot,
12
12
  System,
13
13
  Group,
14
+ catalogGroupTarget,
14
15
  } from "@checkstack/catalog-common";
15
16
  import { resolveRoute } from "@checkstack/common";
16
- import {
17
- NotificationApi,
18
- type EnrichedSubscription,
19
- } from "@checkstack/notification-common";
17
+ import { NotificationSubscriptionsManager } from "@checkstack/notification-frontend";
20
18
  import { IncidentApi } from "@checkstack/incident-common";
21
19
  import { MaintenanceApi } from "@checkstack/maintenance-common";
22
20
  import { AnomalyApi } from "@checkstack/anomaly-common";
@@ -31,8 +29,6 @@ import {
31
29
  StatusCard,
32
30
  EmptyState,
33
31
  LoadingSpinner,
34
- SubscribeButton,
35
- useToast,
36
32
  AnimatedCounter,
37
33
  TerminalFeed,
38
34
  type TerminalEntry,
@@ -56,15 +52,12 @@ import { IncidentOverviewSheet } from "./components/IncidentOverviewSheet";
56
52
  import { MaintenanceOverviewSheet } from "./components/MaintenanceOverviewSheet";
57
53
  import { AnomalyOverviewSheet } from "./components/AnomalyOverviewSheet";
58
54
 
59
- const CATALOG_PLUGIN_ID = "catalog";
60
55
  const MAX_TERMINAL_ENTRIES = 8;
61
56
 
62
57
  interface GroupWithSystems extends Group {
63
58
  systems: System[];
64
59
  }
65
60
 
66
- const getGroupId = (groupId: string) => `${CATALOG_PLUGIN_ID}.group.${groupId}`;
67
-
68
61
  const statusToVariant = (
69
62
  status: string,
70
63
  ): "default" | "success" | "warning" | "error" => {
@@ -87,24 +80,17 @@ const statusToVariant = (
87
80
  export const Dashboard: React.FC = () => {
88
81
  const { isLowPower } = usePerformance();
89
82
  const catalogClient = usePluginClient(CatalogApi);
90
- const notificationClient = usePluginClient(NotificationApi);
91
83
  const incidentClient = usePluginClient(IncidentApi);
92
84
  const maintenanceClient = usePluginClient(MaintenanceApi);
93
85
  const anomalyClient = usePluginClient(AnomalyApi);
94
86
 
95
87
  const navigate = useNavigate();
96
- const toast = useToast();
97
88
  const authApi = useApi(authApiRef);
98
89
  const { data: session } = authApi.useSession();
99
90
 
100
91
  // Terminal feed entries from real healthcheck signals
101
92
  const [terminalEntries, setTerminalEntries] = useState<TerminalEntry[]>([]);
102
93
 
103
- // Track per-group loading state for subscribe buttons
104
- const [subscriptionLoading, setSubscriptionLoading] = useState<
105
- Record<string, boolean>
106
- >({});
107
-
108
94
  const [isIncidentSheetOpen, setIncidentSheetOpen] = useState(false);
109
95
  const [isMaintenanceSheetOpen, setMaintenanceSheetOpen] = useState(false);
110
96
  const [isAnomalySheetOpen, setAnomalySheetOpen] = useState(false);
@@ -158,13 +144,6 @@ export const Dashboard: React.FC = () => {
158
144
  { staleTime: 30_000 },
159
145
  );
160
146
 
161
- // Fetch subscriptions (only when logged in)
162
- const { data: subscriptions = [], refetch: refetchSubscriptions } =
163
- notificationClient.getSubscriptions.useQuery(
164
- {},
165
- { enabled: !!session, staleTime: 60_000 },
166
- );
167
-
168
147
  // Combined loading state
169
148
  const loading =
170
149
  entitiesLoading ||
@@ -172,30 +151,6 @@ export const Dashboard: React.FC = () => {
172
151
  maintenancesLoading ||
173
152
  anomaliesLoading;
174
153
 
175
- // -------------------------------------------------------------------------
176
- // MUTATIONS
177
- // -------------------------------------------------------------------------
178
-
179
- const subscribeMutation = notificationClient.subscribe.useMutation({
180
- onSuccess: () => {
181
- toast.success("Subscribed to group notifications");
182
- void refetchSubscriptions();
183
- },
184
- onError: (error: Error) => {
185
- toast.error(error.message || "Failed to subscribe");
186
- },
187
- });
188
-
189
- const unsubscribeMutation = notificationClient.unsubscribe.useMutation({
190
- onSuccess: () => {
191
- toast.success("Unsubscribed from group notifications");
192
- void refetchSubscriptions();
193
- },
194
- onError: (error: Error) => {
195
- toast.error(error.message || "Failed to unsubscribe");
196
- },
197
- });
198
-
199
154
  // -------------------------------------------------------------------------
200
155
  // COMPUTED DATA
201
156
  // -------------------------------------------------------------------------
@@ -248,39 +203,6 @@ export const Dashboard: React.FC = () => {
248
203
  navigate(resolveRoute(catalogRoutes.routes.systemDetail, { systemId }));
249
204
  };
250
205
 
251
- const isSubscribed = (groupId: string) => {
252
- const fullId = getGroupId(groupId);
253
- return subscriptions.some(
254
- (s: EnrichedSubscription) => s.groupId === fullId,
255
- );
256
- };
257
-
258
- const handleSubscribe = (groupId: string) => {
259
- const fullId = getGroupId(groupId);
260
- setSubscriptionLoading((prev) => ({ ...prev, [groupId]: true }));
261
- subscribeMutation.mutate(
262
- { groupId: fullId },
263
- {
264
- onSettled: () => {
265
- setSubscriptionLoading((prev) => ({ ...prev, [groupId]: false }));
266
- },
267
- },
268
- );
269
- };
270
-
271
- const handleUnsubscribe = (groupId: string) => {
272
- const fullId = getGroupId(groupId);
273
- setSubscriptionLoading((prev) => ({ ...prev, [groupId]: true }));
274
- unsubscribeMutation.mutate(
275
- { groupId: fullId },
276
- {
277
- onSettled: () => {
278
- setSubscriptionLoading((prev) => ({ ...prev, [groupId]: false }));
279
- },
280
- },
281
- );
282
- };
283
-
284
206
  // -------------------------------------------------------------------------
285
207
  // RENDER
286
208
  // -------------------------------------------------------------------------
@@ -324,11 +246,12 @@ export const Dashboard: React.FC = () => {
324
246
  {group.systems.length === 1 ? "system" : "systems"}
325
247
  </span>
326
248
  {session && (
327
- <SubscribeButton
328
- isSubscribed={isSubscribed(group.id)}
329
- onSubscribe={() => handleSubscribe(group.id)}
330
- onUnsubscribe={() => handleUnsubscribe(group.id)}
331
- loading={subscriptionLoading[group.id] || false}
249
+ <NotificationSubscriptionsManager
250
+ target={catalogGroupTarget}
251
+ resource={{
252
+ groupId: group.id,
253
+ groupName: group.name,
254
+ }}
332
255
  />
333
256
  )}
334
257
  </div>
package/tsconfig.json CHANGED
@@ -2,5 +2,55 @@
2
2
  "extends": "@checkstack/tsconfig/frontend.json",
3
3
  "include": [
4
4
  "src"
5
+ ],
6
+ "references": [
7
+ {
8
+ "path": "../anomaly-common"
9
+ },
10
+ {
11
+ "path": "../auth-frontend"
12
+ },
13
+ {
14
+ "path": "../catalog-common"
15
+ },
16
+ {
17
+ "path": "../catalog-frontend"
18
+ },
19
+ {
20
+ "path": "../command-common"
21
+ },
22
+ {
23
+ "path": "../command-frontend"
24
+ },
25
+ {
26
+ "path": "../common"
27
+ },
28
+ {
29
+ "path": "../frontend-api"
30
+ },
31
+ {
32
+ "path": "../healthcheck-common"
33
+ },
34
+ {
35
+ "path": "../incident-common"
36
+ },
37
+ {
38
+ "path": "../maintenance-common"
39
+ },
40
+ {
41
+ "path": "../notification-common"
42
+ },
43
+ {
44
+ "path": "../notification-frontend"
45
+ },
46
+ {
47
+ "path": "../queue-frontend"
48
+ },
49
+ {
50
+ "path": "../signal-frontend"
51
+ },
52
+ {
53
+ "path": "../ui"
54
+ }
5
55
  ]
6
- }
56
+ }