@secure-exec/core 0.0.0-split-runtime-preview.7b0dded
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.md +7 -0
- package/dist/binary.d.ts +4 -0
- package/dist/binary.js +25 -0
- package/dist/bytes.d.ts +2 -0
- package/dist/bytes.js +6 -0
- package/dist/callbacks.d.ts +41 -0
- package/dist/callbacks.js +94 -0
- package/dist/cargo.d.ts +2 -0
- package/dist/cargo.js +142 -0
- package/dist/correlation.d.ts +10 -0
- package/dist/correlation.js +49 -0
- package/dist/descriptors.d.ts +34 -0
- package/dist/descriptors.js +37 -0
- package/dist/event-buffer.d.ts +90 -0
- package/dist/event-buffer.js +313 -0
- package/dist/ext.d.ts +7 -0
- package/dist/ext.js +13 -0
- package/dist/filesystem.d.ts +41 -0
- package/dist/filesystem.js +70 -0
- package/dist/frame-payload-codec.d.ts +8 -0
- package/dist/frame-payload-codec.js +14 -0
- package/dist/frame-rpc.d.ts +38 -0
- package/dist/frame-rpc.js +73 -0
- package/dist/frame-stream.d.ts +27 -0
- package/dist/frame-stream.js +99 -0
- package/dist/framing.d.ts +7 -0
- package/dist/framing.js +22 -0
- package/dist/generated-protocol.d.ts +1038 -0
- package/dist/generated-protocol.js +2879 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +23 -0
- package/dist/json.d.ts +2 -0
- package/dist/json.js +20 -0
- package/dist/kernel-proxy.d.ts +137 -0
- package/dist/kernel-proxy.js +1725 -0
- package/dist/native-client.d.ts +41 -0
- package/dist/native-client.js +124 -0
- package/dist/numbers.d.ts +1 -0
- package/dist/numbers.js +8 -0
- package/dist/ownership.d.ts +18 -0
- package/dist/ownership.js +77 -0
- package/dist/permissions.d.ts +29 -0
- package/dist/permissions.js +68 -0
- package/dist/process.d.ts +35 -0
- package/dist/process.js +125 -0
- package/dist/protocol-client.d.ts +46 -0
- package/dist/protocol-client.js +180 -0
- package/dist/protocol-frames.d.ts +68 -0
- package/dist/protocol-frames.js +139 -0
- package/dist/protocol-maps.d.ts +28 -0
- package/dist/protocol-maps.js +217 -0
- package/dist/protocol-schema.d.ts +10 -0
- package/dist/protocol-schema.js +11 -0
- package/dist/request-payloads.d.ts +139 -0
- package/dist/request-payloads.js +213 -0
- package/dist/response-payloads.d.ts +107 -0
- package/dist/response-payloads.js +161 -0
- package/dist/sidecar-client.d.ts +250 -0
- package/dist/sidecar-client.js +802 -0
- package/dist/state.d.ts +40 -0
- package/dist/state.js +44 -0
- package/dist/test-runtime.d.ts +483 -0
- package/dist/test-runtime.js +1985 -0
- package/fixtures/alpine-defaults.json +520 -0
- package/fixtures/base-filesystem.json +528 -0
- package/package.json +188 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export * from "./binary.js";
|
|
2
|
+
export * from "./bytes.js";
|
|
3
|
+
export * from "./callbacks.js";
|
|
4
|
+
export * from "./correlation.js";
|
|
5
|
+
export * from "./descriptors.js";
|
|
6
|
+
export * from "./ext.js";
|
|
7
|
+
export * from "./frame-payload-codec.js";
|
|
8
|
+
export * from "./frame-rpc.js";
|
|
9
|
+
export * from "./frame-stream.js";
|
|
10
|
+
export * from "./filesystem.js";
|
|
11
|
+
export * from "./framing.js";
|
|
12
|
+
export * from "./json.js";
|
|
13
|
+
export * from "./native-client.js";
|
|
14
|
+
export * from "./numbers.js";
|
|
15
|
+
export * from "./permissions.js";
|
|
16
|
+
export * from "./process.js";
|
|
17
|
+
export * from "./protocol-client.js";
|
|
18
|
+
export * from "./protocol-frames.js";
|
|
19
|
+
export * from "./request-payloads.js";
|
|
20
|
+
export * from "./response-payloads.js";
|
|
21
|
+
export * from "./state.js";
|
|
22
|
+
export * as protocol from "./generated-protocol.js";
|
|
23
|
+
export * from "./generated-protocol.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export * from "./binary.js";
|
|
2
|
+
export * from "./bytes.js";
|
|
3
|
+
export * from "./callbacks.js";
|
|
4
|
+
export * from "./correlation.js";
|
|
5
|
+
export * from "./descriptors.js";
|
|
6
|
+
export * from "./ext.js";
|
|
7
|
+
export * from "./frame-payload-codec.js";
|
|
8
|
+
export * from "./frame-rpc.js";
|
|
9
|
+
export * from "./frame-stream.js";
|
|
10
|
+
export * from "./filesystem.js";
|
|
11
|
+
export * from "./framing.js";
|
|
12
|
+
export * from "./json.js";
|
|
13
|
+
export * from "./native-client.js";
|
|
14
|
+
export * from "./numbers.js";
|
|
15
|
+
export * from "./permissions.js";
|
|
16
|
+
export * from "./process.js";
|
|
17
|
+
export * from "./protocol-client.js";
|
|
18
|
+
export * from "./protocol-frames.js";
|
|
19
|
+
export * from "./request-payloads.js";
|
|
20
|
+
export * from "./response-payloads.js";
|
|
21
|
+
export * from "./state.js";
|
|
22
|
+
export * as protocol from "./generated-protocol.js";
|
|
23
|
+
export * from "./generated-protocol.js";
|
package/dist/json.d.ts
ADDED
package/dist/json.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export function stringifyJsonUtf8(value, context) {
|
|
2
|
+
try {
|
|
3
|
+
const encoded = JSON.stringify(value);
|
|
4
|
+
if (encoded === undefined) {
|
|
5
|
+
throw new Error(`${context} must be JSON-serializable`);
|
|
6
|
+
}
|
|
7
|
+
return encoded;
|
|
8
|
+
}
|
|
9
|
+
catch (error) {
|
|
10
|
+
throw new Error(`${context} must be JSON-serializable: ${error instanceof Error ? error.message : String(error)}`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export function parseJsonUtf8(value, context) {
|
|
14
|
+
try {
|
|
15
|
+
return JSON.parse(value);
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
throw new Error(`invalid ${context} JSON payload: ${error instanceof Error ? error.message : String(error)}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import type { NativeMountPluginDescriptor } from "./descriptors.js";
|
|
2
|
+
import type { ConnectTerminalOptions, KernelExecOptions, KernelExecResult, KernelSpawnOptions, ManagedProcess, OpenShellOptions, ProcessInfo, ShellHandle, VirtualFileSystem, VirtualStat } from "./test-runtime.js";
|
|
3
|
+
import type { AuthenticatedSession, CreatedVm, NativeSidecarProcessClient, SidecarMountDescriptor, SidecarSignalHandlerRegistration } from "./sidecar-client.js";
|
|
4
|
+
export interface PlainMountConfig {
|
|
5
|
+
path: string;
|
|
6
|
+
driver: VirtualFileSystem;
|
|
7
|
+
readOnly?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface NativeMountConfig {
|
|
10
|
+
path: string;
|
|
11
|
+
plugin: NativeMountPluginDescriptor;
|
|
12
|
+
readOnly?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function serializeMountConfigForSidecar(mount: PlainMountConfig | NativeMountConfig): SidecarMountDescriptor;
|
|
15
|
+
export declare function toSidecarSignalName(signal: number): string;
|
|
16
|
+
export interface LocalCompatMount {
|
|
17
|
+
path: string;
|
|
18
|
+
fs: VirtualFileSystem;
|
|
19
|
+
readOnly: boolean;
|
|
20
|
+
}
|
|
21
|
+
interface KernelSocketSnapshot {
|
|
22
|
+
processId: string;
|
|
23
|
+
host?: string;
|
|
24
|
+
port?: number;
|
|
25
|
+
path?: string;
|
|
26
|
+
}
|
|
27
|
+
interface KernelSignalState {
|
|
28
|
+
handlers: Map<number, {
|
|
29
|
+
action: SidecarSignalHandlerRegistration["action"];
|
|
30
|
+
mask: Set<number>;
|
|
31
|
+
flags: number;
|
|
32
|
+
}>;
|
|
33
|
+
}
|
|
34
|
+
interface NativeSidecarKernelProxyOptions {
|
|
35
|
+
client: NativeSidecarProcessClient;
|
|
36
|
+
session: AuthenticatedSession;
|
|
37
|
+
vm: CreatedVm;
|
|
38
|
+
env: Record<string, string>;
|
|
39
|
+
cwd: string;
|
|
40
|
+
defaultExecCwd?: string;
|
|
41
|
+
localMounts: LocalCompatMount[];
|
|
42
|
+
commandGuestPaths: ReadonlyMap<string, string>;
|
|
43
|
+
onWasmCommandResolved?: (command: string) => void;
|
|
44
|
+
onDispose?: () => Promise<void>;
|
|
45
|
+
}
|
|
46
|
+
export declare class NativeSidecarKernelProxy {
|
|
47
|
+
readonly env: Record<string, string>;
|
|
48
|
+
readonly cwd: string;
|
|
49
|
+
readonly commands: ReadonlyMap<string, string>;
|
|
50
|
+
readonly vfs: VirtualFileSystem;
|
|
51
|
+
readonly processes: Map<number, ProcessInfo>;
|
|
52
|
+
private readonly defaultExecCwd;
|
|
53
|
+
private readonly client;
|
|
54
|
+
private readonly session;
|
|
55
|
+
private readonly vm;
|
|
56
|
+
private readonly localMounts;
|
|
57
|
+
private readonly commandDrivers;
|
|
58
|
+
private readonly onWasmCommandResolved;
|
|
59
|
+
private readonly onDispose;
|
|
60
|
+
private readonly trackedProcesses;
|
|
61
|
+
private readonly trackedProcessesById;
|
|
62
|
+
private readonly listenerLookups;
|
|
63
|
+
private readonly boundUdpLookups;
|
|
64
|
+
private readonly signalStates;
|
|
65
|
+
private readonly signalRefreshes;
|
|
66
|
+
private sidecarProcessSnapshot;
|
|
67
|
+
private processSnapshotRefresh;
|
|
68
|
+
private readonly observedProcessStartTimes;
|
|
69
|
+
private readonly rootView;
|
|
70
|
+
private zombieTimerCountValue;
|
|
71
|
+
private zombieTimerCountRefresh;
|
|
72
|
+
private disposed;
|
|
73
|
+
private pumpError;
|
|
74
|
+
private nextSyntheticPid;
|
|
75
|
+
private readonly eventPumpAbortController;
|
|
76
|
+
private readonly eventPump;
|
|
77
|
+
constructor(options: NativeSidecarKernelProxyOptions);
|
|
78
|
+
createRootView(): VirtualFileSystem;
|
|
79
|
+
get zombieTimerCount(): number;
|
|
80
|
+
registerCommandGuestPaths(commandGuestPaths: ReadonlyMap<string, string>): void;
|
|
81
|
+
dispose(): Promise<void>;
|
|
82
|
+
exec(command: string, options?: KernelExecOptions): Promise<KernelExecResult>;
|
|
83
|
+
spawn(command: string, args: string[], options?: KernelSpawnOptions): ManagedProcess;
|
|
84
|
+
openShell(options?: OpenShellOptions): ShellHandle;
|
|
85
|
+
connectTerminal(options?: ConnectTerminalOptions): Promise<number>;
|
|
86
|
+
readFile(path: string): Promise<Uint8Array>;
|
|
87
|
+
writeFile(path: string, content: string | Uint8Array): Promise<void>;
|
|
88
|
+
mkdir(path: string, recursive?: boolean): Promise<void>;
|
|
89
|
+
exists(path: string): Promise<boolean>;
|
|
90
|
+
stat(path: string): Promise<VirtualStat>;
|
|
91
|
+
readdir(path: string): Promise<string[]>;
|
|
92
|
+
removeFile(path: string): Promise<void>;
|
|
93
|
+
removeDir(path: string): Promise<void>;
|
|
94
|
+
rename(oldPath: string, newPath: string): Promise<void>;
|
|
95
|
+
mountFs(path: string, driver: VirtualFileSystem, options?: {
|
|
96
|
+
readOnly?: boolean;
|
|
97
|
+
}): void;
|
|
98
|
+
unmountFs(path: string): void;
|
|
99
|
+
snapshotProcesses(): ProcessInfo[];
|
|
100
|
+
findListener(request: {
|
|
101
|
+
host?: string;
|
|
102
|
+
port?: number;
|
|
103
|
+
path?: string;
|
|
104
|
+
}): KernelSocketSnapshot | null;
|
|
105
|
+
findBoundUdp(request: {
|
|
106
|
+
host?: string;
|
|
107
|
+
port?: number;
|
|
108
|
+
}): KernelSocketSnapshot | null;
|
|
109
|
+
getSignalState(pid: number): KernelSignalState;
|
|
110
|
+
private refreshSocketLookup;
|
|
111
|
+
private refreshSignalState;
|
|
112
|
+
private refreshProcessSnapshot;
|
|
113
|
+
private refreshZombieTimerCount;
|
|
114
|
+
private drainTrailingProcessOutput;
|
|
115
|
+
private startTrackedProcess;
|
|
116
|
+
private runEventPump;
|
|
117
|
+
private finishProcess;
|
|
118
|
+
private waitForTrackedProcess;
|
|
119
|
+
private signalProcess;
|
|
120
|
+
private flushPendingStdin;
|
|
121
|
+
private closeTrackedStdin;
|
|
122
|
+
private handleBackgroundProcessError;
|
|
123
|
+
private recordCompletedProcessError;
|
|
124
|
+
private emitBackgroundProcessError;
|
|
125
|
+
private createFilesystemView;
|
|
126
|
+
private buildProcessSnapshot;
|
|
127
|
+
private dispatchRead;
|
|
128
|
+
private dispatchNativeRead;
|
|
129
|
+
private dispatchWrite;
|
|
130
|
+
private resolveLocalMount;
|
|
131
|
+
private assertGuestPathWritable;
|
|
132
|
+
private mountedChildNames;
|
|
133
|
+
private assertLocalWritable;
|
|
134
|
+
private updateTrackedProcessSnapshot;
|
|
135
|
+
}
|
|
136
|
+
export type { AuthenticatedSession, CreatedVm, GuestFilesystemStat, NativeSidecarSpawnOptions, RootFilesystemEntry, SidecarEventSelector, SidecarPermissionsPolicy, SidecarRegisteredHostCallbackDefinition, SidecarRequestFrame, SidecarResponsePayload, SidecarSessionState, SidecarSignalHandlerRegistration, SidecarSocketStateEntry, } from "./sidecar-client.js";
|
|
137
|
+
export { NATIVE_SIDECAR_FRAME_TIMEOUT_MS, NativeSidecarProcessClient, SidecarEventBufferOverflow, SidecarProcessError, SidecarProcessExited, } from "./sidecar-client.js";
|