@fungi.computer/oyster 0.25.0 → 0.26.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/dist/app-builds.d.ts +4 -2
- package/dist/app-builds.js +14 -0
- package/dist/boot-host-script.js +1 -1
- package/dist/build/build-memory.d.ts +13 -0
- package/dist/build/build-memory.js +29 -0
- package/dist/build/candidate-cli.mjs +19 -2
- package/dist/build/local-build.js +4 -5
- package/dist/cloudflare.d.ts +2 -2
- package/dist/cloudflare.js +3 -0
- package/dist/computer-control-port.d.ts +2 -0
- package/dist/embed-metafiles.js +2 -2
- package/dist/embed-scripts.js +1 -1
- package/dist/mcp.d.ts +26 -0
- package/dist/mcp.js +12 -2
- package/dist/page-script.js +2 -2
- package/dist/release.d.ts +5 -0
- package/dist/standalone/agents.js +11 -1
- package/dist/standalone/app-set.d.ts +4 -3
- package/dist/standalone/app-set.js +9 -5
- package/dist/standalone/computer-control.js +7 -1
- package/dist/standalone/computer-fleet.d.ts +5 -0
- package/dist/standalone/computer-skill-source.d.ts +20 -0
- package/dist/standalone/computer-skill-source.js +165 -0
- package/dist/standalone/computer.d.ts +4 -1
- package/dist/standalone/computer.js +28 -2
- package/dist/standalone/install-apps-cli.js +1 -1
- package/dist/standalone/media.d.ts +1 -1
- package/dist/standalone/registry.d.ts +3 -0
- package/dist/standalone/registry.js +1 -1
- package/docs/api/cloudflare.md +4 -1
- package/docs/api/mcp.md +52 -46
- package/package.json +17 -17
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The memory this process may use, in MiB: its cgroup limit when it has one,
|
|
3
|
+
* else the machine's. A Computer is a VM of 4, 8 or 16 GiB (or a 12 GiB
|
|
4
|
+
* container), so the build must read it rather than assume one.
|
|
5
|
+
*/
|
|
6
|
+
export declare function machineMemoryMib(): number;
|
|
7
|
+
/** The compiler heap ceiling: 4 GiB, or two thirds of a smaller machine. */
|
|
8
|
+
export declare function buildHeapMib(memoryMib: number): number;
|
|
9
|
+
/**
|
|
10
|
+
* How many builds fit at once: one per 6 GiB, at most two by default (a third
|
|
11
|
+
* is allowed only when asked for), at least one.
|
|
12
|
+
*/
|
|
13
|
+
export declare function defaultBuildConcurrency(memoryMib: number): number;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { totalmem } from "node:os";
|
|
2
|
+
const mebibyte = 1024 * 1024;
|
|
3
|
+
/** What one Bonsai-sized compile wants: a 4 GiB heap. */
|
|
4
|
+
const preferredHeapMib = 4096;
|
|
5
|
+
/** Heap plus pnpm and esbuild beside it: 4 GiB and 2 GiB. */
|
|
6
|
+
const memoryPerBuildMib = 6144;
|
|
7
|
+
/** Builds a machine runs at once unless the caller asks for more. */
|
|
8
|
+
const preferredBuildConcurrency = 2;
|
|
9
|
+
/**
|
|
10
|
+
* The memory this process may use, in MiB: its cgroup limit when it has one,
|
|
11
|
+
* else the machine's. A Computer is a VM of 4, 8 or 16 GiB (or a 12 GiB
|
|
12
|
+
* container), so the build must read it rather than assume one.
|
|
13
|
+
*/
|
|
14
|
+
export function machineMemoryMib() {
|
|
15
|
+
const constrained = process.constrainedMemory();
|
|
16
|
+
const bytes = constrained > 0 && constrained < totalmem() ? constrained : totalmem();
|
|
17
|
+
return Math.floor(bytes / mebibyte);
|
|
18
|
+
}
|
|
19
|
+
/** The compiler heap ceiling: 4 GiB, or two thirds of a smaller machine. */
|
|
20
|
+
export function buildHeapMib(memoryMib) {
|
|
21
|
+
return Math.min(preferredHeapMib, Math.floor((memoryMib * 2) / 3));
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* How many builds fit at once: one per 6 GiB, at most two by default (a third
|
|
25
|
+
* is allowed only when asked for), at least one.
|
|
26
|
+
*/
|
|
27
|
+
export function defaultBuildConcurrency(memoryMib) {
|
|
28
|
+
return Math.max(1, Math.min(preferredBuildConcurrency, Math.floor(memoryMib / memoryPerBuildMib)));
|
|
29
|
+
}
|
|
@@ -19604,6 +19604,11 @@ var appBackendBindingKinds = {
|
|
|
19604
19604
|
requires: ["computer.writeFile"],
|
|
19605
19605
|
effect: "write"
|
|
19606
19606
|
},
|
|
19607
|
+
mkdir: {
|
|
19608
|
+
cap: "app.computer.write",
|
|
19609
|
+
requires: ["computer.writeFile"],
|
|
19610
|
+
effect: "write"
|
|
19611
|
+
},
|
|
19607
19612
|
move: {
|
|
19608
19613
|
cap: "app.computer.write",
|
|
19609
19614
|
requires: ["computer.writeFile"],
|
|
@@ -22494,6 +22499,19 @@ import { join as join6 } from "node:path";
|
|
|
22494
22499
|
// src/build.ts
|
|
22495
22500
|
init_snapshot_program_scripts();
|
|
22496
22501
|
|
|
22502
|
+
// src/build/build-memory.ts
|
|
22503
|
+
import { totalmem } from "node:os";
|
|
22504
|
+
var mebibyte = 1024 * 1024;
|
|
22505
|
+
var preferredHeapMib = 4096;
|
|
22506
|
+
function machineMemoryMib() {
|
|
22507
|
+
const constrained = process.constrainedMemory();
|
|
22508
|
+
const bytes = constrained > 0 && constrained < totalmem() ? constrained : totalmem();
|
|
22509
|
+
return Math.floor(bytes / mebibyte);
|
|
22510
|
+
}
|
|
22511
|
+
function buildHeapMib(memoryMib) {
|
|
22512
|
+
return Math.min(preferredHeapMib, Math.floor(memoryMib * 2 / 3));
|
|
22513
|
+
}
|
|
22514
|
+
|
|
22497
22515
|
// src/build/process-group.ts
|
|
22498
22516
|
import { setTimeout as delay2 } from "node:timers/promises";
|
|
22499
22517
|
var CleanupError = class extends Error {
|
|
@@ -35742,13 +35760,12 @@ function runHtmlCommand(args2, cwd, env, command = "pnpm", onOutput) {
|
|
|
35742
35760
|
function snapshotPrograms() {
|
|
35743
35761
|
return Promise.resolve().then(() => (init_snapshot_program_scripts(), snapshot_program_scripts_exports));
|
|
35744
35762
|
}
|
|
35745
|
-
var snapshotBuildHeapMegabytes = 4096;
|
|
35746
35763
|
function snapshotBuildEnvironment(sourceSnapshotPath) {
|
|
35747
35764
|
const env = {
|
|
35748
35765
|
PATH: process.env.PATH ?? "/usr/bin:/bin",
|
|
35749
35766
|
HOME: join5(sourceSnapshotPath, ".publisher-home"),
|
|
35750
35767
|
NODE_ENV: "production",
|
|
35751
|
-
NODE_OPTIONS: `--max-old-space-size=${String(
|
|
35768
|
+
NODE_OPTIONS: `--max-old-space-size=${String(buildHeapMib(machineMemoryMib()))}`,
|
|
35752
35769
|
NODE_EXTRA_CA_CERTS: process.env.NODE_EXTRA_CA_CERTS,
|
|
35753
35770
|
SSL_CERT_FILE: process.env.SSL_CERT_FILE,
|
|
35754
35771
|
npm_config_userconfig: "/dev/null",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { buildHeapMib, machineMemoryMib } from "./build-memory.js";
|
|
1
2
|
import { CleanupError, stopProcessGroup } from "./process-group.js";
|
|
2
3
|
import { addAbortListener } from "node:events";
|
|
3
4
|
import { Buffer } from "node:buffer";
|
|
@@ -621,19 +622,17 @@ function runHtmlCommand(args, cwd, env, command = "pnpm", onOutput) {
|
|
|
621
622
|
function snapshotPrograms() {
|
|
622
623
|
return import("#snapshot-program-scripts");
|
|
623
624
|
}
|
|
624
|
-
/** Compiler heap ceiling: fits a 12 GiB Computer with two builds at once. */
|
|
625
|
-
const snapshotBuildHeapMegabytes = 4096;
|
|
626
625
|
function snapshotBuildEnvironment(sourceSnapshotPath) {
|
|
627
626
|
// PATH locates pinned executables; the Computer's CA files authenticate
|
|
628
627
|
// its egress gateway. Credentials and package-manager settings stay out.
|
|
629
628
|
// V8 sizes its default heap from the machine, about 3 GB in a 12 GiB
|
|
630
|
-
//
|
|
631
|
-
//
|
|
629
|
+
// Computer, where compiling Bonsai runs out; the build owns its ceiling
|
|
630
|
+
// instead, 4 GiB or two thirds of a smaller Computer (see build-memory.ts).
|
|
632
631
|
const env = {
|
|
633
632
|
PATH: process.env.PATH ?? "/usr/bin:/bin",
|
|
634
633
|
HOME: join(sourceSnapshotPath, ".publisher-home"),
|
|
635
634
|
NODE_ENV: "production",
|
|
636
|
-
NODE_OPTIONS: `--max-old-space-size=${String(
|
|
635
|
+
NODE_OPTIONS: `--max-old-space-size=${String(buildHeapMib(machineMemoryMib()))}`,
|
|
637
636
|
NODE_EXTRA_CA_CERTS: process.env.NODE_EXTRA_CA_CERTS,
|
|
638
637
|
SSL_CERT_FILE: process.env.SSL_CERT_FILE,
|
|
639
638
|
npm_config_userconfig: "/dev/null",
|
package/dist/cloudflare.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export type { BackgroundFrameState } from "./invocation.js";
|
|
|
4
4
|
import { WorkerEntrypoint } from "cloudflare:workers";
|
|
5
5
|
import { type GuestLimits } from "./guest-policy.js";
|
|
6
6
|
export type { GuestLimits } from "./guest-policy.js";
|
|
7
|
-
import type { ArtifactHeads, ArtifactStore, ArtifactStreams, VerifiedObjectCache } from "./release.js";
|
|
7
|
+
import type { ArtifactHeads, ArtifactDeletes, ArtifactStore, ArtifactStreams, VerifiedObjectCache } from "./release.js";
|
|
8
8
|
import { type AppBackendBindingName } from "@fungi.computer/puffball/app";
|
|
9
9
|
import { type InvocationFrame, type InvocationGate } from "./invocation.js";
|
|
10
10
|
import * as Schema from "effect/Schema";
|
|
@@ -22,7 +22,7 @@ import { AppInstanceError, type AppInstance, type InstancePorts } from "./index.
|
|
|
22
22
|
*/
|
|
23
23
|
export declare function edgeVerifiedObjectCache(cache: Pick<Cache, "match" | "put">, origin: string): VerifiedObjectCache;
|
|
24
24
|
/** Store Release artifacts without loading the Worker ownership barrel. */
|
|
25
|
-
export declare function r2ArtifactStore(bucket: R2Bucket): ArtifactStore & ArtifactHeads & ArtifactStreams;
|
|
25
|
+
export declare function r2ArtifactStore(bucket: R2Bucket): ArtifactStore & ArtifactHeads & ArtifactStreams & ArtifactDeletes;
|
|
26
26
|
/** Encode supervisor refusals before native RPC can discard Error properties. */
|
|
27
27
|
export declare function captureFrameBindingReply<Value>(run: () => Promise<Value>): Promise<FrameBindingReply<Value>>;
|
|
28
28
|
/** Retained shard reply ceiling; replies settle before the frame aborts its facet. */
|
package/dist/cloudflare.js
CHANGED
|
@@ -109,6 +109,9 @@ export function r2ArtifactStore(bucket) {
|
|
|
109
109
|
async put(artifactRef, bytes) {
|
|
110
110
|
await bucket.put(artifactRef, bytes);
|
|
111
111
|
},
|
|
112
|
+
async delete(artifactRef) {
|
|
113
|
+
await bucket.delete(artifactRef);
|
|
114
|
+
},
|
|
112
115
|
};
|
|
113
116
|
}
|
|
114
117
|
/** Encode supervisor refusals before native RPC can discard Error properties. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { z } from "zod";
|
|
2
|
+
import type { ComputerSize } from "@fungi.computer/computer/backing";
|
|
2
3
|
import type { computerCreateRequestSchema, computerPageSchema } from "@fungi.computer/computer/fleet/inventory-wire";
|
|
3
4
|
import type { computerBackendViewSchema, computerStateSchema, LocalBackendAttachInput } from "@fungi.computer/computer/fleet/wire";
|
|
4
5
|
import type { teamComputerDirectorySchema } from "@fungi.computer/nacre/workbench";
|
|
@@ -19,6 +20,7 @@ export type ComputerControlPort = Readonly<{
|
|
|
19
20
|
computer: {
|
|
20
21
|
computerId: string;
|
|
21
22
|
name: string;
|
|
23
|
+
size: ComputerSize;
|
|
22
24
|
};
|
|
23
25
|
} | {
|
|
24
26
|
kind: "uncertain" | "denied" | "conflict" | "invalid";
|