@fungi.computer/oyster 0.25.0 → 0.26.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/app-builds.d.ts +4 -2
- package/dist/app-builds.js +14 -0
- package/dist/boot-host-script.js +1 -1
- package/dist/build/build-memory.d.ts +13 -0
- package/dist/build/build-memory.js +29 -0
- package/dist/build/candidate-cli.mjs +19 -2
- package/dist/build/local-build.js +4 -5
- package/dist/cloudflare.d.ts +2 -2
- package/dist/cloudflare.js +3 -0
- package/dist/computer-control-port.d.ts +2 -0
- package/dist/embed-metafiles.js +2 -2
- package/dist/embed-scripts.js +1 -1
- package/dist/mcp.d.ts +26 -0
- package/dist/mcp.js +12 -2
- package/dist/page-script.js +2 -2
- package/dist/release.d.ts +5 -0
- package/dist/standalone/agents.js +11 -1
- package/dist/standalone/app-set.d.ts +4 -3
- package/dist/standalone/app-set.js +9 -5
- package/dist/standalone/computer-control.js +7 -1
- package/dist/standalone/computer-fleet.d.ts +5 -0
- package/dist/standalone/computer-skill-source.d.ts +20 -0
- package/dist/standalone/computer-skill-source.js +165 -0
- package/dist/standalone/computer.d.ts +4 -1
- package/dist/standalone/computer.js +28 -2
- package/dist/standalone/install-apps-cli.js +1 -1
- package/dist/standalone/media.d.ts +1 -1
- package/dist/standalone/registry.d.ts +3 -0
- package/dist/standalone/registry.js +1 -1
- package/docs/api/cloudflare.md +4 -1
- package/docs/api/mcp.md +52 -46
- package/package.json +17 -17
package/dist/release.d.ts
CHANGED
|
@@ -15,6 +15,11 @@ export type ArtifactHead = Readonly<{
|
|
|
15
15
|
/** The digest the store verified when it took the bytes, if it did. */
|
|
16
16
|
digest: Sha256Digest | null;
|
|
17
17
|
}>;
|
|
18
|
+
/** A store that can remove one object; only host-owned namespaces use it. */
|
|
19
|
+
export type ArtifactDeletes = Readonly<{
|
|
20
|
+
/** Remove the object at `artifactRef`; a missing object is not an error. */
|
|
21
|
+
delete: (artifactRef: ArtifactRef) => Promise<void>;
|
|
22
|
+
}>;
|
|
18
23
|
/** A store that can describe an object without reading its bytes. */
|
|
19
24
|
export type ArtifactHeads = Readonly<{
|
|
20
25
|
/** Describe the object at `artifactRef`, or `null` when absent. */
|
|
@@ -17,6 +17,7 @@ import { isDiscordBinding, createDiscordBindings, createDiscordInputSchema, upda
|
|
|
17
17
|
import { DISCORD_SETTLEMENT_WAIT_MS, discordDenial, discordFailureText, patchOriginal, postChannelMessage, postFollowUp, quoted, STILL_WORKING_TEXT, splitDiscordMessage, registerAskCommand, } from "../channels/discord-interactions.js";
|
|
18
18
|
import { discordOutcome, sealDiscordToken, } from "./discord-channels.js";
|
|
19
19
|
import { createAgentInstructions, withOwnerInstructions, } from "../agent-instructions.js";
|
|
20
|
+
import { computerSkillsEmpty, createComputerSkillSource, } from "./computer-skill-source.js";
|
|
20
21
|
import { channelSessionDoor } from "./channel-session-door.js";
|
|
21
22
|
import { createAuthenticatedVisitorChannel } from "../channels/visitor-channel.js";
|
|
22
23
|
import { verifyVisitor } from "./visitor-proof.js";
|
|
@@ -1228,7 +1229,16 @@ export class StandaloneAgentBase extends ShiitakeDO {
|
|
|
1228
1229
|
return () => this.computerInvalidations.delete(invalidate);
|
|
1229
1230
|
},
|
|
1230
1231
|
});
|
|
1231
|
-
|
|
1232
|
+
// Skills the owner put on the Agent's Computer, found by the rules Local uses on a disk.
|
|
1233
|
+
const extensions = oysterAgentExtensions(conversationAgents.source(this.controlDirectory()), {
|
|
1234
|
+
source: createComputerSkillSource({
|
|
1235
|
+
computers: async () => {
|
|
1236
|
+
await this.preparedComputerSnapshot();
|
|
1237
|
+
return readAgentComputerConnections(this.computerConnections()).map(({ name, files }) => ({ name, port: files.port }));
|
|
1238
|
+
},
|
|
1239
|
+
}),
|
|
1240
|
+
empty: computerSkillsEmpty,
|
|
1241
|
+
});
|
|
1232
1242
|
const keeping = agentStoreKeeping(this.ctx.storage, (request) => this.readColdSessions(request));
|
|
1233
1243
|
const principal = {
|
|
1234
1244
|
actor: { kind: "agent", agentId: this.ctx.id.name ?? "agent" },
|
|
@@ -80,10 +80,11 @@ export type StarterAppSetResult = Readonly<{
|
|
|
80
80
|
}>;
|
|
81
81
|
/**
|
|
82
82
|
* Builds the installer runs at once by default. A build's compiler may take a
|
|
83
|
-
* 4
|
|
84
|
-
*
|
|
83
|
+
* 4 GiB heap and pnpm and esbuild another 2 GiB, so a Computer runs one build
|
|
84
|
+
* per 6 GiB, two at most: two on a 12 GiB container or 16 GiB VM, one on an
|
|
85
|
+
* 8 GiB or 4 GiB VM. A third runs only when asked for.
|
|
85
86
|
*/
|
|
86
|
-
export declare
|
|
87
|
+
export declare function defaultStarterBuildConcurrency(): number;
|
|
87
88
|
/**
|
|
88
89
|
* Install the standalone App set, each App built on the Oyster's own
|
|
89
90
|
* Computer. Each App's editable source is published as its template; the host
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { defaultBuildConcurrency, machineMemoryMib, } from "../build/build-memory.js";
|
|
1
2
|
import { execFile } from "node:child_process";
|
|
2
3
|
import { mkdtemp, rm } from "node:fs/promises";
|
|
3
4
|
import { join } from "node:path";
|
|
@@ -146,11 +147,14 @@ const computerPhasesSchema = Schema.fromJsonString(Schema.Struct({
|
|
|
146
147
|
const appBuildWaitMs = 20 * 60_000;
|
|
147
148
|
/**
|
|
148
149
|
* Builds the installer runs at once by default. A build's compiler may take a
|
|
149
|
-
* 4
|
|
150
|
-
*
|
|
150
|
+
* 4 GiB heap and pnpm and esbuild another 2 GiB, so a Computer runs one build
|
|
151
|
+
* per 6 GiB, two at most: two on a 12 GiB container or 16 GiB VM, one on an
|
|
152
|
+
* 8 GiB or 4 GiB VM. A third runs only when asked for.
|
|
151
153
|
*/
|
|
152
|
-
export
|
|
153
|
-
|
|
154
|
+
export function defaultStarterBuildConcurrency() {
|
|
155
|
+
return defaultBuildConcurrency(machineMemoryMib());
|
|
156
|
+
}
|
|
157
|
+
/** The most builds at once, when the caller asks for more than the default. */
|
|
154
158
|
const maxStarterBuildConcurrency = 3;
|
|
155
159
|
const run = (command, args, cwd) => new Promise((resolveRun, reject) => {
|
|
156
160
|
execFile(command, args, { cwd, encoding: "utf8", maxBuffer: 1_048_576 }, (error, stdout) => {
|
|
@@ -169,7 +173,7 @@ const run = (command, args, cwd) => new Promise((resolveRun, reject) => {
|
|
|
169
173
|
* is compiled on this machine and no installed App is needed to build.
|
|
170
174
|
*/
|
|
171
175
|
export async function installStandaloneAppSet(options) {
|
|
172
|
-
const concurrency = options.concurrency ?? defaultStarterBuildConcurrency;
|
|
176
|
+
const concurrency = options.concurrency ?? defaultStarterBuildConcurrency();
|
|
173
177
|
if (!Number.isInteger(concurrency) ||
|
|
174
178
|
concurrency < 1 ||
|
|
175
179
|
concurrency > maxStarterBuildConcurrency)
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { computerSizeSchema } from "@fungi.computer/computer/backing";
|
|
2
3
|
import { computerBackendViewSchema, computerStateSchema, } from "@fungi.computer/computer/fleet";
|
|
3
4
|
import { teamComputerDirectorySchema } from "@fungi.computer/nacre/workbench";
|
|
4
5
|
const inventoryComputer = z.strictObject({
|
|
5
6
|
computerId: z.string(),
|
|
6
7
|
name: z.string(),
|
|
8
|
+
size: computerSizeSchema,
|
|
7
9
|
createdAt: z.number(),
|
|
8
10
|
updatedAt: z.number(),
|
|
9
11
|
});
|
|
@@ -75,7 +77,11 @@ export function standaloneComputerControl(registry, memberId) {
|
|
|
75
77
|
const computer = inventoryComputer.parse(result);
|
|
76
78
|
return {
|
|
77
79
|
kind: "created",
|
|
78
|
-
computer: {
|
|
80
|
+
computer: {
|
|
81
|
+
computerId: computer.computerId,
|
|
82
|
+
name: computer.name,
|
|
83
|
+
size: computer.size,
|
|
84
|
+
},
|
|
79
85
|
};
|
|
80
86
|
},
|
|
81
87
|
backends: async (computerId) => backendList.parse(available(await fleet({ operation: "backends", computerId }))).backends,
|
|
@@ -6,6 +6,11 @@ export declare const standaloneFleetRequestSchema: z.ZodDiscriminatedUnion<[z.Zo
|
|
|
6
6
|
operation: z.ZodLiteral<"create">;
|
|
7
7
|
request: z.ZodObject<{
|
|
8
8
|
name: z.ZodOptional<z.ZodString>;
|
|
9
|
+
size: z.ZodOptional<z.ZodEnum<{
|
|
10
|
+
default: "default";
|
|
11
|
+
small: "small";
|
|
12
|
+
large: "large";
|
|
13
|
+
}>>;
|
|
9
14
|
requestId: z.ZodString;
|
|
10
15
|
}, z.core.$strict>;
|
|
11
16
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { FilesPort } from "@fungi.computer/knapsack";
|
|
2
|
+
import type { SkillSource } from "@fungi.computer/shiitake-extensions/skills/source";
|
|
3
|
+
/**
|
|
4
|
+
* Skills on an Agent's own Computer. Discovery follows the same rules Local
|
|
5
|
+
* applies on a disk (frontmatter, naming, bounds, first name wins): this
|
|
6
|
+
* module only walks and reads folders through the Computer's Files port, and
|
|
7
|
+
* the port, not this code, confines every path to the Computer's workspace.
|
|
8
|
+
*/
|
|
9
|
+
/** One attached Computer, as the Agent reaches it. */
|
|
10
|
+
export type SkillComputer = Readonly<{
|
|
11
|
+
name: string;
|
|
12
|
+
port: FilesPort;
|
|
13
|
+
}>;
|
|
14
|
+
/** What a person is told when no skill is installed on the Computer. */
|
|
15
|
+
export declare const computerSkillsEmpty = "No skills are installed; put one at .agents/skills/<name>/SKILL.md on the Computer.";
|
|
16
|
+
/** Discover and load the skills on the Agent's attached Computers. */
|
|
17
|
+
export declare function createComputerSkillSource(options: Readonly<{
|
|
18
|
+
/** The Computers the Agent may use now; read at each discovery. */
|
|
19
|
+
computers: () => Promise<readonly SkillComputer[]>;
|
|
20
|
+
}>): SkillSource;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { admitSkill, maximumDirectoryEntries, maximumFileBytes, newSkillAdmission, parseSkill, skillCatalogOf, skillDiagnostic, skillExplanation, skillFileSchema, SkillSourceError, } from "@fungi.computer/shiitake-extensions/skills/discovery";
|
|
2
|
+
import { defineIdFamily } from "@fungi.computer/cairn/id";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
/** Each Files call this source makes is its own invocation. */
|
|
5
|
+
const skillIds = defineIdFamily({
|
|
6
|
+
family: "computer-skills",
|
|
7
|
+
version: 1,
|
|
8
|
+
kinds: { execution: { prefix: "skill_exec" } },
|
|
9
|
+
});
|
|
10
|
+
/** Where the Computer keeps skills, searched in this order; the first name wins. */
|
|
11
|
+
const skillRoots = [".fungi/skills", ".agents/skills"];
|
|
12
|
+
/** What a person is told when no skill is installed on the Computer. */
|
|
13
|
+
export const computerSkillsEmpty = "No skills are installed; put one at .agents/skills/<name>/SKILL.md on the Computer.";
|
|
14
|
+
const nameLength = z.string().min(1);
|
|
15
|
+
const segments = (path) => path.split("/").filter(Boolean);
|
|
16
|
+
const fileName = (path) => segments(path).at(-1) ?? "";
|
|
17
|
+
const directoryOf = (path) => `/${segments(path).slice(0, -1).join("/")}`;
|
|
18
|
+
/** The model's view of a skill file: bare when one Computer, else a computer:// locator. */
|
|
19
|
+
function located(computer, path, several) {
|
|
20
|
+
return several
|
|
21
|
+
? `computer://${encodeURIComponent(computer)}${path.startsWith("/") ? path : `/${path}`}`
|
|
22
|
+
: path;
|
|
23
|
+
}
|
|
24
|
+
/** Read one whole file or refuse it plainly: oversized, not text, or unreadable. */
|
|
25
|
+
async function readWhole(port, path, signal) {
|
|
26
|
+
signal.throwIfAborted();
|
|
27
|
+
let page;
|
|
28
|
+
try {
|
|
29
|
+
page = await port.read({ path, offset: 0, limit: maximumFileBytes }, invocation(signal));
|
|
30
|
+
}
|
|
31
|
+
catch (cause) {
|
|
32
|
+
signal.throwIfAborted();
|
|
33
|
+
throw new SkillSourceError("Skill file cannot be read", { cause });
|
|
34
|
+
}
|
|
35
|
+
if (!("content" in page))
|
|
36
|
+
throw new SkillSourceError("Skill file is not text");
|
|
37
|
+
if (page.truncated)
|
|
38
|
+
throw new SkillSourceError("Skill file exceeds the 128 KiB bound");
|
|
39
|
+
return page.content;
|
|
40
|
+
}
|
|
41
|
+
function invocation(signal) {
|
|
42
|
+
return {
|
|
43
|
+
executionId: skillIds.execution.generate(),
|
|
44
|
+
deadlineAt: null,
|
|
45
|
+
signal,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/** Skill folders under one root of one Computer, found by their SKILL.md. */
|
|
49
|
+
async function findSkillFiles(port, root, signal, diagnostics) {
|
|
50
|
+
let found;
|
|
51
|
+
try {
|
|
52
|
+
found = await port.glob({ path: root, pattern: "**/SKILL.md", limit: 256 }, invocation(signal));
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
// A Computer without the folder, or one the Agent may not search, has no skills here.
|
|
56
|
+
signal.throwIfAborted();
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
if (found.truncated !== null)
|
|
60
|
+
diagnostics.push(skillDiagnostic(root, "bound", "Skill discovery exceeds its 256-skill search bound"));
|
|
61
|
+
const files = [];
|
|
62
|
+
for (const row of found.results) {
|
|
63
|
+
if (row.type === "directory")
|
|
64
|
+
continue;
|
|
65
|
+
const inside = row.path.startsWith("/") ? row.path : `/${row.path}`;
|
|
66
|
+
const relative = segments(inside).slice(segments(root).length);
|
|
67
|
+
// Like Local: dot folders and node_modules are not searched.
|
|
68
|
+
if (relative
|
|
69
|
+
.slice(0, -1)
|
|
70
|
+
.some((part) => part.startsWith(".") || part === "node_modules")) {
|
|
71
|
+
diagnostics.push(skillDiagnostic(inside, "skipped", "Dot directories and node_modules are not searched"));
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
files.push(inside);
|
|
75
|
+
}
|
|
76
|
+
return files.sort();
|
|
77
|
+
}
|
|
78
|
+
/** Discover and load the skills on the Agent's attached Computers. */
|
|
79
|
+
export function createComputerSkillSource(options) {
|
|
80
|
+
const scan = async (signal) => {
|
|
81
|
+
const computers = await options.computers();
|
|
82
|
+
const several = computers.length > 1;
|
|
83
|
+
const state = newSkillAdmission();
|
|
84
|
+
const homes = new Map();
|
|
85
|
+
for (const computer of computers) {
|
|
86
|
+
for (const root of skillRoots) {
|
|
87
|
+
signal.throwIfAborted();
|
|
88
|
+
const files = await findSkillFiles(computer.port, root, signal, state.diagnostics);
|
|
89
|
+
for (const path of files) {
|
|
90
|
+
const directoryName = fileName(directoryOf(path));
|
|
91
|
+
const skillPath = located(computer.name, path, several);
|
|
92
|
+
try {
|
|
93
|
+
const { metadata } = parseSkill(await readWhole(computer.port, path, signal), directoryName);
|
|
94
|
+
const before = state.skills.length;
|
|
95
|
+
admitSkill(state, {
|
|
96
|
+
metadata,
|
|
97
|
+
directoryName,
|
|
98
|
+
skillPath,
|
|
99
|
+
location: skillPath,
|
|
100
|
+
displayLocation: skillPath,
|
|
101
|
+
origin: { kind: "project" },
|
|
102
|
+
});
|
|
103
|
+
if (state.skills.length > before)
|
|
104
|
+
homes.set(metadata.name, { computer, location: path });
|
|
105
|
+
}
|
|
106
|
+
catch (cause) {
|
|
107
|
+
signal.throwIfAborted();
|
|
108
|
+
state.diagnostics.push({
|
|
109
|
+
path: skillPath,
|
|
110
|
+
reason: "invalid",
|
|
111
|
+
message: skillExplanation(cause, "Skill metadata or file is invalid"),
|
|
112
|
+
cause,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (state.skills.length === 0 && state.diagnostics.length === 0)
|
|
119
|
+
state.diagnostics.push(skillDiagnostic(".agents/skills", "empty", "No skill folders on the Computer"));
|
|
120
|
+
return { catalog: skillCatalogOf(state), homes };
|
|
121
|
+
};
|
|
122
|
+
return {
|
|
123
|
+
catalog: async (signal) => (await scan(signal)).catalog,
|
|
124
|
+
read: async (name, file, signal) => {
|
|
125
|
+
nameLength.parse(name);
|
|
126
|
+
const { catalog, homes } = await scan(signal);
|
|
127
|
+
const home = homes.get(name);
|
|
128
|
+
const found = catalog.skills.find((skill) => skill.name === name);
|
|
129
|
+
if (home === undefined || found === undefined)
|
|
130
|
+
throw new Error(`Unknown or hidden skill: ${name}`);
|
|
131
|
+
const baseDirectory = directoryOf(home.location);
|
|
132
|
+
const selected = file === undefined ? "SKILL.md" : skillFileSchema.parse(file);
|
|
133
|
+
const content = await readWhole(home.computer.port, `${baseDirectory}/${selected}`, signal);
|
|
134
|
+
if (selected !== "SKILL.md")
|
|
135
|
+
return {
|
|
136
|
+
name,
|
|
137
|
+
file: selected,
|
|
138
|
+
content,
|
|
139
|
+
baseDirectory,
|
|
140
|
+
supportingFiles: [],
|
|
141
|
+
};
|
|
142
|
+
const parsed = parseSkill(content, fileName(baseDirectory));
|
|
143
|
+
if (parsed.metadata["disable-model-invocation"])
|
|
144
|
+
throw new Error(`Hidden skill: ${name}`);
|
|
145
|
+
const listed = await home.computer.port.glob({ path: baseDirectory, pattern: "**/*", limit: 256 }, invocation(signal));
|
|
146
|
+
if (listed.truncated !== null ||
|
|
147
|
+
listed.results.length > maximumDirectoryEntries)
|
|
148
|
+
throw new SkillSourceError("Skill supporting files exceed the entry bound");
|
|
149
|
+
const prefix = `${baseDirectory}/`;
|
|
150
|
+
const supportingFiles = listed.results
|
|
151
|
+
.filter((row) => row.type !== "directory")
|
|
152
|
+
.map((row) => (row.path.startsWith("/") ? row.path : `/${row.path}`))
|
|
153
|
+
.filter((path) => path.startsWith(prefix) && path !== home.location)
|
|
154
|
+
.map((path) => path.slice(prefix.length))
|
|
155
|
+
.sort();
|
|
156
|
+
return {
|
|
157
|
+
name,
|
|
158
|
+
file: selected,
|
|
159
|
+
content: parsed.body,
|
|
160
|
+
baseDirectory,
|
|
161
|
+
supportingFiles,
|
|
162
|
+
};
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ComputerSize } from "@fungi.computer/computer/backing";
|
|
1
2
|
import { type AppMethodRefusedReply } from "@fungi.computer/agar/backend";
|
|
2
3
|
import { type ComputerPorts } from "@fungi.computer/agar/computer";
|
|
3
4
|
import { type PreviewSelector } from "./preview.js";
|
|
@@ -86,8 +87,10 @@ export declare class ComputerDO extends NativeComputerDO implements ComputerFetc
|
|
|
86
87
|
* name from the configured id once the namespace verifies it.
|
|
87
88
|
*/
|
|
88
89
|
protected nameCandidates(): readonly string[];
|
|
90
|
+
/** The size fixed at creation; a Computer never created by the fleet has none. */
|
|
91
|
+
protected computerSize(): ComputerSize;
|
|
89
92
|
/** Install the fleet's creation projection before exposing its new identity. */
|
|
90
|
-
initializeFleetBackings(backings: readonly AttachedBackend[]): void;
|
|
93
|
+
initializeFleetBackings(backings: readonly AttachedBackend[], size: ComputerSize): void;
|
|
91
94
|
/** The owner's attached backends with live status. Reads wake nothing. */
|
|
92
95
|
readBackends(authority: ComputerGrant, actor: string): ComputerBackendView[];
|
|
93
96
|
/** Attach the owner's machine; a replay of the same request returns it. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { attachedBackendId, hostedBackingSchema, } from "@fungi.computer/computer/backing";
|
|
1
|
+
import { attachedBackendId, computerSizeSchema, hostedBackingSchema, } from "@fungi.computer/computer/backing";
|
|
2
2
|
import { appMethodRefusalStatus, appMethodRefusedReplySchema, } from "@fungi.computer/agar/backend";
|
|
3
3
|
import * as Schema from "effect/Schema";
|
|
4
4
|
import { computerPortsSchema, } from "@fungi.computer/agar/computer";
|
|
@@ -50,6 +50,7 @@ const processStartReply = z.lazy(() => z.union([
|
|
|
50
50
|
const bindingWrite = writeInputSchema.extend({
|
|
51
51
|
expectedContent: replaceInputSchema.shape.expectedContent.optional(),
|
|
52
52
|
});
|
|
53
|
+
const bindingMkdir = z.strictObject({ path: writeInputSchema.shape.path });
|
|
53
54
|
const allActions = new Set(computerActionSchema.options);
|
|
54
55
|
const terminalGrantHeader = "X-Oyster-Computer-Grant";
|
|
55
56
|
const terminalGrant = computerGrantSchema.extend({
|
|
@@ -111,6 +112,7 @@ const previewRefusal = appMethodRefusedReplySchema.parse({
|
|
|
111
112
|
});
|
|
112
113
|
/** The non-secret context a native command carries for its admitted Git step. */
|
|
113
114
|
const workflowGitExecutionContextSchema = z.lazy(() => z.strictObject({ workflowGit: workflowGitPassGrantSchema }));
|
|
115
|
+
const sizeTable = "CREATE TABLE IF NOT EXISTS oyster_computer_size (singleton INTEGER PRIMARY KEY CHECK (singleton = 1), size TEXT NOT NULL CHECK (size IN ('small','default','large'))) STRICT";
|
|
114
116
|
/** Durable workspace and existing backings, with fleet checks at native acceptance. */
|
|
115
117
|
export class ComputerDO extends NativeComputerDO {
|
|
116
118
|
previewBindings;
|
|
@@ -167,8 +169,21 @@ export class ComputerDO extends NativeComputerDO {
|
|
|
167
169
|
});
|
|
168
170
|
return this.#lifecycle;
|
|
169
171
|
}
|
|
172
|
+
/** The size fixed at creation; a Computer never created by the fleet has none. */
|
|
173
|
+
computerSize() {
|
|
174
|
+
const sql = this.state.storage.sql;
|
|
175
|
+
sql.exec(sizeTable);
|
|
176
|
+
const row = sql
|
|
177
|
+
.exec("SELECT size FROM oyster_computer_size WHERE singleton=1")
|
|
178
|
+
.toArray()[0];
|
|
179
|
+
if (row === undefined)
|
|
180
|
+
throw new Error("Computer was created without a size");
|
|
181
|
+
return computerSizeSchema.parse(row.size);
|
|
182
|
+
}
|
|
170
183
|
/** Install the fleet's creation projection before exposing its new identity. */
|
|
171
|
-
initializeFleetBackings(backings) {
|
|
184
|
+
initializeFleetBackings(backings, size) {
|
|
185
|
+
this.state.storage.sql.exec(sizeTable);
|
|
186
|
+
this.state.storage.sql.exec("INSERT OR IGNORE INTO oyster_computer_size (singleton, size) VALUES (1, ?)", size);
|
|
172
187
|
const owner = createFleetBacking(this.state.storage);
|
|
173
188
|
owner.ensure();
|
|
174
189
|
this.#backends = owner.computerCreated(this.#id(), z.array(hostedBackingSchema).parse(backings)).backends;
|
|
@@ -795,6 +810,11 @@ export const computerFrameMethods = {
|
|
|
795
810
|
.parse(value),
|
|
796
811
|
requiredOperations: () => ["write"],
|
|
797
812
|
},
|
|
813
|
+
mkdir: {
|
|
814
|
+
decodeArgs: (args) => z.tuple([bindingMkdir]).parse(args),
|
|
815
|
+
decodeResult: (value) => mkdirOutputSchema.parse(value),
|
|
816
|
+
requiredOperations: () => ["mkdir"],
|
|
817
|
+
},
|
|
798
818
|
move: {
|
|
799
819
|
decodeArgs: (args) => z.tuple([moveInputSchema]).parse(args),
|
|
800
820
|
decodeResult: (value) => z
|
|
@@ -936,6 +956,12 @@ export async function computerInvocation(env, scope, frame, method, args) {
|
|
|
936
956
|
};
|
|
937
957
|
break;
|
|
938
958
|
}
|
|
959
|
+
case "mkdir": {
|
|
960
|
+
const [parsed] = z.tuple([bindingMkdir]).parse(args);
|
|
961
|
+
action = "mkdir";
|
|
962
|
+
input = { path: parsed.path, recursive: true };
|
|
963
|
+
break;
|
|
964
|
+
}
|
|
939
965
|
case "move":
|
|
940
966
|
action = "files.move";
|
|
941
967
|
[input] = z.tuple([moveInputSchema]).parse(args);
|
|
@@ -108,7 +108,7 @@ export async function installApps(args, install = installStandaloneAppSet, ui =
|
|
|
108
108
|
if (values.from !== undefined && values.repositories !== undefined)
|
|
109
109
|
throw new Error("Choose either --from or --repositories");
|
|
110
110
|
const concurrency = values.concurrency === undefined
|
|
111
|
-
? defaultStarterBuildConcurrency
|
|
111
|
+
? defaultStarterBuildConcurrency()
|
|
112
112
|
: Number(values.concurrency);
|
|
113
113
|
const scratch = await mkdtemp(join(tmpdir(), "oyster-install-apps-"));
|
|
114
114
|
try {
|
|
@@ -55,7 +55,7 @@ export declare const mediaFrameMethods: {
|
|
|
55
55
|
requestId: string;
|
|
56
56
|
libraryPath: string;
|
|
57
57
|
settings: {
|
|
58
|
-
model: "bytedance/seedance-2.0" | "google/veo-3.1" | "bytedance/seedance-2.0-fast" | "bytedance/seedance-2.0-mini" | "google/veo-3.1-fast" | "minimax/h3-max";
|
|
58
|
+
model: "bytedance/seedance-2.0" | "google/veo-3.1" | "bytedance/seedance-2.5" | "bytedance/seedance-2.0-fast" | "bytedance/seedance-2.0-mini" | "google/veo-3.1-fast" | "minimax/h3-max";
|
|
59
59
|
prompt: string;
|
|
60
60
|
resolution?: "480p" | "720p" | "768p" | "1080p" | "4k" | undefined;
|
|
61
61
|
aspectRatio?: "16:9" | "4:3" | "1:1" | "3:4" | "9:16" | "21:9" | "9:21" | undefined;
|
|
@@ -69,12 +69,14 @@ export declare abstract class StandaloneRegistry extends OysterRegistry implemen
|
|
|
69
69
|
computerFleet(memberId: string, request: StandaloneFleetRequest): Promise<Readonly<{
|
|
70
70
|
computerId: string;
|
|
71
71
|
name: string;
|
|
72
|
+
size: import("@fungi.computer/computer").ComputerSize;
|
|
72
73
|
createdAt: number;
|
|
73
74
|
updatedAt: number;
|
|
74
75
|
}> | {
|
|
75
76
|
readonly computers: Readonly<{
|
|
76
77
|
computerId: string;
|
|
77
78
|
name: string;
|
|
79
|
+
size: import("@fungi.computer/computer").ComputerSize;
|
|
78
80
|
createdAt: number;
|
|
79
81
|
updatedAt: number;
|
|
80
82
|
}>[];
|
|
@@ -128,6 +130,7 @@ export declare abstract class StandaloneRegistry extends OysterRegistry implemen
|
|
|
128
130
|
} | Readonly<{
|
|
129
131
|
computerId: string;
|
|
130
132
|
name: string;
|
|
133
|
+
size: import("@fungi.computer/computer").ComputerSize;
|
|
131
134
|
createdAt: number;
|
|
132
135
|
updatedAt: number;
|
|
133
136
|
}>)[];
|
|
@@ -107,7 +107,7 @@ export class StandaloneRegistry extends OysterRegistry {
|
|
|
107
107
|
const backings = this.#computers.readBacking(created.computerId);
|
|
108
108
|
if (backings === null)
|
|
109
109
|
throw new Error("Computer backing is missing");
|
|
110
|
-
await this.#env.COMPUTER.getByName(created.computerId).initializeFleetBackings(backings);
|
|
110
|
+
await this.#env.COMPUTER.getByName(created.computerId).initializeFleetBackings(backings, created.size);
|
|
111
111
|
return created;
|
|
112
112
|
}
|
|
113
113
|
case "list":
|
package/docs/api/cloudflare.md
CHANGED
|
@@ -348,6 +348,9 @@ function r2ArtifactStore(bucket): Readonly<{
|
|
|
348
348
|
artifactRef,
|
|
349
349
|
signal?,
|
|
350
350
|
) => Promise<ReadableStream<Uint8Array<ArrayBufferLike>> | null>;
|
|
351
|
+
}> &
|
|
352
|
+
Readonly<{
|
|
353
|
+
delete: (artifactRef) => Promise<void>;
|
|
351
354
|
}>;
|
|
352
355
|
```
|
|
353
356
|
|
|
@@ -368,7 +371,7 @@ Store Release artifacts without loading the Worker ownership barrel.
|
|
|
368
371
|
`Sha256Digest` \| `null`; \}\> \| `null`\>; \}\> & `Readonly`\<\{ `stream`:
|
|
369
372
|
(`artifactRef`, `signal?`) =>
|
|
370
373
|
`Promise`\<`ReadableStream`\<`Uint8Array`\<`ArrayBufferLike`\>\> \| `null`\>;
|
|
371
|
-
\}\>
|
|
374
|
+
\}\> & `Readonly`\<\{ `delete`: (`artifactRef`) => `Promise`\<`void`\>; \}\>
|
|
372
375
|
|
|
373
376
|
---
|
|
374
377
|
|