@fungi.computer/oyster 0.51.0 → 0.52.1

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.
@@ -0,0 +1,5 @@
1
+ import type { HostPageOptions } from "./host-page.js";
2
+ /** Render one host page, loading the renderer on first use. */
3
+ export declare function renderHostPage(options: HostPageOptions): Promise<Response>;
4
+ /** Serve one content-addressed host page asset, loading the renderer on first use. */
5
+ export declare function serveHostPageAsset(path: string): Promise<Response>;
@@ -0,0 +1,15 @@
1
+ import { loadLazily } from "./lazy-import.js";
2
+ // The page renderer brings React's server renderer, the Caps components and
3
+ // their animation library. Only a request that renders a page needs them, so
4
+ // Worker startup does not evaluate them; the first page loads them.
5
+ const renderer = "Oyster's host page renderer";
6
+ /** Render one host page, loading the renderer on first use. */
7
+ export async function renderHostPage(options) {
8
+ const render = await loadLazily(() => import("./host-page.js").then(({ hostPage }) => hostPage), renderer);
9
+ return render(options);
10
+ }
11
+ /** Serve one content-addressed host page asset, loading the renderer on first use. */
12
+ export async function serveHostPageAsset(path) {
13
+ const serve = await loadLazily(() => import("./host-page.js").then(({ hostPageAsset }) => hostPageAsset), renderer);
14
+ return serve(path);
15
+ }
package/dist/host.js CHANGED
@@ -40,7 +40,7 @@ import { buildGitPassPrefix, presentedGitKey } from "./git-auth.js";
40
40
  import { workflowGitPassPrefix } from "@fungi.computer/braid/runtime";
41
41
  import { loadPageAssets, PageAssetsLoadError, } from "./page-assets.js";
42
42
  import { fungiFaviconHref } from "@fungi.computer/sigils/favicon";
43
- import { hostPage, hostPageAsset } from "./host-page.js";
43
+ import { renderHostPage, serveHostPageAsset } from "./host-page-lazy.js";
44
44
  import { parseAccept } from "hono/utils/accept";
45
45
  import { parseArtifactRef } from "@fungi.computer/puffball";
46
46
  import { isBuildJobLogRef } from "./build/job-log.js";
@@ -377,14 +377,14 @@ export function oysterRouteTable(host) {
377
377
  });
