@volter/browser-python 0.1.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.
Files changed (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +14 -0
  3. package/dist/asgi-bridge.d.ts +3 -0
  4. package/dist/asgi-bridge.d.ts.map +1 -0
  5. package/dist/asgi-bridge.js +307 -0
  6. package/dist/asgi-bridge.js.map +1 -0
  7. package/dist/command.d.ts +20 -0
  8. package/dist/command.d.ts.map +1 -0
  9. package/dist/command.js +154 -0
  10. package/dist/command.js.map +1 -0
  11. package/dist/filesystem.d.ts +9 -0
  12. package/dist/filesystem.d.ts.map +1 -0
  13. package/dist/filesystem.js +96 -0
  14. package/dist/filesystem.js.map +1 -0
  15. package/dist/index.d.ts +4 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +3 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/package-manager.d.ts +8 -0
  20. package/dist/package-manager.d.ts.map +1 -0
  21. package/dist/package-manager.js +103 -0
  22. package/dist/package-manager.js.map +1 -0
  23. package/dist/process-host.d.ts +27 -0
  24. package/dist/process-host.d.ts.map +1 -0
  25. package/dist/process-host.js +326 -0
  26. package/dist/process-host.js.map +1 -0
  27. package/dist/protocol.d.ts +169 -0
  28. package/dist/protocol.d.ts.map +1 -0
  29. package/dist/protocol.js +2 -0
  30. package/dist/protocol.js.map +1 -0
  31. package/dist/pyodide-runtime.d.ts +37 -0
  32. package/dist/pyodide-runtime.d.ts.map +1 -0
  33. package/dist/pyodide-runtime.js +13 -0
  34. package/dist/pyodide-runtime.js.map +1 -0
  35. package/dist/server-host.d.ts +21 -0
  36. package/dist/server-host.d.ts.map +1 -0
  37. package/dist/server-host.js +526 -0
  38. package/dist/server-host.js.map +1 -0
  39. package/dist/sqlite-coherence.d.ts +19 -0
  40. package/dist/sqlite-coherence.d.ts.map +1 -0
  41. package/dist/sqlite-coherence.js +167 -0
  42. package/dist/sqlite-coherence.js.map +1 -0
  43. package/dist/subprocess-bridge.d.ts +12 -0
  44. package/dist/subprocess-bridge.d.ts.map +1 -0
  45. package/dist/subprocess-bridge.js +407 -0
  46. package/dist/subprocess-bridge.js.map +1 -0
  47. package/dist/worker.d.ts +2 -0
  48. package/dist/worker.d.ts.map +1 -0
  49. package/dist/worker.js +251 -0
  50. package/dist/worker.js.map +1 -0
  51. package/dist/wsgi-bridge.d.ts +21 -0
  52. package/dist/wsgi-bridge.d.ts.map +1 -0
  53. package/dist/wsgi-bridge.js +268 -0
  54. package/dist/wsgi-bridge.js.map +1 -0
  55. package/package.json +23 -0
@@ -0,0 +1,169 @@
1
+ import type { BrowserFileSystemSnapshot } from "@volter/browser-runtime/browser-filesystem.js";
2
+ export type PythonWebSocketData = {
3
+ kind: "text";
4
+ text: string;
5
+ } | {
6
+ kind: "binary";
7
+ base64: string;
8
+ };
9
+ export interface PythonRunRequest {
10
+ type: "run";
11
+ argv: string[];
12
+ cwd: string;
13
+ env: Record<string, string>;
14
+ filesystem: BrowserFileSystemSnapshot;
15
+ stdinBase64: string;
16
+ serverPort: MessagePort;
17
+ fileLocks: {
18
+ channel: import("@volter/browser-runtime/browser-file-locks.js").BrowserFileLockChannel;
19
+ owner: string;
20
+ };
21
+ fileCoherence: import("@volter/browser-runtime/browser-file-coherence.js").BrowserFileCoherenceChannel;
22
+ }
23
+ export type PythonWorkerHostMessage = PythonRunRequest | {
24
+ type: "commit-ack";
25
+ commitId: number;
26
+ error?: string;
27
+ } | {
28
+ type: "shutdown";
29
+ };
30
+ export type PythonWorkerMessage = {
31
+ type: "stdout" | "stderr";
32
+ chunk: string;
33
+ } | {
34
+ type: "commit";
35
+ commitId: number;
36
+ filesystem: BrowserFileSystemSnapshot;
37
+ } | {
38
+ type: "result";
39
+ exitCode: number;
40
+ filesystem: BrowserFileSystemSnapshot;
41
+ error?: string;
42
+ };
43
+ export type PythonServerWorkerMessage = {
44
+ type: "listen";
45
+ requestId: number;
46
+ port: number;
47
+ server: "static";
48
+ root: string;
49
+ } | {
50
+ type: "listen";
51
+ requestId: number;
52
+ port: number;
53
+ server: "wsgi";
54
+ } | {
55
+ type: "listen";
56
+ requestId: number;
57
+ port: number;
58
+ server: "asgi";
59
+ } | {
60
+ type: "process-run";
61
+ requestId: number;
62
+ command: string;
63
+ cwd: string;
64
+ env: Record<string, string>;
65
+ stdinBase64: string;
66
+ control: SharedArrayBuffer;
67
+ response: SharedArrayBuffer;
68
+ } | {
69
+ type: "process-start";
70
+ requestId: number;
71
+ command: string;
72
+ cwd: string;
73
+ env: Record<string, string>;
74
+ stdinPipe: boolean;
75
+ stdoutPipe: boolean;
76
+ stderrPipe: boolean;
77
+ stderrToStdout: boolean;
78
+ control: SharedArrayBuffer;
79
+ response: SharedArrayBuffer;
80
+ } | {
81
+ type: "process-action";
82
+ requestId: number;
83
+ childId: number;
84
+ action: "poll" | "wait" | "write" | "close" | "read" | "terminate" | "release";
85
+ stream?: "stdout" | "stderr";
86
+ maximum?: number;
87
+ stdinBase64?: string;
88
+ closeStdin?: boolean;
89
+ control: SharedArrayBuffer;
90
+ response: SharedArrayBuffer;
91
+ } | {
92
+ type: "process-cancel";
93
+ requestId: number;
94
+ } | {
95
+ type: "http-response";
96
+ requestId: number;
97
+ statusCode: number;
98
+ statusMessage: string;
99
+ headers: Record<string, string | string[]>;
100
+ bodyBase64: string;
101
+ error?: string;
102
+ } | {
103
+ type: "http-stream-start";
104
+ requestId: number;
105
+ statusCode: number;
106
+ statusMessage: string;
107
+ headers: Record<string, string | string[]>;
108
+ } | {
109
+ type: "http-stream-chunk";
110
+ requestId: number;
111
+ bodyBase64: string;
112
+ } | {
113
+ type: "http-stream-end";
114
+ requestId: number;
115
+ } | {
116
+ type: "http-stream-error";
117
+ requestId: number;
118
+ error: string;
119
+ } | {
120
+ type: "websocket-opened";
121
+ connectionId: number;
122
+ protocol: string;
123
+ } | {
124
+ type: "websocket-message";
125
+ connectionId: number;
126
+ data: PythonWebSocketData;
127
+ } | {
128
+ type: "websocket-close";
129
+ connectionId: number;
130
+ code: number;
131
+ reason: string;
132
+ clean: boolean;
133
+ } | {
134
+ type: "websocket-error";
135
+ connectionId: number;
136
+ error: string;
137
+ };
138
+ export type PythonServerHostMessage = {
139
+ type: "ack";
140
+ requestId: number;
141
+ result: number;
142
+ } | {
143
+ type: "http-request";
144
+ requestId: number;
145
+ application: "wsgi" | "asgi";
146
+ method: string;
147
+ url: string;
148
+ headers: Record<string, string>;
149
+ bodyBase64: string;
150
+ streaming?: boolean;
151
+ } | {
152
+ type: "websocket-open";
153
+ connectionId: number;
154
+ path: string;
155
+ protocols: string[];
156
+ } | {
157
+ type: "websocket-message";
158
+ connectionId: number;
159
+ data: PythonWebSocketData;
160
+ } | {
161
+ type: "websocket-close";
162
+ connectionId: number;
163
+ code: number;
164
+ reason: string;
165
+ };
166
+ export interface PythonServerAttachment {
167
+ attach(port: MessagePort): () => void;
168
+ }
169
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC;AAE/F,MAAM,MAAM,mBAAmB,GAC3B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,KAAK,CAAC;IACZ,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,UAAU,EAAE,yBAAyB,CAAC;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,WAAW,CAAC;IACxB,SAAS,EAAE;QACT,O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,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAClD;IACA,IAAI,EAAE,cAAc,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,GACC;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,EAAE,CAAA;CAAE,GACnF;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,mBAAmB,CAAA;CAAE,GAC9E;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpF,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,IAAI,CAAC;CACvC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":""}
@@ -0,0 +1,37 @@
1
+ export declare const PYTHON_WORKSPACE = "/workspace";
2
+ export interface PyodideFileSystem {
3
+ analyzePath(path: string): {
4
+ exists: boolean;
5
+ object?: {
6
+ isFolder?: boolean;
7
+ };
8
+ };
9
+ mkdirTree(path: string): void;
10
+ readdir(path: string): string[];
11
+ readFile(path: string): Uint8Array;
12
+ stat(path: string): {
13
+ mode: number;
14
+ mtime?: Date | number;
15
+ };
16
+ chmod(path: string, mode: number): void;
17
+ utime(path: string, atime: number, mtime: number): void;
18
+ unlink(path: string): void;
19
+ rmdir(path: string): void;
20
+ writeFile(path: string, bytes: Uint8Array): void;
21
+ }
22
+ export interface PyodideRuntime {
23
+ FS: PyodideFileSystem;
24
+ globals: {
25
+ set(name: string, value: unknown): void;
26
+ };
27
+ loadPackage(packages: string | string[]): Promise<void>;
28
+ runPythonAsync(code: string): Promise<unknown>;
29
+ setStderr(options: {
30
+ batched(chunk: string): void;
31
+ }): void;
32
+ setStdout(options: {
33
+ batched(chunk: string): void;
34
+ }): void;
35
+ }
36
+ export declare function loadPythonRuntime(): Promise<PyodideRuntime>;
37
+ //# sourceMappingURL=pyodide-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pyodide-runtime.d.ts","sourceRoot":"","sources":["../src/pyodide-runtime.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,eAAe,CAAC;AAE7C,MAAM,WAAW,iBAAiB;IAChC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;SAAE,CAAA;KAAE,CAAC;IAChF,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;IACnC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,CAAA;KAAE,CAAC;IAC5D,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACxD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;CAClD;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,iBAAiB,CAAC;IACtB,OAAO,EAAE;QAAE,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAA;KAAE,CAAC;IACrD,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/C,SAAS,CAAC,OAAO,EAAE;QAAE,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;IAC3D,SAAS,CAAC,OAAO,EAAE;QAAE,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;CAC5D;AAOD,wBAAgB,iBAAiB,IAAI,OAAO,CAAC,cAAc,CAAC,CAQ3D"}
@@ -0,0 +1,13 @@
1
+ export const PYTHON_WORKSPACE = "/workspace";
2
+ const PYODIDE_VERSION = "314.0.6";
3
+ const PYODIDE_INDEX = `https://cdn.jsdelivr.net/pyodide/v${PYODIDE_VERSION}/full/`;
4
+ const PYODIDE_MODULE = `${PYODIDE_INDEX}pyodide.mjs`;
5
+ let runtimePromise;
6
+ export function loadPythonRuntime() {
7
+ runtimePromise ??= (async () => {
8
+ const module = await import(/* @vite-ignore */ PYODIDE_MODULE);
9
+ return module.loadPyodide({ indexURL: PYODIDE_INDEX });
10
+ })();
11
+ return runtimePromise;
12
+ }
13
+ //# sourceMappingURL=pyodide-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pyodide-runtime.js","sourceRoot":"","sources":["../src/pyodide-runtime.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,YAAY,CAAC;AAwB7C,MAAM,eAAe,GAAG,SAAS,CAAC;AAClC,MAAM,aAAa,GAAG,qCAAqC,eAAe,QAAQ,CAAC;AACnF,MAAM,cAAc,GAAG,GAAG,aAAa,aAAa,CAAC;AACrD,IAAI,cAAmD,CAAC;AAExD,MAAM,UAAU,iBAAiB;IAC/B,cAAc,KAAK,CAAC,KAAK,IAAI,EAAE;QAC7B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,cAAc,CAE5D,CAAC;QACF,OAAO,MAAM,CAAC,WAAW,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC,CAAC;IACzD,CAAC,CAAC,EAAE,CAAC;IACL,OAAO,cAAc,CAAC;AACxB,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { BrowserFileSystem } from "@volter/browser-runtime/browser-filesystem.js";
2
+ import type { BrowserCommandBackend } from "@volter/browser-runtime/browser-process.js";
3
+ import type { BrowserServerBridge, BrowserStreamingResponseCallbacks } from "@volter/browser-runtime/browser-http.js";
4
+ import type { BrowserVirtualWebSocketRegistry } from "@volter/browser-runtime/browser-virtual-websocket.js";
5
+ import type { PythonServerAttachment } from "./protocol.js";
6
+ type PortBridge = BrowserServerBridge;
7
+ /** Registers static and WSGI-backed Python processes on the shared virtual port table. */
8
+ export declare class BrowserPythonServerHost implements PythonServerAttachment {
9
+ private readonly filesystem;
10
+ private readonly bridge;
11
+ private readonly processHost?;
12
+ private readonly webSocketRegistry?;
13
+ private nextWebSocketConnection;
14
+ private readonly streamingServers;
15
+ constructor(filesystem: BrowserFileSystem, bridge: PortBridge, processHost?: BrowserCommandBackend | undefined, webSocketRegistry?: BrowserVirtualWebSocketRegistry | undefined);
16
+ handleStreamingRequest(port: number, method: string, url: string, headers: Record<string, string>, body: ArrayBuffer | undefined, callbacks: BrowserStreamingResponseCallbacks): Promise<boolean>;
17
+ attach(port: MessagePort): () => void;
18
+ private handleStatic;
19
+ }
20
+ export {};
21
+ //# sourceMappingURL=server-host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-host.d.ts","sourceRoot":"","sources":["../src/server-host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,KAAK,EACV,mBAAmB,EACnB,iCAAiC,EAElC,MAAM,yCAAyC,CAAC;AACjD,OAAO,KAAK,EAEV,+BAA+B,EAGhC,MAAM,sDAAsD,CAAC;AAC9D,OAAO,KAAK,EACV,sBAAsB,EAGvB,MAAM,eAAe,CAAC;AAGvB,KAAK,UAAU,GAAG,mBAAmB,CAAC;AA8BtC,0FAA0F;AAC1F,qBAAa,uBAAwB,YAAW,sBAAsB;IAWlE,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;IAC7B,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC;IAbrC,OAAO,CAAC,uBAAuB,CAAK;IACpC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAMR;gBAGN,UAAU,EAAE,iBAAiB,EAC7B,MAAM,EAAE,UAAU,EAClB,WAAW,CAAC,EAAE,qBAAqB,YAAA,EACnC,iBAAiB,CAAC,EAAE,+BAA+B,YAAA;IAGtE,sBAAsB,CACpB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,IAAI,EAAE,WAAW,GAAG,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