@checkstack/ui 1.11.0 → 1.13.0

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 (71) hide show
  1. package/.storybook/main.ts +43 -0
  2. package/CHANGELOG.md +326 -0
  3. package/package.json +23 -18
  4. package/scripts/generate-stdlib-types.ts +23 -0
  5. package/src/components/Accordion.tsx +17 -9
  6. package/src/components/ActionCard.tsx +99 -11
  7. package/src/components/BrandIcon.tsx +57 -0
  8. package/src/components/CodeEditor/CodeEditor.tsx +159 -14
  9. package/src/components/CodeEditor/TypefoxEditor.tsx +537 -168
  10. package/src/components/CodeEditor/editorTheme.test.ts +41 -0
  11. package/src/components/CodeEditor/editorTheme.ts +26 -0
  12. package/src/components/CodeEditor/generated/builtin-modules.json +1 -0
  13. package/src/components/CodeEditor/importSpecifiers.test.ts +286 -0
  14. package/src/components/CodeEditor/importSpecifiers.ts +267 -0
  15. package/src/components/CodeEditor/index.ts +26 -0
  16. package/src/components/CodeEditor/monacoGuard.ts +76 -0
  17. package/src/components/CodeEditor/monacoTsService.ts +185 -0
  18. package/src/components/CodeEditor/popoutTitle.test.ts +37 -0
  19. package/src/components/CodeEditor/popoutTitle.ts +31 -0
  20. package/src/components/CodeEditor/scriptContext.test.ts +15 -7
  21. package/src/components/CodeEditor/scriptContext.ts +12 -18
  22. package/src/components/CodeEditor/scriptDiagnostics.test.ts +135 -0
  23. package/src/components/CodeEditor/scriptDiagnostics.ts +172 -0
  24. package/src/components/CodeEditor/types.ts +79 -0
  25. package/src/components/CodeEditor/validateScripts.ts +172 -0
  26. package/src/components/CodeEditor/vscodeServicesSignal.ts +72 -0
  27. package/src/components/ConfirmationModal.tsx +7 -1
  28. package/src/components/Dialog.tsx +32 -11
  29. package/src/components/DurationInput.tsx +121 -0
  30. package/src/components/DynamicForm/DynamicForm.tsx +119 -47
  31. package/src/components/DynamicForm/DynamicOptionsField.tsx +19 -14
  32. package/src/components/DynamicForm/FormField.tsx +183 -15
  33. package/src/components/DynamicForm/MultiTypeEditorField.tsx +78 -2
  34. package/src/components/DynamicForm/SecretEnvEditor.tsx +315 -0
  35. package/src/components/DynamicForm/index.ts +20 -0
  36. package/src/components/DynamicForm/secretEnv.logic.test.ts +126 -0
  37. package/src/components/DynamicForm/secretEnv.logic.ts +87 -0
  38. package/src/components/DynamicForm/types.ts +134 -1
  39. package/src/components/DynamicForm/utils.test.ts +38 -0
  40. package/src/components/DynamicForm/utils.ts +54 -0
  41. package/src/components/DynamicForm/validation.logic.test.ts +255 -0
  42. package/src/components/DynamicForm/validation.logic.ts +210 -0
  43. package/src/components/DynamicIcon.tsx +39 -17
  44. package/src/components/Markdown.tsx +68 -2
  45. package/src/components/Popover.tsx +6 -1
  46. package/src/components/ScriptTestPanel.logic.test.ts +139 -0
  47. package/src/components/ScriptTestPanel.logic.ts +137 -0
  48. package/src/components/ScriptTestPanel.tsx +394 -0
  49. package/src/components/Sheet.tsx +21 -6
  50. package/src/components/Spinner.tsx +56 -0
  51. package/src/components/StatusBadge.tsx +78 -0
  52. package/src/components/StrategyConfigCard.tsx +3 -3
  53. package/src/components/Tabs.tsx +7 -1
  54. package/src/components/TimeOfDayInput.tsx +116 -0
  55. package/src/components/UserMenu.logic.test.ts +37 -0
  56. package/src/components/UserMenu.logic.ts +30 -0
  57. package/src/components/UserMenu.tsx +40 -12
  58. package/src/components/comboboxInteraction.ts +39 -0
  59. package/src/components/iconRegistry.tsx +27 -0
  60. package/src/components/portalContainer.ts +24 -0
  61. package/src/index.ts +7 -0
  62. package/stories/ActionCard.stories.tsx +60 -0
  63. package/stories/CodeEditor.stories.tsx +47 -2
  64. package/stories/DurationInput.stories.tsx +59 -0
  65. package/stories/Introduction.mdx +1 -1
  66. package/stories/Markdown.stories.tsx +56 -0
  67. package/stories/ScriptTestPanel.stories.tsx +106 -0
  68. package/stories/SecretEnvEditor.stories.tsx +80 -0
  69. package/stories/Spinner.stories.tsx +90 -0
  70. package/stories/TimeOfDayInput.stories.tsx +34 -0
  71. package/tsconfig.json +4 -0
@@ -1,4 +1,31 @@
1
1
  import type { StorybookConfig } from "@storybook/react-vite";
2
+ import { createRequire } from "node:module";
3
+ import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { mergeConfig } from "vite";
6
+
7
+ const storybookDir = path.dirname(fileURLToPath(import.meta.url));
8
+ const uiRoot = path.resolve(storybookDir, "..");
9
+ const localRequire = createRequire(import.meta.url);
10
+
11
+ // Resolve the `vscode` npm-alias (= @codingame/monaco-vscode-extension-api) to
12
+ // an absolute path so Vite/Rolldown can alias it. This mirrors the same fix in
13
+ // core/frontend/vite.config.ts.
14
+ //
15
+ // `CodeEditor` (via @typefox/monaco-editor-react + monaco-languageclient) pulls
16
+ // in the @codingame/monaco-vscode-* stack, whose runtime package does
17
+ // `require("vscode")`. Under bun's isolated node_modules the `"vscode":
18
+ // "npm:@codingame/monaco-vscode-extension-api"` alias only exists inside the
19
+ // typefox / monaco-languageclient scopes, so the Storybook build can't resolve
20
+ // a bare `vscode` import and fails with "Rolldown failed to resolve import
21
+ // 'vscode'". We resolve the alias *through* @typefox so the path follows bun's
22
+ // store layout on any machine/CI rather than being hardcoded.
23
+ const typefoxDir = path.dirname(
24
+ localRequire.resolve("@typefox/monaco-editor-react", { paths: [uiRoot] }),
25
+ );
26
+ const vscodeApiDir = path.dirname(
27
+ localRequire.resolve("vscode", { paths: [typefoxDir] }),
28
+ );
2
29
 
