@ai-ecoverse/slicc-kernel 1.179.0 → 1.181.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.
- package/README.md +41 -2
- package/dist/driver-worker.js +67 -1
- package/dist/driver-worker.js.map +2 -2
- package/dist/index.js +78 -1
- package/dist/index.js.map +3 -3
- package/dist/kernel-worker.js +553 -93
- package/dist/kernel-worker.js.map +4 -4
- package/dist/node-driver-worker.js +67 -1
- package/dist/node-driver-worker.js.map +2 -2
- package/dist/node-process-worker.cjs +1 -1
- package/dist/node-process-worker.js +1 -1
- package/dist/node.js +619 -90
- package/dist/node.js.map +4 -4
- package/dist/process-worker.js +1 -1
- package/dist/types/client/attach.d.ts +27 -3
- package/dist/types/client/protocol.d.ts +29 -4
- package/dist/types/index.d.ts +5 -3
- package/dist/types/kernel/children.d.ts +2 -1
- package/dist/types/kernel/jobs.d.ts +2 -1
- package/dist/types/kernel/trace.d.ts +59 -0
- package/dist/types/launcher.d.ts +31 -0
- package/dist/types/node.d.ts +5 -3
- package/dist/types/serve.d.ts +11 -1
- package/dist/types/sudo.d.ts +15 -1
- package/package.json +2 -2
package/dist/process-worker.js
CHANGED
|
@@ -3180,7 +3180,7 @@ var init_version = __esm({
|
|
|
3180
3180
|
"src/version.ts"() {
|
|
3181
3181
|
"use strict";
|
|
3182
3182
|
init_captured_globals();
|
|
3183
|
-
KERNEL_VERSION = true ? "1.
|
|
3183
|
+
KERNEL_VERSION = true ? "1.181.0" : "0.0.0-dev";
|
|
3184
3184
|
OS_RELEASE = "6.0.0-slicc";
|
|
3185
3185
|
}
|
|
3186
3186
|
});
|
|
@@ -4,11 +4,14 @@ import type { FsStat, UsersMode } from '../fs/types.js';
|
|
|
4
4
|
import type { WatchChange } from '../fs/watch.js';
|
|
5
5
|
import { type EmbedderHook } from '../kernel/embedder.js';
|
|
6
6
|
import type { RealmTransport, RealmTransportRequest, RealmTransportResponse, RealmTransportTraits } from '../kernel/net/transport.js';
|
|
7
|
+
import type { TraceEvent } from '../kernel/trace.js';
|
|
7
8
|
import type { MountEntry, MountSpec } from '../mount/mount-fs.js';
|
|
9
|
+
import type { SudoReplay } from '../sudo.js';
|
|
8
10
|
import { type DialledSocket, type DialOptions } from './dial-stream.js';
|
|
9
11
|
import { type LoopbackFetchOptions } from './loopback-fetch.js';
|
|
10
12
|
import { type LockManagerLike, type MessagePortLike, type ProcessEntry } from './protocol.js';
|
|
11
13
|
export type { WatchChange } from '../fs/watch.js';
|
|
14
|
+
export type { TraceEvent, TraceExec, TraceExit, TraceFork } from '../kernel/trace.js';
|
|
12
15
|
export type { ProcessEntry } from './protocol.js';
|
|
13
16
|
export declare class KernelGoneError extends Error {
|
|
14
17
|
constructor(message?: string);
|
|
@@ -30,7 +33,7 @@ export interface SpawnOptions {
|
|
|
30
33
|
stdin?: string | Uint8Array;
|
|
31
34
|
group?: 'new';
|
|
32
35
|
pgid?: number;
|
|
33
|
-
tag?: string;
|
|
36
|
+
tag?: string | readonly string[];
|
|
34
37
|
onStdout?: (bytes: Uint8Array) => void;
|
|
35
38
|
onStderr?: (bytes: Uint8Array) => void;
|
|
36
39
|
}
|
|
@@ -45,13 +48,23 @@ export interface SpawnedProcess {
|
|
|
45
48
|
readonly ended: Promise<ClientEnded>;
|
|
46
49
|
signal(name?: string): Promise<void>;
|
|
47
50
|
}
|
|
51
|
+
export interface SudoRunOptions {
|
|
52
|
+
stdout?: string;
|
|
53
|
+
stderr?: string;
|
|
54
|
+
tag?: string | readonly string[];
|
|
55
|
+
}
|
|
56
|
+
export interface SudoRun {
|
|
57
|
+
readonly pid: number;
|
|
58
|
+
readonly pgid: number;
|
|
59
|
+
readonly ended: Promise<ClientEnded>;
|
|
60
|
+
}
|
|
48
61
|
export interface ClientRunOptions {
|
|
49
62
|
cwd?: string;
|
|
50
63
|
cwdMissing?: 'create' | 'error';
|
|
51
64
|
user?: string | number;
|
|
52
65
|
env?: Record<string, string>;
|
|
53
66
|
stdin?: string | Uint8Array;
|
|
54
|
-
tag?: string;
|
|
67
|
+
tag?: string | readonly string[];
|
|
55
68
|
onStdout?: (text: string) => void;
|
|
56
69
|
onStderr?: (text: string) => void;
|
|
57
70
|
}
|
|
@@ -69,7 +82,7 @@ export interface ClientTerminalOptions {
|
|
|
69
82
|
env?: Record<string, string>;
|
|
70
83
|
cols?: number;
|
|
71
84
|
rows?: number;
|
|
72
|
-
tag?: string;
|
|
85
|
+
tag?: string | readonly string[];
|
|
73
86
|
onData?: (bytes: Uint8Array) => void;
|
|
74
87
|
}
|
|
75
88
|
export interface ClientTerminal {
|
|
@@ -104,6 +117,13 @@ export interface ClientFs {
|
|
|
104
117
|
close(): void;
|
|
105
118
|
}>;
|
|
106
119
|
}
|
|
120
|
+
export interface TraceBatch {
|
|
121
|
+
events: TraceEvent[];
|
|
122
|
+
dropped: number;
|
|
123
|
+
}
|
|
124
|
+
export interface TraceOptions {
|
|
125
|
+
limit?: number;
|
|
126
|
+
}
|
|
107
127
|
export type ClientFetchRequest = Omit<RealmTransportRequest, 'signal'> & {
|
|
108
128
|
signal?: AbortSignal;
|
|
109
129
|
};
|
|
@@ -133,6 +153,10 @@ export interface KernelClient {
|
|
|
133
153
|
close(): void;
|
|
134
154
|
}>;
|
|
135
155
|
onTraits(listener: (traits: RealmTransportTraits) => void): () => void;
|
|
156
|
+
trace(tag: string, onEvents: (batch: TraceBatch) => void | Promise<unknown>, options?: TraceOptions): Promise<{
|
|
157
|
+
close(): void;
|
|
158
|
+
}>;
|
|
159
|
+
sudoRun(request: SudoReplay, options?: SudoRunOptions): Promise<SudoRun>;
|
|
136
160
|
close(options?: {
|
|
137
161
|
kill?: boolean;
|
|
138
162
|
}): Promise<void>;
|
|
@@ -2,6 +2,7 @@ import type { UsersMode } from '../fs/types.js';
|
|
|
2
2
|
import type { WatchChange } from '../fs/watch.js';
|
|
3
3
|
import type { TransportCall, TransportReply } from '../kernel/net/remote-transport.js';
|
|
4
4
|
import type { RealmTransportTraits } from '../kernel/net/transport.js';
|
|
5
|
+
import type { TraceEvent } from '../kernel/trace.js';
|
|
5
6
|
import type { MountSpec } from '../mount/mount-fs.js';
|
|
6
7
|
export declare const PROTOCOL: readonly [number, number];
|
|
7
8
|
export interface ClientHello {
|
|
@@ -26,7 +27,7 @@ export interface SpawnRequestOptions {
|
|
|
26
27
|
env?: Record<string, string>;
|
|
27
28
|
stdin?: Uint8Array;
|
|
28
29
|
pgid?: number;
|
|
29
|
-
tag?: string;
|
|
30
|
+
tag?: string | readonly string[];
|
|
30
31
|
}
|
|
31
32
|
export interface TerminalRequestOptions {
|
|
32
33
|
cwd?: string;
|
|
@@ -35,7 +36,12 @@ export interface TerminalRequestOptions {
|
|
|
35
36
|
env?: Record<string, string>;
|
|
36
37
|
cols?: number;
|
|
37
38
|
rows?: number;
|
|
38
|
-
tag?: string;
|
|
39
|
+
tag?: string | readonly string[];
|
|
40
|
+
}
|
|
41
|
+
export interface SudoRunRequestOptions {
|
|
42
|
+
stdout?: string;
|
|
43
|
+
stderr?: string;
|
|
44
|
+
tag?: string | readonly string[];
|
|
39
45
|
}
|
|
40
46
|
export type TerminalAction = {
|
|
41
47
|
action: 'write';
|
|
@@ -104,6 +110,17 @@ export type ClientCall = {
|
|
|
104
110
|
} | {
|
|
105
111
|
op: 'unserve-facade';
|
|
106
112
|
registration: number;
|
|
113
|
+
} | {
|
|
114
|
+
op: 'trace';
|
|
115
|
+
tag: string;
|
|
116
|
+
limit?: number;
|
|
117
|
+
} | {
|
|
118
|
+
op: 'untrace';
|
|
119
|
+
trace: number;
|
|
120
|
+
} | {
|
|
121
|
+
op: 'sudo-run';
|
|
122
|
+
replay: unknown;
|
|
123
|
+
options: SudoRunRequestOptions;
|
|
107
124
|
} | {
|
|
108
125
|
op: 'detach';
|
|
109
126
|
kill?: boolean;
|
|
@@ -121,16 +138,24 @@ export interface ClientReply {
|
|
|
121
138
|
started?: number;
|
|
122
139
|
signal?: string;
|
|
123
140
|
}
|
|
141
|
+
export interface TraceAck {
|
|
142
|
+
traceAck: number;
|
|
143
|
+
}
|
|
124
144
|
export type ClientMessage = {
|
|
125
145
|
hello: ClientHello;
|
|
126
|
-
} | ClientRequest | TransportCall;
|
|
146
|
+
} | ClientRequest | TransportCall | TraceAck;
|
|
127
147
|
export interface WatchEvent {
|
|
128
148
|
watch: number;
|
|
129
149
|
change: WatchChange;
|
|
130
150
|
}
|
|
151
|
+
export interface TraceMessage {
|
|
152
|
+
trace: number;
|
|
153
|
+
events: TraceEvent[];
|
|
154
|
+
dropped?: number;
|
|
155
|
+
}
|
|
131
156
|
export type KernelMessage = {
|
|
132
157
|
hello: KernelHello;
|
|
133
|
-
} | ClientReply | WatchEvent | TransportReply;
|
|
158
|
+
} | ClientReply | WatchEvent | TraceMessage | TransportReply;
|
|
134
159
|
export interface ProcessEntry {
|
|
135
160
|
pid: number;
|
|
136
161
|
ppid: number;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CdpHook } from './cdp/types.js';
|
|
2
|
+
import type { SudoRun, SudoRunOptions } from './client/attach.js';
|
|
2
3
|
import { type DialledSocket, type DialOptions } from './client/dial-stream.js';
|
|
3
4
|
import { type LoopbackFetchOptions } from './client/loopback-fetch.js';
|
|
4
5
|
import type { FacadeSpecs } from './facade/types.js';
|
|
@@ -14,11 +15,11 @@ import { type NetworkUplink } from './kernel/net/uplink.js';
|
|
|
14
15
|
import type { HostfsGrantHook } from './mount/hostfs.js';
|
|
15
16
|
import type { MountEntry, MountSpec } from './mount/mount-fs.js';
|
|
16
17
|
import type { ProcessMountPolicy } from './mount/syscall.js';
|
|
17
|
-
import type { ApproveHook } from './sudo.js';
|
|
18
|
+
import type { ApproveHook, SudoReplay } from './sudo.js';
|
|
18
19
|
import { type NetworkTransport } from './transport.js';
|
|
19
20
|
import type { Account, AddGroup, AddUser, Group, RemoveUser } from './users.js';
|
|
20
21
|
export type { CdpConnection, CdpHook, CdpRequest } from './cdp/types.js';
|
|
21
|
-
export { type AttachOptions, attachKernel, type ClientEnded, type ClientFetchRequest, type ClientFs, type ClientRunOptions, type ClientRunResult, type ClientTerminal, type ClientTerminalOptions, KernelCallError, type KernelClient, KernelGoneError, type ProcessEntry, type SpawnedProcess, type SpawnOptions, type WatchChange, } from './client/attach.js';
|
|
22
|
+
export { type AttachOptions, attachKernel, type ClientEnded, type ClientFetchRequest, type ClientFs, type ClientRunOptions, type ClientRunResult, type ClientTerminal, type ClientTerminalOptions, KernelCallError, type KernelClient, KernelGoneError, type ProcessEntry, type SpawnedProcess, type SpawnOptions, type SudoRun, type SudoRunOptions, type TraceBatch, type TraceEvent, type TraceExec, type TraceExit, type TraceFork, type TraceOptions, type WatchChange, } from './client/attach.js';
|
|
22
23
|
export type { DialledSocket, DialOptions } from './client/dial-stream.js';
|
|
23
24
|
export type { LoopbackFetchOptions } from './client/loopback-fetch.js';
|
|
24
25
|
export type { FacadeConnection, FacadeHook, FacadeInfo, FacadeSpec, FacadeSpecs, } from './facade/types.js';
|
|
@@ -45,7 +46,7 @@ export type { JsCred, JsSyncContext, JsSyncFile } from './process/js/js-sync.js'
|
|
|
45
46
|
export type { JsThread, JsThreadContext, JsThreadSpawnOptions } from './process/js/js-thread.js';
|
|
46
47
|
export type { JsTermios, JsTty, JsTtySize } from './process/js/js-tty.js';
|
|
47
48
|
export type { JsWebSocket, JsWebSocketClose, JsWebSocketMessage, JsWebSocketOptions, } from './process/js/js-websocket.js';
|
|
48
|
-
export type { ApproveHook, SudoAnswer, SudoApproval, SudoDenial, SudoFile, SudoReply, SudoRequest, SudoStdin, } from './sudo.js';
|
|
49
|
+
export type { ApproveHook, SudoAnswer, SudoApproval, SudoDenial, SudoFile, SudoReplay, SudoReply, SudoRequest, SudoStdin, } from './sudo.js';
|
|
49
50
|
export { type FetchTransportOptions, fetchTransport, type HeaderList, type NetworkExit, type NetworkRedirectPolicy, type NetworkRequest, type NetworkResponse, type NetworkTraits, type NetworkTransport, type NetworkWebSocket, type NetworkWebSocketRequest, } from './transport.js';
|
|
50
51
|
export type { Account, AddGroup, AddUser, Group, RemoveUser } from './users.js';
|
|
51
52
|
export interface NetworkOptions {
|
|
@@ -130,6 +131,7 @@ export interface Kernel {
|
|
|
130
131
|
run(argv: string[], options?: RunOptions): Promise<RunResult>;
|
|
131
132
|
openTerminal(argv: string[], options?: TerminalOptions): Promise<Terminal>;
|
|
132
133
|
connect(options?: ConnectOptions): Promise<MessagePort>;
|
|
134
|
+
sudoRun(request: SudoReplay, options?: SudoRunOptions): Promise<SudoRun>;
|
|
133
135
|
readonly users: KernelUsers;
|
|
134
136
|
readonly groups: KernelGroups;
|
|
135
137
|
setRoutes(routes: RouteTable): Promise<void>;
|
|
@@ -67,7 +67,8 @@ export declare class SpawnError extends Error {
|
|
|
67
67
|
}
|
|
68
68
|
export declare class ChangedError extends SpawnError {
|
|
69
69
|
readonly notice: string;
|
|
70
|
-
|
|
70
|
+
readonly file: string;
|
|
71
|
+
constructor(notice: string, file: string);
|
|
71
72
|
}
|
|
72
73
|
export interface SpawnGrant {
|
|
73
74
|
cred: Cred;
|
|
@@ -29,7 +29,8 @@ export declare class JobTable {
|
|
|
29
29
|
pgidOf(pid: number): number | undefined;
|
|
30
30
|
sidOf(pid: number): number | undefined;
|
|
31
31
|
private member;
|
|
32
|
-
|
|
32
|
+
idOf(pid: number): number;
|
|
33
|
+
execParentOf(pid: number): number | undefined;
|
|
33
34
|
private byId;
|
|
34
35
|
setpgid(caller: number, pid: number, pgid: number): void;
|
|
35
36
|
get handoffCount(): number;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type Cred } from './cred.js';
|
|
2
|
+
export interface TraceExec {
|
|
3
|
+
type: 'exec';
|
|
4
|
+
seq: number;
|
|
5
|
+
pid: number;
|
|
6
|
+
ppid: number;
|
|
7
|
+
pgid: number;
|
|
8
|
+
argv: string[];
|
|
9
|
+
exe?: string;
|
|
10
|
+
uid: number;
|
|
11
|
+
at: number;
|
|
12
|
+
replaced?: true;
|
|
13
|
+
}
|
|
14
|
+
export interface TraceFork {
|
|
15
|
+
type: 'fork';
|
|
16
|
+
seq: number;
|
|
17
|
+
pid: number;
|
|
18
|
+
ppid: number;
|
|
19
|
+
pgid: number;
|
|
20
|
+
argv: string[];
|
|
21
|
+
exe?: string;
|
|
22
|
+
uid: number;
|
|
23
|
+
at: number;
|
|
24
|
+
}
|
|
25
|
+
export interface TraceExit {
|
|
26
|
+
type: 'exit';
|
|
27
|
+
seq: number;
|
|
28
|
+
pid: number;
|
|
29
|
+
status: number;
|
|
30
|
+
signal?: string;
|
|
31
|
+
utime?: number;
|
|
32
|
+
stime?: number;
|
|
33
|
+
at: number;
|
|
34
|
+
}
|
|
35
|
+
export type TraceEvent = TraceExec | TraceFork | TraceExit;
|
|
36
|
+
type Unsequenced<T> = T extends unknown ? Omit<T, 'seq'> : never;
|
|
37
|
+
export type TraceDraft = Unsequenced<TraceEvent>;
|
|
38
|
+
export interface TraceBatch {
|
|
39
|
+
events: TraceEvent[];
|
|
40
|
+
dropped: number;
|
|
41
|
+
}
|
|
42
|
+
export declare const TRACE_LIMIT = 4096;
|
|
43
|
+
export declare const TRACE_LIMIT_MAX = 65536;
|
|
44
|
+
export declare function traceLimit(value: unknown): number;
|
|
45
|
+
export interface TraceSubscription {
|
|
46
|
+
ack(): void;
|
|
47
|
+
close(): void;
|
|
48
|
+
}
|
|
49
|
+
export declare class TraceHub {
|
|
50
|
+
private readonly subs;
|
|
51
|
+
private seq;
|
|
52
|
+
get idle(): boolean;
|
|
53
|
+
subscribe(tag: string, viewer: Readonly<Cred>, deliver: (batch: TraceBatch) => void, limit?: number): TraceSubscription;
|
|
54
|
+
wants(tags: readonly string[] | undefined, cred: Readonly<Cred>): boolean;
|
|
55
|
+
publish(tags: readonly string[] | undefined, cred: Readonly<Cred>, draft: TraceDraft): void;
|
|
56
|
+
private matches;
|
|
57
|
+
private schedule;
|
|
58
|
+
}
|
|
59
|
+
export {};
|
package/dist/types/launcher.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ import { type ProcessInfo } from './kernel/proc-info.js';
|
|
|
31
31
|
import { type SealedCaller, type SealedHook } from './kernel/sealed.js';
|
|
32
32
|
import { type SigInfo } from './kernel/signals.js';
|
|
33
33
|
import { LoopbackNet } from './kernel/socket.js';
|
|
34
|
+
import { TraceHub } from './kernel/trace.js';
|
|
34
35
|
import { type MediumHandle } from './mount/fsa.js';
|
|
35
36
|
import { type FstabResult } from './mount/fstab.js';
|
|
36
37
|
import { type FetchLike, type HostfsGrantHook, type HostfsTiming } from './mount/hostfs.js';
|
|
@@ -163,6 +164,25 @@ interface Target {
|
|
|
163
164
|
copy?: string;
|
|
164
165
|
shim?: string;
|
|
165
166
|
}
|
|
167
|
+
export declare function sudoFailure(errno: string, message: string): Error & {
|
|
168
|
+
code: string;
|
|
169
|
+
};
|
|
170
|
+
export interface SudoRunRequest {
|
|
171
|
+
stdout?: unknown;
|
|
172
|
+
stderr?: unknown;
|
|
173
|
+
tag?: unknown;
|
|
174
|
+
base?: string | undefined;
|
|
175
|
+
session?: number | undefined;
|
|
176
|
+
}
|
|
177
|
+
export interface SudoRunning {
|
|
178
|
+
pid: number;
|
|
179
|
+
ended: Promise<{
|
|
180
|
+
status: number;
|
|
181
|
+
signal?: number;
|
|
182
|
+
}>;
|
|
183
|
+
}
|
|
184
|
+
export declare const MAX_SPAWN_TAGS = 8;
|
|
185
|
+
export declare function tagList(value: unknown): readonly string[];
|
|
166
186
|
export declare function tagOption(tag: unknown): void;
|
|
167
187
|
export type CwdMissing = 'create' | 'error';
|
|
168
188
|
export declare function cwdMissingOption(value: unknown): CwdMissing;
|
|
@@ -397,6 +417,14 @@ export declare class Launcher {
|
|
|
397
417
|
private readonly imageTimes;
|
|
398
418
|
private readonly childTimes;
|
|
399
419
|
private readonly stopped;
|
|
420
|
+
readonly traces: TraceHub;
|
|
421
|
+
private readonly traceHeld;
|
|
422
|
+
private readonly replacedImages;
|
|
423
|
+
private traceStarted;
|
|
424
|
+
private traceEnded;
|
|
425
|
+
private traceEmit;
|
|
426
|
+
private traceAdmitted;
|
|
427
|
+
private chainTimes;
|
|
400
428
|
private stateOf;
|
|
401
429
|
private childrenOf;
|
|
402
430
|
private timesAt;
|
|
@@ -503,5 +531,8 @@ export declare class Launcher {
|
|
|
503
531
|
private starting;
|
|
504
532
|
openTerminal(argv: string[], options: TerminalOptions): Promise<TerminalSession>;
|
|
505
533
|
run(argv: string[], options?: RunOptions): Promise<RunResult>;
|
|
534
|
+
sudoRun(replay: unknown, options?: SudoRunRequest): Promise<SudoRunning>;
|
|
535
|
+
private sudoOutputs;
|
|
536
|
+
private sudoOutput;
|
|
506
537
|
}
|
|
507
538
|
export type { ProcessInfo, ProcessListing } from './kernel/proc-info.js';
|
package/dist/types/node.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type MessagePort, type Worker } from 'node:worker_threads';
|
|
2
2
|
import type { CdpHook } from './cdp/types.js';
|
|
3
|
+
import type { SudoRun, SudoRunOptions } from './client/attach.js';
|
|
3
4
|
import { type CronClock } from './cron/clock.js';
|
|
4
5
|
import type { FacadeSpecs } from './facade/types.js';
|
|
5
6
|
import type { Attestation, AttestTombstone } from './fs/attest.js';
|
|
@@ -17,10 +18,10 @@ import type { MountEntry, MountSpec } from './mount/mount-fs.js';
|
|
|
17
18
|
import type { ProcessMountPolicy } from './mount/syscall.js';
|
|
18
19
|
import { type HostLoopback } from './node/loopback.js';
|
|
19
20
|
import { memoryRoot } from './node/memory-root.js';
|
|
20
|
-
import type { ApproveHook } from './sudo.js';
|
|
21
|
+
import type { ApproveHook, SudoReplay } from './sudo.js';
|
|
21
22
|
import { type NetworkTransport } from './transport.js';
|
|
22
23
|
export type { CdpConnection, CdpHook, CdpRequest } from './cdp/types.js';
|
|
23
|
-
export { type AttachOptions, attachKernel, type ClientEnded, type ClientFetchRequest, type ClientFs, type ClientRunOptions, type ClientRunResult, type ClientTerminal, type ClientTerminalOptions, KernelCallError, type KernelClient, KernelGoneError, type ProcessEntry, type SpawnedProcess, type SpawnOptions, type WatchChange, } from './client/attach.js';
|
|
24
|
+
export { type AttachOptions, attachKernel, type ClientEnded, type ClientFetchRequest, type ClientFs, type ClientRunOptions, type ClientRunResult, type ClientTerminal, type ClientTerminalOptions, KernelCallError, type KernelClient, KernelGoneError, type ProcessEntry, type SpawnedProcess, type SpawnOptions, type SudoRun, type SudoRunOptions, type TraceBatch, type TraceEvent, type TraceExec, type TraceExit, type TraceFork, type TraceOptions, type WatchChange, } from './client/attach.js';
|
|
24
25
|
export type { FacadeConnection, FacadeHook, FacadeInfo, FacadeSpec, FacadeSpecs, } from './facade/types.js';
|
|
25
26
|
export type { Attestation, AttestedDir, AttestOptions, AttestTombstone } from './fs/attest.js';
|
|
26
27
|
export type { Denial, DenialHook } from './fs/dac.js';
|
|
@@ -34,7 +35,7 @@ export type { ConnectorStamp } from './kernel/socket.js';
|
|
|
34
35
|
export type { HostfsEvent, HostfsGrant, HostfsGrantHook, HostfsPortGrant, HostfsTransport, } from './mount/hostfs.js';
|
|
35
36
|
export { serveHostfsPort } from './mount/hostfs.js';
|
|
36
37
|
export type { MountEntry, MountSpec } from './mount/mount-fs.js';
|
|
37
|
-
export type { ApproveHook, SudoAnswer, SudoApproval, SudoDenial, SudoFile, SudoReply, SudoRequest, SudoStdin, } from './sudo.js';
|
|
38
|
+
export type { ApproveHook, SudoAnswer, SudoApproval, SudoDenial, SudoFile, SudoReplay, SudoReply, SudoRequest, SudoStdin, } from './sudo.js';
|
|
38
39
|
export type { NetworkRedirectPolicy } from './transport.js';
|
|
39
40
|
export { fetchTransport, type NetworkTransport } from './transport.js';
|
|
40
41
|
export { memoryRoot };
|
|
@@ -100,6 +101,7 @@ export interface NodeKernel {
|
|
|
100
101
|
absent: 'allow';
|
|
101
102
|
}): Promise<Attestation | AttestTombstone>;
|
|
102
103
|
connect(options?: ConnectOptions): Promise<MessagePort>;
|
|
104
|
+
sudoRun(request: SudoReplay, options?: SudoRunOptions): Promise<SudoRun>;
|
|
103
105
|
readonly users: KernelUsers;
|
|
104
106
|
readonly groups: KernelGroups;
|
|
105
107
|
setRoutes(routes: RouteTable): Promise<void>;
|
package/dist/types/serve.d.ts
CHANGED
|
@@ -69,6 +69,16 @@ export interface OpenTerminalRequest {
|
|
|
69
69
|
argv: string[];
|
|
70
70
|
options: Omit<TerminalOptions, 'onData'>;
|
|
71
71
|
}
|
|
72
|
+
export interface SudoRunKernelRequest {
|
|
73
|
+
id: number;
|
|
74
|
+
op: 'sudo-run';
|
|
75
|
+
replay: unknown;
|
|
76
|
+
options: {
|
|
77
|
+
stdout?: string;
|
|
78
|
+
stderr?: string;
|
|
79
|
+
tag?: string | readonly string[];
|
|
80
|
+
};
|
|
81
|
+
}
|
|
72
82
|
export type TerminalAction = {
|
|
73
83
|
action: 'write';
|
|
74
84
|
bytes: Uint8Array;
|
|
@@ -186,7 +196,7 @@ export type KernelRequest = {
|
|
|
186
196
|
id: number;
|
|
187
197
|
op: 'sealed-placeholders';
|
|
188
198
|
list: readonly string[];
|
|
189
|
-
} | AttestRequest | InitRequest | RunRequest | OpenTerminalRequest | TerminalRequest | ConnectRequest | UsersRequest | MountRequest | DialRequest | RoutesRequest | TraitsRequest;
|
|
199
|
+
} | AttestRequest | InitRequest | RunRequest | OpenTerminalRequest | SudoRunKernelRequest | TerminalRequest | ConnectRequest | UsersRequest | MountRequest | DialRequest | RoutesRequest | TraitsRequest;
|
|
190
200
|
type WithoutId<T> = T extends unknown ? Omit<T, 'id'> : never;
|
|
191
201
|
export type KernelCall = WithoutId<KernelRequest>;
|
|
192
202
|
export declare function inOpfs(deps: ServeDeps, root: FileSystemDirectoryHandle): Promise<boolean>;
|
package/dist/types/sudo.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { KernelFs, UsersMode } from './fs/types.js';
|
|
2
2
|
import type { Cred } from './kernel/cred.js';
|
|
3
3
|
import { type TimestampOwner } from './sudo-timestamp.js';
|
|
4
|
-
import { type UserDb } from './users.js';
|
|
4
|
+
import { type Account, type UserDb } from './users.js';
|
|
5
5
|
export { SUDOERS, SUDOERS_D } from './sudoers.js';
|
|
6
6
|
export declare const SECURE_PATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";
|
|
7
7
|
export declare const DEFAULT_SUDOERS = "%sudo Cmnd *\n";
|
|
8
8
|
export declare const SUDO_TIMEOUT_MS = 300000;
|
|
9
9
|
export declare function changedText(file: string): string;
|
|
10
|
+
export declare function requestedText(file: string): string;
|
|
10
11
|
export declare function changedFile(approved: Readonly<Record<string, string>>, now: Readonly<Record<string, string>>): string | undefined;
|
|
11
12
|
export interface SudoRequest {
|
|
12
13
|
id: string;
|
|
@@ -34,6 +35,13 @@ export interface SudoFile {
|
|
|
34
35
|
path: string;
|
|
35
36
|
sha256: string;
|
|
36
37
|
}
|
|
38
|
+
export type SudoReplay = Pick<SudoRequest, 'id' | 'user' | 'uid' | 'target' | 'argv' | 'path' | 'cwd' | 'stdin' | 'rootOnly' | 'userWritable' | 'tag' | 'tags' | 'validate'>;
|
|
39
|
+
export interface SudoReplayed {
|
|
40
|
+
grant: SudoGrant;
|
|
41
|
+
caller: Account;
|
|
42
|
+
target: Account;
|
|
43
|
+
tags: readonly string[];
|
|
44
|
+
}
|
|
37
45
|
export type SudoStdin = 'tty' | 'none' | 'pipe' | 'file';
|
|
38
46
|
export type SudoAnswer = 'once' | 'always' | 'deny';
|
|
39
47
|
export interface SudoDenial {
|
|
@@ -98,6 +106,10 @@ export interface VisudoResult {
|
|
|
98
106
|
ok: boolean;
|
|
99
107
|
}
|
|
100
108
|
export declare function visudoCall(req: Partial<VisudoCall>): VisudoCall | undefined;
|
|
109
|
+
type Failure = {
|
|
110
|
+
error: string;
|
|
111
|
+
errno: string;
|
|
112
|
+
};
|
|
101
113
|
export interface SudoOptions {
|
|
102
114
|
fs: KernelFs;
|
|
103
115
|
users: UserDb;
|
|
@@ -139,6 +151,8 @@ export declare class Sudo {
|
|
|
139
151
|
private writable;
|
|
140
152
|
private locate;
|
|
141
153
|
request(caller: SudoCaller, call: SudoCall, signal: AbortSignal): Promise<SudoResult>;
|
|
154
|
+
replay(value: unknown): Promise<SudoReplayed | Failure>;
|
|
155
|
+
private mayAsk;
|
|
142
156
|
private command;
|
|
143
157
|
private validate;
|
|
144
158
|
private pendingFor;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ecoverse/slicc-kernel",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.181.0",
|
|
4
4
|
"description": "SLICC's wasm-realm kernel: run Emscripten programs in the browser against OPFS, with fork, spawn, pipes and waitpid",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@ai-ecoverse/py-numpy": "2.5.4-4",
|
|
73
|
-
"@ai-ecoverse/slicc-cdp": "1.48.
|
|
73
|
+
"@ai-ecoverse/slicc-cdp": "1.48.10",
|
|
74
74
|
"@ai-ecoverse/slicc-scrub": "1.1.0",
|
|
75
75
|
"@ai-ecoverse/slicc-shared-web": "2.14.2",
|
|
76
76
|
"@ai-ecoverse/wasi-cargo": "0.99.0-6",
|