@adea-ai/app-framework 0.24.0 → 0.25.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 +49 -1
- package/dist/cli/macos-signing-cli.d.ts +2 -0
- package/dist/cli/macos-signing-cli.js +14 -0
- package/dist/desktop/channel-proof.js +7 -1
- package/dist/framework-source.json +1 -1
- package/dist/release/framework-package-publish.js +4 -2
- package/dist/release/local-release.d.ts +2 -0
- package/dist/release/local-release.js +25 -2
- package/dist/release/macos-signing.d.ts +27 -0
- package/dist/release/macos-signing.js +101 -0
- package/dist/shell/app-shell.js +21 -33
- package/dist/shell/navigation-drawer.d.ts +12 -0
- package/dist/shell/navigation-drawer.js +42 -0
- package/dist/updates/release-feed.d.ts +2 -0
- package/dist/updates/release-feed.js +11 -2
- package/package.json +16 -4
- package/src/shell/app-shell.tsx +29 -20
- package/src/shell/navigation-drawer.tsx +36 -0
- package/src/app/create-application.ts +0 -245
- package/src/app/service-registry.ts +0 -124
- package/src/ci/toolchain-identity.ts +0 -244
- package/src/cli/cef-helper-cli.ts +0 -21
- package/src/cli/cli-runner.ts +0 -29
- package/src/cli/create-application-cli.ts +0 -62
- package/src/cli/electrobun-shortcut-patch-cli.ts +0 -24
- package/src/cli/framework-update-cli.ts +0 -41
- package/src/cli/release-assets-plan-cli.ts +0 -14
- package/src/cli/release-cut-cli.ts +0 -41
- package/src/cli/release-descriptor-staging-cli.ts +0 -57
- package/src/cli/release-finalize-cli.ts +0 -34
- package/src/cli/release-promote-cli.ts +0 -31
- package/src/cli/release-publish-cli.ts +0 -46
- package/src/cli/release-sign-cli.ts +0 -24
- package/src/cli/release-step-cli.ts +0 -71
- package/src/cli/toolchain-identity-cli.ts +0 -12
- package/src/cli/update-helper-cli.ts +0 -12
- package/src/cli/windows-runtime-patch-cli.ts +0 -17
- package/src/desktop/application-command-client.ts +0 -43
- package/src/desktop/channel-handshake.ts +0 -136
- package/src/desktop/channel-proof.ts +0 -122
- package/src/desktop/desktop-client.ts +0 -303
- package/src/desktop/desktop-gateway.ts +0 -189
- package/src/desktop/desktop-host.ts +0 -335
- package/src/desktop/desktop-stream.ts +0 -324
- package/src/desktop/loopback-policy.ts +0 -41
- package/src/desktop/open-url-channel.ts +0 -79
- package/src/desktop/string-policy.ts +0 -9
- package/src/installer/archive-entry.ts +0 -32
- package/src/installer/command-artifact.ts +0 -307
- package/src/installer/command-qualification-command.ts +0 -75
- package/src/installer/hosted-runner.ts +0 -11
- package/src/installer/installed-payload.ts +0 -408
- package/src/installer/installer-ci-bootstrap.ts +0 -199
- package/src/installer/installer-ci-preflight.ts +0 -61
- package/src/installer/installer-ci-worker.ts +0 -105
- package/src/installer/installer-extraction.ts +0 -367
- package/src/installer/installer-fetch-guard.ts +0 -75
- package/src/installer/installer-identity.ts +0 -331
- package/src/installer/installer-layout.ts +0 -167
- package/src/installer/installer-observation.ts +0 -671
- package/src/installer/installer-process-cleanup.ts +0 -167
- package/src/installer/installer-qualification-command.ts +0 -81
- package/src/installer/installer-renderer-evidence.ts +0 -268
- package/src/installer/installer-upgrade-command.ts +0 -226
- package/src/installer/installer-worker-guard.ts +0 -112
- package/src/installer/native-executable.ts +0 -37
- package/src/installer/upgrade-asset-download.ts +0 -72
- package/src/installer/write-all.ts +0 -19
- package/src/native/app-bundle.ts +0 -86
- package/src/native/cef-helper.ts +0 -471
- package/src/native/desktop-build-hook.ts +0 -21
- package/src/native/electrobun-source-patch.ts +0 -107
- package/src/native/linux-cef-links.ts +0 -14
- package/src/native/native-secret-store.ts +0 -99
- package/src/native/native-utilities.ts +0 -166
- package/src/native/partitioned-window.ts +0 -62
- package/src/native/secure-window.ts +0 -115
- package/src/native/sidecar-services.ts +0 -71
- package/src/native/sidecar.ts +0 -387
- package/src/native/window-bootstrap.ts +0 -77
- package/src/native/windows-build-hook-internal.ts +0 -49
- package/src/native/windows-build-hook.ts +0 -12
- package/src/native/windows-runtime-patch-internal.ts +0 -48
- package/src/native/windows-runtime-patch.ts +0 -15
- package/src/release/feed-release-cut.ts +0 -110
- package/src/release/feed-state.ts +0 -135
- package/src/release/framework-package-publish.ts +0 -163
- package/src/release/framework-update.ts +0 -196
- package/src/release/github-cli.ts +0 -27
- package/src/release/github-release-assets.ts +0 -36
- package/src/release/github-release-cut.ts +0 -237
- package/src/release/github-release-lookup.ts +0 -39
- package/src/release/github-release-promotion.ts +0 -112
- package/src/release/github-release-provenance.ts +0 -65
- package/src/release/github-release-publisher.ts +0 -90
- package/src/release/github-release-qualification.ts +0 -144
- package/src/release/local-provenance.ts +0 -92
- package/src/release/local-release.ts +0 -525
- package/src/release/macos-dmg.ts +0 -113
- package/src/release/release-artifact.ts +0 -53
- package/src/release/release-assets-plan.ts +0 -118
- package/src/release/release-config.ts +0 -420
- package/src/release/release-cut-command.ts +0 -80
- package/src/release/release-cut.ts +0 -133
- package/src/release/release-descriptor-staging.ts +0 -242
- package/src/release/release-finalize.ts +0 -191
- package/src/release/release-promotion-command.ts +0 -36
- package/src/release/release-promotion.ts +0 -132
- package/src/release/release-publication.ts +0 -213
- package/src/release/release-publish-command.ts +0 -163
- package/src/release/release-qualification.ts +0 -397
- package/src/release/release-staging.ts +0 -87
- package/src/release/release-steps.ts +0 -173
- package/src/release/retained-release-build.ts +0 -217
- package/src/shell/application-menu-commands.ts +0 -6
- package/src/shell/application-menu.ts +0 -250
- package/src/updates/channel-update-manager.ts +0 -127
- package/src/updates/desktop-updater.ts +0 -440
- package/src/updates/release-feed.ts +0 -187
- package/src/updates/release-location.ts +0 -101
- package/src/updates/signed-release.ts +0 -311
- package/src/updates/stable-file.ts +0 -32
- package/src/updates/update-arm.ts +0 -107
- package/src/updates/update-channel-store.ts +0 -86
- package/src/updates/update-discovery.ts +0 -113
- package/src/updates/update-download.ts +0 -82
- package/src/updates/update-exclusive-rename.ts +0 -58
- package/src/updates/update-extraction.ts +0 -261
- package/src/updates/update-handoff-plan.ts +0 -75
- package/src/updates/update-helper.ts +0 -87
- package/src/updates/update-launch.ts +0 -33
- package/src/updates/update-manager.ts +0 -130
- package/src/updates/update-process-fence.ts +0 -125
- package/src/updates/update-resume.ts +0 -34
- package/src/updates/update-shutdown.ts +0 -37
- package/src/updates/update-swap-stage.ts +0 -75
- package/src/updates/update-swap.ts +0 -30
package/src/shell/app-shell.tsx
CHANGED
|
@@ -14,10 +14,23 @@ import { ShellRail } from '@adea-ai/ui/components/layout/shell-rail'
|
|
|
14
14
|
import { ShellTopBar } from '@adea-ai/ui/components/layout/shell-top-bar'
|
|
15
15
|
import { SideRailItem, SideRailSection } from '@adea-ai/ui/components/layout/side-rail'
|
|
16
16
|
import { ActionButton } from '@adea-ai/ui/components/composites/action-button'
|
|
17
|
-
import { Sheet, SheetContent, SheetHeader, SheetTitle } from '@adea-ai/ui/components/ui/sheet'
|
|
18
17
|
import { TooltipProvider } from '@adea-ai/ui/components/ui/tooltip'
|
|
19
18
|
import { PanelLeftClose, PanelLeftIcon, PanelLeftOpen } from 'lucide-solid'
|
|
20
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
For,
|
|
21
|
+
Show,
|
|
22
|
+
Suspense,
|
|
23
|
+
createEffect,
|
|
24
|
+
createSignal,
|
|
25
|
+
lazy,
|
|
26
|
+
onCleanup,
|
|
27
|
+
onMount,
|
|
28
|
+
type JSX,
|
|
29
|
+
} from 'solid-js'
|
|
30
|
+
|
|
31
|
+
const NavigationDrawer = lazy(() =>
|
|
32
|
+
import('./navigation-drawer').then((module) => ({ default: module.NavigationDrawer }))
|
|
33
|
+
)
|
|
21
34
|
|
|
22
35
|
export type ApplicationDestination = Readonly<{ id: string; label: string; icon: JSX.Element }>
|
|
23
36
|
export type ApplicationShellProps = {
|
|
@@ -94,8 +107,12 @@ export function ApplicationShell(props: ApplicationShellProps) {
|
|
|
94
107
|
props.drawer ? (props.narrowQuery ?? '(max-width: 799px)') : undefined
|
|
95
108
|
)
|
|
96
109
|
const [drawerOpen, setDrawerOpen] = createSignal(false)
|
|
110
|
+
// The drawer mounts (and its chunk loads) the first time the window is narrow, and
|
|
111
|
+
// stays mounted after that so its close animation and focus return keep working.
|
|
112
|
+
const [drawerMounted, setDrawerMounted] = createSignal(false)
|
|
97
113
|
createEffect(() => {
|
|
98
|
-
if (
|
|
114
|
+
if (narrow()) setDrawerMounted(true)
|
|
115
|
+
else setDrawerOpen(false)
|
|
99
116
|
})
|
|
100
117
|
const leading = () => props.sidebar ?? props.pane
|
|
101
118
|
const toggleVisible = () => narrow() || Boolean(leading())
|
|
@@ -257,26 +274,18 @@ export function ApplicationShell(props: ApplicationShellProps) {
|
|
|
257
274
|
{props.status}
|
|
258
275
|
</AppShellBody>
|
|
259
276
|
</AppShell>
|
|
260
|
-
<Show when={props.drawer}>
|
|
277
|
+
<Show when={drawerMounted() && props.drawer}>
|
|
261
278
|
{(drawer) => (
|
|
262
|
-
<
|
|
263
|
-
<
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
onCloseAutoFocus={(event: Event) => {
|
|
269
|
-
if (!sidebarToggle) return
|
|
270
|
-
event.preventDefault()
|
|
271
|
-
sidebarToggle.focus()
|
|
272
|
-
}}
|
|
279
|
+
<Suspense>
|
|
280
|
+
<NavigationDrawer
|
|
281
|
+
name={props.name}
|
|
282
|
+
open={narrow() && drawerOpen()}
|
|
283
|
+
onOpenChange={setDrawerOpen}
|
|
284
|
+
restoreFocus={() => sidebarToggle}
|
|
273
285
|
>
|
|
274
|
-
<SheetHeader class="sr-only">
|
|
275
|
-
<SheetTitle>{`${props.name} navigation`}</SheetTitle>
|
|
276
|
-
</SheetHeader>
|
|
277
286
|
{drawer()(() => setDrawerOpen(false))}
|
|
278
|
-
</
|
|
279
|
-
</
|
|
287
|
+
</NavigationDrawer>
|
|
288
|
+
</Suspense>
|
|
280
289
|
)}
|
|
281
290
|
</Show>
|
|
282
291
|
</div>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Sheet, SheetContent, SheetHeader, SheetTitle } from '@adea-ai/ui/components/ui/sheet'
|
|
2
|
+
import type { JSX } from 'solid-js'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The narrow-window navigation drawer. The shell loads it the first time the window is
|
|
6
|
+
* narrow, so wide windows never fetch the dialog primitives behind the sheet.
|
|
7
|
+
*/
|
|
8
|
+
export function NavigationDrawer(props: {
|
|
9
|
+
name: string
|
|
10
|
+
open: boolean
|
|
11
|
+
onOpenChange(open: boolean): void
|
|
12
|
+
restoreFocus(): HTMLElement | undefined
|
|
13
|
+
children: JSX.Element
|
|
14
|
+
}) {
|
|
15
|
+
return (
|
|
16
|
+
<Sheet open={props.open} onOpenChange={props.onOpenChange}>
|
|
17
|
+
<SheetContent
|
|
18
|
+
data-mobile="true"
|
|
19
|
+
side="start"
|
|
20
|
+
closeButton={false}
|
|
21
|
+
class="w-72 max-w-full"
|
|
22
|
+
onCloseAutoFocus={(event: Event) => {
|
|
23
|
+
const target = props.restoreFocus()
|
|
24
|
+
if (!target) return
|
|
25
|
+
event.preventDefault()
|
|
26
|
+
target.focus()
|
|
27
|
+
}}
|
|
28
|
+
>
|
|
29
|
+
<SheetHeader class="sr-only">
|
|
30
|
+
<SheetTitle>{`${props.name} navigation`}</SheetTitle>
|
|
31
|
+
</SheetHeader>
|
|
32
|
+
{props.children}
|
|
33
|
+
</SheetContent>
|
|
34
|
+
</Sheet>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
import { cp, mkdir, readFile, readdir, writeFile } from 'node:fs/promises'
|
|
2
|
-
import { resolve } from 'node:path'
|
|
3
|
-
import { createRendererProfile, type DesktopRenderer } from '../native/renderer-profile'
|
|
4
|
-
import { assertPortableAppName } from '../installer/installer-layout'
|
|
5
|
-
import { containsAsciiControl } from '../desktop/string-policy'
|
|
6
|
-
|
|
7
|
-
/** Generate a new app without replacing an existing directory. */
|
|
8
|
-
export async function createApplication(options: {
|
|
9
|
-
directory: string
|
|
10
|
-
slug: string
|
|
11
|
-
name: string
|
|
12
|
-
identifier: string
|
|
13
|
-
sourceUrl: string
|
|
14
|
-
frameworkSpecifier: string
|
|
15
|
-
renderer?: DesktopRenderer
|
|
16
|
-
}) {
|
|
17
|
-
if (
|
|
18
|
-
typeof options.directory !== 'string' ||
|
|
19
|
-
!options.directory.trim() ||
|
|
20
|
-
!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(options.slug) ||
|
|
21
|
-
options.slug.length > 64 ||
|
|
22
|
-
typeof options.name !== 'string' ||
|
|
23
|
-
!options.name.trim() ||
|
|
24
|
-
options.name.length > 80 ||
|
|
25
|
-
containsAsciiControl(options.name) ||
|
|
26
|
-
!/^[a-z][a-z0-9-]*(?:\.[a-z][a-z0-9-]*){1,}$/.test(options.identifier) ||
|
|
27
|
-
typeof options.frameworkSpecifier !== 'string' ||
|
|
28
|
-
!options.frameworkSpecifier.trim()
|
|
29
|
-
)
|
|
30
|
-
throw new Error('Invalid application identity or framework dependency')
|
|
31
|
-
assertPortableAppName(options.name)
|
|
32
|
-
let source: URL
|
|
33
|
-
try {
|
|
34
|
-
source = new URL(options.sourceUrl)
|
|
35
|
-
} catch {
|
|
36
|
-
throw new Error('Invalid application source URL')
|
|
37
|
-
}
|
|
38
|
-
if (source.protocol !== 'https:' || source.username || source.password)
|
|
39
|
-
throw new Error('Invalid application source URL')
|
|
40
|
-
if (
|
|
41
|
-
containsAsciiControl(options.frameworkSpecifier, true) ||
|
|
42
|
-
options.frameworkSpecifier.length > 512
|
|
43
|
-
)
|
|
44
|
-
throw new Error('Invalid framework dependency')
|
|
45
|
-
if (/^(?:git\+)?https?:/i.test(options.frameworkSpecifier)) {
|
|
46
|
-
let dependency: URL
|
|
47
|
-
try {
|
|
48
|
-
dependency = new URL(options.frameworkSpecifier.replace(/^git\+/, ''))
|
|
49
|
-
} catch {
|
|
50
|
-
throw new Error('Invalid framework dependency')
|
|
51
|
-
}
|
|
52
|
-
if (
|
|
53
|
-
dependency.protocol !== 'https:' ||
|
|
54
|
-
dependency.username ||
|
|
55
|
-
dependency.password ||
|
|
56
|
-
dependency.search
|
|
57
|
-
)
|
|
58
|
-
throw new Error('Invalid framework dependency')
|
|
59
|
-
}
|
|
60
|
-
const renderer = createRendererProfile(options.renderer).renderer
|
|
61
|
-
const frameworkManifest = JSON.parse(
|
|
62
|
-
await readFile(resolve(import.meta.dir, '../../package.json'), 'utf8')
|
|
63
|
-
) as { version?: unknown; devDependencies?: Record<string, unknown> }
|
|
64
|
-
const uiVersion = frameworkManifest.devDependencies?.['@adea-ai/ui']
|
|
65
|
-
if (typeof uiVersion !== 'string' || !/^\d+\.\d+\.\d+$/.test(uiVersion))
|
|
66
|
-
throw new Error('Framework UI version is unavailable')
|
|
67
|
-
const frameworkVersion = frameworkManifest.version
|
|
68
|
-
if (typeof frameworkVersion !== 'string' || !/^\d+\.\d+\.\d+$/.test(frameworkVersion))
|
|
69
|
-
throw new Error('Framework version is unavailable')
|
|
70
|
-
const directory = resolve(options.directory)
|
|
71
|
-
await mkdir(directory)
|
|
72
|
-
const template = resolve(import.meta.dir, '../../templates/application')
|
|
73
|
-
for (const entry of await readdir(template))
|
|
74
|
-
await cp(resolve(template, entry), resolve(directory, entry), {
|
|
75
|
-
recursive: true,
|
|
76
|
-
errorOnExist: true,
|
|
77
|
-
force: false,
|
|
78
|
-
})
|
|
79
|
-
// The release workflows call this framework release's reusable workflows. The tag
|
|
80
|
-
// pin is replaced with its commit by `adea-update-app-framework`.
|
|
81
|
-
for (const name of ['release.yml', 'release-assets.yml', 'release-finalize.yml']) {
|
|
82
|
-
const path = resolve(directory, '.github/workflows', name)
|
|
83
|
-
const workflow = await readFile(path, 'utf8')
|
|
84
|
-
await writeFile(
|
|
85
|
-
path,
|
|
86
|
-
workflow
|
|
87
|
-
.replaceAll('{{FRAMEWORK_REF}}', `v${frameworkVersion}`)
|
|
88
|
-
.replaceAll('{{RENDERER}}', renderer)
|
|
89
|
-
)
|
|
90
|
-
}
|
|
91
|
-
const config = {
|
|
92
|
-
slug: options.slug,
|
|
93
|
-
name: options.name,
|
|
94
|
-
identifier: options.identifier,
|
|
95
|
-
sourceUrl: source.href,
|
|
96
|
-
version: '0.1.0',
|
|
97
|
-
renderer,
|
|
98
|
-
initialPort: null,
|
|
99
|
-
urlSchemes: [],
|
|
100
|
-
}
|
|
101
|
-
const configEntries = Object.entries(config)
|
|
102
|
-
.map(([key, value]) => {
|
|
103
|
-
const json = JSON.stringify(value)
|
|
104
|
-
const literal =
|
|
105
|
-
typeof value !== 'string' || value.includes("'")
|
|
106
|
-
? json
|
|
107
|
-
: `'${json.slice(1, -1).replace(/\\"/g, '"')}'`
|
|
108
|
-
return ` ${key}: ${literal},`
|
|
109
|
-
})
|
|
110
|
-
.join('\n')
|
|
111
|
-
await writeFile(
|
|
112
|
-
resolve(directory, 'src/app-config.ts'),
|
|
113
|
-
`export const appConfig = {\n${configEntries}\n} as const\n`
|
|
114
|
-
)
|
|
115
|
-
const manifest = {
|
|
116
|
-
name: options.slug,
|
|
117
|
-
version: '0.1.0',
|
|
118
|
-
private: true,
|
|
119
|
-
type: 'module',
|
|
120
|
-
packageManager: 'bun@1.4.4',
|
|
121
|
-
scripts: {
|
|
122
|
-
format: 'oxfmt src scripts tests vite.config.ts electrobun.config.ts',
|
|
123
|
-
'format:check': 'oxfmt --check src scripts tests vite.config.ts electrobun.config.ts',
|
|
124
|
-
'format:write': 'oxfmt --write src scripts tests vite.config.ts electrobun.config.ts',
|
|
125
|
-
lint: 'oxlint src scripts tests vite.config.ts electrobun.config.ts',
|
|
126
|
-
typecheck: 'bun check -p tsconfig.json',
|
|
127
|
-
test: 'bun test tests',
|
|
128
|
-
'dev:web': 'vp dev --host 127.0.0.1',
|
|
129
|
-
'build:web': 'vp build',
|
|
130
|
-
'build:desktop': 'bun run build:web && bun scripts/build-desktop.ts dev',
|
|
131
|
-
'build:release': 'bun run build:web && bun scripts/build-desktop.ts stable',
|
|
132
|
-
'release:cut': 'bun node_modules/@adea-ai/app-framework/dist/cli/release-cut-cli.js',
|
|
133
|
-
'release:promote': 'bun node_modules/@adea-ai/app-framework/dist/cli/release-promote-cli.js',
|
|
134
|
-
'release:finalize':
|
|
135
|
-
'bun node_modules/@adea-ai/app-framework/dist/cli/release-finalize-cli.js',
|
|
136
|
-
'release:publish': 'bun node_modules/@adea-ai/app-framework/dist/cli/release-publish-cli.js',
|
|
137
|
-
'release:stage': 'bun scripts/stage-release.ts',
|
|
138
|
-
'release:stage-build':
|
|
139
|
-
'bun node_modules/@adea-ai/app-framework/dist/cli/release-step-cli.js stage-build',
|
|
140
|
-
'release:inspect':
|
|
141
|
-
'bun node_modules/@adea-ai/app-framework/dist/cli/release-step-cli.js inspect',
|
|
142
|
-
'release:plan': 'bun node_modules/@adea-ai/app-framework/dist/cli/release-assets-plan-cli.js',
|
|
143
|
-
'release:sign-descriptors':
|
|
144
|
-
'bun node_modules/@adea-ai/app-framework/dist/cli/release-descriptor-staging-cli.js',
|
|
145
|
-
'release:qualify':
|
|
146
|
-
'bun node_modules/@adea-ai/app-framework/dist/cli/release-step-cli.js qualify',
|
|
147
|
-
'release:qualify-upgrade':
|
|
148
|
-
'bun node_modules/@adea-ai/app-framework/dist/cli/release-step-cli.js qualify-upgrade',
|
|
149
|
-
'release:select-retained':
|
|
150
|
-
'bun node_modules/@adea-ai/app-framework/dist/cli/release-step-cli.js select-retained',
|
|
151
|
-
},
|
|
152
|
-
dependencies: {
|
|
153
|
-
'@adea-ai/app-framework': options.frameworkSpecifier,
|
|
154
|
-
'@adea-ai/ui': uiVersion,
|
|
155
|
-
'lucide-solid': '^1.51.0',
|
|
156
|
-
'solid-js': '1.9.15',
|
|
157
|
-
},
|
|
158
|
-
devDependencies: {
|
|
159
|
-
'@shadcn/lint': '^0.2.0',
|
|
160
|
-
oxlint: '^1.86.0',
|
|
161
|
-
oxfmt: '^0.71.0',
|
|
162
|
-
'@tailwindcss/vite': '^4.3.3',
|
|
163
|
-
tailwindcss: '^4.3.3',
|
|
164
|
-
vite: 'npm:@voidzero-dev/vite-plus-core@1.4.0',
|
|
165
|
-
'vite-plus': '1.4.0',
|
|
166
|
-
'vite-plugin-solid': '2.11.14',
|
|
167
|
-
electrobun: '2.0.5',
|
|
168
|
-
typescript: '^7.0.2',
|
|
169
|
-
'@types/bun': '^1.4.4',
|
|
170
|
-
},
|
|
171
|
-
overrides: {
|
|
172
|
-
vite: 'npm:@voidzero-dev/vite-plus-core@1.4.0',
|
|
173
|
-
},
|
|
174
|
-
}
|
|
175
|
-
await writeFile(resolve(directory, 'package.json'), JSON.stringify(manifest, null, 2) + '\n')
|
|
176
|
-
const platforms = {
|
|
177
|
-
'macos-arm64': [
|
|
178
|
-
`${options.slug}-{tag}-macos-arm64.dmg`,
|
|
179
|
-
`${options.slug}-{tag}-macos-arm64.tar.zst`,
|
|
180
|
-
],
|
|
181
|
-
'windows-x64': [
|
|
182
|
-
`${options.slug}-{tag}-windows-x64-Setup.zip`,
|
|
183
|
-
`${options.slug}-{tag}-windows-x64.tar.zst`,
|
|
184
|
-
],
|
|
185
|
-
'linux-x64': [
|
|
186
|
-
`${options.slug}-{tag}-linux-x64-Setup.tar.gz`,
|
|
187
|
-
`${options.slug}-{tag}-linux-x64.tar.zst`,
|
|
188
|
-
],
|
|
189
|
-
}
|
|
190
|
-
const devDiscoveryAssets = Object.keys(platforms).map((platform) => `dev-${platform}.json`)
|
|
191
|
-
const dailyDiscoveryAssets = Object.keys(platforms).map((platform) => `daily-${platform}.json`)
|
|
192
|
-
const stableDiscoveryAssets = Object.keys(platforms).map((platform) => `stable-${platform}.json`)
|
|
193
|
-
const releaseAssets = [...dailyDiscoveryAssets, ...stableDiscoveryAssets, ...devDiscoveryAssets]
|
|
194
|
-
const targets = {
|
|
195
|
-
'macos-arm64': ['darwin', 'arm64'],
|
|
196
|
-
'windows-x64': ['win32', 'x64'],
|
|
197
|
-
'linux-x64': ['linux', 'x64'],
|
|
198
|
-
} as const
|
|
199
|
-
const descriptors = Object.fromEntries(
|
|
200
|
-
(['dev', 'daily', 'stable'] as const).flatMap((channel) =>
|
|
201
|
-
Object.entries(targets).map(([platform, [os, arch]]) => [
|
|
202
|
-
`${channel}-${platform}.json`,
|
|
203
|
-
{
|
|
204
|
-
channel,
|
|
205
|
-
platform: os,
|
|
206
|
-
arch,
|
|
207
|
-
allowedPayloads: [platforms[platform as keyof typeof platforms][1]],
|
|
208
|
-
},
|
|
209
|
-
])
|
|
210
|
-
)
|
|
211
|
-
)
|
|
212
|
-
await writeFile(
|
|
213
|
-
resolve(directory, 'release-config.json'),
|
|
214
|
-
JSON.stringify(
|
|
215
|
-
{
|
|
216
|
-
appName: options.name,
|
|
217
|
-
appId: options.identifier,
|
|
218
|
-
soakHours: 96,
|
|
219
|
-
versionSource: { kind: 'source-manifest', path: 'package.json' },
|
|
220
|
-
releaseWorkflows: {
|
|
221
|
-
control: '.github/workflows/release.yml',
|
|
222
|
-
assets: '.github/workflows/release-assets.yml',
|
|
223
|
-
},
|
|
224
|
-
releaseFeed: { base: 'https://adea.dev/releases/', app: options.slug },
|
|
225
|
-
offlinePolicy: { kind: 'standalone', marker: `Welcome to ${options.name}.` },
|
|
226
|
-
offlineExpectedReads: [],
|
|
227
|
-
platforms,
|
|
228
|
-
releaseAssets,
|
|
229
|
-
dailyDiscoveryAssets,
|
|
230
|
-
stableDiscoveryAssets,
|
|
231
|
-
devDiscoveryAssets,
|
|
232
|
-
releaseSigningKeys: {},
|
|
233
|
-
descriptors,
|
|
234
|
-
},
|
|
235
|
-
null,
|
|
236
|
-
2
|
|
237
|
-
) + '\n'
|
|
238
|
-
)
|
|
239
|
-
|
|
240
|
-
await writeFile(
|
|
241
|
-
resolve(directory, '.gitignore'),
|
|
242
|
-
'node_modules/\nbuild/\nartifacts/\n.hutch/\n.cottontail-tmp/\n.env\n.env.*\n!.env.example\n'
|
|
243
|
-
)
|
|
244
|
-
return { directory }
|
|
245
|
-
}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
/** The transport supplies a verified principal; this registry does not authenticate it. */
|
|
2
|
-
export type ServiceDefinition<Principal, Input, Output> = Readonly<{
|
|
3
|
-
parse(value: unknown): Input
|
|
4
|
-
authorize(principal: Principal, input: Input): boolean | Promise<boolean>
|
|
5
|
-
run(principal: Principal, input: Input): Output | Promise<Output>
|
|
6
|
-
/** Largest invoke body the transport accepts for this service. Default 256 KiB, at most 16 MiB. */
|
|
7
|
-
maxBodyBytes?: number
|
|
8
|
-
}>
|
|
9
|
-
export type ServiceResult =
|
|
10
|
-
| { ok: true; value: unknown }
|
|
11
|
-
| { ok: false; code: 'unknown_service' | 'invalid_input' | 'unauthorized' | 'service_failed' }
|
|
12
|
-
| { ok: false; code: 'service_error'; error: { code: string; message: string } }
|
|
13
|
-
|
|
14
|
-
const MAX_ERROR_MESSAGE = 2048
|
|
15
|
-
export const DEFAULT_SERVICE_BODY_BYTES = 256 * 1024
|
|
16
|
-
export const MAX_SERVICE_BODY_BYTES = 16 * 1024 * 1024
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* An error a service means its caller to read. Throw it from `run` and the caller
|
|
20
|
-
* receives `{ok: false, code: 'service_error', error: {code, message}}`; any other
|
|
21
|
-
* thrown value stays a bare `service_failed` so implementation detail never leaks.
|
|
22
|
-
*/
|
|
23
|
-
export class ServiceError extends Error {
|
|
24
|
-
readonly code: string
|
|
25
|
-
constructor(code: string, message: string) {
|
|
26
|
-
if (typeof code !== 'string' || !/^[a-z][a-z0-9_]*$/.test(code) || code.length > 64)
|
|
27
|
-
throw new Error('Invalid service error code')
|
|
28
|
-
if (typeof message !== 'string') throw new Error('Invalid service error message')
|
|
29
|
-
super(message.length > MAX_ERROR_MESSAGE ? message.slice(0, MAX_ERROR_MESSAGE) : message)
|
|
30
|
-
this.name = 'ServiceError'
|
|
31
|
-
this.code = code
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/** In-process dispatch boundary for app services. Never expose it without an authenticated transport. */
|
|
36
|
-
export function createServiceRegistry<Principal>() {
|
|
37
|
-
type Entry = {
|
|
38
|
-
maxBodyBytes: number
|
|
39
|
-
invoke(value: unknown, principal: Principal, current?: () => boolean): Promise<ServiceResult>
|
|
40
|
-
}
|
|
41
|
-
const entries = new Map<string, Entry>()
|
|
42
|
-
return {
|
|
43
|
-
register<Input, Output>(
|
|
44
|
-
name: string,
|
|
45
|
-
definition: ServiceDefinition<Principal, Input, Output>
|
|
46
|
-
): () => void {
|
|
47
|
-
if (!/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/.test(name) || name.length > 128)
|
|
48
|
-
throw new Error('Invalid service name')
|
|
49
|
-
if (entries.has(name)) throw new Error('Service already registered')
|
|
50
|
-
const { parse, authorize, run } = definition
|
|
51
|
-
if (
|
|
52
|
-
typeof parse !== 'function' ||
|
|
53
|
-
typeof authorize !== 'function' ||
|
|
54
|
-
typeof run !== 'function'
|
|
55
|
-
)
|
|
56
|
-
throw new Error('Invalid service definition')
|
|
57
|
-
const maxBodyBytes = definition.maxBodyBytes ?? DEFAULT_SERVICE_BODY_BYTES
|
|
58
|
-
if (
|
|
59
|
-
!Number.isSafeInteger(maxBodyBytes) ||
|
|
60
|
-
maxBodyBytes < 1 ||
|
|
61
|
-
maxBodyBytes > MAX_SERVICE_BODY_BYTES
|
|
62
|
-
)
|
|
63
|
-
throw new Error('Invalid service body limit')
|
|
64
|
-
const entry: Entry = {
|
|
65
|
-
maxBodyBytes,
|
|
66
|
-
async invoke(value, principal, current) {
|
|
67
|
-
let input: Input
|
|
68
|
-
try {
|
|
69
|
-
input = parse(value)
|
|
70
|
-
} catch {
|
|
71
|
-
return { ok: false, code: 'invalid_input' }
|
|
72
|
-
}
|
|
73
|
-
try {
|
|
74
|
-
if ((await authorize(principal, input)) !== true)
|
|
75
|
-
return { ok: false, code: 'unauthorized' }
|
|
76
|
-
} catch {
|
|
77
|
-
return { ok: false, code: 'unauthorized' }
|
|
78
|
-
}
|
|
79
|
-
if (entries.get(name) !== entry) return { ok: false, code: 'unknown_service' }
|
|
80
|
-
try {
|
|
81
|
-
if (current && current() !== true) return { ok: false, code: 'unauthorized' }
|
|
82
|
-
} catch {
|
|
83
|
-
return { ok: false, code: 'unauthorized' }
|
|
84
|
-
}
|
|
85
|
-
try {
|
|
86
|
-
return { ok: true, value: await run(principal, input) }
|
|
87
|
-
} catch (error) {
|
|
88
|
-
if (!(error instanceof ServiceError)) return { ok: false, code: 'service_failed' }
|
|
89
|
-
return {
|
|
90
|
-
ok: false,
|
|
91
|
-
code: 'service_error',
|
|
92
|
-
error: { code: error.code, message: error.message },
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
}
|
|
97
|
-
entries.set(name, entry)
|
|
98
|
-
return () => {
|
|
99
|
-
if (entries.get(name) === entry) entries.delete(name)
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
/**
|
|
103
|
-
* The invoke body limit for `name` (the default for an unknown service), or with no
|
|
104
|
-
* name the largest limit any registered service accepts, for reading before the name is known.
|
|
105
|
-
*/
|
|
106
|
-
maxBodyBytes(name?: string): number {
|
|
107
|
-
if (name !== undefined) return entries.get(name)?.maxBodyBytes ?? DEFAULT_SERVICE_BODY_BYTES
|
|
108
|
-
let largest = DEFAULT_SERVICE_BODY_BYTES
|
|
109
|
-
for (const entry of entries.values()) largest = Math.max(largest, entry.maxBodyBytes)
|
|
110
|
-
return largest
|
|
111
|
-
},
|
|
112
|
-
/** `current` must synchronously recheck channel and scope immediately before the handler starts. */
|
|
113
|
-
async dispatch(
|
|
114
|
-
name: string,
|
|
115
|
-
value: unknown,
|
|
116
|
-
principal: Principal,
|
|
117
|
-
current?: () => boolean
|
|
118
|
-
): Promise<ServiceResult> {
|
|
119
|
-
const entry = entries.get(name)
|
|
120
|
-
if (!entry) return { ok: false, code: 'unknown_service' }
|
|
121
|
-
return entry.invoke(value, principal, current)
|
|
122
|
-
},
|
|
123
|
-
}
|
|
124
|
-
}
|