@sirenodeck/sirenodeck 0.2.7 → 0.2.10
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/config-ui/index.html +13 -0
- package/config-ui/src/App.tsx +675 -0
- package/config-ui/src/DeckFrame.tsx +445 -0
- package/config-ui/src/Shell.tsx +108 -0
- package/config-ui/src/SidePanel.tsx +96 -0
- package/config-ui/src/bridge-log-store.ts +115 -0
- package/config-ui/src/bridge.ts +303 -0
- package/config-ui/src/components/ActionValueEditor.tsx +209 -0
- package/config-ui/src/components/ButtonActionsEditor.tsx +84 -0
- package/config-ui/src/components/DisconnectedOverlay.tsx +77 -0
- package/config-ui/src/components/EmojiPicker.tsx +65 -0
- package/config-ui/src/components/IconPicker.tsx +264 -0
- package/config-ui/src/components/MacroPreview.tsx +22 -0
- package/config-ui/src/components/ReconnectingBanner.tsx +35 -0
- package/config-ui/src/gesture.ts +45 -0
- package/config-ui/src/index.css +8 -0
- package/config-ui/src/main.tsx +20 -0
- package/config-ui/src/pages/AboutPage.tsx +65 -0
- package/config-ui/src/pages/AddonsPage.tsx +232 -0
- package/config-ui/src/pages/BridgeLogsPage.tsx +94 -0
- package/config-ui/src/pages/ButtonConfigEditor/ButtonAppearanceFields.tsx +77 -0
- package/config-ui/src/pages/ButtonConfigEditor/ButtonTypePicker.tsx +80 -0
- package/config-ui/src/pages/ButtonConfigEditor/ConfigForm.tsx +50 -0
- package/config-ui/src/pages/ButtonConfigEditor/FormFieldParts.tsx +23 -0
- package/config-ui/src/pages/ButtonConfigEditor/PositionPicker.tsx +68 -0
- package/config-ui/src/pages/ButtonConfigEditor/controls/ActionControl.tsx +27 -0
- package/config-ui/src/pages/ButtonConfigEditor/controls/ArrayControl.tsx +77 -0
- package/config-ui/src/pages/ButtonConfigEditor/controls/BooleanControl.tsx +34 -0
- package/config-ui/src/pages/ButtonConfigEditor/controls/DeckSelectControl.tsx +47 -0
- package/config-ui/src/pages/ButtonConfigEditor/controls/EmojiControl.tsx +70 -0
- package/config-ui/src/pages/ButtonConfigEditor/controls/IconControl.tsx +31 -0
- package/config-ui/src/pages/ButtonConfigEditor/controls/ObjectControl.tsx +52 -0
- package/config-ui/src/pages/ButtonConfigEditor/controls/RecordControl.tsx +104 -0
- package/config-ui/src/pages/ButtonConfigEditor/controls/SelectControl.tsx +46 -0
- package/config-ui/src/pages/ButtonConfigEditor/controls/ShellControl.tsx +29 -0
- package/config-ui/src/pages/ButtonConfigEditor/controls/TextControl.tsx +36 -0
- package/config-ui/src/pages/ButtonConfigEditor/controls/UnionControl.tsx +96 -0
- package/config-ui/src/pages/ButtonConfigEditor/controls/registry.ts +17 -0
- package/config-ui/src/pages/ButtonConfigEditor/types.ts +67 -0
- package/config-ui/src/pages/ButtonConfigEditor/utils.ts +56 -0
- package/config-ui/src/pages/ButtonConfigEditor.tsx +226 -0
- package/config-ui/src/pages/ConfigPage.tsx +326 -0
- package/config-ui/src/pages/DecksPage.tsx +104 -0
- package/config-ui/src/pages/EditorPage.tsx +1697 -0
- package/config-ui/src/pages/ServiceLogsPage.tsx +130 -0
- package/config-ui/vite.config.ts +105 -0
- package/dist/main.mjs +327 -41554
- package/frontend/index.html +12 -0
- package/frontend/src/App.tsx +536 -0
- package/frontend/src/__mocks__/addons-registry.ts +2 -0
- package/frontend/src/__mocks__/theme.ts +1 -0
- package/frontend/src/__mocks__/themes-manifest.tsx +78 -0
- package/frontend/src/__mocks__/token.ts +2 -0
- package/frontend/src/bridge/client.ts +186 -0
- package/frontend/src/bridge/use-button-action.ts +31 -0
- package/frontend/src/bridge/ws-context.tsx +24 -0
- package/frontend/src/components/Deck.tsx +486 -0
- package/frontend/src/components/DisconnectedOverlay.tsx +82 -0
- package/frontend/src/components/ErrorBoundary.tsx +92 -0
- package/frontend/src/components/ReconnectingBanner.tsx +40 -0
- package/frontend/src/index.css +40 -0
- package/frontend/src/main.tsx +23 -0
- package/frontend/vite.config.ts +132 -0
- package/package.json +20 -6
- package/src/builtin-addons/coding-agents/global/backend.ts +15 -1
- package/src/builtin-addons/internal-settings/index.ts +0 -1
- package/src/builtin-addons/internal-settings/logo72x72.png +0 -0
- package/src/builtin-addons/media/backend.ts +21 -0
- package/src/builtin-addons/system-status/README.md +1 -1
- package/src/builtin-addons/system-status/domain/display-metrics.ts +1 -1
- package/src/builtin-addons/system-status/manifest.ts +1 -1
- package/src/cli/commands/emulator-mode.ts +27 -4
- package/src/cli/commands/service-manager.ts +53 -1
- package/src/device/black-frame.ts +3 -7
- package/src/vite/virtual-modules.ts +16 -1
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { useState } from "react"
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
getServiceLogs,
|
|
5
|
+
type ServiceLogEntry,
|
|
6
|
+
type ServiceLogLevel,
|
|
7
|
+
} from "../bridge-log-store"
|
|
8
|
+
|
|
9
|
+
const LEVEL_COLOR: Record<ServiceLogLevel, string> = {
|
|
10
|
+
trace: "text-neutral-500",
|
|
11
|
+
debug: "text-neutral-400",
|
|
12
|
+
info: "text-sky-300",
|
|
13
|
+
warn: "text-amber-300",
|
|
14
|
+
error: "text-red-400",
|
|
15
|
+
fatal: "text-red-500",
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const COMPONENT_COLOR: Record<string, string> = {
|
|
19
|
+
runtime: "text-cyan-300",
|
|
20
|
+
methods: "text-cyan-300",
|
|
21
|
+
executor: "text-cyan-300",
|
|
22
|
+
"state-publisher": "text-cyan-300",
|
|
23
|
+
real: "text-emerald-300",
|
|
24
|
+
emulator: "text-emerald-300",
|
|
25
|
+
"ws-bridge": "text-fuchsia-300",
|
|
26
|
+
"addon-handler": "text-fuchsia-300",
|
|
27
|
+
"active-app": "text-amber-300",
|
|
28
|
+
"key-macro": "text-amber-300",
|
|
29
|
+
clipboard: "text-amber-300",
|
|
30
|
+
notification: "text-amber-300",
|
|
31
|
+
session: "text-amber-300",
|
|
32
|
+
"browser-renderer": "text-blue-300",
|
|
33
|
+
"emulator-server": "text-blue-300",
|
|
34
|
+
daemon: "text-blue-300",
|
|
35
|
+
requirements: "text-blue-300",
|
|
36
|
+
orchestrator: "text-cyan-300",
|
|
37
|
+
cli: "text-neutral-400",
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const ServiceLogsPage = () => {
|
|
41
|
+
const [level, setLevel] = useState<ServiceLogLevel | "">("")
|
|
42
|
+
const [content, setContent] = useState("")
|
|
43
|
+
const [, force] = useState(0)
|
|
44
|
+
|
|
45
|
+
const logs: ServiceLogEntry[] = getServiceLogs({
|
|
46
|
+
...(level !== "" ? { level } : {}),
|
|
47
|
+
...(content !== "" ? { contentSubstring: content } : {}),
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<div
|
|
52
|
+
data-testid="service-logs-page"
|
|
53
|
+
className="flex h-full flex-col gap-2 p-3"
|
|
54
|
+
>
|
|
55
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
56
|
+
<select
|
|
57
|
+
value={level}
|
|
58
|
+
onChange={(e) => setLevel(e.target.value as ServiceLogLevel | "")}
|
|
59
|
+
className="rounded bg-neutral-800 px-2 py-1 text-xs text-neutral-200"
|
|
60
|
+
>
|
|
61
|
+
<option value="">all levels</option>
|
|
62
|
+
{(["trace", "debug", "info", "warn", "error", "fatal"] as const).map(
|
|
63
|
+
(l) => (
|
|
64
|
+
<option key={l} value={l}>
|
|
65
|
+
{l}
|
|
66
|
+
</option>
|
|
67
|
+
),
|
|
68
|
+
)}
|
|
69
|
+
</select>
|
|
70
|
+
<input
|
|
71
|
+
type="text"
|
|
72
|
+
placeholder="content substring"
|
|
73
|
+
value={content}
|
|
74
|
+
onChange={(e) => setContent(e.target.value)}
|
|
75
|
+
className="rounded bg-neutral-800 px-2 py-1 text-xs text-neutral-200"
|
|
76
|
+
/>
|
|
77
|
+
<button
|
|
78
|
+
type="button"
|
|
79
|
+
onClick={() => force((n) => n + 1)}
|
|
80
|
+
className="rounded bg-neutral-700 px-2 py-1 text-xs text-neutral-200"
|
|
81
|
+
>
|
|
82
|
+
refresh
|
|
83
|
+
</button>
|
|
84
|
+
</div>
|
|
85
|
+
<ul className="flex-1 space-y-1 overflow-y-auto font-mono text-[11px]">
|
|
86
|
+
{logs.map((l, i) => (
|
|
87
|
+
<li
|
|
88
|
+
key={`${l.ts}-${i}`}
|
|
89
|
+
className={`rounded bg-neutral-900 px-2 py-1 ${LEVEL_COLOR[l.level]}`}
|
|
90
|
+
>
|
|
91
|
+
<span className="text-neutral-500">
|
|
92
|
+
{new Date(l.ts).toISOString().slice(11, 19)}
|
|
93
|
+
</span>{" "}
|
|
94
|
+
<span className="uppercase">{l.level}</span>
|
|
95
|
+
{l.component !== undefined && (
|
|
96
|
+
<>
|
|
97
|
+
{" "}
|
|
98
|
+
<span
|
|
99
|
+
className={COMPONENT_COLOR[l.component] ?? "text-neutral-400"}
|
|
100
|
+
>
|
|
101
|
+
[{l.component}]
|
|
102
|
+
</span>
|
|
103
|
+
</>
|
|
104
|
+
)}
|
|
105
|
+
{" — "}
|
|
106
|
+
<span>{l.msg}</span>
|
|
107
|
+
{(l.deckId !== undefined ||
|
|
108
|
+
l.position !== undefined ||
|
|
109
|
+
l.addonName !== undefined ||
|
|
110
|
+
l.gesture !== undefined ||
|
|
111
|
+
l.keyIndex !== undefined) && (
|
|
112
|
+
<span className="text-neutral-500">
|
|
113
|
+
{[
|
|
114
|
+
l.deckId !== undefined ? `deckId=${l.deckId}` : null,
|
|
115
|
+
l.position !== undefined ? `position=${l.position}` : null,
|
|
116
|
+
l.addonName !== undefined ? `addon=${l.addonName}` : null,
|
|
117
|
+
l.gesture !== undefined ? `gesture=${l.gesture}` : null,
|
|
118
|
+
l.keyIndex !== undefined ? `keyIndex=${l.keyIndex}` : null,
|
|
119
|
+
]
|
|
120
|
+
.filter((s) => s !== null)
|
|
121
|
+
.join(", ")}
|
|
122
|
+
</span>
|
|
123
|
+
)}
|
|
124
|
+
</li>
|
|
125
|
+
))}
|
|
126
|
+
{logs.length === 0 && <li className="text-neutral-500">no logs</li>}
|
|
127
|
+
</ul>
|
|
128
|
+
</div>
|
|
129
|
+
)
|
|
130
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { defineConfig } from "vite"
|
|
2
|
+
import react from "@vitejs/plugin-react"
|
|
3
|
+
import tailwindcss from "@tailwindcss/vite"
|
|
4
|
+
import { resolve } from "node:path"
|
|
5
|
+
import { sirenoDeck2 } from "../src/vite/index"
|
|
6
|
+
import { frontendBridgeUrl } from "../src/render/frontend-bridge-url"
|
|
7
|
+
|
|
8
|
+
const wsUrl = frontendBridgeUrl()
|
|
9
|
+
const frontendUrl =
|
|
10
|
+
process.env["SIRENO_FRONTEND_URL"] ?? "http://127.0.0.1:5180"
|
|
11
|
+
|
|
12
|
+
const parseThemeFromEnv = ():
|
|
13
|
+
| { name: string; manifestPath: string; uiOverridesPath: string | null }
|
|
14
|
+
| undefined => {
|
|
15
|
+
const blob = process.env["SIRENO_THEME"]
|
|
16
|
+
if (blob === undefined || blob.length === 0) return undefined
|
|
17
|
+
try {
|
|
18
|
+
const parsed = JSON.parse(blob) as {
|
|
19
|
+
name?: unknown
|
|
20
|
+
manifestPath?: unknown
|
|
21
|
+
uiOverridesPath?: unknown
|
|
22
|
+
}
|
|
23
|
+
if (
|
|
24
|
+
typeof parsed.name === "string" &&
|
|
25
|
+
typeof parsed.manifestPath === "string"
|
|
26
|
+
) {
|
|
27
|
+
return {
|
|
28
|
+
name: parsed.name,
|
|
29
|
+
manifestPath: parsed.manifestPath,
|
|
30
|
+
uiOverridesPath:
|
|
31
|
+
parsed.uiOverridesPath === null ||
|
|
32
|
+
typeof parsed.uiOverridesPath === "string"
|
|
33
|
+
? (parsed.uiOverridesPath as string | null)
|
|
34
|
+
: null,
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
} catch {
|
|
38
|
+
/* ignore */
|
|
39
|
+
}
|
|
40
|
+
return undefined
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const defaultTheme = {
|
|
44
|
+
name: "default",
|
|
45
|
+
manifestPath: resolve(__dirname, "../src/themes/default/sirenodeck.json"),
|
|
46
|
+
uiOverridesPath: null as string | null,
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const theme = parseThemeFromEnv() ?? defaultTheme
|
|
50
|
+
|
|
51
|
+
const addonsFromEnv = () => {
|
|
52
|
+
const blob = process.env["SIRENO_ADDONS"]
|
|
53
|
+
if (blob === undefined || blob.length === 0) return undefined
|
|
54
|
+
try {
|
|
55
|
+
return JSON.parse(blob) as Array<{
|
|
56
|
+
name: string
|
|
57
|
+
frontend?: { main: string; styles?: string[] }
|
|
58
|
+
buttons?: Array<{ type: string }>
|
|
59
|
+
buttonTypes?: Record<string, string>
|
|
60
|
+
}>
|
|
61
|
+
} catch {
|
|
62
|
+
return undefined
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export default defineConfig({
|
|
67
|
+
root: __dirname,
|
|
68
|
+
plugins: [
|
|
69
|
+
react(),
|
|
70
|
+
tailwindcss(),
|
|
71
|
+
sirenoDeck2({
|
|
72
|
+
token: process.env["SIRENO_TOKEN"] ?? "",
|
|
73
|
+
theme,
|
|
74
|
+
...(addonsFromEnv() !== undefined ? { addons: addonsFromEnv()! } : {}),
|
|
75
|
+
}),
|
|
76
|
+
],
|
|
77
|
+
resolve: {
|
|
78
|
+
alias: [
|
|
79
|
+
{
|
|
80
|
+
find: /^@sirenodeck\/sirenodeck(\/.*)?$/,
|
|
81
|
+
replacement: resolve(__dirname, "../src") + "$1",
|
|
82
|
+
},
|
|
83
|
+
{ find: /^@\//, replacement: resolve(__dirname, "../src") + "/" },
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
define: {
|
|
87
|
+
"import.meta.env.VITE_WS_URL": JSON.stringify(wsUrl),
|
|
88
|
+
"import.meta.env.VITE_FRONTEND_URL": JSON.stringify(frontendUrl),
|
|
89
|
+
"import.meta.env.VITE_EMULATOR_MODE": JSON.stringify(
|
|
90
|
+
process.env.SIRENO_EMULATOR_MODE !== "false",
|
|
91
|
+
),
|
|
92
|
+
"import.meta.env.VITE_DEV_MODE": JSON.stringify(
|
|
93
|
+
process.env.SIRENO_DEV_MODE === "true",
|
|
94
|
+
),
|
|
95
|
+
"import.meta.env.VITE_REMOTE_MODE": JSON.stringify(
|
|
96
|
+
process.env.SIRENO_REQUIRE_TOKEN !== undefined,
|
|
97
|
+
),
|
|
98
|
+
},
|
|
99
|
+
server: {
|
|
100
|
+
port: Number(process.env.SIRENO_CONFIG_UI_PORT ?? 52938),
|
|
101
|
+
strictPort: false,
|
|
102
|
+
host: process.env["SIRENO_VITE_HOST"] ?? "127.0.0.1",
|
|
103
|
+
},
|
|
104
|
+
assetsInclude: ["**/*.html"],
|
|
105
|
+
})
|