@sirenodeck/sirenodeck 0.2.9 → 0.4.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 (65) hide show
  1. package/dist/main.mjs +1118 -624
  2. package/dist/{windows-CRWdUgCn.mjs → windows-BCvfQ3PA.mjs} +4 -4
  3. package/frontend/src/App.tsx +3 -0
  4. package/frontend/src/components/Deck.tsx +13 -2
  5. package/package.json +10 -1
  6. package/src/addon/api.ts +24 -1
  7. package/src/addon/data-directory.ts +52 -0
  8. package/src/api/protocol-internal.ts +1 -0
  9. package/src/builtin-addons/coding-agents/global/backend.ts +15 -1
  10. package/src/builtin-addons/index.ts +0 -1
  11. package/src/builtin-addons/internal-settings/backend.ts +1 -1
  12. package/src/builtin-addons/internal-settings/buttons/brightness/common/frontend.tsx +14 -3
  13. package/src/builtin-addons/internal-settings/buttons/brightness-compact/frontend.tsx +6 -0
  14. package/src/builtin-addons/internal-settings/index.ts +15 -0
  15. package/src/builtin-addons/media/backend.ts +21 -0
  16. package/src/builtin-addons/register-builtins.ts +0 -3
  17. package/src/builtin-addons/system-status/README.md +1 -1
  18. package/src/builtin-addons/system-status/domain/display-metrics.ts +1 -1
  19. package/src/builtin-addons/system-status/manifest.ts +1 -1
  20. package/src/cli/commands/addon-decks.ts +1 -0
  21. package/src/cli/commands/addon-setup-config.ts +85 -0
  22. package/src/cli/commands/addon-setup.ts +134 -0
  23. package/src/cli/commands/emulator-mode.ts +2 -1
  24. package/src/cli/commands/run.ts +53 -11
  25. package/src/cli/commands/service-manager.ts +3 -5
  26. package/src/cli/commands/start.ts +14 -81
  27. package/src/cli/commands/stop.ts +4 -0
  28. package/src/cli/index.ts +2 -0
  29. package/src/config/environment.ts +44 -0
  30. package/src/config/loader.ts +17 -1
  31. package/src/config/schemas.ts +2 -1
  32. package/src/config/validation.ts +5 -1
  33. package/src/deck/addon-handler-bridge.ts +105 -6
  34. package/src/deck/addon-settings.ts +94 -0
  35. package/src/deck/deck-config.ts +1 -0
  36. package/src/deck/inject-config-ui-button.ts +25 -14
  37. package/src/deck/runtime/runtime.ts +175 -3
  38. package/src/deck/system-back-injection.ts +2 -0
  39. package/src/deck/system-buttons/registry.tsx +1 -0
  40. package/src/deck/system-buttons/types.ts +1 -0
  41. package/src/system/credentials/native.ts +74 -0
  42. package/src/system/credentials/store.ts +77 -0
  43. package/src/system/providers/notification/windows.ts +4 -4
  44. package/src/themes/default/sirenodeck.json +1 -0
  45. package/src/themes/light/sirenodeck.json +1 -0
  46. package/src/themes/manifest.ts +1 -0
  47. package/src/ui/primitives/Chip.tsx +1 -0
  48. package/src/ui/primitives/StatusIndicator.tsx +36 -0
  49. package/src/ui/primitives/index.ts +1 -0
  50. package/src/ui/surfaces/BinaryToggleSurface.tsx +52 -0
  51. package/src/ui/surfaces/LoadingSurface.tsx +34 -0
  52. package/src/ui/surfaces/index.ts +2 -0
  53. package/src/builtin-addons/brightness/README.md +0 -51
  54. package/src/builtin-addons/brightness/buttons/brightness/backend.ts +0 -13
  55. package/src/builtin-addons/brightness/buttons/brightness/config.ts +0 -20
  56. package/src/builtin-addons/brightness/buttons/brightness/frontend.tsx +0 -50
  57. package/src/builtin-addons/brightness/domain/macos.ts +0 -46
  58. package/src/builtin-addons/brightness/index.d.ts +0 -5
  59. package/src/builtin-addons/brightness/index.ts +0 -20
  60. package/src/builtin-addons/brightness/poller.ts +0 -27
  61. package/src/builtin-addons/brightness/sirenodeck.json +0 -6
  62. /package/src/builtin-addons/{brightness/providers → internal-settings/brightness-providers}/darwin.ts +0 -0
  63. /package/src/builtin-addons/{brightness/providers → internal-settings/brightness-providers}/index.ts +0 -0
  64. /package/src/builtin-addons/{brightness/providers → internal-settings/brightness-providers}/linux.ts +0 -0
  65. /package/src/builtin-addons/{brightness/providers → internal-settings/brightness-providers}/windows.ts +0 -0
