@fungi.computer/computer 0.2.0 → 0.2.2

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 (2) hide show
  1. package/dist/files.js +15 -3
  2. package/package.json +6 -6
package/dist/files.js CHANGED
@@ -1,5 +1,5 @@
1
- import { WorkspaceFileStore } from "@fungi.computer/cloudflare-computer/tools";
2
1
  import { posix } from "node:path";
2
+ import { z } from "zod";
3
3
  import { SearchVisibility } from "@fungi.computer/knapsack/files-search";
4
4
  import { imageReadResult, imageSniffBytes, imageTooLargeMessage, maximumImageBytes, sniffImageMimeType, } from "@fungi.computer/knapsack/files-read";
5
5
  import { replaceOutputSchema, } from "@fungi.computer/computer-contract";
@@ -203,13 +203,25 @@ function workspacePath(path) {
203
203
  return "/";
204
204
  return path.startsWith("/") ? path : `/${path}`;
205
205
  }
206
+ const missingSchema = z.object({ code: z.literal("ENOENT") });
207
+ /** A regular file's stat, or null when the path is absent or not a file. */
208
+ async function fileStat(workspace, path) {
209
+ try {
210
+ const stat = await workspace.fs.stat(path);
211
+ return stat.isFile ? stat : null;
212
+ }
213
+ catch (error) {
214
+ if (missingSchema.safeParse(error).success)
215
+ return null;
216
+ throw error;
217
+ }
218
+ }
206
219
  /** Storage adapter only; shared Files policy owns visibility and grammar. */
207
220
  function workspaceSearchVisibility(workspace) {
208
- const store = new WorkspaceFileStore(workspace);
209
221
  let bytes = 0;
210
222
  return new SearchVisibility(async (directory) => {
211
223
  const path = posix.join("/", directory, ".gitignore");
212
- const stat = await store.stat(path);
224
+ const stat = await fileStat(workspace, path);
213
225
  if (stat !== null) {
214
226
  // Match Local's bounded text reads; never silently omit unreadable rules.
215
227
  if (stat.size > 128 * 1_024 || bytes + stat.size > 64 * 1_024 * 1_024)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/computer",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "author": "Levi <levi@technomancy.dev>",
5
5
  "description": "Cloudflare Computer host for one durable Fungi Computer",
6
6
  "type": "module",
@@ -54,12 +54,12 @@
54
54
  "dependencies": {
55
55
  "@fungi.computer/cairn": "0.1.0",
56
56
  "@fungi.computer/capnweb": "0.12.0",
57
- "@fungi.computer/cloudflare-computer": "0.2.1-fungi.1",
58
- "@fungi.computer/cordyceps": "0.3.0",
59
- "@fungi.computer/knapsack": "0.2.0",
57
+ "@fungi.computer/cloudflare-computer": "0.2.1-fungi.2",
58
+ "@fungi.computer/cordyceps": "0.3.1",
59
+ "@fungi.computer/knapsack": "0.2.1",
60
60
  "@fungi.computer/seam": "0.1.0",
61
61
  "@fungi.computer/watchdog": "0.1.0",
62
- "@fungi.computer/computer-contract": "0.0.1",
62
+ "@fungi.computer/computer-contract": "0.0.2",
63
63
  "effect": "4.0.2",
64
64
  "just-bash": "3.4.2",
65
65
  "zod": "4.4.3"
@@ -107,7 +107,7 @@
107
107
  "build": "pnpm run clean && tsc -p tsconfig.build.json && node scripts/copy-daemon.mjs",
108
108
  "build:native": "fungi-apply-patch-build --out native/bin",
109
109
  "clean": "node --input-type=module --eval \"import { rm } from 'node:fs/promises'; await rm('dist', { recursive: true, force: true });\"",
110
- "test": "pnpm run test:unit && pnpm run test:fleet-native && node test/port-proof.mjs && node test/terminal-container-proof.mjs && node test/fuse-startup-proof.mjs && node test/container-resource-proof.mjs && node test/runtime-proof.mjs && node test/process-schema-proof.mjs && node test/process-proof.mjs && node test/terminal-proof.mjs && pnpm run test:app-method-execution && pnpm run test:execution-lifecycle",
110
+ "test": "pnpm run test:unit && pnpm run test:fleet-native && node test/files-rpc.native.mjs && node test/port-proof.mjs && node test/terminal-container-proof.mjs && node test/fuse-startup-proof.mjs && node test/container-resource-proof.mjs && node test/runtime-proof.mjs && node test/process-schema-proof.mjs && node test/process-proof.mjs && node test/terminal-proof.mjs && pnpm run test:app-method-execution && pnpm run test:execution-lifecycle",
111
111
  "format:check": "node ../../tooling/repository/scripts/format-package-check.mjs",
112
112
  "lint:anti-slop": "node ../../tooling/repository/scripts/lint-package-anti-slop.mjs",
113
113
  "test:merge": "pnpm run test",