@fungi.computer/oyster 0.30.1 → 0.31.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/r2-files.js CHANGED
@@ -59,6 +59,9 @@ export function r2FileSource(bucket, prefix) {
59
59
  async write(path, content) {
60
60
  await bucket.put(key(path), content);
61
61
  },
62
+ async delete(path) {
63
+ await bucket.delete(key(path));
64
+ },
62
65
  async mkdir(path) {
63
66
  await bucket.put(dirKey(path), new Uint8Array());
64
67
  },
@@ -8,7 +8,7 @@ import * as z from "zod";
8
8
  import { computerProcessSchema, computerToolResultSchema, readOutputSchema } from "@fungi.computer/computer-contract";
9
9
  import { ComputerDO as NativeComputerDO, type AttachedBackend, type ComputerEnv, type ComputerFilesRpc } from "@fungi.computer/computer";
10
10
  import { patchInputSchema, patchOutputSchema } from "@fungi.computer/knapsack/files-patch";
11
- import { listOutputSchema, writeOutputSchema, mkdirOutputSchema, moveOutputSchema, computerPortsOutputSchema, computerPortOutputSchema, computerPortRemovalOutputSchema, processListOutputSchema, processKillOutputSchema, processLogsOutputSchema, processWaitOutputSchema, computerOperationResultSchema, type ComputerExecutionHostHooks, type ComputerValue } from "@fungi.computer/computer-contract";
11
+ import { listOutputSchema, writeOutputSchema, mkdirOutputSchema, moveOutputSchema, removeOutputSchema, computerPortsOutputSchema, computerPortOutputSchema, computerPortRemovalOutputSchema, processListOutputSchema, processKillOutputSchema, processLogsOutputSchema, processWaitOutputSchema, computerOperationResultSchema, type ComputerExecutionHostHooks, type ComputerValue } from "@fungi.computer/computer-contract";
12
12
  import { type WorkflowGitCredential, type WorkflowGitPassGrant } from "@fungi.computer/braid/runtime";
13
13
  import { type ComputerAction, type ComputerBackendView, type ComputerGrant, type LocalBackendAttachInput, type LocalBackendDetachInput } from "@fungi.computer/computer/fleet";
14
14
  import type { InvocationFrame } from "../invocation.js";
@@ -42,7 +42,7 @@ export type StandaloneComputerResult = z.output<typeof listOutputSchema> | Reado
42
42
  truncated: boolean;
43
43
  }> | Readonly<{
44
44
  error: "conflict" | "no_runtime" | "not_found" | "invalid";
45
- }> | z.output<typeof writeOutputSchema> | z.output<typeof moveOutputSchema> | z.output<typeof mkdirOutputSchema> | z.output<typeof computerPortsOutputSchema> | z.output<typeof computerPortOutputSchema> | z.output<typeof computerPortRemovalOutputSchema> | z.output<typeof processListOutputSchema> | z.output<typeof processKillOutputSchema> | z.output<typeof processLogsOutputSchema> | z.output<typeof processWaitOutputSchema> | z.output<typeof computerProcessSchema> | ComputerPorts["ports"][number] | z.output<typeof computerOperationResultSchema> | z.output<typeof readOutputSchema> | z.output<typeof computerToolResultSchema>;
45
+ }> | z.output<typeof writeOutputSchema> | z.output<typeof moveOutputSchema> | z.output<typeof removeOutputSchema> | z.output<typeof mkdirOutputSchema> | z.output<typeof computerPortsOutputSchema> | z.output<typeof computerPortOutputSchema> | z.output<typeof computerPortRemovalOutputSchema> | z.output<typeof processListOutputSchema> | z.output<typeof processKillOutputSchema> | z.output<typeof processLogsOutputSchema> | z.output<typeof processWaitOutputSchema> | z.output<typeof computerProcessSchema> | ComputerPorts["ports"][number] | z.output<typeof computerOperationResultSchema> | z.output<typeof readOutputSchema> | z.output<typeof computerToolResultSchema>;
46
46
  /**
47
47
  * A port-preview listing, or the typed refusal the owner route presents with
48
48
  * {@link appMethodRefusalStatus}. A refusal never escapes as a 500.
@@ -207,6 +207,8 @@ export declare class ComputerDO extends NativeComputerDO implements ComputerFetc
207
207
  /** Binary files share the same native filesystem as commands and PTYs. */
208
208
  fileRead(authority: ComputerGrant, path: string): Promise<Uint8Array | null>;
