pkg stores application files in a virtual filesystem, and its worker_threads hook discovers worker entry points only when they are passed as filesystem strings. Convert the code-runtime entry with fileURLToPath() and return the workflow built entry as a string while retaining its source-mode data URL bootstrap. Emit worker entry bundles as CommonJS .cjs files. pkg executes a VFS-backed string-path worker through Module._compile, so an ESM-only entry can be present in the executable yet still fail when launched. Keep the public hosts ESM, adapt worker startup accordingly, and align exports, package file lists, workspace constraints, documentation, and built-worker tests with the actual artifact format. Expand the custom-config executable smoke to load the Code Mode and workflow plugins and script real run_code and zero-agent workflow calls. Require both tools to return 42 from workers launched inside the pkg VFS, turning worker support from an asset-presence assumption into an end-to-end runtime contract. Update the implemented RFC and verification gates to describe and exercise the supported built-worker path. This adds no tool or JSON-RPC protocol shape; it fixes how existing worker-backed capabilities are located and executed in the single-file distribution.
35 lines
1019 B
TypeScript
35 lines
1019 B
TypeScript
import { defineConfig } from 'tsdown'
|
|
|
|
/**
|
|
* The engine ships two runtime entries: the engine service (index) and the
|
|
* worker-thread entry (worker) the engine spawns via `new Worker`. The
|
|
* entries are JS emitted by tsc under lib/types and are bundled as two
|
|
* single-entry passes so shared modules (realm, runtime, session) are inlined
|
|
* into each instead of split into a hash-named chunk (the worker entry must
|
|
* be a self-contained file the Worker constructor can load by path). The
|
|
* worker bundle is CommonJS because pkg's VFS Worker hook compiles
|
|
* filesystem-string entries as CommonJS.
|
|
*/
|
|
export default defineConfig([
|
|
{
|
|
entry: ['lib/types/index.js'],
|
|
outDir: 'lib',
|
|
format: ['esm'],
|
|
platform: 'node',
|
|
target: 'es2024',
|
|
fixedExtension: false,
|
|
dts: false,
|
|
clean: false,
|
|
},
|
|
{
|
|
entry: ['lib/types/worker.js'],
|
|
outDir: 'lib',
|
|
format: ['cjs'],
|
|
platform: 'node',
|
|
target: 'es2024',
|
|
fixedExtension: false,
|
|
dts: false,
|
|
clean: false,
|
|
},
|
|
])
|