@fungi.computer/oyster 0.25.0 → 0.27.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.
Files changed (49) hide show
  1. package/dist/agents.d.ts +24 -8
  2. package/dist/agents.js +12 -5
  3. package/dist/app-builds.d.ts +4 -2
  4. package/dist/app-builds.js +14 -0
  5. package/dist/apps/catalog.js +1 -1
  6. package/dist/boot-host-script.js +1 -1
  7. package/dist/build/build-memory.d.ts +13 -0
  8. package/dist/build/build-memory.js +29 -0
  9. package/dist/build/candidate-cli.mjs +25 -2
  10. package/dist/build/local-build.js +4 -5
  11. package/dist/cloudflare.d.ts +2 -2
  12. package/dist/cloudflare.js +3 -0
  13. package/dist/computer-control-port.d.ts +2 -0
  14. package/dist/embed-metafiles.js +2 -2
  15. package/dist/embed-scripts.js +1 -1
  16. package/dist/hello-app-script.js +1 -1
  17. package/dist/mcp.d.ts +26 -0
  18. package/dist/mcp.js +12 -2
  19. package/dist/media.d.ts +5 -0
  20. package/dist/media.js +1 -0
  21. package/dist/page-script.js +2 -2
  22. package/dist/release.d.ts +5 -0
  23. package/dist/standalone/agent-computers.js +17 -1
  24. package/dist/standalone/agents.d.ts +16 -8
  25. package/dist/standalone/agents.js +88 -25
  26. package/dist/standalone/app-set.d.ts +11 -3
  27. package/dist/standalone/app-set.js +26 -8
  28. package/dist/standalone/computer-control.js +7 -1
  29. package/dist/standalone/computer-fleet.d.ts +6 -0
  30. package/dist/standalone/computer-fleet.js +9 -1
  31. package/dist/standalone/computer-skill-source.d.ts +20 -0
  32. package/dist/standalone/computer-skill-source.js +165 -0
  33. package/dist/standalone/computer.d.ts +30 -4
  34. package/dist/standalone/computer.js +60 -3
  35. package/dist/standalone/install-apps-cli.js +9 -3
  36. package/dist/standalone/media.d.ts +9 -4
  37. package/dist/standalone/media.js +76 -7
  38. package/dist/standalone/registry.d.ts +8 -1
  39. package/dist/standalone/registry.js +10 -1
  40. package/docs/api/agents.md +204 -214
  41. package/docs/api/apps.md +33 -33
  42. package/docs/api/cloudflare.md +4 -1
  43. package/docs/api/mcp.md +52 -46
  44. package/docs/api/media.md +4 -0
  45. package/docs/api/workers-git.md +7 -7
  46. package/examples/standalone/wrangler.jsonc +3 -0
  47. package/package.json +19 -23
  48. package/dist/agent-instructions.d.ts +0 -35
  49. package/dist/agent-instructions.js +0 -42
@@ -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
+ }
@@ -19599,11 +19599,21 @@ 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"],
19605
19610
  effect: "write"
19606
19611
  },
19612
+ mkdir: {
19613
+ cap: "app.computer.write",
19614
+ requires: ["computer.writeFile"],
19615
+ effect: "write"
19616
+ },
19607
19617
  move: {
19608
19618
  cap: "app.computer.write",
19609
19619
  requires: ["computer.writeFile"],
@@ -22285,6 +22295,7 @@ var symbols = {
22285
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)" })] }),
22286
22296
  write: (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [(0, import_jsx_runtime4.jsx)(Pencil, {}), (0, import_jsx_runtime4.jsx)(InkTrail, {})] }),
22287
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" }),
22288
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" })] }),
22289
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" })] }),
22290
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" })] }),
@@ -22494,6 +22505,19 @@ import { join as join6 } from "node:path";
22494
22505
  // src/build.ts
22495
22506
  init_snapshot_program_scripts();
22496
22507
 
22508
+ // src/build/build-memory.ts
22509
+ import { totalmem } from "node:os";
22510
+ var mebibyte = 1024 * 1024;
22511
+ var preferredHeapMib = 4096;
22512
+ function machineMemoryMib() {
22513
+ const constrained = process.constrainedMemory();
22514
+ const bytes = constrained > 0 && constrained < totalmem() ? constrained : totalmem();
22515
+ return Math.floor(bytes / mebibyte);
22516
+ }
22517
+ function buildHeapMib(memoryMib) {
22518
+ return Math.min(preferredHeapMib, Math.floor(memoryMib * 2 / 3));
22519
+ }
22520
+
22497
22521
  // src/build/process-group.ts
22498
22522
  import { setTimeout as delay2 } from "node:timers/promises";
22499
22523
  var CleanupError = class extends Error {
@@ -35742,13 +35766,12 @@ function runHtmlCommand(args2, cwd, env, command = "pnpm", onOutput) {
35742
35766
  function snapshotPrograms() {
35743
35767
  return Promise.resolve().then(() => (init_snapshot_program_scripts(), snapshot_program_scripts_exports));
35744
35768
  }
35745
- var snapshotBuildHeapMegabytes = 4096;
35746
35769
  function snapshotBuildEnvironment(sourceSnapshotPath) {
35747
35770
  const env = {
35748
35771
  PATH: process.env.PATH ?? "/usr/bin:/bin",
35749
35772
  HOME: join5(sourceSnapshotPath, ".publisher-home"),
35750
35773
  NODE_ENV: "production",
35751
- NODE_OPTIONS: `--max-old-space-size=${String(snapshotBuildHeapMegabytes)}`,
35774
+ NODE_OPTIONS: `--max-old-space-size=${String(buildHeapMib(machineMemoryMib()))}`,
35752
35775
  NODE_EXTRA_CA_CERTS: process.env.NODE_EXTRA_CA_CERTS,
35753
35776
  SSL_CERT_FILE: process.env.SSL_CERT_FILE,
35754
35777
  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
- // standard-4 Computer, where compiling Bonsai runs out; the build owns one
631
- // fixed ceiling instead.
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(snapshotBuildHeapMegabytes)}`,
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",
@@ -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. */
@@ -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";