209
209
  fileWrite(authority: ComputerGrant, path: string, bytes: Uint8Array): Promise<void>;
210
+ /** Delete one file; a path that is already absent is already deleted. */
211
+ fileDelete(authority: ComputerGrant, path: string): Promise<void>;
210
212
  /** Patch is handled by the Computer's pinned native engine, not by the Agent. */
211
213
  filePatch(authority: ComputerGrant, input: z.output<typeof patchInputSchema>): Promise<z.output<typeof patchOutputSchema>>;
212
214
  fileReplace(authority: ComputerGrant, path: string, expectedContent: string | null, content: string): Promise<{
@@ -12,7 +12,7 @@ import * as z from "zod";
12
12
  import { ComputerPortConflictError, computerByteReadReplySchema, computerProcessSchema, installationProcessScope, processStartInputSchema, processStartToolInputSchema, computerCapabilities, computerToolResultSchema, readOutputSchema, } from "@fungi.computer/computer-contract";
13
13
  import { ComputerDO as NativeComputerDO, ComputerOperationConflictError, ComputerBackendUnavailableError, } from "@fungi.computer/computer";
14
14
  import { patchInputSchema, patchOutputSchema, } from "@fungi.computer/knapsack/files-patch";
15
- import { ComputerFileConflict, ComputerFileMoveError, computerExecutionRequestSchema, computerValueSchema, computerPortInputSchema, listInputSchema, listOutputSchema, readBytesInputSchema, writeInputSchema, replaceInputSchema, writeOutputSchema, mkdirOutputSchema, moveInputSchema, moveOutputSchema, computerPortsOutputSchema, computerPortOutputSchema, computerPortRemovalOutputSchema, processListOutputSchema, processKillOutputSchema, processLogsInputSchema, processWaitInputSchema, processLogsOutputSchema, processWaitOutputSchema, computerOperationResultSchema, mintComputerRequestId, processIdInputSchema, } from "@fungi.computer/computer-contract";
15
+ import { ComputerFileConflict, ComputerFileMoveError, ComputerFileRemoveError, computerExecutionRequestSchema, computerValueSchema, computerPortInputSchema, listInputSchema, listOutputSchema, readBytesInputSchema, writeInputSchema, replaceInputSchema, writeOutputSchema, mkdirOutputSchema, moveInputSchema, moveOutputSchema, removeOutputSchema, computerPortsOutputSchema, computerPortOutputSchema, computerPortRemovalOutputSchema, processListOutputSchema, processKillOutputSchema, processLogsInputSchema, processWaitInputSchema, processLogsOutputSchema, processWaitOutputSchema, computerOperationResultSchema, mintComputerRequestId, processIdInputSchema, } from "@fungi.computer/computer-contract";
16
16
  import { workflowGitExecutionEnvironment, workflowGitPassGrantSchema, } from "@fungi.computer/braid/runtime";
17
17
  import { checkComputerGrant, computerActionSchema, computerGrantSchema, ComputerBackingError, createFleetBacking, FleetGrantRefused, FleetLifecycle, } from "@fungi.computer/computer/fleet";
18
18
  import { AppInstanceError, selectionOf } from "../index.js";
@@ -586,6 +586,17 @@ export class ComputerDO extends NativeComputerDO {
586
586
  };
587
587
  throw error;
588
588
  }
589
+ case "files.remove":
590
+ try {
591
+ return removeOutputSchema.parse(await this.callAfterAcceptance("remove", input, accept));
592
+ }
593
+ catch (error) {
594
+ if (error instanceof ComputerFileRemoveError)
595
+ return {
596
+ error: error.reason === "missing" ? "not_found" : "invalid",
597
+ };
598
+ throw error;
599
+ }
589
600
  case "mkdir":
590
601
  return mkdirOutputSchema.parse(await this.callAfterAcceptance("mkdir", input, accept));
591
602
  default:
@@ -628,6 +639,20 @@ export class ComputerDO extends NativeComputerDO {
628
639
  this.#accept(authority, "files.writeBytes");
629
640
  });
630
641
  }
642
+ /** Delete one file; a path that is already absent is already deleted. */
643
+ async fileDelete(authority, path) {
644
+ try {
645
+ await this.callAfterAcceptance("remove", { path }, () => {
646
+ this.#accept(authority, "files.remove");
647
+ });
648
+ }
649
+ catch (error) {
650
+ if (error instanceof ComputerFileRemoveError &&
651
+ error.reason === "missing")
652
+ return;
653
+ throw error;
654
+ }
655
+ }
631
656
  /** Patch is handled by the Computer's pinned native engine, not by the Agent. */