3
30
  const config: StorybookConfig = {
4
31
  stories: [
@@ -17,6 +44,22 @@ const config: StorybookConfig = {
17
44
  typescript: {
18
45
  reactDocgen: "react-docgen",
19
46
  },
47
+ viteFinal: (viteConfig) =>
48
+ mergeConfig(viteConfig, {
49
+ // The @typefox/monaco-editor-react + @codingame/monaco-vscode-* stack
50
+ // loads its language services in ES module workers.
51
+ worker: {
52
+ format: "es",
53
+ },
54
+ resolve: {
55
+ alias: {
56
+ // Alias the `vscode` npm-alias to its real package dir so @codingame's
57
+ // CJS `require("vscode")` resolves under bun's isolated store instead
58
+ // of failing the build.
59
+ vscode: vscodeApiDir,
60
+ },
61
+ },
62
+ }),
20
63
  };
21
64
 
22
65
  export default config;
package/CHANGELOG.md CHANGED
@@ -1,5 +1,331 @@
1
1
  # @checkstack/ui
2
2
 
3
+ ## 1.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 9dcc848: AI chat UX: ordered turns, readable diffs, persistent errors, auto-titles, decision acknowledgments, and a smarter topical guard.
8
+
9
+ - Turns render as ordered parts (text / tool-call status / confirm card) in chronological order, with inline tool-error lines and a mid-turn "Thinking..." indicator, instead of one text blob plus a flat tool list. The confirm card and tool-step parts no longer vanish after a turn finishes (hydration seeds once per conversation id via `useInitOnceForKey`, so background refetches are no-ops).
10
+ - Errors persist: in-stream provider errors are lifted into the chat hook's durable error state and shown in a dismissible banner with selectable text and a Copy button (single-line digest, full text on hover); it clears on send / open / new chat. The backend installs an `onError` handler that logs the provider's full HTTP response and returns a readable message, and normalizes the model message history (drop empty rows, merge consecutive same-role rows, strip a leading non-user row) so a single provider hiccup can no longer brick a conversation.
11
+ - Confirm/applied card diffs render as a GitHub-style split diff (line-number gutters, per-line tint, word-level highlighting, an "Expand" pop-out). `computeFieldDiff` recurses into arrays element-wise so a single changed leaf is pinpointed instead of dumping whole serialized arrays.
12
+ - Conversations auto-title after the first user message (cheap `generateText` reusing the turn's model, fire-and-forget, heuristic fallback). "New chat" opens immediately and reuses an empty untitled draft instead of spawning duplicates; "Delete" is a soft archive (`archived_at` on `ai_conversations`, data retained). A clean model picker always renders a `Select` of `[defaultModel, ...availableModels]` de-duplicated.
13
+ - The assistant acknowledges a confirm-card decision (a new `decision` mode -> `streamDecision`) instead of going silent after an apply/decline; the decision note is derived server-side from the stored proposal and is ephemeral.
14
+ - A cheap topical pre-classifier short-circuits off-topic turns with a canned refusal (fail-open, spend recorded). It marks meta/capability/greeting/how-to questions as ON_TOPIC; only clearly unrelated requests (coding help, creative writing, trivia) are refused.
15
+ - The chat agent no longer emits duplicate proposals for one request: propose/auto-apply results carry an explicit model-facing "stop and wait" note, and a per-turn `<tool>:<argsHash>` dedupe short-circuits repeated identical mutating calls.
16
+ - Assistant messages render through the shared `<MarkdownBlock>`: it now parses a SAFE subset of raw HTML (`rehype-raw` + `rehype-sanitize`) so native `<details>`/`<summary>` widgets render, and enables `remark-gfm` so GFM tables, strikethrough, and autolinks render (the assistant often summarizes drafts as tables).
17
+
18
+ State and scale: the archive marker, titles, and permission mode all live in the shared `ai_conversations` table, read identically on every pod; the classifier holds no state and its spend is recorded in the shared `ai_spend` ledger. No new pod-local state.
19
+
20
+ This is a beta minor.
21
+
22
+ - 9dcc848: Plugin-owned AI tools: every domain plugin contributes its own AI tools (chat assistant + automation AI action), and `ai-backend` is platform-only.
23
+
24
+ Every plugin-specific AI tool is owned by the plugin whose domain it acts on, registered via that plugin's own `aiToolExtensionPoint` / `aiToolProjectionExtensionPoint` from its init - the same path an external plugin author uses. `ai-backend` no longer imports or depends on any capability plugin's `*-common`; the dependency direction is strictly plugin -> ai-platform. Pure helpers (`computeFieldDiff`, capability-summary, `ScriptContextKind`) live in `@checkstack/ai-common`.
25
+
26
+ Tools shipped:
27
+
28
+ - Health checks and automations: full CRUD - `healthcheck.propose` / `automation.propose` and `*.update` (`mutate`, deep-validated) and `*.delete` (`destructive`, always confirm-gated). `healthcheck.propose`'s dry-run calls the new deep `validateConfiguration` so propose-time validation matches apply-time. Assertions are validated against the collector's result schema and the canonical operator vocabulary. Capability-catalog tools (`ai.listCapabilities`, `ai.getCapabilitySchema`), script context tools (`ai.getScriptContext`, `ai.testScript`), and notify-subscriber tools (`healthcheck.notifySystemSubscribers` / `...GroupSubscribers`).
29
+ - Catalog: `catalog.createSystem` / `updateSystem` / `createGroup` / `updateGroup` (`mutate`), `catalog.deleteSystem` / `deleteGroup` (`destructive`), membership tools (`mutate`), plus `catalog.listSystems` / `listGroups` read projections.
30
+ - Incident: `incident.create` / `update` / `addUpdate` / `resolve` / `addLink` (`mutate`), `incident.delete` / `removeLink` (`destructive`), and `incident.get` / `incident.list` read projections.
31
+ - Maintenance: `maintenance.create` / `update` / `addUpdate` / `close` / `addLink` (`mutate`), `maintenance.delete` / `removeLink` (`destructive`), and `maintenance.list` / `get` read projections.
32
+ - Read projections for SLO (`slo.listObjectives`), dependency (`dependency.list`), incident (`incident.list`), healthcheck (`healthcheck.status`), and anomaly (`anomaly.explain`), each gated by the source procedure's own access rule and routed as the principal.
33
+ - Documentation grounding: `ai.searchDocs` / `ai.getDoc` over a build-time bundled docs index (BM25-ish ranking), so the assistant grounds how-to answers in Checkstack's own docs offline.
34
+ - URL introspection: `ai.probeUrl`, an SSRF-guarded read tool the assistant uses to inspect a real endpoint before drafting a health check. Update tools compute a before -> after field diff rendered on the confirm card (approve mode) or an "Applied" card (auto mode), so a change is never silent.
35
+
36
+ `ai_analyze` automation action (automation-backend, with an editor connection picker + audited tool calls): runs a bounded AI agent on the run context as the automation's `runAs` service account, so it can never exceed that identity's permissions; destructive tools are never offered; mutating tools auto-apply through the service account's client. Produces an `automation.analysis` artifact downstream actions can branch on. The agent loop is exposed as a headless `aiAgentRunnerRef` service so automation-backend can drive it without depending on ai-backend.
37
+
38
+ `notification.notifyForSubscription` is now callable by user / application principals holding `notification.send` (previously service-only). Every tool routes through the user-scoped client, so handler-side authorization is enforced exactly as a direct UI/RPC action; the resolver gate plus the propose/apply re-check at propose AND apply are the additional authority. A systemic authz regression test asserts every registered tool falls into exactly one safe authorization category.
39
+
40
+ A new `ai_transport` enum value `automation` records the AI action's tool calls in the `ai_tool_calls` audit log. No new durable state beyond that; each tool is a thin, deterministic wrapper over an existing RPC, so every pod behaves identically.
41
+
42
+ This is a beta minor.
43
+
44
+ - 9dcc848: Redesign the dashboard as an extensible "needs attention" overview, and normalize system state badges.
45
+
46
+ The dashboard now surfaces ONLY systems that need attention (degraded, unhealthy, breaching/at-risk SLO, under an incident or active maintenance, anomalous, or with a dependency problem) and hides everything healthy. A compact header summarises fleet health and filters by severity; each problem renders as an elevated card with one row per issue that deep-links to where the issue originates. A calm "all clear" state shows when nothing needs attention, a live "recent activity" feed sits below, and a "View catalog" link replaces the duplicated system list.
47
+
48
+ New platform contract `SystemSignalsSlot` (`@checkstack/catalog-common`): a headless, render-once slot where any plugin bulk-fetches and reports structured `SystemSignal[]` per system via `onSignals(sourceId, map)`. The dashboard aggregates every source agnostic to which plugins contribute; each core reliability plugin (healthcheck, incident, SLO, maintenance, anomaly, dependency) ships a filler, and third-party plugins add new per-system state the same way with no dashboard change. Signals carry an `iconName` rendered via `DynamicIcon` so the contract stays React-free. The dashboard's old summary tiles and overview sheets are removed, so it no longer depends on those plugins' packages. The group "subscribe" control moved onto the catalog browse page's group headers.
49
+
50
+ System state badges are normalized into one icon-only `@checkstack/ui` `StatusBadge` primitive - a small tinted icon chip with the full label on hover/focus (and via `aria-label`). Each signal uses its feature's navbar icon (health = Activity, incident = AlertTriangle, SLO = Target, maintenance = Wrench, dependency = GitBranch; anomaly = ChartSpline). Badges self-sort by severity via CSS `order` (error -> warn -> info), tooltips are scoped to a named group, and in catalog browse rows the cluster moved to the right edge.
51
+
52
+ This is a beta minor.
53
+
54
+ - 9dcc848: Surface integration connection validation errors inline, and fix blank secrets clearing stored credentials on edit.
55
+
56
+ `@checkstack/ui` `DynamicForm` gains opt-in, backward-compatible props plus pure DOM-free helpers:
57
+
58
+ - `showInlineErrors` (default `false`): renders a concise per-field error under each touched required field; the `onValidChange` validity boolean derives from the same per-field error map.
59
+ - `fieldErrors`: an externally-supplied `{ [fieldPath]: message }` map (dot-joined for nested fields) for surfacing SERVER validation inline; nested paths flag their parent.
60
+ - `keepExistingSecretFields`: in EDIT mode, lists `x-secret` keys already stored server-side - a blank input means "keep existing" and is treated as VALID (CREATE mode omits it). New exported helpers: `deriveClientFieldErrors`, `deriveServerFieldErrors`, `parseServerValidationData`, `omitKeepExistingSecrets`, `listSecretFieldKeys`. `DynamicForm` also no longer shows a required (`*`) marker on the child fields of an OPTIONAL nested object while that object is empty (e.g. the OpenAI-compatible `spendCap`); required nested objects are unchanged.
61
+
62
+ `@checkstack/integration-backend`: connection-config validation failures attach the structured zod issues to `ORPCError.data` under a `CONFIG_VALIDATION` discriminator; the human-readable message is unchanged.
63
+
64
+ `@checkstack/integration-frontend` `ProviderConnectionsPage`: validation failures appear inline on the offending fields (the toast remains a fallback); Create/Save stays disabled while invalid; on edit a blank `x-secret` field is treated as "keep existing" (no required error, omitted from the update so the stored secret is not cleared).
65
+
66
+ BREAKING CHANGES: none. The new `DynamicForm` props are optional and default to previous behavior.
67
+
68
+ This is a beta minor.
69
+
70
+ - 9dcc848: Add environments as a first-class catalog primitive, with per-environment health-check fan-out, config templating, per-environment reactive health, and script run-context exposure.
71
+
72
+ - Catalog primitive: an environment is a sibling of groups - a named, instance-global record carrying free-form custom fields (baseUrl, region, tier, ...) that any system can belong to many-to-many. New `environments` + `systems_environments` tables, `EnvironmentSchema` + create/update schemas, `EntityService` environment CRUD and membership joins, RPC endpoints gated by a new `catalogAccess.environment` access rule, a GitOps `Environment` kind + `System.environments` extension, and frontend management (an `EnvironmentEditor`, an Environments management panel, and a per-system environment picker). The Environments card's Add/Edit/Delete affordances are gated on `catalogAccess.environment.manage`.
73
+ - Per-environment fan-out: run identity becomes `(systemId, configurationId, environmentId)`. Runs, aggregates, and state transitions gain a nullable `environmentId`. The health-check assignment gains an `environmentIds` selector with three modes (All / Specific / None; `null` and `[]` are distinct). The queue executor resolves the effective environment set via the catalog `resolveSystemEnvironments` read and executes one isolated run per environment.
74
+ - Config templating: a new `x-templatable` config-field marker renders a string field through the template engine at execute time, against `{ environment, check, system }`. A shared `renderTemplatableConfig` and a `renderTemplatePreview` helper (re-exported from `@checkstack/template-engine`) keep editor previews identical to the run-time render. The HTTP collector's `url`, `headers[].value`, and `body` are templatable, rendered per environment (the strategy client build moves inside the per-env loop); the `url`'s `.url()` validation moves post-render. Secrets resolve before templating; a field marked both secret and `x-templatable` is rejected at plugin load. `DynamicForm` shows a live "Preview" line, and the catalog `EnvironmentPreviewPicker` ("Preview as: <environment>") drives it in the collector editor (only when the schema has a templatable field).
75
+ - Script run-context: `CollectorRunContext` gains an optional `environment` field (`{ id, name, fields }`, metadata only). Shell collectors receive `CHECKSTACK_ENV_ID` / `_NAME` / `CHECKSTACK_ENV_<FIELD>` vars; inline TS collectors read `globalThis.context.environment`; the editor test panel mirrors both. The env-less path is unchanged.
76
+ - Per-environment reactive health (see BREAKING below), env-keyed read/write paths, env-qualified serialization locks, an optional `trigger.payload.environmentId`, per-environment isolation, and an `ENVIRONMENT_RESOLUTION_FAILED` signal when catalog resolution degrades to a single env-less run.
77
+
78
+ BREAKING CHANGES: the reactive `health` entity's id-shape and cardinality change. It now encodes two views: per-environment (id `"<systemId>::<environmentId>"`) and a system rollup (id `"<systemId>"`, the worst status across environments + env-less runs). The rollup PRESERVES the pre-existing system-level contract - dashboards, status badges, and automations referencing health by `systemId` keep working without re-authoring - but the entity's contract surface changed (new id-shape, higher cardinality, new payload field), so it is flagged breaking. `getBulkHealthState` parses env-qualified ids and keys results by the original id.
79
+
80
+ State and scale: membership and custom fields live only in catalog Postgres and are re-read every tick via the cross-plugin RPC; env-keyed health reads from shared `health_check_runs` / aggregates / transitions (compute-on-read). Every pod resolves the same effective set and the same per-environment health. No pod-local environment state.
81
+
82
+ Also: `unwrapSchema` in `zod-config.ts` loops instead of single-pass-stripping so multi-layer wrappers (`.optional().default()`) still resolve `x-templatable` meta. The env-less `{{ environment.* }}` run notice logs at `debug` (a legitimate recurring configuration), while the post-render HTTP `.url()` check still fails a genuinely-broken empty render with a clear "Rendered URL is invalid" error.
83
+
84
+ This is a beta minor.
85
+
86
+ - 9dcc848: Cut initial-load JS: lazy plugin contributions, a hardened lazy-by-default contribution contract, on-demand Monaco, and a lighter icon/chart load.
87
+
88
+ - Lazy plugin route pages: each plugin's route `element` references a `React.lazy`-wrapped page rendered inside a shared `<Suspense>` boundary. Plugins still register synchronously, so nav, slots, commands, API factories, and `foreignSignals` are available on first paint. This moves ~37 route-page chunks (~600 KB) out of the entry; the entry chunk drops from ~2.4 MB to ~190 KB. Auth flow pages stay eager. The `@checkstack/scripts` scaffold template generates lazy route pages too.
89
+ - Hardened contribution contract (BREAKING, frontend plugin contract): plugins declare contributions lazily and let the framework own code-splitting, Suspense, and per-plugin error isolation. Routes use `load: () => import("./Page").then((m) => ({ default: m.Page }))` instead of `element: <Page />` (`element` is still accepted for the rare page that must paint without a chunk fetch; provide exactly one). Slot extensions accept either an eager `component` or a lazy `load`; new `getLazyContribution` + `ExtensionComponent` exports from `@checkstack/frontend-api` render either kind. This also fixes runtime-installed plugins: `ExtensionSlot` subscribes to the plugin registry, and the API registry rebuilds when the plugin set changes (`getPlugins()` returns an immutable snapshot via `useSyncExternalStore`). A per-plugin error boundary contains a bad contribution.
90
+ - On-demand Monaco: the `@checkstack/ui` barrel no longer pulls the `@codingame/*` / `monaco-languageclient` stack into the initial load. `CodeEditor` lazy-loads its Monaco-backed editor behind `React.lazy` + Suspense, `validateTypeScriptSources` imports the editor API via in-body `await import(...)`, and the "vscode services ready" signal moved to a Monaco-free module. The ~10 MB editor body loads only when a `CodeEditor` mounts. A `react-vendor` `manualChunks` split was added for stable vendor caching.
91
+ - lucide-react 1.x + lighter icons/charts (BREAKING for icon consumers): lucide-react unified from three drifting ranges to `^1.17.0`. lucide v1 removed brand icons, so the GitHub/GitLab marks are vendored in `@checkstack/ui` (`GithubIcon`, `GitlabIcon`, `brandIcons`); a new `IconName` type (`LucideIconName | BrandIconName`) in `@checkstack/common` is canonical, accepted by `AuthStrategy.icon` and the card components, so data-driven brand names keep working. `DynamicIcon` no longer eagerly imports lucide's ~1600-icon map (~1 MB) - it lives in a `React.lazy` `iconRegistry` chunk fetched on first data-driven render, while statically named-imported icons tree-shake normally. The recharts-backed health-check charts (~300 KB) and the `HealthCheckSystemOverview` drawer leave the initial load.
92
+
93
+ BREAKING CHANGES:
94
+
95
+ - Frontend plugin contract: routes/slot contributions are lazy-by-default (`load` instead of `element`/eager elements) as described above.
96
+ - Any external consumer importing a brand icon from `lucide-react` (e.g. `import { Github } from "lucide-react"`) must switch to the vendored `@checkstack/ui` brand icons or a custom SVG.
97
+
98
+ This is a beta minor.
99
+
100
+ - 9dcc848: Add the auto-generated, version-pinned `@checkstack/sdk` package + codegen, and serve its types live to the in-app editor.
101
+
102
+ - A new committed workspace package `@checkstack/sdk`, generated from the platform's source of truth by `scripts/generate-sdk.ts` (`generate:sdk` / `generate:sdk:check`): a fully-typed oRPC client (`createCheckstackClient`) over the REST surface with one `InferClient` per plugin contract, real script-authoring helpers (`@checkstack/sdk/healthcheck`, `@checkstack/sdk/integration`) whose runtime body is the same identity function the in-app runner injects, per-subpath `.d.ts` under the package `exports` map, and an editor-only ambient bundle. A `generate:sdk:check` CI guard fails when the committed SDK files drift from a fresh generation. The `@checkstack/sdk` version is stamped from `@checkstack/release` and MUST NOT appear in a changeset (a guard enforces this); the `@checkstack/release` bump here advances the release version so the generated SDK can be published later. The generated client also normalizes its base URL without a backtracking-prone regex, closing a CodeQL `js/polynomial-redos` finding.
103
+ - Live editor type injection: a new version-keyed route `GET /api/script-packages/sdk-types/:releaseVersion` (raw handler in `@checkstack/script-packages-backend`) serves the generated SDK editor bundle with `Cache-Control: private, max-age=1y, immutable`; the pure path-build/parse module lives in `@checkstack/script-packages-common`, shared by backend and frontend. A mismatched version returns `409` so the editor refetches and never serves stale types after an upgrade. The frontend `useSdkTypeInjection` hook fetches the bundle once per session and mounts it into Monaco via `addExtraLib`. Schema-narrowed `context.config` / `context.event.payload` editor types stay local; the package-resolving module declarations come from the one published `@checkstack/sdk` source.
104
+
105
+ BREAKING CHANGES: the script-authoring import surface moves from the bare `@checkstack/healthcheck` / `@checkstack/integration` virtual modules to the `@checkstack/sdk/healthcheck` / `@checkstack/sdk/integration` subpaths of the published `@checkstack/sdk` package. The old bare-name imports no longer resolve (an old import now errors in the editor, surfacing the migration). Existing scripts must update the module specifier:
106
+
107
+ - import { defineHealthCheck } from "@checkstack/healthcheck";
108
+ + import { defineHealthCheck } from "@checkstack/sdk/healthcheck";
109
+
110
+ - import { defineIntegration } from "@checkstack/integration";
111
+ + import { defineIntegration } from "@checkstack/sdk/integration";
112
+
113
+ The helper names and their runtime behaviour are unchanged - only the module specifier moves. The global (no-import) helper form continues to work unchanged.
114
+
115
+ This is a beta minor.
116
+
117
+ - 9dcc848: Guard component animations behind isLowPower, and add a shared inline Spinner.
118
+
119
+ - `@checkstack/ui` shared components (`Tabs`, `ConfirmationModal`, `Accordion`, `CodeEditor` popout-button backdrop blur) now drop their `animate-*` / `backdrop-blur` classes when the device reports the low-power tier, matching `LoadingSpinner` / `Skeleton`. No public API change; normal-power rendering is unchanged.
120
+ - A new shared inline `Spinner` (`@checkstack/ui`) renders a lucide `Loader2` whose `animate-spin` is gated internally behind `usePerformance().isLowPower`, so call sites inherit the low-power guard. Props: `size` (`sm`/`md`/`lg`), `className`, rest spread to the icon; decorative by default (`aria-hidden`), `role="status"` when given `aria-label`. The hand-rolled `Loader2` button/table spinners in `HealthCheckDrawer`, `HealthCheckRunsTable`, `IncidentEditor`, `IncidentUpdateForm`, `ProviderConnectionsPage`, `MaintenanceEditor`, `MaintenanceUpdateForm`, `UserChannelCard`, and `DynamicOptionsField` are migrated onto it.
121
+ - Remaining unguarded `animate-*` / `animate-in` / blur classes across the auth, gitops, healthcheck, incident, integration, maintenance, and notification frontends are gated behind `usePerformance().isLowPower`, so effects degrade gracefully on low-power devices per the performance rule.
122
+
123
+ Normal-power behavior is unchanged; low-power rendering drops the animations.
124
+
125
+ This is a beta minor.
126
+
127
+ - 9dcc848: Align workspace dependency versions and migrate React Router to v7.
128
+
129
+ BREAKING CHANGES (React Router v7): All frontend packages now depend on `react-router-dom@^7.16.0`. Previously the workspace declared four divergent ranges (`^6.20.0`, `^6.22.0`, `^7.1.1`, `^7.14.2`), which resolved both `react-router@6` and `react-router@7` into a single bundle. Everything is now unified on v7. The public imports the app uses (`BrowserRouter`, `Routes`, `Route`, `Link`, `NavLink`, `MemoryRouter`, `useNavigate`, `useParams`, `useSearchParams`, `useLocation`) are unchanged between v6 and v7, so no source rewrites were required - but any out-of-tree plugin still on react-router v6 should upgrade to v7 (see the React Router v6 -> v7 upgrade guide) to share the host's single router instance via the import map.
130
+
131
+ Other unified ranges (no API change): `react` -> `^18.3.1`, the `@orpc/*` family (`contract`, `server`, `client`, `tanstack-query`, `openapi`, `zod`) -> `^1.14.4`, and `better-auth` -> `^1.6.13`.
132
+
133
+ Removed the pre-rename `@orpc/react-query` leftover from `@checkstack/frontend-api`; its `createRouterUtils` / `RouterUtils` / `ProcedureUtils` now come from `@orpc/tanstack-query` (the package already in use).
134
+
135
+ Stale in-range runtime deps pulled up to current published versions: `hono` `^4.12.23`, `@tanstack/react-query` (+devtools) `^5.100.14`, `date-fns` `^4.4.0`, `jose` `^6.2.3`, `tar` `^7.5.16`, `semver` `^7.8.1`, `@xyflow/react` `^12.11.0`.
136
+
137
+ ### Patch Changes
138
+
139
+ - Updated dependencies [9dcc848]
140
+ - Updated dependencies [9dcc848]
141
+ - Updated dependencies [9dcc848]
142
+ - Updated dependencies [9dcc848]
143
+ - Updated dependencies [9dcc848]
144
+ - @checkstack/common@0.13.0
145
+ - @checkstack/template-engine@0.4.0
146
+ - @checkstack/frontend-api@0.7.0
147
+
148
+ ## 1.12.0
149
+
150
+ ### Minor Changes
151
+
152
+ - b995afb: Redesign the automation visual editor to a Home-Assistant-style collapsed-card UX.
153
+
154
+ Every item in all three sections (actions, triggers, conditions) now renders as a compact summary row by default - icon, title, and a one-line summary derived from its config. Clicking the row opens the item's full configuration in a right-side sheet that edits the same live definition (no draft/commit step), so closing the sheet keeps the changes. The saved `definition` is unchanged - only the editor presentation - so the visual and YAML views still round-trip losslessly.
155
+
156
+ - `@checkstack/ui` `ActionCard` gains three optional, backward-compatible props: `onOpenSheet` (turns the card into a non-expanding summary row that opens a host-supplied sheet on header click), `summary` (the compact one-line hint shown under the title), and `actions` (a typed `ActionCardMenuItem[]` rendered as a three-dot overflow menu). The new `ActionCardMenuItem` type is exported. Existing inline-expand usages are unaffected when the new props are omitted.
157
+ - Per-card commands move into the overflow menu: Disable/Enable, a new Duplicate, and Delete. The drag grip stays on the action card header; actions keep dnd-kit reordering and the parallel id array. Triggers and conditions remain non-reorderable.
158
+ - Duplicate clones an item with fresh, unique ids (via the existing id helpers) and inserts it directly after the original, keeping the editor's parallel id array in sync.
159
+ - Composite actions (choose / parallel / repeat / sequence) keep nesting: a child card inside a parent's sheet opens its OWN sheet, stacking via Radix Dialog's portal + overlay.
160
+ - Cards with validation errors auto-open their sheet and show an error badge on the collapsed row, so problems are never hidden behind a collapsed row plus a closed sheet.
161
+
162
+ - 270ef29: Add the sensing-layer editor UX (Wave 2 Phase 19) - the visual widgets for the duration-aware and structured-condition building blocks from Phases 15-18.
163
+
164
+ - New `@checkstack/ui` components (each with a Storybook story):
165
+ - `DurationInput` - number + unit (`seconds` / `minutes` / `hours`) picker emitting the single-unit `Duration` object the backend accepts, so it round-trips losslessly through YAML.
166
+ - `TimeOfDayInput` - HH:MM (24h) input emitting the `"HH:mm"` string the `time` condition's `after` / `before` accept. Both are plain inputs (no animations), so no `usePerformance` gating is needed.
167
+ - `DynamicForm`'s `FormField` gains an additive `x-duration` / `format: "duration"` branch that renders `DurationInput` for schema-driven duration configs. (Additive alongside the existing dispatch; reconciles cleanly with the parallel branch's `FormField` edits.)
168
+ - The `ConditionEditor` kind selector gains `numeric_state` / `time` / `state` structured branches: an operator dropdown (above / below / between) + threshold for numeric, `TimeOfDayInput` + weekday toggles + timezone for time, and a status dropdown + optional `DurationInput` dwell for state. The raw-expression escape hatch is kept. Pure `kindOf` / `defaultForKind` helpers are split into a UI-free `condition-kind` module so they unit-test under bun (the UI barrel drags Monaco).
169
+ - The trigger card gains a `for:` dwell toggle + `DurationInput` (Phase 15's schema was already round-tripping in YAML).
170
+
171
+ Visual and YAML views stay lossless; structured conditions authored in either are editable in the other.
172
+
173
+ - b995afb: Surface inline-script type errors as automation action badges.
174
+
175
+ Every inline `run_script` action in the automation editor is now type-checked
176
+ against its generated `context` types continuously - including actions whose
177
+ cards are collapsed - and any errors show up as the action card's error badge
178
+ (and in the definition issue list), the same surface structural validation
179
+ uses. Previously a type error was only visible as a red squiggle inside the
180
+ open Monaco editor, so a broken script behind a collapsed card (or one
181
+ invalidated by adding a new trigger) went unnoticed until runtime, where the
182
+ bad property access silently read `undefined`.
183
+
184
+ Validation runs entirely in the browser via the same standalone TypeScript
185
+ worker the editor uses (new `validateTypeScriptSources` export on
186
+ `@checkstack/ui`), so there is no backend round-trip. Each script is checked by
187
+ prepending its generated `context.d.ts` to the source, which keeps the
188
+ `context` global scoped to that one off-screen file and avoids colliding with
189
+ any open editor. When an automation already contains scripts, a hidden editor
190
+ boots the shared editor services on open so validation runs immediately rather
191
+ than only after the first script card is expanded.
192
+
193
+ This covers the automation currently open in the editor. Scripts in other
194
+ automations, or definitions authored via YAML/API, are not type-checked here -
195
+ that platform-wide coverage remains future work for a backend typecheck.
196
+
197
+ Also: action cards no longer auto-open their detail sheet when they have
198
+ validation issues; issues now surface only as the card badge, so multiple
199
+ flagged actions no longer pop several sheets open at once.
200
+
201
+ - b995afb: Improve the automation Run Script secret → env mapping editor and script IntelliSense.
202
+
203
+ - **Searchable secret picker with existence validation.** The secret → env mapping editor (`SecretEnvEditor`) now uses a searchable, keyboard-navigable combobox (modeled on `VariablePicker` / `PackageNameCombobox`, `isLowPower`-aware) populated from the secrets plugin's `listSecretNames`, replacing the plain `<input>` + `<datalist>`. A free-typed name still round-trips (a secret may be created later). When a row references a name that the loaded list does not contain, the row shows a non-blocking warning (red border + message); save is not prevented. The existence check lives in a pure, unit-tested `unknownSecretNames` helper.
204
+ - **Clearer field description.** The `secretEnv` field descriptions on the `run_script` / `run_shell` actions no longer show the stored `${{ secrets.NAME }}` template (which is confusing in a UI that takes a bare name); they now describe the actual UI behavior and how the value is injected (`process.env.<ENV_NAME>` / `$<ENV_NAME>`) and masked.
205
+ - **`process.env.<ENV_NAME>` autocomplete.** Declared `secretEnv` env-var names now autocomplete under `process.env.` in the Run Script (TypeScript) Monaco editor and are typed `string`, via an ambient `NodeJS.ProcessEnv` augmentation merged into the editor type definitions. New pure, unit-tested generators `generateSecretEnvTypes` and `secretEnvEnvNames` (exported from `@checkstack/automation-frontend`) drive this; the augmentation coexists with `@types/node`'s existing index signature.
206
+ - **Shared combobox-interaction helper.** The "opens-then-immediately-closes" popover guard (`comboboxAnchorProps` / `isAnchorInteraction`) is promoted from `@checkstack/script-packages-frontend` into `@checkstack/ui` so the new secret picker and the existing package/version comboboxes share one implementation; the package comboboxes now import it from `@checkstack/ui` and the local copy is removed.
207
+
208
+ - b995afb: Add an "expand to overlay" popout to the shared `CodeEditor` so big scripts (shell / TypeScript / JavaScript) can be edited comfortably in a large full-screen overlay.
209
+
210
+ Every consumer of `CodeEditor` (automation Run Script, healthcheck collectors, etc.) now gets a subtle "Expand editor" affordance (a `Maximize2` icon button) in the editor's top-right corner. Clicking it opens the shared `Dialog` at `size="full"` containing a large editor that fills the dialog.
211
+
212
+ - The overlay editor is a second `TypefoxEditor` instance bound to the SAME `value` / `onChange` and all the same completion props (`typeDefinitions`, `templateProperties`, `shellEnvVars`, `markers`, `acquireTypes`, `acquireResetKey`, `importablePackages`, `language`, `readOnly`, `placeholder`), so IntelliSense / ATA / import-name / shell-var completion all work in the overlay exactly as inline. Both editors are controlled on the same value, so edits stay in sync and closing the dialog keeps them.
213
+ - The overlay editor only MOUNTS while the dialog is open (lazy), so there is no second Monaco instance cost when closed. It uses a distinct `${id}-popout` model id so the two Monaco models don't fight over the same URI.
214
+ - New opt-in `TypefoxEditor` prop `fillHeight`: when true the editor container uses `height: 100%` (with `minHeight` as a floor) instead of a fixed px height, so it fills the tall flex dialog body and Monaco's `automaticLayout` resizes to fit. Inline behaviour is unchanged when `fillHeight` is absent/false.
215
+ - `CodeEditorProps` gains two additive optional props: `allowPopout` (default `true`; set `false` to hide the affordance) and `title` (override the overlay dialog title, which otherwise derives from `language`, e.g. "Edit script - TypeScript").
216
+ - `TypefoxEditor` is now properly controlled: external `value` changes are applied to the live model (guarded by an equality check so a user's own edit is a no-op and there's no loop). This is what keeps the inline and popout editors in sync — editing one updates the other — and also fixes external resets (YAML→Visual, loaded definitions) reflecting in the editor.
217
+ - `DialogContent`'s inner content wrapper gains `min-h-0 flex-1` so it fills the height when a consumer makes `DialogContent` a tall flex column (e.g. the popout body). Inert for the default non-flex dialog, so existing dialogs are unaffected.
218
+
219
+ The `Dialog` already degrades its own animations under `usePerformance` / `isLowPower`; the popout button adds no heavy effects.
220
+
221
+ - b995afb: Suggest Node and Bun built-in modules in script-editor import-name completion.
222
+
223
+ The import-specifier completion now also offers the always-available runtime built-ins (`node:fs`, bare `fs`, `bun`, `bun:test`, `node:crypto`, ...) alongside the installed allowlist packages. These are importable in the script sandbox regardless of the allowlist (the sandbox is a Bun subprocess, which provides Node's builtins plus its own `bun:` modules), and their types are already loaded ambiently, so completing one needs no lazy acquisition.
224
+
225
+ - The built-in name list is DERIVED authoritatively at build time from the same bundled `@types/node` + `bun-types` declarations the editor injects: every importable built-in is a top-level `declare module "<spec>"`, so the generator (`scripts/generate-stdlib-types.ts`) now also parses those names (via the new pure `extractBuiltinModuleSpecifiers`) and emits `generated/builtin-modules.json`. No hand-maintained list - it auto-updates whenever the bundled types are regenerated. Wildcard / asset-glob ambient shims (names containing a star, e.g. asset globs or a `bun.lock` path glob) are filtered out.
226
+ - The completion provider merges built-ins with the injected installed packages (deduped + sorted via the pure `mergeImportCompletionEntries`), labelling each via `detail` ("Node.js" / "Bun built-in" / "installed package"). Built-ins appear even when the allowlist is empty; the provider still only fires inside an import-string position and coexists with the TS worker's own completions.
227
+
228
+ The existing node/bun stdlib TYPE hosting is unchanged (still injected from the separately code-split `stdlib-types.json` asset), so global completions (`process.*`, `Buffer`, ...) and member completions (`import * as fs from "node:fs"`) are unaffected. New pure helpers are fully unit-tested; the Monaco glue is untested per the no-DOM rule.
229
+
230
+ - 270ef29: Add in-UI script testing for automation `run_script` / `run_shell` actions.
231
+
232
+ A new `testScript` RPC runs a TypeScript or shell script against an
233
+ editable, auto-seeded sample context using the same sandboxed runner the
234
+ real action uses, so operators can test scripts directly in the editor
235
+ without dispatching a whole automation. Surfaces beneath any script field
236
+ flagged `x-script-testable` via the new `ScriptTestPanel` /
237
+ `ContextSampleEditor` components in `@checkstack/ui` and the
238
+ `scriptTestRenderer` prop threaded through `DynamicForm`.
239
+
240
+ - `@checkstack/automation-common`: adds the `testScript` contract +
241
+ `ScriptTest*` schemas (gated by `automation.manage`).
242
+ - `@checkstack/automation-backend`: implements `testScript` reusing the
243
+ shared ESM / shell runners; central-only, time-bounded.
244
+ - `@checkstack/backend-api`: new `x-script-testable` config-schema
245
+ metadata propagated to the frontend JSON Schema.
246
+ - `@checkstack/ui`: new `ScriptTestPanel` + `ContextSampleEditor`
247
+ components and a `scriptTestRenderer` prop on `DynamicForm`.
248
+ - `@checkstack/automation-frontend`: wires the test panel into the action
249
+ editor.
250
+ - `@checkstack/integration-script-backend`: marks the `run_script` /
251
+ `run_shell` script fields as testable.
252
+
253
+ - b995afb: Autocomplete the import specifier itself in script editors.
254
+
255
+ Lazy type acquisition only loads a package's types once its name is already in the buffer, so while you were still typing the import specifier (`import {} from "lod"`) there were no suggestions - the lazy-ATA catch-22. Script editors now suggest installed package names directly in import-specifier position; selecting one (e.g. `lodash`) inserts the name, and the existing ATA loop then loads its `@types/lodash` closure so members complete.
256
+
257
+ - `@checkstack/ui`: `CodeEditor`/`TypefoxEditor` gained an injected `importablePackages?: string[]` prop and a dedicated Monaco completion provider (registered once per `typescript`/`javascript` language, scoped to the editor's model, disposed on unmount). It fires ONLY when the cursor is inside an import/require module-specifier string - detected by a new pure, unit-tested helper `importSpecifierCompletionContext(lineUpToCursor)` that handles `from "…"`, bare `import "…"`, `require("…")`, and dynamic `import("…")`, returns the partial specifier + the replace range, and returns null once the string is closed or outside an import. Items are `kind: Module`, insert the bare name without touching the quotes, and coexist with (do not replace) the TS worker's own completions. Trigger characters: `"`, `'`, and `/` (for scoped subpaths); manual invoke (Ctrl+Space) also works. A new pure helper `importablePackageNames` filters a raw manifest name list (excludes `@types/*`, dedupes, sorts).
258
+ - `@checkstack/script-packages-frontend`: `useScriptPackageTypeAcquisition()` now also returns `importablePackages`, derived from the installed manifest (what is actually resolvable at runtime) with `@types/*` companions excluded - you import `lodash`, never `@types/lodash` (the `@types` package still backs the closure types).
259
+ - `@checkstack/automation-frontend` / `@checkstack/healthcheck-frontend`: pass `importablePackages` into `DynamicForm` alongside the existing `acquireTypes` wiring, so both the Run Script action editor and healthcheck collector editors get import-name completion.
260
+
261
+ The completion list is plugin-agnostic in `@checkstack/ui` (the names are injected); it never fires outside import-string positions, so normal completions are unaffected.
262
+
263
+ - b995afb: Fix package IntelliSense in script editors: lazy Automatic Type Acquisition (ATA) with proper `@types/*` resolution.
264
+
265
+ Script editors (automation "Run Script (TypeScript)" and healthcheck collectors) now provide real autocomplete for installed npm packages. Importing a package whose types live in DefinitelyTyped - e.g. `import { debounce } from "lodash"` (lodash ships no own types; `@types/lodash` does) - now yields member completions. Previously no package completions appeared at all.
266
+
267
+ Root cause: the old rollup wrapped each package's raw, multi-file `.d.ts` (with `export =`, `export as namespace`, and triple-slash `/// <reference path>` chains) inside a single `declare module "<name>" { ... }`, which the TypeScript worker silently rejected, and it truncated large type sets (lodash is ~866 KB across ~700 files) at a 256 KB cap.
268
+
269
+ The fix registers the REAL declaration files at their `node_modules/...` virtual paths and lets TypeScript's own NodeJs + `@types` resolution do the work:
270
+
271
+ - `@checkstack/script-packages-backend`: replaced `rollupPackageTypes` with a tree-driven closure extractor (`resolvePackageTypeClosure`). Given a bare specifier, it resolves against the materialized tree - own types via `package.json` `types`/`typings`/`exports` (bundled-types packages like `zod`/`dayjs`), the `@types/<mangled>` companion when it exists (`lodash` -> `@types/lodash`, scoped `@babel/core` -> `@types/babel__core`), or both, or neither (graceful empty, never a throw). It follows `/// <reference path|types>` and relative imports, includes each package's `package.json`, leaves every file UNWRAPPED, and surfaces a `truncated` flag instead of silently capping. Served from a new raw, HTTP-cacheable route `GET /api/script-packages/types/:lockfileHash/:specifier` (`Cache-Control: private, max-age=1y, immutable`), auth-gated by `script-packages.read`.
272
+ - `@checkstack/script-packages-common`: **BREAKING** - replaced the `listPackageTypes` RPC procedure and `PackageTypesSchema { name, version, dts }` with `PackageTypeClosureSchema` (a `{ path, content }` file-map plus `hasOwnTypes`/`hasAtTypes`/`notFound`/`truncated`) served over the cacheable HTTP route. Added a shared `buildTypeAcquisitionPath`/`parseTypeAcquisitionPath` path contract.
273
+ - `@checkstack/ui`: `CodeEditor`/`TypefoxEditor` gained an injected `acquireTypes` resolver + `acquireResetKey`. On debounced buffer change it parses bare `import`/`require` specifiers (pure, unit-tested) and lazily fetches + registers each NEW package's closure via `addExtraLib` at `file:///node_modules/...`, deduped by a shared acquired-set that resets when the install hash changes. Compiler options set `moduleResolution: NodeJs`, `baseUrl: "file:///"`, and `typeRoots` so a bare import resolves to its `@types` companion. The `context` ambient global keeps working unchanged.
274
+ - `@checkstack/script-packages-frontend`: replaced the old `useScriptPackageTypes` (which concatenated the broken `dts`) with `useScriptPackageTypeAcquisition()`, returning the `acquireTypes` resolver (targets the cacheable route, zod-validates the response) and the current `lockfileHash` as `acquireResetKey`.
275
+ - `@checkstack/automation-frontend` / `@checkstack/healthcheck-frontend`: wired the resolver into the Run Script and collector editors.
276
+
277
+ State & scale: the type closure is derived on read from the materialized package tree (no new durable state). The editor's acquired-set is pod-local UI bookkeeping; the route is keyed by the cluster-wide `lockfileHash`, so the browser HTTP cache is correct across pods and only refetches after a new install changes the hash.
278
+
279
+ - b995afb: Fix the automation Run Script action's `secretEnv` (secret → env mapping) test wiring and tolerate bare secret names.
280
+
281
+ - `@checkstack/ui` `ScriptTestPanel` now accepts the script field's declared `secretEnv` and renders an optional per-secret test-override input. The `ScriptTestRenderer` callback (DynamicForm) receives the SIBLING `x-secret-env` mapping value, located by annotation (not by field name), so a testable script field forwards it to the panel. Previously the test path never sent `secretEnv`, so `buildTestSecretEnv` got `undefined` and `process.env.<env>` was undefined in an in-UI test. Now an override-less test injects `__SECRET_<NAME>__` placeholders, and any operator override is masked from the output. Real secret values are still NEVER resolved in the test path.
282
+ - `@checkstack/automation-frontend` forwards the action's `secretEnv` and the collected overrides to `testScript`.
283
+ - `@checkstack/secrets-common`: the `secretEnv` mapping VALUE now accepts EITHER a `${{ secrets.NAME }}` template OR a bare secret name, normalizing a bare name to the canonical `${{ secrets.NAME }}` template on parse. This is a forgiving / NARROWING input change (more inputs accepted; stored/output form is unchanged and still the template), not a breaking change. Existing data and YAML shorthand like `secretEnv: { secret: SECRET }` now pass config validation instead of failing with "Must contain a ${{ secrets.NAME }} reference". Partial inline interpolation (e.g. `u:${{ secrets.pw }}@host`) keeps working unchanged; values that are neither a secret reference nor a valid secret name are still rejected.
284
+ - `@checkstack/ui` `parseSecretName` tolerates a legacy bare secret name for display so the picker shows the same name for both the template and the bare form.
285
+
286
+ The healthcheck collector test panel was checked: its config has no `x-secret-env` field, so it needed no secret wiring (only the `onRun` signature change, which is backward compatible).
287
+
288
+ - 270ef29: Secrets platform Phase 2: secret -> env-var mapping with central resolve, inject, and mask.
289
+
290
+ - Script consumers declare a least-privilege `secretEnv` allowlist
291
+ (`{ ENV_NAME: "${{ secrets.NAME }}" }`). The automation `run_script` /
292
+ `run_shell` actions resolve ONLY the declared secrets via
293
+ `secretResolverRef.resolveForRun`, inject them into the runner env for
294
+ that run (memory-only; the ESM runner gained a per-run `env` option), and
295
+ mask their values out of stdout/stderr/result/error via the run-scoped
296
+ masking context. A missing required secret fails the run clearly. No
297
+ ambient secret access.
298
+ - Test panel: `testScript` / `testCollectorScript` inject named
299
+ `__SECRET_<NAME>__` placeholders by default, or user-supplied per-secret
300
+ overrides; real production values are never resolved in the test path,
301
+ and overrides are masked out of the result.
302
+ - Healthcheck collectors carry the `secretEnv` field for authoring +
303
+ the test panel; runtime injection on satellites lands in Phase 3.
304
+ - Editor UX: a new `@checkstack/ui` `SecretEnvEditor` renders `x-secret-env`
305
+ record fields with `${{ secrets.* }}` name autocomplete (from
306
+ `listSecretNames`), wired into the automation action editor and the
307
+ healthcheck collector editor. New `withConfigMeta` helper +
308
+ `x-secret-env` config-meta key in `@checkstack/backend-api`.
309
+
310
+ - b995afb: fix(ui): make Popover/combobox lists scrollable inside a Sheet or Dialog
311
+
312
+ A `Popover` (and the comboboxes built on it, e.g. the automation trigger Event
313
+ picker, the secret-name picker, the package picker) portals its content to
314
+ `document.body`. When opened inside a modal `Sheet`/`Dialog`, the dialog's
315
+ `react-remove-scroll` scroll-lock blocked wheel/touch scrolling on that
316
+ body-portaled content, so a long list's `overflow-y-auto` could not scroll.
317
+
318
+ `SheetContent` and `DialogContent` now publish their content element through a
319
+ `PortalContainerContext`, and `PopoverContent` portals INTO it when present.
320
+ That keeps the popover inside the dialog's allowed-scroll subtree, so its lists
321
+ scroll again. Radix positions popovers with `position: fixed`, so placement and
322
+ clipping are unaffected; outside a Sheet/Dialog the popover still portals to
323
+ `body` as before.
324
+
325
+ - 270ef29: Collapse `ScriptTestPanel` behind a compact disclosure by default.
326
+
327
+ The inline script-test panel previously expanded its sample-context editor and results under every testable script field. It now defaults to collapsed: a compact "Test script" affordance shows, and the panel expands on demand. Running a test still auto-expands the results, and the last run's outcome surfaces as a badge while collapsed. A new `defaultOpen` prop opts back into the always-expanded behaviour.
328
+
3
329
  ## 1.11.0
4
330
 
5
331
  ### Minor Changes
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@checkstack/ui",
3
- "version": "1.11.0",
3
+ "version": "1.13.0",
4
4
  "license": "Elastic-2.0",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
7
7
  "dependencies": {
8
- "@checkstack/common": "0.11.0",
9
- "@checkstack/frontend-api": "0.5.2",
8
+ "@checkstack/common": "0.12.0",
9
+ "@checkstack/frontend-api": "0.6.0",
10
+ "@checkstack/template-engine": "0.3.0",
10
11
  "@codingame/monaco-vscode-editor-api": "25.1.2",
11
12
  "@codingame/monaco-vscode-languages-service-override": "25.1.2",
12
13
  "@codingame/monaco-vscode-standalone-json-language-features": "25.1.2",
@@ -23,43 +24,47 @@
23
24
  "ajv-formats": "^3.0.1",
24
25
  "class-variance-authority": "^0.7.1",
25
26
  "clsx": "^2.1.0",
26
- "date-fns": "^4.1.0",
27
+ "date-fns": "^4.4.0",
27
28
  "fast-xml-parser": "^5.8.0",
28
29
  "jsonc-parser": "^3.3.1",
29
- "lucide-react": "0.562.0",
30
+ "lucide-react": "^1.17.0",
30
31
  "monaco-languageclient": "10.7.0",
31
- "react": "^18.2.0",
32
+ "react": "^18.3.1",
32
33
  "react-day-picker": "^9.13.0",
33
34
  "react-dom": "^18.2.0",
34
35
  "react-markdown": "^10.1.0",
35
- "react-router-dom": "^6.20.0",
36
+ "react-router-dom": "^7.16.0",
36
37
  "recharts": "^3.6.0",
38
+ "rehype-raw": "^7.0.0",
39
+ "rehype-sanitize": "^6.0.0",
40
+ "remark-gfm": "^4.0.1",
37
41
  "tailwind-merge": "^2.2.0",
38
- "yaml": "^2.9.0"
42
+ "yaml": "^2.9.0",
43
+ "zod": "^4.2.1"
39
44
  },
40
45
  "devDependencies": {
41
- "@checkstack/scripts": "0.3.3",
46
+ "@checkstack/scripts": "0.3.4",
42
47
  "@checkstack/test-utils-frontend": "0.0.5",
43
48
  "@checkstack/tsconfig": "0.0.7",
44
- "@storybook/addon-a11y": "^10.3.6",
45
- "@storybook/addon-docs": "^10.3.6",
46
- "@storybook/addon-themes": "^10.3.6",
47
- "@storybook/react": "^10.3.6",
48
- "@storybook/react-vite": "^10.3.6",
49
+ "@storybook/addon-a11y": "^10.4.1",
50
+ "@storybook/addon-docs": "^10.4.1",
51
+ "@storybook/addon-themes": "^10.4.1",
52
+ "@storybook/react": "^10.4.1",
53
+ "@storybook/react-vite": "^10.4.1",
49
54
  "@testing-library/react": "^16.0.0",
50
55
  "@types/bun": "^1.3.14",
51
56
  "@types/node": "^20.19.27",
52
57
  "@types/react": "^18.2.0",
53
58
  "@types/react-dom": "^18.2.0",
54
- "@vitejs/plugin-react": "^6.0.1",
59
+ "@vitejs/plugin-react": "^6.0.2",
55
60
  "bun-types": "^1.3.14",
56
61
  "autoprefixer": "^10.4.18",
57
- "postcss": "^8.4.35",
58
- "storybook": "^10.3.6",
62
+ "postcss": "^8.5.15",
63
+ "storybook": "^10.4.1",
59
64
  "tailwindcss": "^3.4.1",
60
65
  "tailwindcss-animate": "^1.0.7",
61
66
  "typescript": "^5.0.0",
62
- "vite": "^8.0.8"
67
+ "vite": "^8.0.16"
63
68
  },
64
69
  "scripts": {
65
70
  "typecheck": "tsgo -b",
@@ -21,10 +21,18 @@
21
21
  * lives at `src/components/CodeEditor/generated/stdlib-types.json` and is
22
22
  * lazy-imported by the editor (so the ~3 MB payload is code-split into its
23
23
  * own chunk and never blocks initial page load).
24
+ *
25
+ * It ALSO emits `generated/builtin-modules.json`: the authoritative list of
26
+ * importable built-in specifiers (`node:fs`, bare `fs`, `bun`, `bun:test`, ...)
27
+ * derived from the SAME bundled declarations (every importable built-in is a
28
+ * top-level `declare module "<spec>"`). The editor ships this so the
29
+ * import-name completion provider can suggest sandbox built-ins regardless of
30
+ * the installed-package allowlist, and it auto-updates with the bundled types.
24
31
  */
25
32
  import { createRequire } from "node:module";
26
33
  import { readdir, readFile, mkdir, writeFile } from "node:fs/promises";
27
34
  import path from "node:path";
35
+ import { extractBuiltinModuleSpecifiers } from "../src/components/CodeEditor/importSpecifiers";
28
36
 
29
37
  const require = createRequire(import.meta.url);
30
38
 
@@ -88,3 +96,18 @@ const totalBytes = Object.values(files).reduce((acc, c) => acc + c.length, 0);
88
96
  console.log(
89
97
  `✅ Wrote ${Object.keys(files).length} files (${(totalBytes / 1024 / 1024).toFixed(2)} MB) → ${path.relative(process.cwd(), outFile)}`,
90
98
  );
99
+
100
+ // Derive the authoritative built-in import specifier list from the SAME
101
+ // bundled declarations: every importable built-in (`node:fs`, bare `fs`,
102
+ // `bun`, `bun:test`, ...) is a top-level `declare module "<spec>"`, so the
103
+ // name set falls out of the d.ts text directly. Wildcard/asset-glob shims
104
+ // (`*.txt`, `*/bun.lock`) are filtered out by the extractor. This auto-updates
105
+ // whenever the bundled `@types/node` / `bun-types` are regenerated, so the
106
+ // editor's import-name completions never drift from the runtime stdlib.
107
+ const allDeclarations = Object.values(files).join("\n");
108
+ const builtinModules = extractBuiltinModuleSpecifiers(allDeclarations);
109
+ const builtinsFile = path.join(outDir, "builtin-modules.json");
110
+ await writeFile(builtinsFile, JSON.stringify(builtinModules), "utf8");
111
+ console.log(
112
+ `✅ Wrote ${builtinModules.length} built-in module specifiers → ${path.relative(process.cwd(), builtinsFile)}`,
113
+ );
@@ -2,6 +2,7 @@ import * as React from "react";
2
2
  import * as AccordionPrimitive from "@radix-ui/react-accordion";
3
3
  import { ChevronDown } from "lucide-react";
4
4
  import { cn } from "../utils";
5
+ import { usePerformance } from "./PerformanceProvider";
5
6
 
6
7
  const Accordion = AccordionPrimitive.Root;
7
8
 
@@ -40,15 +41,22 @@ AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
40
41
  const AccordionContent = React.forwardRef<
41
42
  React.ElementRef<typeof AccordionPrimitive.Content>,
42
43
  React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
43
- >(({ className, children, ...props }, ref) => (
44
- <AccordionPrimitive.Content
45
- ref={ref}
46
- className="overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
47
- {...props}
48
- >
49
- <div className={cn("pb-4 pt-0", className)}>{children}</div>
50
- </AccordionPrimitive.Content>
51
- ));
44
+ >(({ className, children, ...props }, ref) => {
45
+ const { isLowPower } = usePerformance();
46
+ return (
47
+ <AccordionPrimitive.Content
48
+ ref={ref}
49
+ className={cn(
50
+ "overflow-hidden text-sm transition-all",
51
+ !isLowPower &&
52
+ "data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",
53
+ )}
54
+ {...props}
55
+ >
56
+ <div className={cn("pb-4 pt-0", className)}>{children}</div>
57
+ </AccordionPrimitive.Content>
58
+ );
59
+ });
52
60
 
53
61
  AccordionContent.displayName = AccordionPrimitive.Content.displayName;
54
62