@adea-ai/app-framework 0.25.1 → 0.26.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.
- package/README.md +157 -19
- package/dist/app/application.d.ts +11 -4
- package/dist/app/application.js +24 -4
- package/dist/app/create-application.d.ts +9 -0
- package/dist/app/create-application.js +214 -143
- package/dist/app/private-group.d.ts +14 -0
- package/dist/app/private-group.js +39 -0
- package/dist/app/service-registry.d.ts +8 -4
- package/dist/app/service-registry.js +43 -6
- package/dist/appearance/custom-theme-import.d.ts +5 -7
- package/dist/appearance/custom-theme-import.js +66 -18
- package/dist/appearance/custom-theme-library.d.ts +51 -3
- package/dist/appearance/custom-theme-library.js +262 -33
- package/dist/appearance/editor.d.ts +3 -1
- package/dist/appearance/editor.js +37 -2
- package/dist/appearance/theme-file-importer.d.ts +7 -3
- package/dist/appearance/theme-file-importer.js +27 -7
- package/dist/appearance/theme-library-action-fence.d.ts +11 -0
- package/dist/appearance/theme-library-action-fence.js +29 -0
- package/dist/cli/cef-helper-cli.js +0 -0
- package/dist/cli/create-application-cli.js +0 -0
- package/dist/cli/electrobun-shortcut-patch-cli.js +0 -0
- package/dist/cli/framework-update-cli.js +16 -3
- package/dist/cli/macos-signing-cli.js +0 -0
- package/dist/cli/release-assets-plan-cli.js +0 -0
- package/dist/cli/release-cut-cli.js +0 -0
- package/dist/cli/release-descriptor-staging-cli.js +0 -0
- package/dist/cli/release-finalize-cli.js +0 -0
- package/dist/cli/release-promote-cli.js +0 -0
- package/dist/cli/release-publish-cli.js +0 -0
- package/dist/cli/release-sign-cli.js +0 -0
- package/dist/cli/release-step-cli.js +0 -0
- package/dist/cli/toolchain-identity-cli.js +0 -0
- package/dist/cli/windows-runtime-patch-cli.js +0 -0
- package/dist/desktop/application-command-client.d.ts +11 -1
- package/dist/desktop/application-command-client.js +66 -3
- package/dist/desktop/channel-handshake.d.ts +2 -1
- package/dist/desktop/channel-handshake.js +21 -5
- package/dist/desktop/client-asset-stream.d.ts +10 -0
- package/dist/desktop/client-asset-stream.js +97 -0
- package/dist/desktop/client-assets.d.ts +3 -1
- package/dist/desktop/client-assets.js +41 -6
- package/dist/desktop/desktop-client.d.ts +15 -1
- package/dist/desktop/desktop-client.js +235 -109
- package/dist/desktop/desktop-gateway.d.ts +2 -0
- package/dist/desktop/desktop-gateway.js +134 -22
- package/dist/desktop/desktop-host-websocket.d.ts +10 -0
- package/dist/desktop/desktop-host-websocket.js +28 -0
- package/dist/desktop/desktop-host.d.ts +9 -0
- package/dist/desktop/desktop-host.js +70 -61
- package/dist/desktop/desktop-port-file.d.ts +2 -0
- package/dist/desktop/desktop-port-file.js +23 -0
- package/dist/desktop/desktop-stream.d.ts +5 -0
- package/dist/desktop/desktop-stream.js +83 -15
- package/dist/desktop/gateway-limits.d.ts +2 -0
- package/dist/desktop/gateway-limits.js +6 -0
- package/dist/desktop/open-url-channel.d.ts +5 -3
- package/dist/desktop/open-url-channel.js +18 -5
- package/dist/desktop/typed-array-intrinsics.d.ts +6 -0
- package/dist/desktop/typed-array-intrinsics.js +19 -0
- package/dist/framework-source.json +1 -1
- package/dist/installer/installed-payload.js +1 -1
- package/dist/installer/installer-ci-bootstrap.js +2 -1
- package/dist/installer/installer-command.d.ts +13 -0
- package/dist/installer/installer-command.js +47 -0
- package/dist/installer/installer-extraction.js +27 -61
- package/dist/installer/installer-identity.d.ts +19 -3
- package/dist/installer/installer-identity.js +58 -70
- package/dist/installer/installer-image-mount.d.ts +48 -0
- package/dist/installer/installer-image-mount.js +347 -0
- package/dist/installer/installer-layout.js +1 -1
- package/dist/installer/installer-process-cleanup.js +1 -1
- package/dist/installer/installer-renderer-evidence.js +6 -2
- package/dist/installer/upgrade-asset-download.js +30 -8
- package/dist/native/app-bundle.d.ts +2 -2
- package/dist/native/app-bundle.js +5 -4
- package/dist/native/cef-helper-download.d.ts +1 -0
- package/dist/native/cef-helper-download.js +35 -0
- package/dist/native/cef-helper.js +146 -61
- package/dist/native/exclusive-rename.d.ts +2 -0
- package/dist/native/exclusive-rename.js +52 -0
- package/dist/native/native-secret-store.js +5 -4
- package/dist/native/partitioned-window.d.ts +5 -2
- package/dist/native/partitioned-window.js +69 -9
- package/dist/native/sidecar-services.js +2 -2
- package/dist/native/sidecar.js +68 -25
- package/dist/native/window-bootstrap.js +2 -2
- package/dist/release/feed-state.js +2 -1
- package/dist/release/framework-update-lock.d.ts +2 -0
- package/dist/release/framework-update-lock.js +42 -0
- package/dist/release/framework-update.d.ts +6 -2
- package/dist/release/framework-update.js +165 -40
- package/dist/release/local-release.js +68 -39
- package/dist/release/release-config.js +1 -1
- package/dist/shared/discard-stream.d.ts +4 -0
- package/dist/shared/discard-stream.js +9 -0
- package/dist/shell/app-shell.js +59 -7
- package/dist/shell/app-utilities.js +2 -2
- package/dist/shell/application-menu.d.ts +13 -0
- package/dist/shell/application-menu.js +21 -8
- package/dist/update-helper.bundle.js +40 -4
- package/dist/updates/channel-update-manager.d.ts +2 -0
- package/dist/updates/channel-update-manager.js +15 -3
- package/dist/updates/desktop-updater.d.ts +2 -0
- package/dist/updates/desktop-updater.js +36 -7
- package/dist/updates/linux-process-state.d.ts +2 -0
- package/dist/updates/linux-process-state.js +13 -0
- package/dist/updates/release-location.js +5 -4
- package/dist/updates/update-adapter.js +5 -0
- package/dist/updates/update-arm.d.ts +2 -0
- package/dist/updates/update-arm.js +58 -7
- package/dist/updates/update-discovery.js +2 -1
- package/dist/updates/update-download-cleanup.d.ts +7 -0
- package/dist/updates/update-download-cleanup.js +21 -0
- package/dist/updates/update-download.js +41 -20
- package/dist/updates/update-exclusive-rename.d.ts +3 -2
- package/dist/updates/update-exclusive-rename.js +3 -50
- package/dist/updates/update-extraction.js +1 -1
- package/dist/updates/update-manager.d.ts +17 -1
- package/dist/updates/update-manager.js +27 -8
- package/dist/updates/update-process-fence.js +18 -3
- package/dist/views/appearance-surface.js +51 -15
- package/package.json +8 -3
- package/src/app/application.tsx +49 -7
- package/src/appearance/custom-theme-import.ts +67 -7
- package/src/appearance/custom-theme-library.ts +391 -33
- package/src/appearance/editor.ts +49 -10
- package/src/appearance/theme-file-importer.ts +43 -12
- package/src/appearance/theme-library-action-fence.ts +28 -0
- package/src/desktop/client-asset-stream.ts +118 -0
- package/src/desktop/client-assets.ts +55 -5
- package/src/shell/app-shell.tsx +71 -8
- package/src/shell/app-utilities.tsx +2 -2
- package/src/updates/update-adapter.ts +5 -0
- package/src/views/appearance-surface.tsx +61 -29
- package/templates/application/README.md +5 -1
- package/templates/application/scripts/app-version.ts +7 -3
- package/templates/application/src/bun/index.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adea-ai/app-framework",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"src/app/application.tsx",
|
|
29
29
|
"src/appearance",
|
|
30
30
|
"src/desktop/client-assets.ts",
|
|
31
|
+
"src/desktop/client-asset-stream.ts",
|
|
31
32
|
"src/native/*.patch",
|
|
32
33
|
"src/native/renderer-profile.ts",
|
|
33
34
|
"src/native/window-options.ts",
|
|
@@ -331,6 +332,7 @@
|
|
|
331
332
|
"scripts": {
|
|
332
333
|
"test": "bun test tests/*/*.test.ts && bun run test:ui",
|
|
333
334
|
"test:ui": "bun test --conditions=browser --preload @adea-ai/ui/testing/solid-transform tests/*/*.test.tsx",
|
|
335
|
+
"test:theme-browser": "bun scripts/test-theme-library-browser.ts",
|
|
334
336
|
"build": "vp build && tsc -p tsconfig.json --emitDeclarationOnly && bun build src/cli/update-helper-cli.ts --target=bun --outfile dist/update-helper.bundle.js && bun scripts/write-framework-source.ts",
|
|
335
337
|
"typecheck": "bun check -p tsconfig.test.json",
|
|
336
338
|
"format": "oxfmt .",
|
|
@@ -366,12 +368,15 @@
|
|
|
366
368
|
"vite-plus": "1.4.0"
|
|
367
369
|
},
|
|
368
370
|
"peerDependencies": {
|
|
369
|
-
"@adea-ai/ui": "^0.146.10 || ^0.147.0 || ^0.148.0 || ^0.149.0 || ^0.150.0",
|
|
371
|
+
"@adea-ai/ui": "^0.146.10 || ^0.147.0 || ^0.148.0 || ^0.149.0 || ^0.150.0 || ^0.151.0",
|
|
370
372
|
"lucide-solid": "^1.51.0",
|
|
371
373
|
"solid-js": "^1.9.15"
|
|
372
374
|
},
|
|
373
375
|
"overrides": {
|
|
374
376
|
"vite": "npm:@voidzero-dev/vite-plus-core@1.4.0"
|
|
375
377
|
},
|
|
376
|
-
"packageManager": "bun@1.4.4"
|
|
378
|
+
"packageManager": "bun@1.4.4",
|
|
379
|
+
"patchedDependencies": {
|
|
380
|
+
"@kobalte/core@0.13.14": "patches/@kobalte%2Fcore@0.13.14.patch"
|
|
381
|
+
}
|
|
377
382
|
}
|
package/src/app/application.tsx
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createEffect,
|
|
3
|
+
createMemo,
|
|
4
|
+
createSignal,
|
|
5
|
+
onCleanup,
|
|
6
|
+
type Component,
|
|
7
|
+
type JSX,
|
|
8
|
+
type ParentProps,
|
|
9
|
+
} from 'solid-js'
|
|
2
10
|
import type { ContextualSidebarProps } from '@adea-ai/ui/components/layout/contextual-sidebar'
|
|
3
11
|
import type { ThemeProviderProps } from '@adea-ai/ui/components/theme/lazy'
|
|
4
12
|
import { ApplicationShell } from '../shell/app-shell'
|
|
@@ -24,6 +32,17 @@ export type ApplicationDefinition = Readonly<{
|
|
|
24
32
|
views: readonly ApplicationView[]
|
|
25
33
|
}>
|
|
26
34
|
|
|
35
|
+
/**
|
|
36
|
+
* A host router may expose a Solid-reactive `current` getter. Plain mutable
|
|
37
|
+
* routers must implement `subscribe` to report route changes made outside the
|
|
38
|
+
* Application; navigation requested by the Application always causes a refresh.
|
|
39
|
+
*/
|
|
40
|
+
export type ApplicationRouter = Readonly<{
|
|
41
|
+
current(): string
|
|
42
|
+
navigate(id: string): void
|
|
43
|
+
subscribe?(listener: () => void): () => void
|
|
44
|
+
}>
|
|
45
|
+
|
|
27
46
|
/** Validate the static app identity and destinations before the UI mounts. */
|
|
28
47
|
export function defineApplication(definition: ApplicationDefinition): ApplicationDefinition {
|
|
29
48
|
if (
|
|
@@ -56,7 +75,7 @@ export type ApplicationProps = {
|
|
|
56
75
|
definition: ApplicationDefinition
|
|
57
76
|
runtime: 'desktop' | 'web'
|
|
58
77
|
/** Supply a router when navigation is externally owned; otherwise the app keeps local state. */
|
|
59
|
-
router?:
|
|
78
|
+
router?: ApplicationRouter
|
|
60
79
|
utilities?: Omit<ApplicationUtilitiesProps, 'identity' | 'runtime'>
|
|
61
80
|
theme?: Omit<ThemeProviderProps, 'children' | 'storageKey'>
|
|
62
81
|
/** Replace the default provider to retain an existing appearance contract. */
|
|
@@ -78,15 +97,38 @@ export type ApplicationProps = {
|
|
|
78
97
|
/** Mount shared UI chrome from an app's own views and identity. */
|
|
79
98
|
export function Application(props: ApplicationProps) {
|
|
80
99
|
const [localView, setLocalView] = createSignal(props.definition.initialView)
|
|
81
|
-
const
|
|
82
|
-
|
|
100
|
+
const [routerRevision, setRouterRevision] = createSignal(0)
|
|
101
|
+
createEffect(() => {
|
|
102
|
+
const router = props.router
|
|
103
|
+
if (!router?.subscribe) return
|
|
104
|
+
|
|
105
|
+
let active = true
|
|
106
|
+
const unsubscribe = router.subscribe(() => {
|
|
107
|
+
if (active) setRouterRevision((revision) => revision + 1)
|
|
108
|
+
})
|
|
109
|
+
onCleanup(() => {
|
|
110
|
+
active = false
|
|
111
|
+
unsubscribe()
|
|
112
|
+
})
|
|
113
|
+
})
|
|
114
|
+
const view = createMemo(() => {
|
|
115
|
+
routerRevision()
|
|
116
|
+
return (
|
|
83
117
|
props.definition.views.find((item) => item.id === (props.router?.current() ?? localView())) ??
|
|
84
118
|
props.definition.views.find((item) => item.id === props.definition.initialView)!
|
|
85
|
-
|
|
119
|
+
)
|
|
120
|
+
})
|
|
86
121
|
const navigate = (id: string) => {
|
|
87
122
|
if (!props.definition.views.some((item) => item.id === id)) return
|
|
88
|
-
if (props.router)
|
|
89
|
-
|
|
123
|
+
if (!props.router) return setLocalView(id)
|
|
124
|
+
|
|
125
|
+
try {
|
|
126
|
+
props.router.navigate(id)
|
|
127
|
+
} finally {
|
|
128
|
+
// Legacy mutable routers have no reactive dependency or subscription.
|
|
129
|
+
// Re-read current() after every attempted navigation, even when navigate throws.
|
|
130
|
+
setRouterRevision((revision) => revision + 1)
|
|
131
|
+
}
|
|
90
132
|
}
|
|
91
133
|
const Theme =
|
|
92
134
|
props.themeProvider ??
|
|
@@ -28,11 +28,12 @@ import {
|
|
|
28
28
|
} from '@adea-ai/ui/lib/theme-projection'
|
|
29
29
|
import type { AdeaTheme } from '@adea-ai/ui/lib/theme-records'
|
|
30
30
|
import {
|
|
31
|
+
mutateCustomThemeLibrary,
|
|
31
32
|
flatVariantTokens,
|
|
32
|
-
setCustomThemes,
|
|
33
33
|
validateThemeRegistry,
|
|
34
34
|
type AppearanceStorage,
|
|
35
35
|
type CustomThemeStored,
|
|
36
|
+
type ThemeLibraryMutationOptions,
|
|
36
37
|
type StoredThemeColors as ThemeColors,
|
|
37
38
|
type StoredThemeVariant as ThemeVariant,
|
|
38
39
|
} from './custom-theme-library'
|
|
@@ -100,6 +101,8 @@ export type CustomThemeImportResult =
|
|
|
100
101
|
| { ok: true; theme: CustomThemeStored }
|
|
101
102
|
| { ok: false; error: string }
|
|
102
103
|
|
|
104
|
+
let fallbackThemeIdSequence = 0
|
|
105
|
+
|
|
103
106
|
function slug(value: string): string {
|
|
104
107
|
return (
|
|
105
108
|
value
|
|
@@ -110,6 +113,37 @@ function slug(value: string): string {
|
|
|
110
113
|
)
|
|
111
114
|
}
|
|
112
115
|
|
|
116
|
+
function uniqueThemeId(name: string, existing: readonly CustomThemeStored[]): string {
|
|
117
|
+
const base = `custom-${slug(name)}-${Date.now().toString(36)}`
|
|
118
|
+
const usedIds = new Set(existing.map((theme) => theme.id))
|
|
119
|
+
let suffix: string | undefined
|
|
120
|
+
try {
|
|
121
|
+
const crypto = globalThis.crypto
|
|
122
|
+
if (crypto?.getRandomValues) {
|
|
123
|
+
const bytes = crypto.getRandomValues(new Uint8Array(16))
|
|
124
|
+
suffix = Array.from(bytes, (byte) => byte.toString(16).padStart(2, '0')).join('')
|
|
125
|
+
}
|
|
126
|
+
} catch {
|
|
127
|
+
// Web Crypto can exist but be unavailable in a restricted runtime. Use the
|
|
128
|
+
// local fallback below so an imported theme can still be saved.
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (suffix === undefined) {
|
|
132
|
+
// Randomness separates windows in practice; sequence handles repeated
|
|
133
|
+
// imports in one module instance when the clock and random source are fixed.
|
|
134
|
+
fallbackThemeIdSequence += 1
|
|
135
|
+
suffix = `${Math.random().toString(36).slice(2)}-${fallbackThemeIdSequence.toString(36)}`
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
let id = `${base}-${suffix}`
|
|
139
|
+
let collision = 0
|
|
140
|
+
while (usedIds.has(id)) {
|
|
141
|
+
collision += 1
|
|
142
|
+
id = `${base}-${suffix}-${collision.toString(36)}`
|
|
143
|
+
}
|
|
144
|
+
return id
|
|
145
|
+
}
|
|
146
|
+
|
|
113
147
|
function normalizeHex(value: string): string {
|
|
114
148
|
const parsed = parseHex(value)
|
|
115
149
|
return parsed
|
|
@@ -248,9 +282,8 @@ function projectCanonical(theme: AdeaTheme): ThemeVariant {
|
|
|
248
282
|
* JSON: everything else normalizes, fills from the same-appearance default,
|
|
249
283
|
* and reports what it had to adjust.
|
|
250
284
|
*/
|
|
251
|
-
|
|
285
|
+
function prepareCustomTheme(
|
|
252
286
|
text: string,
|
|
253
|
-
storage: AppearanceStorage | undefined,
|
|
254
287
|
existing: readonly CustomThemeStored[]
|
|
255
288
|
): CustomThemeImportResult {
|
|
256
289
|
let source: unknown
|
|
@@ -305,7 +338,10 @@ export function importCustomTheme(
|
|
|
305
338
|
notes.push('Missing roles were filled from the default theme.')
|
|
306
339
|
}
|
|
307
340
|
|
|
308
|
-
//
|
|
341
|
+
// Body and terminal foreground roles must stay readable against the
|
|
342
|
+
// background we actually ship. The shared shadcn projection consumes `text`
|
|
343
|
+
// for body copy, while the terminal adapter consumes `foreground` directly.
|
|
344
|
+
colors.foreground = repairToFloor(colors.foreground!, colors.background!, notes, 'foreground')
|
|
309
345
|
colors.text = repairToFloor(colors.text!, colors.background!, notes, 'text')
|
|
310
346
|
colors.textMuted = repairToFloor(colors.textMuted!, colors.background!, notes, 'muted text')
|
|
311
347
|
colors.textSubtle = repairToFloor(colors.textSubtle!, colors.background!, notes, 'subtle text')
|
|
@@ -339,7 +375,7 @@ export function importCustomTheme(
|
|
|
339
375
|
variant = projectHostFallback(name, appearance, canonical.colors, ansi)
|
|
340
376
|
notes.push('Syntax roles were approximated from the ANSI ramp.')
|
|
341
377
|
}
|
|
342
|
-
variant = { ...variant, id:
|
|
378
|
+
variant = { ...variant, id: uniqueThemeId(name, existing), name }
|
|
343
379
|
|
|
344
380
|
const issues = validateThemeRegistry([variant]).filter((issue) => issue.severity === 'error')
|
|
345
381
|
for (const issue of issues) notes.push(`${issue.variantId}: ${issue.message}`)
|
|
@@ -353,11 +389,35 @@ export function importCustomTheme(
|
|
|
353
389
|
flatTokens: flatVariantTokens(variant),
|
|
354
390
|
notes,
|
|
355
391
|
}
|
|
356
|
-
if (!setCustomThemes([...existing, stored], storage))
|
|
357
|
-
return { ok: false, error: 'The theme could not be saved. Check your storage and try again.' }
|
|
358
392
|
return { ok: true, theme: stored }
|
|
359
393
|
}
|
|
360
394
|
|
|
395
|
+
/** Parse and add a theme using the latest snapshot inside the shared mutation lock. */
|
|
396
|
+
export async function importCustomThemeAtomically(
|
|
397
|
+
text: string,
|
|
398
|
+
storage: AppearanceStorage | undefined,
|
|
399
|
+
options: ThemeLibraryMutationOptions & { canCommit?: () => boolean } = {}
|
|
400
|
+
): Promise<CustomThemeImportResult> {
|
|
401
|
+
const { canCommit, ...mutationOptions } = options
|
|
402
|
+
const mutation = await mutateCustomThemeLibrary<CustomThemeImportResult>(
|
|
403
|
+
storage,
|
|
404
|
+
(existing) => {
|
|
405
|
+
if (canCommit && !canCommit()) {
|
|
406
|
+
return {
|
|
407
|
+
themes: existing,
|
|
408
|
+
commit: false,
|
|
409
|
+
value: { ok: false, error: 'This import was superseded.' },
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
const result = prepareCustomTheme(text, existing)
|
|
413
|
+
if (!result.ok) return { themes: existing, commit: false, value: result }
|
|
414
|
+
return { themes: [...existing, result.theme], value: result }
|
|
415
|
+
},
|
|
416
|
+
mutationOptions
|
|
417
|
+
)
|
|
418
|
+
return mutation.ok ? mutation.value : { ok: false, error: mutation.error }
|
|
419
|
+
}
|
|
420
|
+
|
|
361
421
|
/** Direct host projection for inputs the canonical adapters reject. */
|
|
362
422
|
function projectHostFallback(
|
|
363
423
|
name: string,
|