@@ -3,14 +3,14 @@ import { a as withTimeout } from "./main.mjs";
3
3
  const DEFAULT_TIMEOUT_MS = 5e3;
4
4
  const shellQuote = (value) => `'${value.replace(/'/g, "''").replace(/'/g, "'\\''")}'`;
5
5
  const buildToastScript = (title, body) => {
6
- const safeTitle = title.replace(/[`$"\\]/g, "\\$&");
7
- const safeBody = body.replace(/[`$"\\]/g, "\\$&");
6
+ const safeTitle = Buffer.from(title, "utf8").toString("base64");
7
+ const safeBody = Buffer.from(body, "utf8").toString("base64");
8
8
  return [
9
9
  "Add-Type -AssemblyName System.Windows.Forms | Out-Null",
10
10
  `$balloon = New-Object System.Windows.Forms.NotifyIcon`,
11
11
  `$balloon.Icon = [System.Drawing.SystemIcons]::Information`,
12
- `$balloon.BalloonTipTitle = "${safeTitle}"`,
13
- `$balloon.BalloonTipText = "${safeBody}"`,
12
+ `$balloon.BalloonTipTitle = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String('${safeTitle}'))`,
13
+ `$balloon.BalloonTipText = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String('${safeBody}'))`,
14
14
  `$balloon.Visible = $true`,
15
15
  `$balloon.ShowBalloonTip(5000)`,
16
16
  "Start-Sleep -Milliseconds 5500",
@@ -55,6 +55,7 @@ interface DeckState {
55
55
  id: string
56
56
  name: string
57
57
  buttons: DeckButton[]
58
+ isModal?: boolean
58
59
  isCompact?: boolean
59
60
  hasOverlayDeckAvailable?: boolean
60
61
  overlayDeckIcon?: string | null
@@ -379,6 +380,7 @@ const AppContent = () => {
379
380
  | "amber"
380
381
  | "lime"
381
382
  variant?: string
383
+ isModal?: boolean
382
384
  buttonErrors?: ButtonErrorState[]
383
385
  }
384
386
  >
@@ -391,6 +393,7 @@ const AppContent = () => {
391
393
  id: message.deckId,
392
394
  name: surface.name ?? message.deckId,
393
395
  buttons: surface.buttons,
396
+ isModal: surface.isModal === true,
394
397
  ...(surface.buttonColor !== undefined
395
398
  ? { buttonColor: surface.buttonColor }
396
399
  : {}),
@@ -45,6 +45,9 @@ import { ErrorBoundary } from "./ErrorBoundary"
45
45
  ;(
46
46
  globalThis as { __codingAgentsUseAddonChannel?: typeof useAddonChannel }
47
47
  ).__codingAgentsUseAddonChannel = useAddonChannel
48
+ ;(
49
+ globalThis as { __calendarUseAddonChannel?: typeof useAddonChannel }
50
+ ).__calendarUseAddonChannel = useAddonChannel
48
51
 
49
52
  const BUTTON_SIZE = BUTTON_SIZE_PX
50
53
  export interface DeckButton {
@@ -63,6 +66,7 @@ export interface Deck {
63
66
  id: string
64
67
  name: string
65
68
  buttons: DeckButton[]
69
+ isModal?: boolean
66
70
  buttonColor?:
67
71
  | "blue"
68
72
  | "green"
@@ -381,7 +385,8 @@ export const Deck = ({
381
385
  const width = columns * BUTTON_SIZE + (columns - 1) * resolvedGap + pad * 2
382
386
  const height = rows * BUTTON_SIZE + (rows - 1) * resolvedGap + pad * 2
383
387
  const n1Position = model.keyCount - 1
384
- const splitAtN1 = deck.hasOverlayDeckAvailable === true
388
+ const splitAtN1 =
389
+ deck.hasOverlayDeckAvailable === true && deck.isModal !== true
385
390
  const errorPositions = new Set(
386
391
  (deck.buttonErrors ?? []).map((error) => error.position),
387
392
  )
@@ -413,7 +418,7 @@ export const Deck = ({
413
418
  .filter((p) => p < model.keyCount),
414
419
  )
415
420
  const emptyCells: ReactNode[] = []
416
- if (!compact) {
421
+ if (!compact && deck.isModal !== true) {
417
422
  for (let position = 0; position < model.keyCount; position += 1) {
418
423
  if (occupiedPositions.has(position)) continue
419
424
  const col = (position % columns) + 1
@@ -446,6 +451,12 @@ export const Deck = ({
446
451
  gap: `${resolvedGap}px`,
447
452
  width,
448
453
  height,
454
+ ...(deck.isModal
455
+ ? {
456
+ backgroundColor:
457
+ "var(--sireno-color-modal-deck-bgr, var(--sireno-variant-default-bg))",
458
+ }
459
+ : {}),
449
460
  } as CSSProperties
450
461
  }
451
462
  data-deck-id={deck.id}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sirenodeck/sirenodeck",
3
- "version": "0.2.9",
3
+ "version": "0.4.0",
4
4
  "description": "CLI for managing Elgato Stream Deck devices via a config-driven deck system.",
5
5
  "homepage": "https://deck.sireno.dev",
6
6
  "bugs": {
@@ -69,6 +69,14 @@
69
69
  "types": "./src/ui/surfaces/IconLabelSurface.tsx",
70
70
  "default": "./src/ui/surfaces/IconLabelSurface.tsx"
71
71
  },
72
+ "./ui/surfaces/BinaryToggleSurface": {
73
+ "types": "./src/ui/surfaces/BinaryToggleSurface.tsx",
74
+ "default": "./src/ui/surfaces/BinaryToggleSurface.tsx"
75
+ },
76
+ "./ui/surfaces/LoadingSurface": {
77
+ "types": "./src/ui/surfaces/LoadingSurface.tsx",
78
+ "default": "./src/ui/surfaces/LoadingSurface.tsx"
79
+ },
72
80
  "./ui/surfaces/IconLabelProgressSurface": {
73
81
  "types": "./src/ui/surfaces/IconLabelProgressSurface.tsx",
74
82
  "default": "./src/ui/surfaces/IconLabelProgressSurface.tsx"
@@ -108,6 +116,7 @@
108
116
  "@heroui/styles": "3.2.6",
109
117
  "@internationalized/date": "^3.12.4",
110
118
  "@meteocons/svg-static": "^0.1.0",
119
+ "@napi-rs/keyring": "2.1.2",
111
120
  "@react-aria/ssr": "^3.10.1",
112
121
  "@react-aria/utils": "^3.34.1",
113
122
  "@tailwindcss/vite": "^4.0.0",
package/src/addon/api.ts CHANGED
@@ -8,6 +8,7 @@ import type { GestureKind } from "@/core/gesture-state"
8
8
 
9
9
  export type { GestureKind }
10
10
  import type { Methods } from "@/deck/methods"
11
+ import type { AddonCredentials } from "@/system/credentials/store"
11
12
 
12
13
  /** The runtime manifest API version (`AddonManifestV1`). */
13
14
  export const SIRENO_ADDON_API_VERSION = 1 as const
@@ -269,6 +270,12 @@ export interface AddonManifestV1 {
269
270
  readonly kind?: AddonKind
270
271
  readonly buttonTypes: Readonly<Record<string, AddonButtonTypeDefAny>>
271
272
  readonly defaultButton?: string
273
+ /** Entry shown in the global Settings deck for this loaded addon. */
274
+ readonly settings?: {
275
+ readonly label: string
276
+ readonly icon: string
277
+ readonly deck: string
278
+ }
272
279
  readonly decks?: ReadonlyArray<AddonDeckEntry>
273
280
  readonly frontend?: AddonFrontend
274
281
  readonly poller?: {
@@ -310,7 +317,8 @@ export interface AddonGlobalService {
310
317
  // onLoad/onUnload accept an optional addon-specific config (typed as
311
318
  // `unknown` since the runtime doesn't know the addon's config shape).
312
319
  // Built-in addons ignore it; third-party / builtin addons that need
313
- // hydrated state can read it. The runtime calls these once per process.
320
+ // hydrated state can read addons[].config.service. Changes require restart;
321
+ // this ordinary config is not secure credential storage.
314
322
  readonly onLoad?: (
315
323
  ctx: AddonServiceContext,
316
324
  config?: unknown,
@@ -338,6 +346,21 @@ export interface AddonGlobalSubscription {
338
346
  }
339
347
 
340
348
  export interface AddonServiceContext {
349
+ /** Private persistent directory scoped by the host to this addon; not a credential store. */
350
+ getDataDirectory?: () => Promise<string>
351
+ /** Show an existing deck until released. Returns null if unavailable or locked.
352
+ * A newer interruption or navigation supersedes the returned release handle. */
353
+ interruptDeck?: (
354
+ deckId: string,
355
+ options?: { onBack?: () => void | Promise<void> },
356
+ ) => (() => void) | null
357
+ /** Queue a modal deck; OK closes it and invokes onOk. The returned handle cancels it. */
358
+ showModal?: (
359
+ deckId: string,
360
+ options?: { onOk?: () => void | Promise<void> },
361
+ ) => (() => void) | null
362
+ /** Namespaced credential store when supported by the host; addons are trusted code. */
363
+ credentials?: AddonCredentials
341
364
  /** Push data to the channel this poller/subscription is bound to. */
342
365
  publish: (data: unknown) => void
343
366
  /**
@@ -0,0 +1,52 @@
1
+ import { createHash } from "node:crypto"
2
+ import { chmod, lstat, mkdir } from "node:fs/promises"
3
+ import { homedir } from "node:os"
4
+ import { isAbsolute, join } from "node:path"
5
+
6
+ export const addonDataRoot = (): string => {
7
+ if (process.platform === "win32") {
8
+ const local = process.env["LOCALAPPDATA"]
9
+ if (!local || !isAbsolute(local))
10
+ throw new Error("LOCALAPPDATA is unavailable")
11
+ return join(local, "sirenodeck")
12
+ }
13
+ if (process.platform === "darwin") {
14
+ return join(homedir(), "Library", "Application Support", "sirenodeck")
15
+ }
16
+ const xdg = process.env["XDG_DATA_HOME"]
17
+ return join(
18
+ xdg && isAbsolute(xdg) ? xdg : join(homedir(), ".local", "share"),
19
+ "sirenodeck",
20
+ )
21
+ }
22
+
23
+ export const createAddonDataDirectory = (
24
+ name: string,
25
+ root?: string,
26
+ ): (() => Promise<string>) => {
27
+ let result: Promise<string> | undefined
28
+ return () => {
29
+ result ??= (async () => {
30
+ const base = root ?? addonDataRoot()
31
+ if (!isAbsolute(base)) throw new Error("Addon data root must be absolute")
32
+ const addons = join(base, "addons")
33
+ const directory = join(
34
+ addons,
35
+ createHash("sha256").update(name).digest("hex"),
36
+ )
37
+ await mkdir(base, { recursive: true, mode: 0o700 })
38
+ for (const path of [addons, directory]) {
39
+ await mkdir(path, { mode: 0o700 }).catch(
40
+ (error: NodeJS.ErrnoException) => {
41
+ if (error.code !== "EEXIST") throw error
42
+ },
43
+ )
44
+ if (!(await lstat(path)).isDirectory())
45
+ throw new Error(`Not a directory: ${path}`)
46
+ if (process.platform !== "win32") await chmod(path, 0o700)
47
+ }
48
+ return directory
49
+ })()
50
+ return result
51
+ }
52
+ }
@@ -86,6 +86,7 @@ export const deckConfigSurfaceSchema = z.object({
86
86
  id: z.string(),
87
87
  name: z.string(),
88
88
  buttons: z.array(deckConfigSurfaceButtonSchema),
89
+ isModal: z.boolean().optional(),
89
90
  buttonColor: z.string().optional(),
90
91
  variant: z.string().optional(),
91
92
  buttonErrors: z
@@ -273,10 +273,24 @@ const captureAgentsForStage = (stage: string): AgentsSnapshot => {
273
273
  "waiting_for_human",
274
274
  ]
275
275
  const now = Date.now()
276
+ const titles = [
277
+ "Review authentication flow",
278
+ "Fix dashboard loading state",
279
+ "Write API integration tests",
280
+ "Refactor configuration parser",
281
+ "Investigate memory usage",
282
+ "Update developer documentation",
283
+ "Add keyboard shortcuts",
284
+ "Improve deployment pipeline",
285
+ "Review database migration",
286
+ "Polish settings interface",
287
+ "Summarize code changes",
288
+ "Check release notes",
289
+ ]
276
290
  const agents: Agent[] = statuses.map((status, index) => ({
277
291
  sessionId: `sireno-capture-${stage}-${index + 1}`,
278
292
  providerId: index % 2 === 0 ? "opencode" : "claude-code",
279
- title: `Showcase task ${index + 1}`,
293
+ title: titles[index]!,
280
294
  status,
281
295
  directory: "/works/sireno-deck",
282
296
  updatedAt: now - index * 1_000,
@@ -1,5 +1,4 @@
1
1
  export { SYSTEM_BUTTON_TYPES } from "@/deck/system-buttons/types"
2
- export { default as brightnessAddon } from "./brightness/index"
3
2
  export { coreAddon } from "./core/index"
4
3
  export { default as dateTimeAddon } from "./date-time/index"
5
4
  export { default as emojiSelectorAddon } from "./emoji-selector/index"
@@ -4,7 +4,7 @@ import { AddonServiceContext, AddonGlobalService } from "@/addon/api"
4
4
  import {
5
5
  createBrightnessProvider,
6
6
  type BrightnessProvider,
7
- } from "@/builtin-addons/brightness/providers"
7
+ } from "./brightness-providers"
8
8
 
9
9
  let brightnessProvider: BrightnessProvider | null = null
10
10
 
@@ -6,7 +6,7 @@ import { useEffect, useRef, useState } from "react"
6
6
  const BRIGHTNESS_CHANNEL = "sireno:settings:brightness"
7
7
  const PROGRESS_VISIBLE_MS = 2000
8
8
 
9
- export type BrightnessVariant = "down" | "up"
9
+ export type BrightnessVariant = "down" | "up" | "compact"
10
10
 
11
11
  interface BrightnessButtonFrontendProps {
12
12
  readonly variant: BrightnessVariant
@@ -23,7 +23,12 @@ export const BrightnessButtonFrontend = ({
23
23
  const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null)
24
24
 
25
25
  useEffect(() => {
26
- if (gesture?.gesture !== "tap" && gesture?.gesture !== "dbl-tap") return
26
+ if (
27
+ gesture?.gesture !== "tap" &&
28
+ gesture?.gesture !== "dbl-tap" &&
29
+ gesture?.gesture !== "hold"
30
+ )
31
+ return
27
32
  setShowProgress(true)
28
33
  if (timerRef.current) clearTimeout(timerRef.current)
29
34
  timerRef.current = setTimeout(
@@ -42,7 +47,13 @@ export const BrightnessButtonFrontend = ({
42
47
  return (
43
48
  <IconLabelProgressSurface
44
49
  source={`icon://${variant === "down" ? "sun-dim" : "sun"}`}
45
- label={variant === "down" ? "Darker" : "Lighter"}
50
+ label={
51
+ variant === "compact"
52
+ ? "Tap + / Hold −"
53
+ : variant === "down"
54
+ ? "Darker"
55
+ : "Lighter"
56
+ }
46
57
  progress={progress}
47
58
  visible={showProgress}
48
59
  />
@@ -0,0 +1,6 @@
1
+ import type { AddonFrontendButton } from "@/addon/api"
2
+ import { BrightnessButtonFrontend } from "../brightness/common/frontend"
3
+
4
+ export const CompactBrightnessFrontend: AddonFrontendButton<unknown> = ({
5
+ gesture,
6
+ }) => <BrightnessButtonFrontend variant="compact" gesture={gesture ?? null} />
@@ -4,6 +4,7 @@ import appInfoBackend from "./buttons/app-info/backend"
4
4
  import appInfoFrontend from "./buttons/app-info/frontend"
5
5
  import brightnessDownBackend from "./buttons/brightness-down/backend"
6
6
  import brightnessDownFrontend from "./buttons/brightness-down/frontend"
7
+ import { CompactBrightnessFrontend } from "./buttons/brightness-compact/frontend"
7
8
  import brightnessUpBackend from "./buttons/brightness-up/backend"
8
9
  import brightnessUpFrontend from "./buttons/brightness-up/frontend"
9
10
  import settingsDeck from "./decks/settings"
@@ -31,6 +32,20 @@ export const manifest: AddonManifestV1 = {
31
32
  gestureHandlers: ["tap", "dbl-tap"] as const,
32
33
  },
33
34
  },
35
+ "internal-settings:compact-brightness": {
36
+ frontend: CompactBrightnessFrontend,
37
+ service: {
38
+ ...withInternal(brightnessUpBackend),
39
+ gestureHandlers: ["tap", "dbl-tap", "hold"] as const,
40
+ onHold: ({ coreMethods }) => {
41
+ coreMethods.adjustBrightness({ direction: "down" })
42
+ },
43
+ },
44
+ },
45
+ "internal-settings:compact-app-info": {
46
+ frontend: appInfoFrontend,
47
+ service: { internal: true },
48
+ },
34
49
  "internal-settings:app-info": {
35
50
  frontend: appInfoFrontend,
36
51
  service: {
@@ -26,11 +26,30 @@ let provider: MediaStatusProvider | null = null
26
26
  let ctxRef: AddonServiceContext | null = null
27
27
  let captureMediaState: MediaPlayerState | null = null
28
28
  let captureStage = "playing"
29
+ let captureUpdatedAt = 0
29
30
 
30
31
  const captureMode = (): boolean =>
31
32
  process.env["SIRENO_CAPTURE_FAKE_MEDIA"] === "1"
32
33
 
34
+ const updateCaptureProgress = (): void => {
35
+ if (captureMediaState === null) return
36
+ const now = Date.now()
37
+ if (captureMediaState.isPlaying) {
38
+ const currentTime = Math.min(
39
+ captureMediaState.totalTime,
40
+ captureMediaState.currentTime + (now - captureUpdatedAt) / 1000,
41
+ )
42
+ captureMediaState = {
43
+ ...captureMediaState,
44
+ currentTime,
45
+ progress: computeProgress(currentTime, captureMediaState.totalTime),
46
+ }
47
+ }
48
+ captureUpdatedAt = now
49
+ }
50
+
33
51
  const setCapturePlayback = (playing: boolean): void => {
52
+ updateCaptureProgress()
34
53
  captureStage = playing ? "playing" : "paused"
35
54
  if (captureMediaState === null) return
36
55
  captureMediaState = {
@@ -92,6 +111,7 @@ export const globalService: AddonGlobalService = {
92
111
  intervalMs: 1_000,
93
112
  poll: async (_ctx: AddonServiceContext): Promise<MediaPlayerState> => {
94
113
  if (captureMode() && captureMediaState !== null) {
114
+ updateCaptureProgress()
95
115
  const stagePath = process.env["SIRENO_CAPTURE_FAKE_MEDIA_FILE"]
96
116
  if (stagePath !== undefined) {
97
117
  try {
@@ -169,6 +189,7 @@ export const globalService: AddonGlobalService = {
169
189
  muted: false,
170
190
  }
171
191
  captureStage = "playing"
192
+ captureUpdatedAt = Date.now()
172
193
  provider = null
173
194
  return
174
195
  }
@@ -4,7 +4,6 @@ import { registerBuiltInThemes, registerSiblingThemes } from "@/themes/loader"
4
4
 
5
5
  import { manifest as codingAgentsManifest } from "./coding-agents"
6
6
  import { registerCodingAgentsAddon } from "./coding-agents"
7
- import brightnessAddon from "./brightness/index"
8
7
  import { coreAddon } from "./core/index"
9
8
  import dateTimeAddon from "./date-time/index"
10
9
  import emojiSelectorAddon from "./emoji-selector/index"
@@ -27,7 +26,6 @@ export const registerBuiltins = (registry: AddonRegistry): void => {
27
26
  registry.load(systemStatusAddon)
28
27
  registry.load(valueDisplayAddon)
29
28
  registry.load(weatherAddon)
30
- registry.load(brightnessAddon)
31
29
  registerCodingAgentsAddon(registry)
32
30
  }
33
31
 
@@ -60,6 +58,5 @@ export const BUILTIN_MANIFESTS: ReadonlyMap<string, unknown> = new Map<
60
58
  ["system-status", systemStatusAddon],
61
59
  ["value-display", valueDisplayAddon],
62
60
  ["weather", weatherAddon],
63
- ["brightness", brightnessAddon],
64
61
  ["coding-agents", codingAgentsManifest],
65
62
  ])
@@ -123,7 +123,7 @@ rail, so there is nothing to read — this is not a gap waiting to be filled.
123
123
  | `count` | `42` (≥100) / `5.4` (<100) |
124
124
  | `bytes` | `5.2 MB` |
125
125
  | `rate-bytes` | `5.2 MB/s` (uses KiB/MiB/GiB/TiB scaling) |
126
- | `frequency-ghz` | `3.40` |
126
+ | `frequency-ghz` | `3.4` |
127
127
  | `uptime` | `2h` |
128
128
  | `bool` | `ON` (≥0.5) / `OFF` |
129
129
 
@@ -54,7 +54,7 @@ function formatValue(
54
54
  value: value.toFixed(0),
55
55
  }
56
56
  case "frequency-ghz":
57
- return { value: value.toFixed(2) }
57
+ return { value: value.toFixed(1) }
58
58
  case "percent":
59
59
  // ponytail: integers when stable, one decimal when low. High values
60
60
  // (10%+) hide <1% swing behind integer rounding; low values benefit
@@ -22,7 +22,7 @@ const CAPTURE_METRIC_VALUES: Readonly<Record<SystemMetricId, number>> = {
22
22
  disk: 54,
23
23
  "disk-io": 1_240_000,
24
24
  "fan-rpm": 1_260,
25
- frequency: 3_400,
25
+ frequency: 3.6,
26
26
  "gpu-temp": 58,
27
27
  "gpu-usage": 27,
28
28
  load: 1.4,
@@ -239,6 +239,7 @@ export const collectAddonDefaultButtonConfig = (
239
239
  if (addon.defaultButton === undefined) continue
240
240
  let matchCount = 0
241
241
  for (const deck of userDecks) {
242
+ if (deck.addonOwner !== undefined) continue
242
243
  for (const btn of deck.buttons) {
243
244
  if (btn.type === addon.defaultButton || btn.type === addon.name) {
244
245
  if (matchCount > 0) {
@@ -0,0 +1,85 @@
1
+ import { basename, dirname, resolve } from "node:path"
2
+ import { existsSync, readFileSync } from "node:fs"
3
+ import { isMap, isScalar, isSeq, parseDocument } from "yaml"
4
+ import { createConfigMutationService } from "@/config/mutation"
5
+
6
+ export const saveAddonProvider = async (
7
+ path: string,
8
+ addonName: string,
9
+ provider: {
10
+ id: string
11
+ type: string
12
+ clientId: string
13
+ calendarIds: string[]
14
+ calendarColors?: Record<string, string>
15
+ },
16
+ ): Promise<void> => {
17
+ const mutation = createConfigMutationService({ configPath: path })
18
+ const candidates: Array<{ path: string; index: number }> = []
19
+ for (const source of mutation.sources()) {
20
+ const doc = parseDocument(readFileSync(source, "utf8"))
21
+ if (doc.errors.length) continue
22
+ const addons = doc.get("addons")
23
+ if (!isSeq(addons)) continue
24
+ addons.items.forEach((item, index) => {
25
+ const value = isMap(item)
26
+ ? item.get("src")
27
+ : isScalar(item)
28
+ ? item.value
29
+ : undefined
30
+ if (typeof value !== "string") return
31
+ const base = basename(value.replace(/\/$/, ""))
32
+ let name = base === addonName || base === `addon-${addonName}`
33
+ const manifestPath = resolve(dirname(source), value, "sirenodeck.json")
34
+ if (!name && existsSync(manifestPath)) {
35
+ try {
36
+ name =
37
+ JSON.parse(readFileSync(manifestPath, "utf8")).name === addonName
38
+ } catch {
39
+ /* ignore invalid manifests */
40
+ }
41
+ }
42
+ if (name) candidates.push({ path: source, index })
43
+ })
44
+ }
45
+ if (candidates.length !== 1)
46
+ throw new Error(
47
+ `Expected one ${addonName} addon entry; found ${candidates.length}`,
48
+ )
49
+ const target = candidates[0]!
50
+ const document = parseDocument(mutation.readSource(target.path), {
51
+ keepSourceTokens: true,
52
+ })
53
+ const addonPath = ["addons", target.index]
54
+ const item = document.getIn(addonPath)
55
+ if (!isMap(item)) {
56
+ const src =
57
+ typeof item === "string" ? item : isScalar(item) ? item.value : undefined
58
+ if (typeof src !== "string") throw new Error("Invalid addon entry")
59
+ document.setIn(addonPath, document.createNode({ src }))
60
+ }
61
+ const providersPath = [...addonPath, "config", "service", "providers"]
62
+ let providers = document.getIn(providersPath)
63
+ if (providers === undefined) {
64
+ document.setIn(providersPath, [])
65
+ providers = document.getIn(providersPath)
66
+ }
67
+ if (!isSeq(providers)) throw new Error("Calendar providers must be a list")
68
+ const matches = providers.items.filter(
69
+ (entry) => isMap(entry) && entry.get("id") === provider.id,
70
+ )
71
+ if (matches.length > 1)
72
+ throw new Error("Duplicate calendar account IDs in config")
73
+ if (matches.length === 1) {
74
+ const existing = matches[0]!
75
+ if (!isMap(existing) || existing.get("type") !== provider.type)
76
+ throw new Error("Account ID is already used by another provider")
77
+ for (const [key, value] of Object.entries(provider))
78
+ existing.set(key, value)
79
+ } else providers.add(provider)
80
+ await mutation.apply({
81
+ kind: "edit-source",
82
+ path: target.path,
83
+ content: document.toString(),
84
+ })
85
+ }