@orkestrel/sea 0.0.1
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/LICENSE +21 -0
- package/README.md +210 -0
- package/dist/src/server/index.cjs +2536 -0
- package/dist/src/server/index.cjs.map +1 -0
- package/dist/src/server/index.d.cts +1113 -0
- package/dist/src/server/index.d.ts +1113 -0
- package/dist/src/server/index.js +2465 -0
- package/dist/src/server/index.js.map +1 -0
- package/package.json +84 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Orkestrel
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# @orkestrel/sea
|
|
2
|
+
|
|
3
|
+
A pure-TypeScript Node.js [Single Executable Application (SEA)](https://nodejs.org/api/single-executable-applications.html)
|
|
4
|
+
builder for the `@orkestrel` line — compress assets, assemble the SEA blob,
|
|
5
|
+
and inject it into a standalone binary, entirely in TypeScript with no
|
|
6
|
+
external tools.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install @orkestrel/sea
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Quick start
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { formatSize, createSEA } from '@orkestrel/sea'
|
|
18
|
+
|
|
19
|
+
const sea = createSEA({
|
|
20
|
+
name: 'myapp',
|
|
21
|
+
entry: { path: 'dist/server/serve.cjs' },
|
|
22
|
+
output: 'dist/sea',
|
|
23
|
+
assets: { 'model.gguf': 'models/model.gguf' },
|
|
24
|
+
compression: {
|
|
25
|
+
paths: ['dist/app/browser'],
|
|
26
|
+
mode: 'text',
|
|
27
|
+
},
|
|
28
|
+
windows: { terminal: false },
|
|
29
|
+
on: {
|
|
30
|
+
compress: (compression) => {
|
|
31
|
+
if (compression === undefined) return
|
|
32
|
+
process.stdout.write(`compressed ${String(compression.assets.length)} assets\n`)
|
|
33
|
+
},
|
|
34
|
+
blob: (blob) => {
|
|
35
|
+
process.stdout.write(`blob ${blob}\n`)
|
|
36
|
+
},
|
|
37
|
+
assemble: (executable) => {
|
|
38
|
+
process.stdout.write(`assembled ${executable}\n`)
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const result = await sea.execute()
|
|
44
|
+
process.stdout.write(
|
|
45
|
+
`${result.executable} ${formatSize(result.size)} ${String(result.duration)}ms\n`,
|
|
46
|
+
)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Features
|
|
50
|
+
|
|
51
|
+
- **Pure-TypeScript cross-platform injection** — PE (Windows), ELF (Linux),
|
|
52
|
+
and Mach-O (macOS) binary formats, with no external tools (no `postject`,
|
|
53
|
+
no WASM) and no size ceiling: the blob is streamed from disk in 4 MB
|
|
54
|
+
chunks.
|
|
55
|
+
- **Brotli asset compression** — directories are compressed before blob
|
|
56
|
+
assembly, with `generic` / `text` / `font` modes.
|
|
57
|
+
- **Hide the Windows terminal** — `windows: { terminal: false }` patches the
|
|
58
|
+
PE subsystem field so a GUI application launches without a console window.
|
|
59
|
+
- **Runtime asset access** — `AssetManager` loads assets embedded in the SEA
|
|
60
|
+
blob via `node:sea`, or falls back to disk in development.
|
|
61
|
+
- **Open the browser** — `openBrowser(url)` is a runtime helper (not a build
|
|
62
|
+
step) for a bundled local-UI app to launch the system default browser at
|
|
63
|
+
its own served address. Best-effort, detached, argv-only dispatch.
|
|
64
|
+
- **Typed events** — `SEA` and `AssetManager` each own an `Emitter` from
|
|
65
|
+
[`@orkestrel/emitter`](https://github.com/orkestrel/emitter), exposed as
|
|
66
|
+
`readonly emitter`.
|
|
67
|
+
|
|
68
|
+
## Code signing
|
|
69
|
+
|
|
70
|
+
- **macOS** — the injector re-signs the output automatically with an ad-hoc
|
|
71
|
+
identity (`codesign --sign -`) and verifies the signature
|
|
72
|
+
(`codesign --verify --strict`) as the final build step. An ad-hoc signature
|
|
73
|
+
satisfies local Gatekeeper checks but is not a trusted, distributable
|
|
74
|
+
signature — re-sign with a real Apple Developer ID for distribution.
|
|
75
|
+
- **Windows** — signing is **optional**, via `windows.sign`. Provide exactly
|
|
76
|
+
one of `file` (a `.pfx` path + `password`) or `thumbprint` (a cert-store
|
|
77
|
+
SHA1 hash), plus an optional RFC 3161 `timestamp` URL and `digest`
|
|
78
|
+
(defaults to `sha256`):
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
// Certificate store, by thumbprint
|
|
82
|
+
windows: {
|
|
83
|
+
sign: {
|
|
84
|
+
thumbprint: 'AABBCCDDEEFF00112233445566778899AABBCCDD',
|
|
85
|
+
timestamp: 'http://timestamp.digicert.com',
|
|
86
|
+
},
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// PFX file on disk
|
|
90
|
+
windows: {
|
|
91
|
+
sign: {
|
|
92
|
+
file: 'certs/signing.pfx',
|
|
93
|
+
password: process.env.SIGNING_PASSWORD,
|
|
94
|
+
timestamp: 'http://timestamp.digicert.com',
|
|
95
|
+
},
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Without `windows.sign` the produced `.exe` is intentionally left unsigned —
|
|
100
|
+
it still runs, but Windows SmartScreen will warn on first launch. Signing
|
|
101
|
+
requires `signtool` (from the Windows SDK) to be on `PATH`.
|
|
102
|
+
|
|
103
|
+
## Compatibility
|
|
104
|
+
|
|
105
|
+
- **Node.js >= 24** is required; the package is a single Node-native
|
|
106
|
+
server-only surface (no CommonJS/browser split).
|
|
107
|
+
- **ESM entry requires a Node ≥ 25.7 build host.** `entry: { format: 'esm' }`
|
|
108
|
+
emits `mainFormat: 'module'`, a SEA-config field that only exists starting
|
|
109
|
+
Node 25.7; it is incompatible with `useSnapshot`. CommonJS (the default) is
|
|
110
|
+
the safe choice on Node 24.
|
|
111
|
+
- **No cross-compilation.** The build uses the host `process.execPath` /
|
|
112
|
+
`process.platform` — you must build on and for each target OS/arch. Blobs
|
|
113
|
+
are Node-version-coupled, so they are not portable across Node versions.
|
|
114
|
+
- **The CI matrix is the real acceptance gate.** A build-only pass proves
|
|
115
|
+
nothing about injector correctness on a given OS/arch — the project's CI
|
|
116
|
+
runs a matrix (ubuntu / windows / macos, including arm64, on Node 24 and 26)
|
|
117
|
+
that builds a real SEA **and executes it** on every combination.
|
|
118
|
+
- **Byte reproducibility.** Output is reproducible for an identical Node
|
|
119
|
+
binary + identical inputs; the embedded V8 code cache is host-coupled, so
|
|
120
|
+
set `blob: { cache: false }` to drop it if you need byte-identical output
|
|
121
|
+
across hosts.
|
|
122
|
+
|
|
123
|
+
## Migrating from postject / pkg / `--build-sea`
|
|
124
|
+
|
|
125
|
+
If you're coming from a manual `postject` injection script, `pkg`, or Node's
|
|
126
|
+
built-in `--build-sea`, this package's edge is: a `postject`-free streaming
|
|
127
|
+
injector with no file size ceiling, a fully programmatic surface (`createSEA`,
|
|
128
|
+
typed events, `Result`-style errors), brotli asset compression, and the
|
|
129
|
+
terminal-hiding (`windows.terminal`) and SEA-sentinel-fuse patches that none
|
|
130
|
+
of those flows provide out of the box.
|
|
131
|
+
|
|
132
|
+
## Troubleshooting
|
|
133
|
+
|
|
134
|
+
- **Antivirus / EDR flags the output binary.** SEA works by cloning the Node
|
|
135
|
+
binary broadly and injecting a blob — this pattern resembles what some
|
|
136
|
+
AV/EDR heuristics flag for modified executables. Code-sign the output (see
|
|
137
|
+
Code signing above) and, if needed, submit it to your vendor's allowlist.
|
|
138
|
+
- **Windows SmartScreen warns on first launch.** The `.exe` is unsigned —
|
|
139
|
+
sign it via `windows.sign` (see Code signing above) to avoid the warning.
|
|
140
|
+
- **macOS Gatekeeper blocks the app.** Gatekeeper requires a valid signature;
|
|
141
|
+
the automatic ad-hoc signature (`codesign --sign -`) satisfies local
|
|
142
|
+
Gatekeeper checks so it runs on the machine that built it, but for
|
|
143
|
+
distribution to other Macs, re-sign with a real Apple Developer ID.
|
|
144
|
+
- **`signtool` / `codesign` not found.** These come from the platform SDK
|
|
145
|
+
(Windows SDK for `signtool`, Xcode Command Line Tools for `codesign`) —
|
|
146
|
+
install the SDK and ensure the tool is on `PATH`.
|
|
147
|
+
|
|
148
|
+
## Example: embedded local UI
|
|
149
|
+
|
|
150
|
+
A SEA whose entry starts a local server, serves a bundled `client.html` via
|
|
151
|
+
`AssetManager`, and opens the system browser once ready:
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
import { createSEA } from '@orkestrel/sea'
|
|
155
|
+
|
|
156
|
+
const sea = createSEA({
|
|
157
|
+
name: 'myapp',
|
|
158
|
+
entry: { path: 'dist/server/serve.cjs' },
|
|
159
|
+
output: 'dist/sea',
|
|
160
|
+
assets: { 'client.html': 'dist/app/client.html' },
|
|
161
|
+
on: {
|
|
162
|
+
progress: (p) => {
|
|
163
|
+
process.stdout.write(`${p.path} ${String(p.current)}/${String(p.total)}\n`)
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
await sea.execute()
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
```ts
|
|
172
|
+
// dist/server/serve.cjs (the SEA entry point)
|
|
173
|
+
import { createServer } from 'node:http'
|
|
174
|
+
import { AssetManager, openBrowser } from '@orkestrel/sea'
|
|
175
|
+
|
|
176
|
+
const assets = new AssetManager()
|
|
177
|
+
const server = createServer((_req, res) => {
|
|
178
|
+
const asset = assets.asset('client.html')
|
|
179
|
+
if (asset) res.end(Buffer.from(asset.content))
|
|
180
|
+
})
|
|
181
|
+
|
|
182
|
+
server.listen(0, () => {
|
|
183
|
+
const address = server.address()
|
|
184
|
+
const port = typeof address === 'object' && address !== null ? address.port : 0
|
|
185
|
+
void openBrowser(`http://localhost:${String(port)}`)
|
|
186
|
+
})
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Status
|
|
190
|
+
|
|
191
|
+
Pre-release. The public API documented in
|
|
192
|
+
[`guides/src/sea.md`](https://github.com/orkestrel/sea/blob/main/guides/src/sea.md)
|
|
193
|
+
is implemented and covered by tests, but the package has not yet reached a
|
|
194
|
+
stable `1.0` release.
|
|
195
|
+
|
|
196
|
+
## Package
|
|
197
|
+
|
|
198
|
+
Published as a single Node-only surface per the `exports` field in
|
|
199
|
+
`package.json` — one `.` entry backed by a CommonJS build of `src/server`
|
|
200
|
+
(required by Node's CJS-only SEA entry-point shape).
|
|
201
|
+
|
|
202
|
+
## Guides
|
|
203
|
+
|
|
204
|
+
- [`guides/README.md`](guides/README.md) — the guides index.
|
|
205
|
+
- [`guides/src/sea.md`](guides/src/sea.md) — the `SEA` / `Injector` /
|
|
206
|
+
`Asset` / `AssetManager` surface.
|
|
207
|
+
|
|
208
|
+
## License
|
|
209
|
+
|
|
210
|
+
MIT © [Orkestrel](https://github.com/orkestrel) — see [LICENSE](./LICENSE).
|