@secure-exec/browser 0.0.0-agentos-dylib-base.edaa4a4

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 (66) hide show
  1. package/README.md +6 -0
  2. package/dist/child-process-bridge.d.ts +25 -0
  3. package/dist/child-process-bridge.js +50 -0
  4. package/dist/converged-base64.d.ts +2 -0
  5. package/dist/converged-base64.js +41 -0
  6. package/dist/converged-dgram-bridge.d.ts +11 -0
  7. package/dist/converged-dgram-bridge.js +147 -0
  8. package/dist/converged-driver-setup.d.ts +22 -0
  9. package/dist/converged-driver-setup.js +72 -0
  10. package/dist/converged-execution-host-bridge.d.ts +7 -0
  11. package/dist/converged-execution-host-bridge.js +85 -0
  12. package/dist/converged-executor-session.d.ts +60 -0
  13. package/dist/converged-executor-session.js +127 -0
  14. package/dist/converged-fs-bridge.d.ts +42 -0
  15. package/dist/converged-fs-bridge.js +245 -0
  16. package/dist/converged-module-servicer.d.ts +8 -0
  17. package/dist/converged-module-servicer.js +79 -0
  18. package/dist/converged-net-bridge.d.ts +28 -0
  19. package/dist/converged-net-bridge.js +155 -0
  20. package/dist/converged-permissions.d.ts +9 -0
  21. package/dist/converged-permissions.js +46 -0
  22. package/dist/converged-sync-bridge-handler.d.ts +47 -0
  23. package/dist/converged-sync-bridge-handler.js +140 -0
  24. package/dist/converged-sync-bridge-router.d.ts +33 -0
  25. package/dist/converged-sync-bridge-router.js +41 -0
  26. package/dist/driver.d.ts +91 -0
  27. package/dist/driver.js +386 -0
  28. package/dist/encoding.d.ts +4 -0
  29. package/dist/encoding.js +102 -0
  30. package/dist/generated/util-polyfill.d.ts +1 -0
  31. package/dist/generated/util-polyfill.js +2 -0
  32. package/dist/index.d.ts +9 -0
  33. package/dist/index.js +5 -0
  34. package/dist/kernel-backed-filesystem.d.ts +33 -0
  35. package/dist/kernel-backed-filesystem.js +205 -0
  36. package/dist/os-filesystem.d.ts +47 -0
  37. package/dist/os-filesystem.js +409 -0
  38. package/dist/permission-validation.d.ts +15 -0
  39. package/dist/permission-validation.js +62 -0
  40. package/dist/root-filesystem-from-vfs.d.ts +13 -0
  41. package/dist/root-filesystem-from-vfs.js +95 -0
  42. package/dist/runtime-driver.d.ts +66 -0
  43. package/dist/runtime-driver.js +611 -0
  44. package/dist/runtime.d.ts +248 -0
  45. package/dist/runtime.js +2296 -0
  46. package/dist/sidecar-wasm-module.d.ts +62 -0
  47. package/dist/sidecar-wasm-module.js +28 -0
  48. package/dist/sidecar-worker-protocol.d.ts +14 -0
  49. package/dist/sidecar-worker-protocol.js +9 -0
  50. package/dist/sidecar-worker.d.ts +19 -0
  51. package/dist/sidecar-worker.js +63 -0
  52. package/dist/signals.d.ts +13 -0
  53. package/dist/signals.js +89 -0
  54. package/dist/sync-bridge.d.ts +50 -0
  55. package/dist/sync-bridge.js +93 -0
  56. package/dist/wasi-polyfill.d.ts +1 -0
  57. package/dist/wasi-polyfill.js +2154 -0
  58. package/dist/worker-adapter.d.ts +21 -0
  59. package/dist/worker-adapter.js +41 -0
  60. package/dist/worker-protocol.d.ts +104 -0
  61. package/dist/worker-protocol.js +1 -0
  62. package/dist/worker-sidecar-client.d.ts +71 -0
  63. package/dist/worker-sidecar-client.js +152 -0
  64. package/dist/worker.d.ts +1 -0
  65. package/dist/worker.js +2125 -0
  66. package/package.json +111 -0
