@fungi.computer/computer 0.0.1 → 0.2.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 +38 -10
- package/dist/computer-backends.d.ts +11 -12
- package/dist/computer-backends.js +4 -7
- package/dist/exec-output.d.ts +13 -0
- package/dist/exec-output.js +24 -0
- package/dist/execution-lifecycle.d.ts +35 -0
- package/dist/execution-lifecycle.js +78 -0
- package/dist/files-patch.d.ts +12 -4
- package/dist/files-patch.js +8 -14
- package/dist/files.d.ts +65 -15
- package/dist/files.js +152 -31
- package/dist/fleet/backing.js +2 -2
- package/dist/fleet/index.d.ts +1 -1
- package/dist/fleet/index.js +1 -1
- package/dist/fleet/inventory-wire.d.ts +4 -0
- package/dist/fleet/inventory-wire.js +5 -0
- package/dist/fleet/inventory.js +4 -4
- package/dist/fleet/lifecycle.d.ts +7 -1
- package/dist/fleet/lifecycle.js +23 -6
- package/dist/fleet/wire.d.ts +28 -28
- package/dist/fleet/wire.js +9 -9
- package/dist/index.d.ts +33 -15
- package/dist/index.js +426 -109
- package/dist/internet-access.d.ts +4 -0
- package/dist/internet-access.js +14 -0
- package/dist/local-backend-replay.d.ts +10 -0
- package/dist/local-backend-replay.js +43 -0
- package/dist/local-backend.d.ts +2 -1
- package/dist/local-backend.js +4 -4
- package/dist/on-box-vm.d.ts +15 -4
- package/dist/on-box-vm.js +43 -20
- package/dist/operation-record.d.ts +1 -1
- package/dist/operation-record.js +1 -1
- package/dist/process-inventory.d.ts +3 -1
- package/dist/process-inventory.js +2 -2
- package/dist/team-candidate-builder.mjs +8428 -337
- package/package.json +17 -24
- package/dist/light-shell.d.ts +0 -44
- package/dist/light-shell.js +0 -376
- package/dist/operation-contract.d.ts +0 -456
- package/dist/operation-contract.js +0 -452
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
export { createLocalBackendReplayStore } from "./local-backend-replay.js";
|
|
1
2
|
import { Workspace, WorkspaceProxy, WorkspaceServiceProxy, type WorkspaceStubHost } from "@fungi.computer/cloudflare-computer";
|
|
2
3
|
import { type WorkerShellBackendOptions } from "@fungi.computer/cloudflare-computer/backends/worker-shell";
|
|
3
4
|
import { type IWorkspaceContainerAPI } from "@fungi.computer/cloudflare-computer/backends/container";
|
|
4
5
|
import { DurableObject } from "cloudflare:workers";
|
|
5
6
|
import type { FilesPort } from "@fungi.computer/knapsack";
|
|
6
7
|
import { z } from "zod";
|
|
7
|
-
import { type ComputerExecutionBudget, type ComputerExecRequest, type ComputerOperationResult, type ComputerFileReadInput, type ComputerFileByteReadInput, type ComputerFileReplacement, type ComputerFileReplacementResult, type ComputerValue, writeInputSchema, writeOutputSchema, type ComputerProcess } from "
|
|
8
|
+
import { type ComputerExecutionBudget, type ComputerExecutionHostHooks, type ComputerExecRequest, type ComputerOperationResult, type ComputerFileReadInput, type ComputerFileByteReadInput, type ComputerFileReplacement, type ComputerFileReplacementResult, type ComputerValue, writeInputSchema, writeOutputSchema, type ComputerProcess } from "@fungi.computer/computer-contract";
|
|
8
9
|
import { createWorkspaceFilesPort } from "./files.js";
|
|
9
10
|
import { OnBoxVmContainerHost, type OnBoxVmEnv, type OnBoxVmPlacement } from "./on-box-vm.js";
|
|
10
11
|
import { type AttachedBackend, type AttachedBackendView, type BackendNeed, type BackendRoute, type ContainerRuntimeStart, type HostedBacking } from "./computer-backends.js";
|
|
@@ -89,7 +90,7 @@ declare class ContainerComputer extends ContainerComputerBase {
|
|
|
89
90
|
* The hosted backend that terminals, processes and ports use: the first in
|
|
90
91
|
* the default order, or none when only local machines are attached.
|
|
91
92
|
*/
|
|
92
|
-
protected hostedRoute(): Readonly<{
|
|
93
|
+
protected hostedRoute(backend?: string): Readonly<{
|
|
93
94
|
id: string;
|
|
94
95
|
backing: HostedBacking;
|
|
95
96
|
}> | undefined;
|
|
@@ -114,9 +115,8 @@ declare class ContainerComputer extends ContainerComputerBase {
|
|
|
114
115
|
protected workspace(): Workspace;
|
|
115
116
|
/**
|
|
116
117
|
* The current Workspace once its mount index is ready and its guest mount
|
|
117
|
-
* root exists. Every backend mounts `/workspace`, so
|
|
118
|
-
*
|
|
119
|
-
* on a guest having booted first.
|
|
118
|
+
* root exists. Every backend mounts `/workspace`, so an ordinary host file
|
|
119
|
+
* write there must not depend on a guest having booted first.
|
|
120
120
|
*/
|
|
121
121
|
protected readyWorkspace(): Promise<Workspace>;
|
|
122
122
|
/** `getWorkspace(stub)` reaches the current generation through this door. */
|
|
@@ -132,6 +132,16 @@ declare class ContainerComputer extends ContainerComputerBase {
|
|
|
132
132
|
/** One upstream Cloudflare Workspace that advertises and runs its capabilities. */
|
|
133
133
|
export declare class ComputerDO extends ContainerComputer {
|
|
134
134
|
#private;
|
|
135
|
+
constructor(ctx: DurableObjectState, env: ComputerEnv);
|
|
136
|
+
/** Host-admitted settings write; egress reads the current durable value. */
|
|
137
|
+
internetAccess(enabled?: boolean): boolean;
|
|
138
|
+
/** Ordinary Computers have no credential host; resource hosts override it. */
|
|
139
|
+
protected executionHooks(): ComputerExecutionHostHooks | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* Admission observes the actual native subscriber, never App completion,
|
|
142
|
+
* output silence, an accepted signal or this isolate's warm state.
|
|
143
|
+
*/
|
|
144
|
+
executionIsLive(invocationId: string): Promise<boolean>;
|
|
135
145
|
/** Persist the bounded set of ports admitted for preview on this Computer. */
|
|
136
146
|
exposePort(input: {
|
|
137
147
|
port: number;
|
|
@@ -201,17 +211,25 @@ export declare class ComputerDO extends ContainerComputer {
|
|
|
201
211
|
protected applyPatchAfterAcceptance(input: {
|
|
202
212
|
patch: string;
|
|
203
213
|
}, accept: () => void): Promise<{
|
|
204
|
-
status: "
|
|
214
|
+
status: "failed" | "completed" | "cancelled";
|
|
205
215
|
exitCode: number;
|
|
206
216
|
stdout: string;
|
|
207
217
|
stderr: string;
|
|
208
|
-
truncated:
|
|
218
|
+
truncated: false | {
|
|
219
|
+
stream: "stdout" | "stderr";
|
|
220
|
+
keptBytes: number;
|
|
221
|
+
totalBytes: number;
|
|
222
|
+
}[];
|
|
209
223
|
} | {
|
|
210
|
-
status: "
|
|
224
|
+
status: "failed" | "completed" | "cancelled";
|
|
211
225
|
exitCode: number;
|
|
212
226
|
stdout: string;
|
|
213
227
|
stderr: string;
|
|
214
|
-
truncated:
|
|
228
|
+
truncated: false | {
|
|
229
|
+
stream: "stdout" | "stderr";
|
|
230
|
+
keptBytes: number;
|
|
231
|
+
totalBytes: number;
|
|
232
|
+
}[];
|
|
215
233
|
error: {
|
|
216
234
|
kind: "mismatch";
|
|
217
235
|
};
|
|
@@ -220,14 +238,15 @@ export declare class ComputerDO extends ContainerComputer {
|
|
|
220
238
|
protected writeTextAfterAcceptance(input: z.output<typeof writeInputSchema>, accept: () => void): Promise<z.output<typeof writeOutputSchema>>;
|
|
221
239
|
call(capabilityId: ComputerValue, input: ComputerValue): Promise<ComputerValue>;
|
|
222
240
|
/** Resource hosts may accept authority once the Workspace is ready to dispatch. */
|
|
223
|
-
protected callAfterAcceptance(capabilityId: ComputerValue, input: ComputerValue, accept: () => void): Promise<ComputerValue>;
|
|
241
|
+
protected callAfterAcceptance(capabilityId: ComputerValue, input: ComputerValue, accept: () => void, executionContext?: ComputerValue): Promise<ComputerValue>;
|
|
224
242
|
/**
|
|
225
243
|
* Execute a host request once, after the host accepts current authority.
|
|
226
244
|
* `exec` runs on the Workspace's built-in Worker shell unless it names an
|
|
227
245
|
* attached backend; `bash` always runs on an attached backend, the named one
|
|
228
|
-
* or the first available in the default order.
|
|
246
|
+
* or the first available in the default order. Host-only `hosted` execution
|
|
247
|
+
* excludes local backends, including an explicitly named local backend.
|
|
229
248
|
*/
|
|
230
|
-
protected executeOperationAfterAcceptance(input: ComputerExecRequest, accept: () => void, kind: "exec" | "bash", budget?: ComputerExecutionBudget, signal?: AbortSignal): Promise<ComputerOperationResult>;
|
|
249
|
+
protected executeOperationAfterAcceptance(input: ComputerExecRequest, accept: () => void, kind: "exec" | "bash" | "hosted", budget?: ComputerExecutionBudget, signal?: AbortSignal, executionContext?: ComputerValue): Promise<ComputerOperationResult>;
|
|
231
250
|
/**
|
|
232
251
|
* Run one command on a routed backend. Owners admit and meter hosted
|
|
233
252
|
* backends here; a member's own machine is neither reserved nor metered.
|
|
@@ -238,7 +257,7 @@ export declare class ComputerDO extends ContainerComputer {
|
|
|
238
257
|
/** Start one long-running container process with a durable identity. */
|
|
239
258
|
startProcess(input: ComputerValue): Promise<ComputerProcess>;
|
|
240
259
|
/** The host accepts authority when the running slot is reserved. */
|
|
241
|
-
protected startProcessAfterAcceptance(input: ComputerValue, accept: () => void): Promise<ComputerProcess>;
|
|
260
|
+
protected startProcessAfterAcceptance(input: ComputerValue, accept: () => void, executionContext?: ComputerValue): Promise<ComputerProcess>;
|
|
242
261
|
/** List this Computer's processes, reconciling live ones with computerd. */
|
|
243
262
|
listProcesses(): Promise<{
|
|
244
263
|
processes: ComputerProcess[];
|
|
@@ -270,13 +289,12 @@ export declare class ComputerDO extends ContainerComputer {
|
|
|
270
289
|
protected replaceFileIfUnchangedAfterAcceptance(input: ComputerFileReplacement, accept: () => void): Promise<ComputerFileReplacementResult>;
|
|
271
290
|
}
|
|
272
291
|
export { WorkspaceProxy, WorkspaceServiceProxy };
|
|
273
|
-
export { OnBoxVmContainerHost, onBoxVmPlacement, onBoxVmIngress, type OnBoxVmEnv, type OnBoxVmState, } from "./on-box-vm.js";
|
|
292
|
+
export { OnBoxVmContainerHost, OnBoxVmTimeoutError, onBoxVmPlacement, onBoxVmIngress, type OnBoxVmEnv, type OnBoxVmOperation, type OnBoxVmState, } from "./on-box-vm.js";
|
|
274
293
|
export { computerContainerSleepAfterMs } from "./container-policy.js";
|
|
275
294
|
export * from "./computer-backends.js";
|
|
276
295
|
export { LocalBackendOfflineError, localBackendAudience, localBackendDialPath, verifyLocalBackendDial, } from "./local-backend.js";
|
|
277
296
|
/** Keep each native Workspace lease inside the operation that uses it. */
|
|
278
297
|
export declare function createComputerFilesPort(computer: ComputerRpc): FilesPort;
|
|
279
298
|
export { createWorkspaceFilesPort, type WorkspaceFilesOwner } from "./files.js";
|
|
280
|
-
export * from "./operation-contract.js";
|
|
281
299
|
export { ComputerOperationConflictError, ComputerOperationLimitError, ComputerRequestInvalidError, } from "./operation-record.js";
|
|
282
300
|
export type { ContainerComputer };
|