@fungi.computer/computer 0.11.0 → 0.12.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 +8 -5
- package/dist/container-policy.js +1 -1
- package/dist/files.d.ts +2 -0
- package/dist/files.js +12 -0
- package/dist/fleet/computers.d.ts +1 -1
- package/dist/fleet/lifecycle.d.ts +11 -0
- package/dist/fleet/lifecycle.js +20 -0
- package/dist/fleet/slots.d.ts +1 -1
- package/dist/fleet/slots.js +3 -3
- package/dist/fleet/wire.d.ts +2 -0
- package/dist/fleet/wire.js +1 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.js +42 -5
- package/dist/process-inventory.d.ts +18 -0
- package/dist/process-inventory.js +19 -0
- package/dist/team-candidate-builder.mjs +6 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -129,11 +129,14 @@ backend termination are different events. A reachable backend can preserve a
|
|
|
129
129
|
process across Worker reconstruction; a sleeping or stopped backend does not
|
|
130
130
|
keep that process alive.
|
|
131
131
|
|
|
132
|
-
Ordinary command execution is bounded to
|
|
133
|
-
process operations
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
132
|
+
Ordinary command execution is bounded to ten minutes. Long-running work uses
|
|
133
|
+
process operations: `start_process` detaches a command with no run-time limit
|
|
134
|
+
(it lives within the Computer's awake window), `process_logs` reads its retained
|
|
135
|
+
output tail, `wait_process` waits up to a bound for its exit, and `kill_process`
|
|
136
|
+
stops it. Port exposure is explicit and bounded. Ports 8080 and 7681 belong to
|
|
137
|
+
Computer control/terminal daemons and cannot be application previews. The Hub
|
|
138
|
+
owns preview admission and URLs; this runtime does not expose arbitrary Computer
|
|
139
|
+
control endpoints to the browser.
|
|
137
140
|
|
|
138
141
|
[Container policy](src/container-policy.ts) configures idle sleep and respects
|
|
139
142
|
`HOSTED_COMPUTERS`. Invalid pause settings fail closed. Network access follows
|
package/dist/container-policy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
/** The one idle window: a Computer sleeps this long after its last activity. */
|
|
3
|
-
export const computerContainerSleepAfterMs =
|
|
3
|
+
export const computerContainerSleepAfterMs = 60 * 60 * 1_000;
|
|
4
4
|
/** A kept-awake container's platform backstop: the 24 hour runtime ceiling. */
|
|
5
5
|
export const computerKeepAwakeTimeoutMs = 24 * 60 * 60 * 1_000;
|
|
6
6
|
const hostedComputersSchema = z
|
package/dist/files.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export type Utf8Page = Readonly<{
|
|
|
12
12
|
}>;
|
|
13
13
|
/** Decode a bounded byte page without consuming an incomplete final UTF-8 character. */
|
|
14
14
|
export declare function decodeUtf8Page(bytes: Uint8Array, path: string, moreBytesRemain: boolean): Utf8Page;
|
|
15
|
+
/** Whether anything exists at `path`; any other stat failure reaches the caller. */
|
|
16
|
+
export declare function workspaceFileExists(provider: SQLiteWorkspaceProvider, path: string): boolean;
|
|
15
17
|
/** Read raw bounded bytes without Workspace.fs's BOM-stripping UTF-8 path. */
|
|
16
18
|
export declare function readBoundedWorkspaceText(provider: SQLiteWorkspaceProvider, path: string, maximumBytes: number): string;
|
|
17
19
|
/** Adapt native Workspace.fs at the one real file boundary. */
|
package/dist/files.js
CHANGED
|
@@ -44,6 +44,18 @@ async function readBytes(workspace, path, byteOffset, byteLength) {
|
|
|
44
44
|
const source = await workspace.fs.readFile(path, options);
|
|
45
45
|
return new Uint8Array(await new Response(source).arrayBuffer());
|
|
46
46
|
}
|
|
47
|
+
/** Whether anything exists at `path`; any other stat failure reaches the caller. */
|
|
48
|
+
export function workspaceFileExists(provider, path) {
|
|
49
|
+
try {
|
|
50
|
+
provider.statSync(path);
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
if (missingSchema.safeParse(error).success)
|
|
55
|
+
return false;
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
47
59
|
/** Read raw bounded bytes without Workspace.fs's BOM-stripping UTF-8 path. */
|
|
48
60
|
export function readBoundedWorkspaceText(provider, path, maximumBytes) {
|
|
49
61
|
const stat = provider.statSync(path);
|
|
@@ -47,7 +47,7 @@ export declare function createFleetComputers(owner: WatchdogSqliteOwner, capacit
|
|
|
47
47
|
hostLabel: string;
|
|
48
48
|
folderLabel: string;
|
|
49
49
|
})[] | null;
|
|
50
|
-
reserveSlot: (computerId: string) => Readonly<{
|
|
50
|
+
reserveSlot: (computerId: string, limit?: number) => Readonly<{
|
|
51
51
|
kind: "reserved";
|
|
52
52
|
runningComputers: number;
|
|
53
53
|
}> | Readonly<{
|
|
@@ -65,6 +65,17 @@ export declare class FleetLifecycle {
|
|
|
65
65
|
startHostedComputer(admitted: (backing: HostedBacking, run: () => Promise<void>) => Promise<void>): Promise<{
|
|
66
66
|
state: "running";
|
|
67
67
|
}>;
|
|
68
|
+
/**
|
|
69
|
+
* The owner's Stop: bring the runtime's workspace changes back into the
|
|
70
|
+
* durable workspace, then end the hosted runtime. Durable files survive, the
|
|
71
|
+
* Computer reads as sleeping, and the next start pushes them back. A Computer
|
|
72
|
+
* with a boot or operation in flight is refused rather than cut off.
|
|
73
|
+
*/
|
|
74
|
+
stopHostedComputer(): Promise<{
|
|
75
|
+
state: "sleeping";
|
|
76
|
+
} | {
|
|
77
|
+
error: "busy";
|
|
78
|
+
}>;
|
|
68
79
|
/** Read liveness without waking a sleeping backend. Queue state wins over booting. */
|
|
69
80
|
readComputerState(): Promise<{
|
|
70
81
|
state: "queued";
|
package/dist/fleet/lifecycle.js
CHANGED
|
@@ -79,6 +79,26 @@ export class FleetLifecycle {
|
|
|
79
79
|
finish();
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* The owner's Stop: bring the runtime's workspace changes back into the
|
|
84
|
+
* durable workspace, then end the hosted runtime. Durable files survive, the
|
|
85
|
+
* Computer reads as sleeping, and the next start pushes them back. A Computer
|
|
86
|
+
* with a boot or operation in flight is refused rather than cut off.
|
|
87
|
+
*/
|
|
88
|
+
async stopHostedComputer() {
|
|
89
|
+
await this.awaitRuntimeMaintenance();
|
|
90
|
+
if (this.hasPendingOperations)
|
|
91
|
+
return { error: "busy" };
|
|
92
|
+
const hosted = this.ports.backend.requireHostedRoute();
|
|
93
|
+
this.usage.ensure();
|
|
94
|
+
if (await this.ports.backend.containerRunning(hosted.backing)) {
|
|
95
|
+
await this.ports.backend.syncRecycledWorkspace(hosted.backing);
|
|
96
|
+
await this.destroyRuntime(hosted.backing, "Computer stopped by its owner");
|
|
97
|
+
this.ports.backend.endedByIdleSleep(attachedBackendId(hosted.backing));
|
|
98
|
+
}
|
|
99
|
+
await this.observeOpenRuntimes();
|
|
100
|
+
return { state: "sleeping" };
|
|
101
|
+
}
|
|
82
102
|
/** Read liveness without waking a sleeping backend. Queue state wins over booting. */
|
|
83
103
|
async readComputerState() {
|
|
84
104
|
const backends = await this.readAttachedBackends();
|
package/dist/fleet/slots.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export declare function createFleetSlots(options: Readonly<{
|
|
|
24
24
|
toArray: () => readonly import("@fungi.computer/watchdog").WatchdogSqliteRow[];
|
|
25
25
|
}>;
|
|
26
26
|
count: () => number;
|
|
27
|
-
reserve: (computerId: string) => FleetSlotReservation;
|
|
27
|
+
reserve: (computerId: string, limit?: number) => FleetSlotReservation;
|
|
28
28
|
release: (computerId: string) => void;
|
|
29
29
|
};
|
|
30
30
|
export {};
|
package/dist/fleet/slots.js
CHANGED
|
@@ -14,7 +14,7 @@ export function createFleetSlots(options, capacity) {
|
|
|
14
14
|
return z.number().int().nonnegative().parse(row.count);
|
|
15
15
|
};
|
|
16
16
|
/** Capacity-only synchronous admission for a hosted cold start. */
|
|
17
|
-
const reserve = (computerId) => {
|
|
17
|
+
const reserve = (computerId, limit = capacity.limit) => {
|
|
18
18
|
try {
|
|
19
19
|
return options.transactionSync(() => {
|
|
20
20
|
const existing = sql
|
|
@@ -23,11 +23,11 @@ export function createFleetSlots(options, capacity) {
|
|
|
23
23
|
const running = count();
|
|
24
24
|
if (existing !== undefined)
|
|
25
25
|
return { kind: "reserved", runningComputers: running };
|
|
26
|
-
if (running >=
|
|
26
|
+
if (running >= limit)
|
|
27
27
|
return {
|
|
28
28
|
kind: "capacity",
|
|
29
29
|
runningComputers: running,
|
|
30
|
-
limit
|
|
30
|
+
limit,
|
|
31
31
|
retryAfterSeconds: capacity.retryAfterSeconds,
|
|
32
32
|
};
|
|
33
33
|
sql.exec("INSERT INTO hub_team_running_computers (computer_id) VALUES (?)", computerId);
|
package/dist/fleet/wire.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export declare const computerActionSchema: z.ZodEnum<{
|
|
|
24
24
|
processList: "processList";
|
|
25
25
|
processKill: "processKill";
|
|
26
26
|
processLogs: "processLogs";
|
|
27
|
+
processWait: "processWait";
|
|
27
28
|
exposePort: "exposePort";
|
|
28
29
|
unexposePort: "unexposePort";
|
|
29
30
|
listPorts: "listPorts";
|
|
@@ -61,6 +62,7 @@ export declare const computerGrantSchema: z.ZodObject<{
|
|
|
61
62
|
processList: "processList";
|
|
62
63
|
processKill: "processKill";
|
|
63
64
|
processLogs: "processLogs";
|
|
65
|
+
processWait: "processWait";
|
|
64
66
|
exposePort: "exposePort";
|
|
65
67
|
unexposePort: "unexposePort";
|
|
66
68
|
listPorts: "listPorts";
|
package/dist/fleet/wire.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { type IWorkspaceContainerAPI } from "@fungi.computer/cloudflare-computer
|
|
|
6
6
|
import { DurableObject } from "cloudflare:workers";
|
|
7
7
|
import type { FilesPort } from "@fungi.computer/knapsack";
|
|
8
8
|
import { z } from "zod";
|
|
9
|
-
import { type ComputerExecutionBudget, type ComputerExecutionHostHooks, type ComputerExecRequest, type ComputerOperationResult, type ComputerFileReadInput, type ComputerFileByteReadInput, type ComputerFileReplacement, type ComputerFileReplacementResult, type ComputerValue, writeInputSchema, writeOutputSchema, processLogsOutputSchema, type ComputerProcess } from "@fungi.computer/computer-contract";
|
|
9
|
+
import { type ComputerExecutionBudget, type ComputerExecutionHostHooks, type ComputerExecRequest, type ComputerOperationResult, type ComputerFileReadInput, type ComputerFileByteReadInput, type ComputerFileReplacement, type ComputerFileReplacementResult, type ComputerValue, writeInputSchema, writeOutputSchema, processLogsOutputSchema, processWaitOutputSchema, type ComputerProcess } from "@fungi.computer/computer-contract";
|
|
10
10
|
import { createWorkspaceFilesPort } from "./files.js";
|
|
11
11
|
import { OnBoxVmContainerHost, type OnBoxVmEnv, type OnBoxVmPlacement } from "./on-box-vm.js";
|
|
12
12
|
import { type AttachedBackend, type AttachedBackendView, type BackendNeed, type BackendRoute, type ComputerSize, type ContainerRuntimeStart, type HostedBacking } from "./computer-backends.js";
|
|
@@ -300,6 +300,12 @@ export declare class ComputerDO extends ContainerComputer implements ComputerFil
|
|
|
300
300
|
/** The retained last output lines of one process, with its record. */
|
|
301
301
|
processLogs(input: ComputerValue): z.output<typeof processLogsOutputSchema>;
|
|
302
302
|
protected processLogsAfterAcceptance(input: ComputerValue, accept: () => void): z.output<typeof processLogsOutputSchema>;
|
|
303
|
+
/**
|
|
304
|
+
* Wait up to a bound for one process to exit, then return its record and
|
|
305
|
+
* retained output tail. The process keeps running past a timed-out wait.
|
|
306
|
+
*/
|
|
307
|
+
waitProcess(input: ComputerValue): Promise<z.output<typeof processWaitOutputSchema>>;
|
|
308
|
+
protected waitProcessAfterAcceptance(input: ComputerValue, accept: () => void): Promise<z.output<typeof processWaitOutputSchema>>;
|
|
303
309
|
/** Send SIGTERM to one running process; its exit is recorded when observed. */
|
|
304
310
|
killProcess(input: ComputerValue): Promise<{
|
|
305
311
|
process: ComputerProcess;
|
package/dist/index.js
CHANGED
|
@@ -68,13 +68,13 @@ import { z } from "zod";
|
|
|
68
68
|
import { SystemTrustContainerBackend } from "./container-system-trust.js";
|
|
69
69
|
import { computerTransportBackend } from "./transport-backend.js";
|
|
70
70
|
import { PullPendingTracker } from "./pull-pending.js";
|
|
71
|
-
import { ComputerFileConflict, ComputerFileRangeError, ComputerFileTooLargeError, capabilityNameSchema, computerValueSchema, computerCapabilities, computerPortInputSchema, computerPortOutputSchema, computerPortRemovalOutputSchema, computerPortsOutputSchema, computerPortSchema, ComputerPortLimitError, ComputerPortReservedError, computerTerminalPort, isComputerReservedPort, maximumExposedPorts, maximumProcessRecords, execInputSchema, execOutputSchema, computerToolResult, computerExecutionRequestSchema, genericComputerExecutionBudget, mintComputerRequestId, listInputSchema, listOutputSchema, maximumFileBytes, mkdirInputSchema, mkdirOutputSchema, moveInputSchema, moveOutputSchema, ComputerFileMoveError, readInputSchema, readBytesInputSchema, readOutputSchema, replaceInputSchema, writeInputSchema, writeOutputSchema, processIdInputSchema, processKillOutputSchema, processListOutputSchema, processLogsInputSchema, processLogsOutputSchema, maximumProcessLogLines, processStartInputSchema, processStartToolInputSchema, ComputerProcessNotFoundError, } from "@fungi.computer/computer-contract";
|
|
72
|
-
import { createWorkspaceFilesPort, readBoundedWorkspaceText, listWorkspaceFiles, } from "./files.js";
|
|
71
|
+
import { ComputerFileConflict, ComputerFileRangeError, ComputerFileTooLargeError, capabilityNameSchema, computerValueSchema, computerCapabilities, computerPortInputSchema, computerPortOutputSchema, computerPortRemovalOutputSchema, computerPortsOutputSchema, computerPortSchema, ComputerPortLimitError, ComputerPortReservedError, computerTerminalPort, isComputerReservedPort, maximumExposedPorts, maximumProcessRecords, execInputSchema, execOutputSchema, computerToolResult, computerExecutionRequestSchema, genericComputerExecutionBudget, mintComputerRequestId, listInputSchema, listOutputSchema, maximumFileBytes, mkdirInputSchema, mkdirOutputSchema, moveInputSchema, moveOutputSchema, ComputerFileMoveError, readInputSchema, readBytesInputSchema, readOutputSchema, replaceInputSchema, writeInputSchema, writeOutputSchema, processIdInputSchema, processKillOutputSchema, processListOutputSchema, processLogsInputSchema, processLogsOutputSchema, processWaitInputSchema, processWaitOutputSchema, maximumProcessLogLines, processStartInputSchema, processStartToolInputSchema, ComputerProcessNotFoundError, } from "@fungi.computer/computer-contract";
|
|
72
|
+
import { createWorkspaceFilesPort, readBoundedWorkspaceText, workspaceFileExists, listWorkspaceFiles, } from "./files.js";
|
|
73
73
|
import { computerExecutionResult } from "./execution-result.js";
|
|
74
74
|
import { ComputerOperationRecord } from "./operation-record.js";
|
|
75
75
|
import { createComputerExecutionLifecycle } from "./execution-lifecycle.js";
|
|
76
76
|
import { applyWorkspacePatch } from "./files-patch.js";
|
|
77
|
-
import { ComputerProcessInventory, drainProcessExit, ProcessLogTail, failedObservation, observeProcess, } from "./process-inventory.js";
|
|
77
|
+
import { ComputerProcessInventory, drainProcessExit, ProcessLogTail, failedObservation, observeProcess, waitForProcessExit, } from "./process-inventory.js";
|
|
78
78
|
import { assertComputerContainersEnabled, ComputerContainersPausedError, configureComputerContainer, hostedComputerContainersPaused, } from "./container-policy.js";
|
|
79
79
|
import { OnBoxVmContainerHost, onBoxVmPlacement, } from "./on-box-vm.js";
|
|
80
80
|
import { computerKeepAwake } from "./fleet/keep-awake.js";
|
|
@@ -1077,6 +1077,10 @@ export class ComputerDO extends ContainerComputer {
|
|
|
1077
1077
|
return await this.listProcessesAfterAcceptance(accept);
|
|
1078
1078
|
case "kill_process":
|
|
1079
1079
|
return await this.killProcessAfterAcceptance(input, accept);
|
|
1080
|
+
case "process_logs":
|
|
1081
|
+
return this.processLogsAfterAcceptance(input, accept);
|
|
1082
|
+
case "wait_process":
|
|
1083
|
+
return await this.waitProcessAfterAcceptance(input, accept);
|
|
1080
1084
|
}
|
|
1081
1085
|
const workspace = await this.readyWorkspace();
|
|
1082
1086
|
accept();
|
|
@@ -1393,6 +1397,36 @@ export class ComputerDO extends ContainerComputer {
|
|
|
1393
1397
|
truncated: log.truncated || log.lines.length > wanted,
|
|
1394
1398
|
});
|
|
1395
1399
|
}
|
|
1400
|
+
/**
|
|
1401
|
+
* Wait up to a bound for one process to exit, then return its record and
|
|
1402
|
+
* retained output tail. The process keeps running past a timed-out wait.
|
|
1403
|
+
*/
|
|
1404
|
+
async waitProcess(input) {
|
|
1405
|
+
return await this.waitProcessAfterAcceptance(input, () => undefined);
|
|
1406
|
+
}
|
|
1407
|
+
async waitProcessAfterAcceptance(input, accept) {
|
|
1408
|
+
const { id, timeoutMs } = processWaitInputSchema.parse(input);
|
|
1409
|
+
accept();
|
|
1410
|
+
const waited = await waitForProcessExit({
|
|
1411
|
+
read: () => {
|
|
1412
|
+
const row = this.#processes.get(id);
|
|
1413
|
+
if (row === undefined)
|
|
1414
|
+
throw new ComputerProcessNotFoundError(id);
|
|
1415
|
+
return row;
|
|
1416
|
+
},
|
|
1417
|
+
observe: (row) => this.#observeOwnedProcess(row),
|
|
1418
|
+
now: Date.now,
|
|
1419
|
+
sleep: (ms) => new Promise((resolve) => setTimeout(resolve, ms)),
|
|
1420
|
+
timeoutMs,
|
|
1421
|
+
});
|
|
1422
|
+
const log = this.#processes.logOf(id);
|
|
1423
|
+
return processWaitOutputSchema.parse({
|
|
1424
|
+
process: this.#processReceipt(waited.process),
|
|
1425
|
+
lines: (log?.lines ?? []).slice(-maximumProcessLogLines),
|
|
1426
|
+
truncated: log?.truncated ?? false,
|
|
1427
|
+
timedOut: waited.timedOut,
|
|
1428
|
+
});
|
|
1429
|
+
}
|
|
1396
1430
|
/** Send SIGTERM to one running process; its exit is recorded when observed. */
|
|
1397
1431
|
async killProcess(input) {
|
|
1398
1432
|
return await this.killProcessAfterAcceptance(input, () => undefined);
|
|
@@ -1639,8 +1673,11 @@ export class ComputerDO extends ContainerComputer {
|
|
|
1639
1673
|
const provider = new SQLiteWorkspaceProvider(workspace.fs.db);
|
|
1640
1674
|
const result = writeOutputSchema.parse(this.state.storage.transactionSync(() => {
|
|
1641
1675
|
accept();
|
|
1642
|
-
|
|
1643
|
-
|
|
1676
|
+
if (replacement.expectedContent === null) {
|
|
1677
|
+
if (workspaceFileExists(provider, replacement.path))
|
|
1678
|
+
throw new ComputerFileConflict();
|
|
1679
|
+
}
|
|
1680
|
+
else if (readBoundedWorkspaceText(provider, replacement.path, maximumFileBytes) !== replacement.expectedContent) {
|
|
1644
1681
|
throw new ComputerFileConflict();
|
|
1645
1682
|
}
|
|
1646
1683
|
provider.writeFileSync(replacement.path, replacement.content);
|
|
@@ -20,6 +20,24 @@ export declare class ProcessLogTail {
|
|
|
20
20
|
/** The retained lines, including any unfinished last line. */
|
|
21
21
|
snapshot(): ProcessLogSnapshot;
|
|
22
22
|
}
|
|
23
|
+
/** What one wait found: the process as last read, and whether it was still running at the bound. */
|
|
24
|
+
export type ProcessWaitOutcome = Readonly<{
|
|
25
|
+
process: ComputerProcess;
|
|
26
|
+
timedOut: boolean;
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Poll one process until it is no longer running or the bound passes. The drain
|
|
30
|
+
* that watches the process records its exit; every tenth poll the caller's
|
|
31
|
+
* `observe` also asks the execution owner, so a lost watcher cannot hold a
|
|
32
|
+
* wait open. The clock and sleep are the caller's, so a fake clock drives it.
|
|
33
|
+
*/
|
|
34
|
+
export declare function waitForProcessExit(options: {
|
|
35
|
+
read: () => ComputerProcess;
|
|
36
|
+
observe: (process: ComputerProcess) => Promise<ComputerProcess>;
|
|
37
|
+
now: () => number;
|
|
38
|
+
sleep: (ms: number) => Promise<void>;
|
|
39
|
+
timeoutMs: number;
|
|
40
|
+
}): Promise<ProcessWaitOutcome>;
|
|
23
41
|
/** Computer-owned replay identities; computerd owns execution and exit observations. */
|
|
24
42
|
export declare class ComputerProcessInventory {
|
|
25
43
|
#private;
|
|
@@ -117,6 +117,25 @@ export class ProcessLogTail {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Poll one process until it is no longer running or the bound passes. The drain
|
|
122
|
+
* that watches the process records its exit; every tenth poll the caller's
|
|
123
|
+
* `observe` also asks the execution owner, so a lost watcher cannot hold a
|
|
124
|
+
* wait open. The clock and sleep are the caller's, so a fake clock drives it.
|
|
125
|
+
*/
|
|
126
|
+
export async function waitForProcessExit(options) {
|
|
127
|
+
const deadline = options.now() + options.timeoutMs;
|
|
128
|
+
for (let poll = 0;; poll += 1) {
|
|
129
|
+
const row = options.read();
|
|
130
|
+
const current = row.state === "running" && poll % 10 === 9
|
|
131
|
+
? await options.observe(row)
|
|
132
|
+
: row;
|
|
133
|
+
const remaining = deadline - options.now();
|
|
134
|
+
if (current.state !== "running" || remaining <= 0)
|
|
135
|
+
return { process: current, timedOut: current.state === "running" };
|
|
136
|
+
await options.sleep(Math.min(500, remaining));
|
|
137
|
+
}
|
|
138
|
+
}
|
|
120
139
|
function clipLine(line) {
|
|
121
140
|
return line.length > maximumProcessLogLineCharacters
|
|
122
141
|
? line.slice(0, maximumProcessLogLineCharacters)
|
|
@@ -19599,6 +19599,11 @@ var appBackendBindingKinds = {
|
|
|
19599
19599
|
requires: ["computer.execute"],
|
|
19600
19600
|
effect: "read"
|
|
19601
19601
|
},
|
|
19602
|
+
gitChanges: {
|
|
19603
|
+
cap: "app.computer.read",
|
|
19604
|
+
requires: ["computer.readFile"],
|
|
19605
|
+
effect: "read"
|
|
19606
|
+
},
|
|
19602
19607
|
write: {
|
|
19603
19608
|
cap: "app.computer.write",
|
|
19604
19609
|
requires: ["computer.writeFile"],
|
|
@@ -22290,6 +22295,7 @@ var symbols = {
|
|
|
22290
22295
|
sendPrompts: (0, import_jsx_runtime4.jsxs)("g", { transform: "translate(32 32) scale(1.08) translate(-32 -32)", children: [(0, import_jsx_runtime4.jsx)("g", { transform: "translate(4 13.2) scale(.412 .436)", children: (0, import_jsx_runtime4.jsx)(SpeechBubble, { fill: coral }) }), (0, import_jsx_runtime4.jsx)("g", { transform: "translate(17.1 28.7) scale(.19)", children: (0, import_jsx_runtime4.jsx)(SpeakingMouth, {}) }), (0, import_jsx_runtime4.jsx)(TaperedRay, { fill: mint, transform: "translate(48.1 26.4) rotate(65) scale(1.7 1.28)" }), (0, import_jsx_runtime4.jsx)(TaperedRay, { fill: mint, transform: "translate(48.4 33.8) rotate(110) scale(1.7 1.28)" })] }),
|
|
22291
22296
|
write: (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [(0, import_jsx_runtime4.jsx)(Pencil, {}), (0, import_jsx_runtime4.jsx)(InkTrail, {})] }),
|
|
22292
22297
|
run: (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [(0, import_jsx_runtime4.jsx)("rect", { style: { fill: blue }, x: "6", y: "9", width: "52", height: "43", rx: "7" }), (0, import_jsx_runtime4.jsx)("path", { style: { stroke: cream }, strokeWidth: "5", strokeLinecap: "round", strokeLinejoin: "round", d: "m17 22 9 8-9 8m17 0h12" })] }),
|
|
22298
|
+
stop: (0, import_jsx_runtime4.jsx)("rect", { style: { fill: coral }, x: "12", y: "12", width: "40", height: "40", rx: "9" }),
|
|
22293
22299
|
connected: (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [(0, import_jsx_runtime4.jsx)("path", { fill: "none", style: { stroke: blue }, strokeWidth: "12", strokeLinecap: "round", d: "M34 37Q43 21 26 20H18Q3 20 6 37q2 10 15 9" }), (0, import_jsx_runtime4.jsx)("path", { fill: "none", style: { stroke: coral }, strokeWidth: "12", strokeLinecap: "round", d: "M29 33Q20 50 38 53h8q16-1 12-17-2-11-14-10" }), (0, import_jsx_runtime4.jsx)("path", { style: { stroke: yellow }, strokeWidth: "4", strokeLinecap: "round", d: "m27 4 2 6m10-5-2 7m12 0-5 4" })] }),
|
|
22294
22300
|
working: (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [(0, import_jsx_runtime4.jsx)("ellipse", { style: { fill: mint }, cx: "23", cy: "14", rx: "13", ry: "8", transform: "rotate(-30 23 14)" }), (0, import_jsx_runtime4.jsx)("ellipse", { style: { fill: yellow }, cx: "48", cy: "36", rx: "13", ry: "8", transform: "rotate(35 48 36)" }), (0, import_jsx_runtime4.jsx)("ellipse", { style: { fill: grape }, cx: "22", cy: "48", rx: "13", ry: "8", transform: "rotate(45 22 48)" }), (0, import_jsx_runtime4.jsx)("path", { fill: "none", style: { stroke: figure }, strokeWidth: "3", strokeLinecap: "round", d: "M42 8q13 2 13 13M43 55q-5 5-12 4M5 39q-5-9 1-17" })] }),
|
|
22295
22301
|
complete: (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [(0, import_jsx_runtime4.jsx)("path", { style: { fill: mint }, d: "M32 6q5-8 10 0 9-3 10 6 9 2 5 11 8 6 0 12 3 9-6 11-1 9-10 6-6 8-12 0-9 3-11-6-9-2-6-11-8-6 0-12-3-9 6-11 1-9 10-6Z" }), (0, import_jsx_runtime4.jsx)("path", { fill: "none", style: { stroke: ink }, strokeWidth: "6", strokeLinecap: "round", strokeLinejoin: "round", d: "m23 29 7 7 13-15" }), (0, import_jsx_runtime4.jsx)("path", { style: { stroke: figure }, strokeWidth: "3", strokeLinecap: "round", d: "m4 8 5 6m48-4 5-5M2 24l6 1" })] }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/computer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"author": "Levi <levi@technomancy.dev>",
|
|
5
5
|
"description": "Cloudflare Computer host for one durable Fungi Computer",
|
|
6
6
|
"type": "module",
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
"@fungi.computer/capnweb": "0.12.0-fungi.0",
|
|
61
61
|
"@fungi.computer/cloudflare-computer": "0.2.1-fungi.2",
|
|
62
62
|
"@fungi.computer/cordyceps": "0.4.2",
|
|
63
|
-
"@fungi.computer/knapsack": "0.4.
|
|
63
|
+
"@fungi.computer/knapsack": "0.4.12",
|
|
64
64
|
"@fungi.computer/seam": "0.2.5",
|
|
65
65
|
"@fungi.computer/watchdog": "0.1.3",
|
|
66
|
-
"@fungi.computer/computer-contract": "0.
|
|
66
|
+
"@fungi.computer/computer-contract": "0.4.0",
|
|
67
67
|
"effect": "4.0.2",
|
|
68
68
|
"just-bash": "3.4.2",
|
|
69
69
|
"zod": "4.4.3"
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"test:nightly": "bash ../../tooling/proof-runner/run-proof.sh node test/egress-proof.mjs",
|
|
120
120
|
"test:app-method-execution": "node test/app-method-execution-proof.mjs",
|
|
121
121
|
"test:execution-lifecycle": "node test/execution-lifecycle-proof.mjs",
|
|
122
|
-
"test:unit": "bash ../../tooling/proof-runner/hermetic-host.sh -- sh -c \"node --test --test-concurrency=${BOTANICAL_TEST_WORKERS:-4} test/egress-policy.test.mjs test/preview.test.mjs test/fleet.test.mjs test/proof-worker.test.mjs test/proof-client.test.mjs test/native-readiness.test.mjs test/workspace-sync.test.mjs test/runtime-observer.test.mjs test/files-patch.test.mjs test/exec-output.test.mjs && node --test --test-concurrency=${BOTANICAL_TEST_WORKERS:-4} test/seam-signature.test.mjs test/local-backend-replay.test.mjs test/machine-link-reopen-replay.test.mjs test/computer-backends.test.mjs test/terminal-welcome.test.mjs test/on-box-vm.test.mjs && node test/terminal-protocol.test.mjs && node test/container-policy.test.mjs && node test/files-adapter-proof.mjs && node test/operation-record-proof.mjs && node test/process-inventory-proof.mjs\"",
|
|
122
|
+
"test:unit": "bash ../../tooling/proof-runner/hermetic-host.sh -- sh -c \"node --test --test-concurrency=${BOTANICAL_TEST_WORKERS:-4} test/egress-policy.test.mjs test/preview.test.mjs test/process-wait.test.mjs test/fleet.test.mjs test/proof-worker.test.mjs test/proof-client.test.mjs test/native-readiness.test.mjs test/workspace-sync.test.mjs test/runtime-observer.test.mjs test/files-patch.test.mjs test/exec-output.test.mjs && node --test --test-concurrency=${BOTANICAL_TEST_WORKERS:-4} test/seam-signature.test.mjs test/local-backend-replay.test.mjs test/machine-link-reopen-replay.test.mjs test/computer-backends.test.mjs test/terminal-welcome.test.mjs test/on-box-vm.test.mjs && node test/terminal-protocol.test.mjs && node test/container-policy.test.mjs && node test/files-adapter-proof.mjs && node test/operation-record-proof.mjs && node test/process-inventory-proof.mjs\"",
|
|
123
123
|
"test:fleet-native": "node test/fleet.native.mjs",
|
|
124
124
|
"assemble:image": "node scripts/assemble-image.mjs"
|
|
125
125
|
}
|