@@ -0,0 +1,248 @@
1
+ import { createInMemoryFileSystem, InMemoryFileSystem } from "./os-filesystem.js";
2
+ export type StdioChannel = "stdout" | "stderr";
3
+ export type TimingMitigation = "off" | "freeze";
4
+ type BodyLike = unknown;
5
+ export interface VirtualDirEntry {
6
+ name: string;
7
+ isDirectory: boolean;
8
+ isSymbolicLink?: boolean;
9
+ }
10
+ export interface VirtualStat {
11
+ mode: number;
12
+ size: number;
13
+ blocks: number;
14
+ dev: number;
15
+ rdev: number;
16
+ isDirectory: boolean;
17
+ isSymbolicLink: boolean;
18
+ atimeMs: number;
19
+ mtimeMs: number;
20
+ ctimeMs: number;
21
+ birthtimeMs: number;
22
+ ino: number;
23
+ nlink: number;
24
+ uid: number;
25
+ gid: number;
26
+ }
27
+ export interface VirtualFileSystem {
28
+ readFile(path: string): Promise<Uint8Array>;
29
+ readTextFile(path: string): Promise<string>;
30
+ readDir(path: string): Promise<string[]>;
31
+ readDirWithTypes(path: string): Promise<VirtualDirEntry[]>;
32
+ writeFile(path: string, content: string | Uint8Array): Promise<void>;
33
+ createDir(path: string): Promise<void>;
34
+ mkdir(path: string, options?: {
35
+ recursive?: boolean;
36
+ }): Promise<void>;
37
+ exists(path: string): Promise<boolean>;
38
+ stat(path: string): Promise<VirtualStat>;
39
+ removeFile(path: string): Promise<void>;
40
+ removeDir(path: string): Promise<void>;
41
+ rename(oldPath: string, newPath: string): Promise<void>;
42
+ realpath(path: string): Promise<string>;
43
+ symlink(target: string, linkPath: string): Promise<void>;
44
+ readlink(path: string): Promise<string>;
45
+ lstat(path: string): Promise<VirtualStat>;
46
+ link(oldPath: string, newPath: string): Promise<void>;
47
+ chmod(path: string, mode: number): Promise<void>;
48
+ chown(path: string, uid: number, gid: number): Promise<void>;
49
+ utimes(path: string, atime: number, mtime: number): Promise<void>;
50
+ truncate(path: string, length: number): Promise<void>;
51
+ pread(path: string, offset: number, length: number): Promise<Uint8Array>;
52
+ pwrite(path: string, offset: number, data: Uint8Array): Promise<void>;
53
+ }
54
+ export type PermissionDecision = boolean | {
55
+ allowed: boolean;
56
+ reason?: string;
57
+ } | {
58
+ allow: boolean;
59
+ reason?: string;
60
+ };
61
+ export type PermissionCheck<T = unknown> = (request: T) => PermissionDecision;
62
+ export interface Permissions {
63
+ fs?: PermissionCheck<{
64
+ path: string;
65
+ operation: string;
66
+ }>;
67
+ network?: PermissionCheck<{
68
+ url?: string;
69
+ host?: string;
70
+ port?: number;
71
+ }>;
72
+ childProcess?: PermissionCheck<{
73
+ command: string;
74
+ args: string[];
75
+ cwd?: string;
76
+ env?: Record<string, string>;
77
+ }>;
78
+ env?: PermissionCheck<{
79
+ name: string;
80
+ value: string;
81
+ }>;
82
+ }
83
+ export declare const allowAllFs: PermissionCheck;
84
+ export declare const allowAllNetwork: PermissionCheck;
85
+ export declare const allowAllChildProcess: PermissionCheck;
86
+ export declare const allowAllEnv: PermissionCheck;
87
+ export declare const allowAll: Permissions;
88
+ export interface ExecOptions {
89
+ filePath?: string;
90
+ env?: Record<string, string>;
91
+ cwd?: string;
92
+ stdin?: string;
93
+ cpuTimeLimitMs?: number;
94
+ timingMitigation?: TimingMitigation;
95
+ onStdio?: StdioHook;
96
+ }
97
+ export interface ExecResult {
98
+ code: number;
99
+ exitCode?: number;
100
+ stdout?: string;
101
+ stderr?: string;
102
+ errorMessage?: string;
103
+ }
104
+ export interface RunResult<T = unknown> {
105
+ value?: T;
106
+ code: number;
107
+ errorMessage?: string;
108
+ exports?: T;
109
+ }
110
+ export interface OSConfig {
111
+ platform?: string;
112
+ arch?: string;
113
+ type?: string;
114
+ release?: string;
115
+ version?: string;
116
+ cpuCount?: number;
117
+ totalmem?: number;
118
+ freemem?: number;
119
+ hostname?: string;
120
+ homedir?: string;
121
+ tmpdir?: string;
122
+ machine?: string;
123
+ user?: string;
124
+ shell?: string;
125
+ uid?: number;
126
+ gid?: number;
127
+ }
128
+ export interface ProcessConfig {
129
+ cwd?: string;
130
+ env?: Record<string, string>;
131
+ argv?: string[];
132
+ platform?: string;
133
+ arch?: string;
134
+ version?: string;
135
+ pid?: number;
136
+ ppid?: number;
137
+ uid?: number;
138
+ gid?: number;
139
+ timingMitigation?: TimingMitigation;
140
+ frozenTimeMs?: number;
141
+ }
142
+ export type StdioEvent = {
143
+ channel: StdioChannel;
144
+ message: string;
145
+ };
146
+ export type StdioHook = (event: StdioEvent) => void;
147
+ export interface CommandExecutor {
148
+ spawn(command: string, args: string[], options?: {
149
+ cwd?: string;
150
+ env?: Record<string, string>;
151
+ onStdout?: (data: Uint8Array) => void;
152
+ onStderr?: (data: Uint8Array) => void;
153
+ }): {
154
+ wait(): Promise<number>;
155
+ writeStdin(data: Uint8Array | string): void;
156
+ closeStdin(): void;
157
+ kill(signal?: number): void;
158
+ };
159
+ }
160
+ export interface NetworkAdapter {
161
+ fetch(url: string, options?: {
162
+ method?: string;
163
+ headers?: Record<string, string>;
164
+ body?: BodyLike | null;
165
+ }): Promise<{
166
+ ok: boolean;
167
+ status: number;
168
+ statusText: string;
169
+ headers: Record<string, string>;
170
+ body: string;
171
+ url: string;
172
+ redirected: boolean;
173
+ }>;
174
+ dnsLookup(hostname: string): Promise<{
175
+ address?: string;
176
+ family?: number;
177
+ error?: string;
178
+ code?: string;
179
+ }>;
180
+ httpRequest(url: string, options?: {
181
+ method?: string;
182
+ headers?: Record<string, string>;
183
+ body?: BodyLike | null;
184
+ }): Promise<{
185
+ status: number;
186
+ statusText: string;
187
+ headers: Record<string, string>;
188
+ body: string;
189
+ url: string;
190
+ }>;
191
+ }
192
+ export interface SystemDriver {
193
+ filesystem?: VirtualFileSystem;
194
+ network?: NetworkAdapter;
195
+ commandExecutor?: CommandExecutor;
196
+ permissions?: Permissions;
197
+ runtime: {
198
+ process: ProcessConfig;
199
+ os: OSConfig;
200
+ };
201
+ }
202
+ export interface RuntimeDriverOptions {
203
+ system: SystemDriver;
204
+ runtime: {
205
+ process: ProcessConfig;
206
+ os: OSConfig;
207
+ };
208
+ memoryLimit?: number;
209
+ cpuTimeLimitMs?: number;
210
+ timingMitigation?: TimingMitigation;
211
+ onStdio?: StdioHook;
212
+ payloadLimits?: {
213
+ base64TransferBytes?: number;
214
+ jsonPayloadBytes?: number;
215
+ };
216
+ }
217
+ export interface NodeRuntimeDriver {
218
+ exec(code: string, options?: ExecOptions): Promise<ExecResult>;
219
+ run<T = unknown>(code: string, filePath?: string): Promise<RunResult<T>>;
220
+ dispose(): void;
221
+ terminate?(): Promise<void>;
222
+ }
223
+ export interface NodeRuntimeDriverFactory {
224
+ createRuntimeDriver(options: RuntimeDriverOptions): NodeRuntimeDriver;
225
+ }
226
+ export declare function permissionAllowed(decision: PermissionDecision | undefined): boolean;
227
+ export declare function filterEnv(env: Record<string, string> | undefined, permissions?: Permissions): Record<string, string>;
228
+ export declare function createEnosysError(operation: string): Error;
229
+ export declare function createFsStub(): VirtualFileSystem;
230
+ export declare function createNetworkStub(): NetworkAdapter;
231
+ export declare function createCommandExecutorStub(): CommandExecutor;
232
+ export declare function wrapCommandExecutor(adapter: CommandExecutor, permissions?: Permissions): CommandExecutor;
233
+ export declare function wrapFileSystem(filesystem: VirtualFileSystem, permissions?: Permissions): VirtualFileSystem;
234
+ export declare function wrapNetworkAdapter(adapter: NetworkAdapter, permissions?: Permissions): NetworkAdapter;
235
+ export declare function mkdir(filesystem: VirtualFileSystem, path: string, options?: {
236
+ recursive?: boolean;
237
+ } | boolean): Promise<void>;
238
+ export declare function loadFile(path: string, filesystem: VirtualFileSystem): Promise<string | null>;
239
+ export declare function moduleFormat(path: string, filesystem: VirtualFileSystem): Promise<"module" | "commonjs" | "json" | null>;
240
+ export declare function resolveModule(specifier: string, fromPath: string, filesystem: VirtualFileSystem, mode?: "require" | "import"): Promise<string | null>;
241
+ export declare function isESM(code: string, filePath?: string): boolean;
242
+ export declare function transformDynamicImport(code: string): string;
243
+ export declare const POLYFILL_CODE_MAP: Record<string, string>;
244
+ export declare function exposeCustomGlobal(name: string, value: unknown): void;
245
+ export declare function exposeMutableRuntimeStateGlobal(name: string, value: unknown): void;
246
+ export declare function getIsolateRuntimeSource(id: string): string;
247
+ export declare function getRequireSetupCode(): string;
248
+ export { createInMemoryFileSystem, InMemoryFileSystem };