@deepseek-ai/dsh-experimental-webworker-runtime 0.2.1-rc.4 → 0.2.2-alpha.2
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.i18n.yaml +4 -4
- package/README.md +7 -4
- package/README.zh.md +7 -4
- package/lib/client.js +104 -9
- package/lib/index.js +79 -4
- package/lib/types/client/client.d.ts +5 -0
- package/lib/types/node/builtin_modules/implemented/async_hooks.d.ts +3 -3
- package/lib/types/node/builtin_modules/implemented/buffer.d.ts +7 -0
- package/lib/types/node/builtin_modules/implemented/string_decoder.d.ts +12 -0
- package/lib/types/node/builtin_modules/mock/repl.d.ts +10 -0
- package/lib/types/node/external_packages/pi-coding-agent.d.ts +64 -0
- package/lib/types/node/globals/process.d.ts +1 -1
- package/lib/types/package-assets.d.ts +17 -0
- package/lib/types/string-decoder-types.d.ts +5 -0
- package/lib/types/transport/tunnel.d.ts +5 -0
- package/lib/worker.js +363 -87
- package/package.json +25 -24
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { MemoryVfs } from './storage/memory.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Archive every file a package of the image publishes through `"./assets/*": "./lib/assets/*"`.
|
|
4
|
+
* @param vfs - Mounted image filesystem.
|
|
5
|
+
* @param root - Image root holding `node_modules`.
|
|
6
|
+
* @returns An uncompressed tar whose entries are named `plugins/<package>/assets/<path>` with the path unencoded,
|
|
7
|
+
* so every name fits the ustar limits the base image already met.
|
|
8
|
+
*/
|
|
9
|
+
export declare function packPackageAssets(vfs: MemoryVfs, root: string): Uint8Array;
|
|
10
|
+
/**
|
|
11
|
+
* Map each archived package asset to a Blob URL kept for the page's lifetime.
|
|
12
|
+
* @param archive - Archive from {@link packPackageAssets}.
|
|
13
|
+
* @returns The synchronous resolver behind `require.asset`: the Blob URL of a
|
|
14
|
+
* reference the image holds, otherwise the reference itself, which then fails as an unserved image.
|
|
15
|
+
*/
|
|
16
|
+
export declare function packageAssetResolver(archive: Uint8Array): (reference: string) => string;
|
|
17
|
+
//# sourceMappingURL=package-assets.d.ts.map
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
*
|
|
5
5
|
* - `GET /__boot__` answers from tunnel glue, never from the host API surface,
|
|
6
6
|
* because the page needs the boot payload before its Cordis tree exists.
|
|
7
|
+
* `GET /__assets__` answers the same way with every package asset of the
|
|
8
|
+
* image, which the page maps before any Client bundle runs.
|
|
7
9
|
* - Privileged `/api` methods take that same direct entry. The method set is not
|
|
8
10
|
* restated here: a 401 or 403 from the route lane is retried on the direct
|
|
9
11
|
* lane because the page owns the worker and needs no network authentication.
|
|
@@ -47,6 +49,8 @@ export interface TunnelSeams {
|
|
|
47
49
|
readonly directFetch: (request: Request) => Promise<Response>;
|
|
48
50
|
/** Boot payload for `GET /__boot__`: the structured index injection table. */
|
|
49
51
|
readonly bootPayload: () => unknown;
|
|
52
|
+
/** Archive for `GET /__assets__`: every package asset of the image, named by its unencoded `plugins/<package>/assets/<path>`. */
|
|
53
|
+
readonly packageAssets: () => Uint8Array;
|
|
50
54
|
/** Open one decoded Gateway Remote stream without another network carrier; `uplink` carries the page's items. */
|
|
51
55
|
readonly openStream: (endpoint: string, payload: unknown, uplink: AsyncIterable<unknown>, signal: AbortSignal) => Promise<AsyncIterable<unknown>>;
|
|
52
56
|
/** Convert a Gateway stream failure to stable Client fields. */
|
|
@@ -136,6 +140,7 @@ export declare class TunnelServer {
|
|
|
136
140
|
* when network authentication or trust rejects the worker-owning page.
|
|
137
141
|
*/
|
|
138
142
|
private serveApi;
|
|
143
|
+
private servePackageAssets;
|
|
139
144
|
private serveBoot;
|
|
140
145
|
private serveDirect;
|
|
141
146
|
}
|