632
657
  async filePatch(authority, input) {
633
658
  return this.applyPatchAfterAcceptance(input, () => {
@@ -696,6 +721,7 @@ export function standaloneWorkspace(env, keysLive, selectedComputerId = env.OYST
696
721
  list: (path, limit, offset) => computer().fileList(authority(), path, limit, offset),
697
722
  read: (path) => computer().fileRead(authority(), path),
698
723
  write: (path, bytes) => computer().fileWrite(authority(), path, bytes),
724
+ delete: (path) => computer().fileDelete(authority(), path),
699
725
  mkdir: async (path) => {
700
726
  await computer().value(authority(), "mkdir", { path, recursive: true });
701
727
  },
@@ -31,6 +31,8 @@ export declare function workersMedia(env: OysterMediaEnv, workspace: Readonly<{
31
31
  computerId: string;
32
32
  files: FileSource;
33
33
  }>): readonly OysterCapability[];
34
+ /** Erase a written file from the workspace only while it still holds the written bytes. */
35
+ export declare function workspaceMediaRemove(files: Pick<FileSource, "read" | "delete">): MediaServiceHost["destination"]["remove"];
34
36
  /** The Instance gate and native guest entrypoint share these argument codecs. */
35
37
  export declare const mediaFrameMethods: {
36
38
  MEDIA: {
@@ -44,6 +46,7 @@ export declare const mediaFrameMethods: {
44
46
  prompt: string;
45
47
  width: number;
46
48
  height: number;
49
+ guidance?: number | undefined;
47
50
  resolution?: "480p" | "720p" | "768p" | "1080p" | "4k" | undefined;
48
51
  aspectRatio?: "16:9" | "4:3" | "1:1" | "3:4" | "9:16" | "21:9" | "9:21" | undefined;
49
52
  references?: {
@@ -7,7 +7,7 @@ import { computer, routes as routeTable } from "../authorization.js";
7
7
  import * as Schema from "effect/Schema";
8
8
  import { pendingSchema } from "@fungi.computer/agar/backend-definition";
9
9
  import { mediaGenerationDescriptionSchema, mediaGenerationJsonRequestSchema, mediaGenerationQuoteRequestSchema, mediaGenerationReferenceSchema, } from "@fungi.computer/agar/media-json";
10
- import { createDailyMediaMetering, createMediaService, readHostReference, referenceFilename, estimateMediaModel, mediaPendingSchema, mediaResultSchema, mediaBindingCallSchema, mediaBindingRequest, parseMediaBindingCall, readMediaBindingReply, } from "@fungi.computer/darkroom/server";
10
+ import { createDailyMediaMetering, createMediaService, readHostReference, removeMediaIfWritten, referenceFilename, estimateMediaModel, mediaPendingSchema, mediaResultSchema, mediaBindingCallSchema, mediaBindingRequest, parseMediaBindingCall, readMediaBindingReply, } from "@fungi.computer/darkroom/server";
11
11
  import { createWorkersAiMediaProvider, createImagesReferenceFitter, } from "@fungi.computer/darkroom/cloudflare";
12
12
  import { oysterPrincipalId, } from "../host.js";
13
13
  import { normalizeFilePath } from "../files.js";
@@ -186,6 +186,16 @@ function workspacePath(path) {
186
186
  throw new Error("Media destination must be an absolute workspace file path");
187
187
  return normalized;
188
188
  }
189
+ /** Erase a written file from the workspace only while it still holds the written bytes. */
190
+ export function workspaceMediaRemove(files) {
191
+ return async (path, written) => {
192
+ const target = workspacePath(path);
193
+ return await removeMediaIfWritten({
194
+ read: () => files.read(target),
195
+ delete: () => files.delete(target),
196
+ }, written.sha256);
197
+ };
198
+ }
189
199
  /** Both the HTTP capability and guest binding construct the existing Darkroom service. */
190
200
  function standaloneMediaService(env, actorId, workspace, owner = "owner", libraryPath) {
191
201
  const { computerId, files } = workspace;
@@ -210,6 +220,7 @@ function standaloneMediaService(env, actorId, workspace, owner = "owner", librar
210
220
  await files.mkdir(workspacePath(libraryPath));
211
221
  },
212
222
  write: (path, bytes) => files.write(workspacePath(path), bytes),
223
+ remove: workspaceMediaRemove(files),
213
224
  readAudioReference: (reference) => readWorkspaceReference("audio", reference),
214
225
  };
215
226
  const admittedDestination = fit === undefined
@@ -228,6 +239,8 @@ function standaloneMediaService(env, actorId, workspace, owner = "owner", librar
228
239
  const host = {
229
240
  scope: { actorId, namespace: "oyster", owner, destinationId: computerId },
230
241
  operations: env.MEDIA_OPERATION,
242
+ // Prints publishes a shareable file's prompt and strips it on download.
243
+ embedPrompt: true,
231
244
  provider,
232
245
  destination: admittedDestination,
233
246
  };
package/docs/api/files.md CHANGED
@@ -68,6 +68,7 @@ type FileSource = Readonly<{
68
68
  }> | null>;
69
69
  read: Promise<Uint8Array<ArrayBufferLike> | null>;
70
70
  write: Promise<void>;
71
+ delete: Promise<void>;
71
72
  mkdir: Promise<void>;
72
73
  replace: Promise<FileReplaceOutcome>;
73
74
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/oyster",
3
- "version": "0.30.1",
3
+ "version": "0.31.0",
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",
@@ -346,37 +346,37 @@
346
346
  "dependencies": {
347
347
  "@cfworker/json-schema": "4.1.1",
348
348
  "@earendil-works/pi-ai": "1.3.0",
349
- "@fungi.computer/agar": "0.17.0",
349
+ "@fungi.computer/agar": "0.18.0",
350
350
  "@fungi.computer/bird-dog": "0.3.6",
351
- "@fungi.computer/braid": "0.4.18",
351
+ "@fungi.computer/braid": "0.4.19",
352
352
  "@fungi.computer/burrow": "0.2.1",
353
353
  "@fungi.computer/cairn": "0.1.0",
354
354
  "@fungi.computer/capnweb": "0.12.0-fungi.0",
355
355
  "@fungi.computer/caps": "0.11.7",
356
356
  "@fungi.computer/carrier": "0.2.4",
357
- "@fungi.computer/computer": "0.12.2",
358
- "@fungi.computer/computer-contract": "0.4.1",
359
- "@fungi.computer/darkroom": "0.10.0",
357
+ "@fungi.computer/computer": "0.13.0",
358
+ "@fungi.computer/computer-contract": "0.5.0",
359
+ "@fungi.computer/darkroom": "0.11.0",
360
360
  "@fungi.computer/ear-tag": "0.1.0",
361
361
  "@fungi.computer/forage": "0.3.9",
362
362
  "@fungi.computer/gills": "0.3.0",
363
363
  "@fungi.computer/knapsack": "0.4.13",
364
364
  "@fungi.computer/lantern": "0.4.2",
365
365
  "@fungi.computer/mycelium": "0.4.0",
366
- "@fungi.computer/nacre": "0.6.5",
367
- "@fungi.computer/parakeet": "0.11.35",
366
+ "@fungi.computer/nacre": "0.6.6",
367
+ "@fungi.computer/parakeet": "0.11.37",
368
368
  "@fungi.computer/puffball": "0.9.0",
369
369
  "@fungi.computer/seam": "0.2.5",
370
- "@fungi.computer/shiitake": "0.18.1",
371
- "@fungi.computer/shiitake-extensions": "0.10.1",
370
+ "@fungi.computer/shiitake": "0.18.2",
371
+ "@fungi.computer/shiitake-extensions": "0.10.2",
372
372
  "@fungi.computer/sigils": "0.3.2",
373
373
  "@fungi.computer/sprite": "0.2.2",
374
374
  "@fungi.computer/sprite-zdog": "0.3.2",
375
375
  "@fungi.computer/veil": "0.7.4",
376
376
  "@fungi.computer/watchdog": "0.1.3",
377
377
  "@fungi.computer/whistle": "0.3.0",
378
- "@fungi.computer/workflows-wire": "0.4.18",
379
- "@fungi.computer/zookeeper": "0.0.31",
378
+ "@fungi.computer/workflows-wire": "0.4.19",
379
+ "@fungi.computer/zookeeper": "0.0.32",
380
380
  "@modelcontextprotocol/server": "2.0.0",
381
381
  "@pnpm/lockfile.fs": "1100.2.13",
382
382
  "@pnpm/lockfile.pruner": "1100.0.27",