@fungi.computer/oyster 0.19.12 → 0.19.14

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 CHANGED
@@ -34,9 +34,10 @@ in the launcher; the page it opens reads **Hello from my first Oyster App**.
34
34
 
35
35
  Once the desktop is up, `try` keeps building the other starter Apps from their
36
36
  public sources in the background, one at a time, and prints a line for each:
37
- Grove, Prints, Inkcap, Trellis and Bonsai run fully on your computer; Shed
38
- installs but needs a Computer runtime that a trial does not have. Running `try`
39
- again leaves installed Apps untouched.
37
+ Grove, Prints, Inkcap, Trellis and Bonsai run fully on your computer. Truffle,
38
+ installed with Oyster, attaches the trial’s `computer/` folder so Shed can run
39
+ commands when the local sandbox is available. Running `try` again leaves
40
+ installed Apps untouched.
40
41
 
41
42
  The owner key is saved in `my-oyster/.oyster-owner` and never printed. Press
42
43
  Ctrl-C to stop, and run the same command again in `my-oyster` to restart.
@@ -7,7 +7,7 @@ const readRuntimeStatus = Schema.decodeUnknownOption(Schema.fromJsonString(Schem
7
7
  class TrialComputerUnavailable extends Error {
8
8
  code = "no_runtime";
9
9
  constructor() {
10
- super("Install the Truffle local runtime and make fungi-local-computer available on PATH, then restart oyster try.");
10
+ super("The Truffle local runtime could not start. Check its installation and local sandbox, then restart oyster try.");
11
11
  this.name = "TrialComputerUnavailable";
12
12
  }
13
13
  }
@@ -16,9 +16,8 @@ export async function startTrialComputer(input) {
16
16
  const folder = join(input.directory, "computer");
17
17
  await mkdir(folder, { recursive: true });
18
18
  input.signal.throwIfAborted();
19
- const child = spawn(process.env.FUNGI_LOCAL_COMPUTER ?? "fungi-local-computer", ["attach"], {
20
- stdio: ["pipe", "pipe", "ignore"],
21
- });
19
+ const child = spawn(process.env.FUNGI_LOCAL_COMPUTER ??
20
+ join(input.directory, "node_modules", ".bin", "fungi-local-computer"), ["attach"], { stdio: ["pipe", "pipe", "ignore"] });
22
21
  const online = Promise.withResolvers();
23
22
  const closed = Promise.withResolvers();
24
23
  const unavailable = () => {
@@ -80,4 +80,14 @@ export type TryEffects = Readonly<{
80
80
  export type Manager = "npm" | "pnpm";
81
81
  /** pnpm when it ran this command (`pnpm dlx`), otherwise npm. */
82
82
  export declare function detectManager(userAgent: string | undefined): "pnpm" | "npm";
83
+ /**
84
+ * `wrangler dev` for one local Oyster. The devtools inspector takes a port the
85
+ * kernel assigns (0): wrangler's default probes 9229 upward and binds it later,
86
+ * so two Oysters (or any wrangler dev) starting together could both pick the
87
+ * same port and one failed with "Address already in use".
88
+ */
89
+ export declare function wranglerDevArguments(input: {
90
+ port: number;
91
+ key: string;
92
+ }): readonly string[];
83
93
  export declare function tryOyster(args: readonly string[], effects?: TryEffects, ui?: Cli, callerSignal?: AbortSignal): Promise<void>;
@@ -157,6 +157,7 @@ function projectManifest(own, spec) {
157
157
  const dependencies = {
158
158
  "@fungi.computer/oyster": spec ?? own.version,
159
159
  "@fungi.computer/computer": own.dependencies["@fungi.computer/computer"] ?? "latest",
160
+ "@fungi.computer/truffle": "latest",
160
161
  react: "^19.2.0",
161
162
  "react-dom": "^19.2.0",
162
163
  // Building the desktop here needs this exact pnpm, whatever the caller uses.
@@ -387,6 +388,32 @@ async function waitUntilReady(url, child, timeoutMs, signal) {
387
388
  }
388
389
  return signal.aborted ? "exited" : "timeout";
389
390
  }
391
+ /**
392
+ * `wrangler dev` for one local Oyster. The devtools inspector takes a port the
393
+ * kernel assigns (0): wrangler's default probes 9229 upward and binds it later,
394
+ * so two Oysters (or any wrangler dev) starting together could both pick the
395
+ * same port and one failed with "Address already in use".
396
+ */
397
+ export function wranglerDevArguments(input) {
398
+ const url = `http://127.0.0.1:${String(input.port)}`;
399
+ return [
400
+ "dev",
401
+ "--local",
402
+ "--enable-containers=false",
403
+ "--ip",
404
+ "127.0.0.1",
405
+ "--port",
406
+ String(input.port),
407
+ "--inspector-port",
408
+ "0",
409
+ "--var",
410
+ `OYSTER_OWNER_KEY:${input.key}`,
411
+ "--var",
412
+ `OYSTER_ORIGIN:${url}`,
413
+ "--var",
414
+ "OYSTER_COMPUTER_BACKEND:local",
415
+ ];
416
+ }
390
417
  function startWrangler(input) {
391
418
  return (async () => {
392
419
  input.signal.throwIfAborted();
@@ -399,22 +426,7 @@ function startWrangler(input) {
399
426
  const logStream = createWriteStream(log);
400
427
  const logClosed = Promise.allSettled([finished(logStream)]);
401
428
  const url = `http://127.0.0.1:${String(input.port)}`;
402
- const child = spawn(process.execPath, [
403
- wrangler,
404
- "dev",
405
- "--local",
406
- "--enable-containers=false",
407
- "--ip",
408
- "127.0.0.1",
409
- "--port",
410
- String(input.port),
411
- "--var",
412
- `OYSTER_OWNER_KEY:${input.key}`,
413
- "--var",
414
- `OYSTER_ORIGIN:${url}`,
415
- "--var",
416
- "OYSTER_COMPUTER_BACKEND:local",
417
- ], {
429
+ const child = spawn(process.execPath, [wrangler, ...wranglerDevArguments({ port: input.port, key: input.key })], {
418
430
  cwd: input.directory,
419
431
  detached: process.platform !== "win32",
420
432
  signal: input.signal,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/oyster",
3
- "version": "0.19.12",
3
+ "version": "0.19.14",
4
4
  "author": "Levi <levi@technomancy.dev>",
5
5
  "description": "Run your own Apps on Cloudflare Workers or celld: installable App Releases, each with its own Durable Object, SQLite database and declared bindings",
6
6
  "type": "module",