@ai-ecoverse/slicc-kernel 1.178.0 → 1.178.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.
@@ -45,7 +45,7 @@ export type { JsCred, JsSyncContext, JsSyncFile } from './process/js/js-sync.js'
45
45
  export type { JsThread, JsThreadContext, JsThreadSpawnOptions } from './process/js/js-thread.js';
46
46
  export type { JsTermios, JsTty, JsTtySize } from './process/js/js-tty.js';
47
47
  export type { JsWebSocket, JsWebSocketClose, JsWebSocketMessage, JsWebSocketOptions, } from './process/js/js-websocket.js';
48
- export type { ApproveHook, SudoAnswer, SudoApproval, SudoDenial, SudoReply, SudoRequest, SudoStdin, } from './sudo.js';
48
+ export type { ApproveHook, SudoAnswer, SudoApproval, SudoDenial, SudoFile, SudoReply, SudoRequest, SudoStdin, } from './sudo.js';
49
49
  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
50
  export type { Account, AddGroup, AddUser, Group, RemoveUser } from './users.js';
51
51
  export interface NetworkOptions {
@@ -65,9 +65,14 @@ export declare class SpawnError extends Error {
65
65
  readonly code: KernelErrno;
66
66
  constructor(code: KernelErrno);
67
67
  }
68
+ export declare class ChangedError extends SpawnError {
69
+ readonly notice: string;
70
+ constructor(notice: string);
71
+ }
68
72
  export interface SpawnGrant {
69
73
  cred: Cred;
70
74
  caller: Cred;
75
+ files?: Readonly<Record<string, string>>;
71
76
  }
72
77
  export type ChildSpawner = (req: ChildSpawnRequest, fds: FdTable, grant?: SpawnGrant) => Promise<ChildHandle>;
73
78
  export type ChildForker = (state: ForkState, fds: FdTable) => Promise<ChildHandle>;
@@ -1,7 +1,7 @@
1
1
  import type { SyncFsResult } from '../../realm/sync-fs-wire.js';
2
2
  import type { SealedCaller } from '../sealed.js';
3
3
  import { type KernelLoopback } from './loopback-transport.js';
4
- import type { HeaderList, RealmTransport } from './transport.js';
4
+ import { type HeaderList, type RealmTransport } from './transport.js';
5
5
  import { type WsSyscall } from './ws-syscalls.js';
6
6
  export interface HttpRequestBody {
7
7
  url: string;
@@ -1,5 +1,5 @@
1
1
  import type { SealedCaller } from '../sealed.js';
2
- import type { HeaderList, RealmRedirectHop, RealmRedirectPolicy, RealmTransport, RealmTransportRequest, RealmTransportResponse, RealmTransportTraits, RealmWebSocket, RealmWebSocketMessage, RealmWebSocketRequest } from './transport.js';
2
+ import { FORBIDDEN_HEADER, type HeaderList, type RealmRedirectHop, type RealmRedirectPolicy, type RealmTransport, type RealmTransportRequest, type RealmTransportResponse, type RealmTransportTraits, type RealmWebSocket, type RealmWebSocketMessage, type RealmWebSocketRequest } from './transport.js';
3
3
  export type TransportCall = {
4
4
  net: 'fetch';
5
5
  nid: number;
@@ -74,7 +74,7 @@ export type TransportReply = {
74
74
  message: string;
75
75
  status?: number;
76
76
  code?: string;
77
- detail?: 'transport';
77
+ detail?: 'transport' | typeof FORBIDDEN_HEADER;
78
78
  } | {
79
79
  net: 'ws-opened';
80
80
  nid: number;
@@ -99,7 +99,7 @@ export interface TransportPort {
99
99
  export declare class TransportError extends Error {
100
100
  readonly status: number | undefined;
101
101
  readonly code: string | undefined;
102
- readonly detail: 'transport' | undefined;
102
+ readonly detail: 'transport' | typeof FORBIDDEN_HEADER | undefined;
103
103
  constructor(message: string, status?: number, code?: string, detail?: unknown);
104
104
  }
105
105
  export declare function unfollowed(redirect?: RealmRedirectPolicy): boolean;
@@ -1,4 +1,5 @@
1
1
  import type { SealedCaller } from '../sealed.js';
2
+ export declare const FORBIDDEN_HEADER = "forbidden-header";
2
3
  export type HeaderList = ReadonlyArray<readonly [name: string, value: string]>;
3
4
  export type RealmRedirectPolicy = 'follow' | 'manual' | 'error';
4
5
  export interface RealmTransportRequest {
@@ -335,6 +335,9 @@ export declare class Launcher {
335
335
  private interpreterChain;
336
336
  private commandFile;
337
337
  private trustedFiles;
338
+ private unchanged;
339
+ private pinOf;
340
+ private pinnedBytes;
338
341
  private grantedCwd;
339
342
  private binfmtManifests;
340
343
  private backing;
@@ -34,7 +34,7 @@ export type { ConnectorStamp } from './kernel/socket.js';
34
34
  export type { HostfsEvent, HostfsGrant, HostfsGrantHook, HostfsPortGrant, HostfsTransport, } from './mount/hostfs.js';
35
35
  export { serveHostfsPort } from './mount/hostfs.js';
36
36
  export type { MountEntry, MountSpec } from './mount/mount-fs.js';
37
- export type { ApproveHook, SudoAnswer, SudoApproval, SudoDenial, SudoReply, SudoRequest, SudoStdin, } from './sudo.js';
37
+ export type { ApproveHook, SudoAnswer, SudoApproval, SudoDenial, SudoFile, SudoReply, SudoRequest, SudoStdin, } from './sudo.js';
38
38
  export type { NetworkRedirectPolicy } from './transport.js';
39
39
  export { fetchTransport, type NetworkTransport } from './transport.js';
40
40
  export { memoryRoot };
@@ -47,7 +47,7 @@ export type SyncFsResult = {
47
47
  message: string;
48
48
  direct?: true;
49
49
  dev?: string;
50
- detail?: 'transport' | 'placeholder';
50
+ detail?: 'transport' | 'placeholder' | 'forbidden-header';
51
51
  };
52
52
  export declare const SYNC_FS_REQUEST_TIMEOUT_MS = 25000;
53
53
  export declare const SYNC_FS_READ_ONLY: ReadonlySet<string>;
@@ -6,6 +6,8 @@ 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
+ export declare function changedText(file: string): string;
10
+ export declare function changedFile(approved: Readonly<Record<string, string>>, now: Readonly<Record<string, string>>): string | undefined;
9
11
  export interface SudoRequest {
10
12
  id: string;
11
13
  kind: 'sudo';
@@ -24,9 +26,14 @@ export interface SudoRequest {
24
26
  always: boolean;
25
27
  stdin?: SudoStdin;
26
28
  rootOnly?: Record<string, boolean>;
29
+ userWritable?: SudoFile[];
27
30
  validate?: true;
28
31
  timestamp?: true;
29
32
  }
33
+ export interface SudoFile {
34
+ path: string;
35
+ sha256: string;
36
+ }
30
37
  export type SudoStdin = 'tty' | 'none' | 'pipe' | 'file';
31
38
  export type SudoAnswer = 'once' | 'always' | 'deny';
32
39
  export interface SudoDenial {
@@ -54,6 +61,7 @@ export interface SudoGrant {
54
61
  cwd: string;
55
62
  cred: Cred;
56
63
  caller: Cred;
64
+ files: Record<string, string>;
57
65
  }
58
66
  export type SudoResult = {
59
67
  error: string;
@@ -125,7 +133,10 @@ export declare class Sudo {
125
133
  private lookup;
126
134
  private canonical;
127
135
  reachable(cred: Cred, cwd: string): Promise<boolean>;
128
- private untrusted;
136
+ real(file: string): Promise<string>;
137
+ digests(files: readonly string[]): Promise<Record<string, string>>;
138
+ private bound;
139
+ private writable;
129
140
  private locate;
130
141
  request(caller: SudoCaller, call: SudoCall, signal: AbortSignal): Promise<SudoResult>;
131
142
  private command;
@@ -1,7 +1,7 @@
1
1
  export declare const SUDOERS = "/etc/sudoers";
2
2
  export declare const SUDOERS_D = "/etc/sudoers.d";
3
3
  export declare const NAME: RegExp;
4
- export declare const KERNEL_SYNTAX = "[NOPASSWD] <user|%group|ALL> [(<target>)] [Cwd <dir>] [Stdin none] Cmnd <command\u2026|*>";
4
+ export declare const KERNEL_SYNTAX = "[NOPASSWD] <user|%group|ALL> [(<target>)] [Cwd <dir>] [Stdin none] [Sha256 <file>=<sha256>\u2026] Cmnd <command\u2026|*>";
5
5
  export declare const SUDOERS_SYNTAX = "<user|%group|ALL> ALL=[(<target>[,<target>\u2026])] [NOPASSWD:] <command\u2026|ALL>";
6
6
  export type Pattern = (string | null)[];
7
7
  export interface Command {
@@ -14,6 +14,7 @@ export interface Rule {
14
14
  target: string;
15
15
  cwd?: string;
16
16
  stdin?: 'none';
17
+ sha256?: Record<string, string>;
17
18
  cmnd: Command | '*';
18
19
  }
19
20
  export type TimestampType = 'tty' | 'ppid' | 'global';
@@ -45,6 +46,7 @@ export declare function splitWords(text: string): string[] | undefined;
45
46
  export declare function quoteWord(word: string): string;
46
47
  export declare function commandMatches(cmnd: Command | '*', argv: readonly string[]): boolean;
47
48
  export declare function commandText(cmnd: Command): string;
49
+ export declare function sha256Text(files: Readonly<Record<string, string>>): string;
48
50
  export declare function resolveDefaults(entries: readonly DefaultsEntry[], applies: (who: string) => boolean): Resolved;
49
51
  export declare function defaultsText(entries: readonly DefaultsEntry[]): string[];
50
52
  export declare function parseLine(line: string, file?: string): PolicyLine;
@@ -1,5 +1,5 @@
1
1
  import type { TransportCall, TransportReply } from './kernel/net/remote-transport.js';
2
- import type { HeaderList, RealmRedirectHop, RealmRedirectPolicy, RealmTransport, RealmTransportExit, RealmTransportRequest, RealmTransportResponse, RealmTransportTraits, RealmWebSocket, RealmWebSocketRequest } from './kernel/net/transport.js';
2
+ import { type HeaderList, type RealmRedirectHop, type RealmRedirectPolicy, type RealmTransport, type RealmTransportExit, type RealmTransportRequest, type RealmTransportResponse, type RealmTransportTraits, type RealmWebSocket, type RealmWebSocketRequest } from './kernel/net/transport.js';
3
3
  import { type WebSocketConstructor } from './websocket-transport.js';
4
4
  export type { HeaderList, RealmRedirectHop as NetworkRedirectHop, RealmRedirectPolicy as NetworkRedirectPolicy, RealmTransport as NetworkTransport, RealmTransportExit as NetworkExit, RealmTransportRequest as NetworkRequest, RealmTransportResponse as NetworkResponse, RealmTransportTraits as NetworkTraits, RealmWebSocket as NetworkWebSocket, RealmWebSocketRequest as NetworkWebSocketRequest, };
5
5
  export interface FetchTransportOptions {
@@ -11,6 +11,7 @@ export interface FetchTransportOptions {
11
11
  webSocketHeaders?: boolean;
12
12
  redirect?: 'follow' | 'manual';
13
13
  streamingBodies?: boolean;
14
+ forbiddenHeaders?: 'send' | 'refuse';
14
15
  }
15
16
  export declare const SEND_BUFFER: number;
16
17
  export declare function fetchTransport(options?: FetchTransportOptions): RealmTransport;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-kernel",
3
- "version": "1.178.0",
3
+ "version": "1.178.2",
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,9 +70,9 @@
70
70
  },
71
71
  "devDependencies": {
72
72
  "@ai-ecoverse/py-numpy": "2.5.4-4",
73
- "@ai-ecoverse/slicc-cdp": "1.47.4",
73
+ "@ai-ecoverse/slicc-cdp": "1.47.5",
74
74
  "@ai-ecoverse/slicc-scrub": "1.1.0",
75
- "@ai-ecoverse/slicc-shared-web": "2.13.10",
75
+ "@ai-ecoverse/slicc-shared-web": "2.14.0",
76
76
  "@ai-ecoverse/wasi-cargo": "0.99.0-6",
77
77
  "@ai-ecoverse/wasi-pnpm": "12.9.1-21",
78
78
  "@ai-ecoverse/wasi-ripgrep": "15.2.0-5",