@waffle-os/runtime 0.0.151 → 0.0.153
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/browser/run-command.ts +14 -8
- package/browser/runtime-terminals.ts +26 -0
- package/browser/service-worker.ts +18 -3
- package/browser/terminal-output.ts +3 -1
- package/dist/browser/run-command.js +11 -7
- package/dist/browser/runtime-terminals.js +16 -0
- package/dist/browser/service-worker.js +9 -3
- package/dist/browser/terminal-output.js +2 -2
- package/dist/fs/multitab-backend.js +303 -97
- package/dist/fs/multitab-protocol.js +2 -0
- package/dist/fs/service.js +25 -3
- package/dist/proc/start-command.js +4 -0
- package/dist/tooling/program/program-transformer.json +1 -1
- package/fs/backend.ts +6 -1
- package/fs/multitab-backend.ts +385 -105
- package/fs/multitab-protocol.ts +11 -0
- package/fs/service.ts +28 -6
- package/package.json +1 -1
- package/proc/start-command.ts +9 -0
- package/tooling/program/program-transformer.json +1 -1
|
@@ -211,6 +211,8 @@ export function isPeerMessage(value) {
|
|
|
211
211
|
return typeof value.reqId === "number" && typeof value.op === "string" && Array.isArray(value.args);
|
|
212
212
|
case "chunk-put":
|
|
213
213
|
return typeof value.reqId === "number" && typeof value.uploadId === "string" && typeof value.offset === "number" && typeof value.totalBytes === "number" && value.chunk instanceof Uint8Array;
|
|
214
|
+
case "chunk-abort":
|
|
215
|
+
return typeof value.uploadId === "string";
|
|
214
216
|
case "chunk-get":
|
|
215
217
|
return typeof value.reqId === "number" && typeof value.downloadId === "string" && typeof value.offset === "number" && typeof value.length === "number";
|
|
216
218
|
case "res":
|
package/dist/fs/service.js
CHANGED
|
@@ -973,14 +973,36 @@ export class FilesystemService {
|
|
|
973
973
|
return;
|
|
974
974
|
}
|
|
975
975
|
if (operation === "flush" || operation === "sync") {
|
|
976
|
-
const
|
|
977
|
-
|
|
976
|
+
const target = operation === "sync" ? a : typeof a === "string" ? a : undefined;
|
|
977
|
+
if (operation === "sync")
|
|
978
|
+
this.backend.retain(a);
|
|
979
|
+
let flushing;
|
|
980
|
+
try {
|
|
981
|
+
flushing = this.backend.flush?.(target);
|
|
982
|
+
} catch (error) {
|
|
983
|
+
if (operation === "sync")
|
|
984
|
+
this.backend.release(a);
|
|
985
|
+
throw error;
|
|
986
|
+
}
|
|
987
|
+
return this.trackRequestWork(session, Promise.resolve(flushing)).then(() => {
|
|
988
|
+
if (operation === "sync")
|
|
989
|
+
this.backend.release(a);
|
|
990
|
+
return this.finishResult(session, id, operation, operation === "sync" ? 0 : undefined);
|
|
991
|
+
}, (error) => {
|
|
992
|
+
if (operation === "sync")
|
|
993
|
+
this.backend.release(a);
|
|
994
|
+
throw error;
|
|
995
|
+
});
|
|
978
996
|
}
|
|
979
997
|
if (operation === "resolve" && session.socketScope && this.backend instanceof MemoryBackend) {
|
|
980
998
|
const result = this.backend.fs.resolveSocket(a, b, c === true);
|
|
981
999
|
return this.finishResult(session, id, operation, result, args);
|
|
982
1000
|
}
|
|
983
|
-
const
|
|
1001
|
+
const isCancelled = () => {
|
|
1002
|
+
const pending = session.pending.get(id);
|
|
1003
|
+
return !pending || sessionRevoked(session) || !this.sessions.has(session) || requestCancelled(pending);
|
|
1004
|
+
};
|
|
1005
|
+
const result = this.backend.execute(operation, args, data, isCancelled);
|
|
984
1006
|
if (result instanceof Promise)
|
|
985
1007
|
return this.trackRequestWork(session, result).then((value) => this.finishResult(session, id, operation, value, args));
|
|
986
1008
|
return this.finishResult(session, id, operation, result, args);
|
|
@@ -30,6 +30,9 @@ function snapshot(executable, options) {
|
|
|
30
30
|
throw new TypeError("Command executable must be an absolute path");
|
|
31
31
|
const { args, cwd = "/", env, stdin, stdout, stderr, deadlineMs } = options;
|
|
32
32
|
const { programs, onLeaderExit } = policies(options);
|
|
33
|
+
const { terminal = false } = options;
|
|
34
|
+
if (typeof terminal !== "boolean")
|
|
35
|
+
throw new TypeError("Command terminal must be a boolean");
|
|
33
36
|
if (!path(cwd))
|
|
34
37
|
throw new TypeError("Command cwd must be an absolute path");
|
|
35
38
|
if (args !== undefined && !Array.isArray(args))
|
|
@@ -52,6 +55,7 @@ function snapshot(executable, options) {
|
|
|
52
55
|
filesystem: "runtime-root",
|
|
53
56
|
programs,
|
|
54
57
|
onLeaderExit,
|
|
58
|
+
terminal,
|
|
55
59
|
args: argv,
|
|
56
60
|
cwd,
|
|
57
61
|
env: Object.fromEntries(entries),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"commit":"
|
|
1
|
+
{"commit":"5dcc58a08c0c1b3044dc6d47b4c13b688d70fa6d","buildToolsSha256":"b617652c1601f8722bb85c3a688a1fca4985b53f2c2066c10c76c2e693081137","optimizerSourceSha256":"34c4a040f3cf639f039823880822c6541c384c9b4eaa116d27dda8d9cb5c9f9e"}
|
package/fs/backend.ts
CHANGED
|
@@ -23,7 +23,12 @@ import { SharedFilesystemState, type SharedSegment } from "./shared.js";
|
|
|
23
23
|
|
|
24
24
|
/** Storage boundary. 3b can add asynchronous loading/commit without changing guest transport. */
|
|
25
25
|
export interface FilesystemBackend {
|
|
26
|
-
execute(
|
|
26
|
+
execute(
|
|
27
|
+
operation: string,
|
|
28
|
+
args: any[],
|
|
29
|
+
data: Uint8Array,
|
|
30
|
+
cancelled?: () => boolean,
|
|
31
|
+
): unknown | Promise<unknown>;
|
|
27
32
|
retain(handle: FileHandle): void;
|
|
28
33
|
release(handle: FileHandle): void;
|
|
29
34
|
resources?(): Record<string, number>;
|