378
378
  const page = async (state, options = {}) => {
379
379
  const { loginFonts, styles } = await assets();
380
- return hostPage({
380
+ return renderHostPage({
381
381
  state,
382
382
  title,
383
383
  stylesheets: [styles.path, loginFonts.path],
384
384
  ...options,
385
385
  });
386
386
  };
387
- table.get("/_oyster/host-assets/*", publicRoute("content-addressed host illustrations and layout"), (context) => hostPageAsset(new URL(context.req.url).pathname));
387
+ table.get("/_oyster/host-assets/*", publicRoute("content-addressed host illustrations and layout"), (context) => serveHostPageAsset(new URL(context.req.url).pathname));
388
388
  table.get("/login", publicRoute("the sign-in form"), (context) => page("login", {
389
389
  returning: getCookie(context, returningCookieName) === "1",
390
390
  usedLink: context.req.query("link") === "used",
@@ -1114,7 +1114,7 @@ export function oysterRouteTable(host) {
1114
1114
  headers: { "Cache-Control": "no-store" },
1115
1115
  });
1116
1116
  const pageAssets = await assets();
1117
- const response = await hostPage({
1117
+ const response = await renderHostPage({
1118
1118
  state: "permissions",
1119
1119
  title,
1120
1120
  stylesheets: [pageAssets.loginFonts.path, pageAssets.styles.path],
@@ -1610,7 +1610,11 @@ export function oysterRouteTable(host) {
1610
1610
  if (!(cause instanceof PageAssetsLoadError))
1611
1611
  throw cause;
1612
1612
  console.error("Host page assets unavailable; serving recovery document", cause);
1613
- rendered = await hostPage({ state, title, status: response.status });
1613
+ rendered = await renderHostPage({
1614
+ state,
1615
+ title,
1616
+ status: response.status,
1617
+ });
1614
1618
  }
1615
1619
  // Keep timing, robots and retry metadata from the original refusal.
1616
1620
  response.headers.forEach((value, name) => {
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Load a module on first use. A failed load (a missing chunk, a corrupt
3
+ * bundle) is reported as the feature that could not start, with the loader's
4
+ * own error as the cause, instead of a bare module-resolution message.
5
+ */
6
+ export declare function loadLazily<Loaded>(load: () => Promise<Loaded>, what: string): Promise<Loaded>;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Load a module on first use. A failed load (a missing chunk, a corrupt
3
+ * bundle) is reported as the feature that could not start, with the loader's
4
+ * own error as the cause, instead of a bare module-resolution message.
5
+ */
6
+ export async function loadLazily(load, what) {
7
+ try {
8
+ return await load();
9
+ }
10
+ catch (cause) {
11
+ throw new Error(`${what} failed to load`, { cause });
12
+ }
13
+ }
@@ -1789,7 +1789,10 @@ export class AgentDirectory extends DurableObject {
1789
1789
  const ownerKey = key === undefined
1790
1790
  ? crypto.getRandomValues(new Uint8Array(32))
1791
1791
  : Result.getOrElse(decodeBase64Url(key), () => new Uint8Array(0));
1792
- return createFingerprintSet(ownerKey, [...values]);
1792
+ // The set goes only to this Oyster's own Agents, which run in the same
1793
+ // Worker that holds the values, so it may carry short-prefix fingerprints:
1794
+ // live output then waits only on text that begins a stored value.
1795
+ return createFingerprintSet(ownerKey, [...values], { prefixes: true });
1793
1796
  }
1794
1797
  mcpOwner;
1795
1798
  /** Loaded on the first MCP request: the SDK and OpenAPI decoders stay out of startup. */
@@ -397,6 +397,8 @@ export class ComputerDO extends NativeComputerDO {
397
397
  accept: (ownerId) => {
398
398
  this.#accept(this.#previewGrant(ownerId), "listPorts");
399
399
  },
400
+ isOwner: async (ownerId) => (await (await standaloneTenancy(this.previewBindings)).owner())?.actor
401
+ .memberId === ownerId,
400
402
  forward: (port, request, accept) => this.portPreviewAfterAcceptance(port, request, accept),
401
403
  });
402
404
  return this.#preview;
@@ -33,6 +33,8 @@ export declare class PreviewRefused extends Error {
33
33
  }
34
34
  export type PreviewNative = Readonly<{
35
35
  accept: (ownerId: string) => void;
36
+ /** Whether this member ID is still the Oyster's owner. */
37
+ isOwner: (ownerId: string) => Promise<boolean>;
36
38
  forward: (port: number, request: Request, accept: () => void) => Promise<Response>;
37
39
  }>;
38
40
  export declare function createStandalonePreview(storage: ConstructorParameters<typeof ComputerPortAccess>[0], computerId: string, origins: PreviewOrigins, native: PreviewNative): {
@@ -78,7 +78,13 @@ function entryUrl(origins, computerId, port) {
78
78
  return new URL(`/computers/${encodeURIComponent(computerId)}/ports/${String(port)}`, origins.owner).href;
79
79
  }
80
80
  export function createStandalonePreview(storage, computerId, origins, native) {
81
- const access = new ComputerPortAccess(storage);
81
+ // A preview session names the owner who opened it; it ends when that
82
+ // member is no longer the owner.
83
+ const access = new ComputerPortAccess(storage, {
84
+ admitted: (principal) => "ownerId" in principal
85
+ ? native.isOwner(principal.ownerId)
86
+ : Promise.resolve(false),
87
+ });
82
88
  const issueOwner = async (ownerId, port) => {
83
89
  const target = previewUrl(origins, computerId, port);
84
90
  const token = await access.issue(port, { ownerId }, () => {
@@ -5,9 +5,12 @@
5
5
  "main": "worker.ts",
6
6
  "compatibility_date": "2026-09-04",
7
7
  "compatibility_flags": ["nodejs_compat"],
8
- // The unminified bundle can exceed Cloudflare's Worker startup CPU limit
9
- // (error 10021) on some accounts.
8
+ // The unminified bundle exceeds Cloudflare's Worker startup CPU limit
9
+ // (error 10021) on some accounts, and preserving names adds a call to every
10
+ // function and class the bundle declares. Startup pays for both.
10
11
  "minify": true,
12
+ "keep_names": false,
13
+ "upload_source_maps": true,
11
14
  "workers_dev": true,
12
15
  "preview_urls": false,
13
16
  "observability": { "enabled": true },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/oyster",
3
- "version": "0.51.0",
3
+ "version": "0.52.1",
4
4
  "author": "Levi <levi@technomancy.dev>",
5
5
  "description": "Oyster by Fungi: open-source Apps for people and AI agents. Try with one command or run on your own Cloudflare account.",
6
6
  "homepage": "https://docs.fungi.computer/oyster",
@@ -370,8 +370,8 @@
370
370
  "@fungi.computer/capnweb": "0.12.0-fungi.0",
371
371
  "@fungi.computer/caps": "0.12.3",
372
372
  "@fungi.computer/carrier": "0.2.5",
373
- "@fungi.computer/computer": "0.16.5",
374
- "@fungi.computer/computer-contract": "0.5.10",
373
+ "@fungi.computer/computer": "0.16.6",
374
+ "@fungi.computer/computer-contract": "0.5.11",
375
375
  "@fungi.computer/darkroom": "0.11.13",
376
376
  "@fungi.computer/ear-tag": "0.1.0",
377
377
  "@fungi.computer/forage": "0.4.0",
@@ -380,19 +380,19 @@
380
380
  "@fungi.computer/lantern": "0.4.2",
381
381
  "@fungi.computer/mycelium": "0.4.8",
382
382
  "@fungi.computer/nacre": "0.8.7",
383
- "@fungi.computer/parakeet": "0.16.6",
383
+ "@fungi.computer/parakeet": "0.16.7",
384
384
  "@fungi.computer/puffball": "0.13.0",
385
385
  "@fungi.computer/seam": "0.2.6",
386
- "@fungi.computer/shiitake": "0.21.14",
387
- "@fungi.computer/shiitake-extensions": "0.12.3",
386
+ "@fungi.computer/shiitake": "0.21.15",
387
+ "@fungi.computer/shiitake-extensions": "0.12.4",
388
388
  "@fungi.computer/sigils": "0.3.2",
389
389
  "@fungi.computer/sprite": "0.2.2",
390
390
  "@fungi.computer/sprite-zdog": "0.3.2",
391
- "@fungi.computer/veil": "0.11.4",
391
+ "@fungi.computer/veil": "0.11.5",
392
392
  "@fungi.computer/watchdog": "0.1.4",
393
393
  "@fungi.computer/whistle": "0.3.0",
394
394
  "@fungi.computer/workflows-wire": "0.7.5",
395
- "@fungi.computer/zookeeper": "0.0.56",
395
+ "@fungi.computer/zookeeper": "0.0.57",
396
396
  "@jellybrick/dbus-next": "0.11.4",
397
397
  "@modelcontextprotocol/server": "2.0.0",
398
398
  "@msgpack/msgpack": "3.1.3",
@@ -414,6 +414,9 @@
414
414
  "wrangler": "4.159.0",
415
415
  "tldts": "7.4.11"
416
416
  },
417
+ "engines": {
418
+ "node": ">=24"
419
+ },
417
420
  "license": "MIT",
418
421
  "peerDependencies": {
419
422
  "react": "^18.3.1 || ^19.2.0",