@fungi.computer/oyster 0.23.0 → 0.25.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/agent-instructions.d.ts +35 -0
- package/dist/agent-instructions.js +42 -0
- package/dist/agents.d.ts +14 -0
- package/dist/agents.js +43 -1
- package/dist/apps/catalog.d.ts +11 -0
- package/dist/apps/catalog.js +1 -0
- package/dist/apps/gate.d.ts +2 -2
- package/dist/apps/installation.d.ts +7 -7
- package/dist/apps/permissions.d.ts +5 -5
- package/dist/boot-host-script.js +1 -1
- package/dist/browser/boot-once.d.ts +84 -0
- package/dist/browser/boot-once.js +48 -0
- package/dist/build/candidate-cli.mjs +6 -0
- package/dist/channels/discord-interactions.d.ts +15 -0
- package/dist/channels/discord-interactions.js +29 -0
- package/dist/channels/discord-replies.d.ts +9 -1
- package/dist/channels/discord-replies.js +34 -9
- package/dist/embed-metafiles.js +2 -2
- package/dist/embed-scripts.js +1 -1
- package/dist/installation-operations.d.ts +8 -8
- package/dist/machine-link/link.js +3 -1
- package/dist/page/computer-handles.d.ts +4 -0
- package/dist/page-script.js +2 -2
- package/dist/standalone/agents.d.ts +20 -0
- package/dist/standalone/agents.js +96 -13
- package/dist/standalone/computer.d.ts +3 -3
- package/dist/standalone/computer.js +37 -1
- package/dist/standalone/workflow-host.d.ts +5 -5
- package/dist/standalone/workflow-trigger-host.d.ts +1 -1
- package/docs/api/agents.md +18 -0
- package/docs/api/apps.md +148 -131
- package/docs/api/browser/boot-once.md +169 -0
- package/docs/api/build-contract.md +27 -21
- package/docs/api/build.md +70 -69
- package/docs/api/git.md +3 -3
- package/docs/api/host.md +91 -85
- package/docs/api/mcp.md +16 -16
- package/docs/api/modules.md +1 -0
- package/docs/api/workers-git.md +7 -7
- package/docs/api/workers.md +24 -21
- package/package.json +25 -17
|
@@ -142,6 +142,10 @@ export declare abstract class StandaloneAgentBase<Env extends StandaloneAgentEnv
|
|
|
142
142
|
askDiscord(bindingId: string, ask: DiscordAsk): void;
|
|
143
143
|
private discordReplyOwner;
|
|
144
144
|
private discordReplies;
|
|
145
|
+
/** How long one pass waits on an unfinished run before looking again. */
|
|
146
|
+
protected discordSettlementWaitMs(): number;
|
|
147
|
+
/** The directory, which holds the sealed bot token and sends with it. */
|
|
148
|
+
private discordDirectory;
|
|
145
149
|
/** The Discord replies this Agent owes; a full option override must run it. */
|
|
146
150
|
protected discordReplyWork(): {
|
|
147
151
|
pending: () => {
|
|
@@ -264,6 +268,12 @@ export declare abstract class StandaloneAgentBase<Env extends StandaloneAgentEnv
|
|
|
264
268
|
/** A byok choice must name a stored key of the chosen provider. */
|
|
265
269
|
private admitKey;
|
|
266
270
|
private choice;
|
|
271
|
+
private instructionsOwner;
|
|
272
|
+
private ownerInstructions;
|
|
273
|
+
/** The owner's standing instructions for this Agent; the host admits the owner first. */
|
|
274
|
+
readInstructions(): string;
|
|
275
|
+
/** Replace them. The next turn follows the new text; a run already going does not change. */
|
|
276
|
+
writeInstructions(instructions: string): string;
|
|
267
277
|
/** Secret-free default of this Agent; stored separately from Session history. */
|
|
268
278
|
readModelChoice(): Promise<AgentModelChoice>;
|
|
269
279
|
setModelChoice(input: AgentModelChoice): Promise<AgentModelChoice | Readonly<{
|
|
@@ -483,6 +493,16 @@ export declare class AgentDirectory extends DurableObject<StandaloneAgentEnv> {
|
|
|
483
493
|
registered: readonly string[];
|
|
484
494
|
failed: readonly string[];
|
|
485
495
|
}> | DiscordRefusal>;
|
|
496
|
+
/**
|
|
497
|
+
* Host-only: post one channel message as this binding's bot, for an answer
|
|
498
|
+
* that outlived its interaction token. The sealed token stays inside this call.
|
|
499
|
+
*/
|
|
500
|
+
discordSend(bindingId: string, message: Readonly<{
|
|
501
|
+
channelId: string;
|
|
502
|
+
content: string;
|
|
503
|
+
withReply: boolean;
|
|
504
|
+
mentionUserId: string | null;
|
|
505
|
+
}>): Promise<"delivered" | "gone" | "retry">;
|
|
486
506
|
/** Host-only: the website or Discord binding an Agent serves, read fresh on every use. */
|
|
487
507
|
channelBinding(bindingId: string): WebsiteBinding | DiscordBinding | null;
|
|
488
508
|
/** Host-only public lookup: a site key resolves to its site, or to nothing. */
|
|
@@ -14,8 +14,9 @@ import { decideChannelRunSafely } from "../channels/run-decision.js";
|
|
|
14
14
|
import { createWebsiteChannelOwner, websiteOutcome, } from "./website-channels.js";
|
|
15
15
|
import { createDiscordReplies, } from "../channels/discord-replies.js";
|
|
16
16
|
import { isDiscordBinding, createDiscordBindings, createDiscordInputSchema, updateDiscordInputSchema, } from "../channels/discord-binding.js";
|
|
17
|
-
import { DISCORD_SETTLEMENT_WAIT_MS, discordDenial, discordFailureText, patchOriginal, postFollowUp, quoted, splitDiscordMessage, registerAskCommand, } from "../channels/discord-interactions.js";
|
|
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
|
+
import { createAgentInstructions, withOwnerInstructions, } from "../agent-instructions.js";
|
|
19
20
|
import { channelSessionDoor } from "./channel-session-door.js";
|
|
20
21
|
import { createAuthenticatedVisitorChannel } from "../channels/visitor-channel.js";
|
|
21
22
|
import { verifyVisitor } from "./visitor-proof.js";
|
|
@@ -396,6 +397,14 @@ export class StandaloneAgentBase extends ShiitakeDO {
|
|
|
396
397
|
},
|
|
397
398
|
}));
|
|
398
399
|
}
|
|
400
|
+
/** How long one pass waits on an unfinished run before looking again. */
|
|
401
|
+
discordSettlementWaitMs() {
|
|
402
|
+
return DISCORD_SETTLEMENT_WAIT_MS;
|
|
403
|
+
}
|
|
404
|
+
/** The directory, which holds the sealed bot token and sends with it. */
|
|
405
|
+
discordDirectory() {
|
|
406
|
+
return agentDirectoryForScope(this.env, tenantScope(defaultTenant, this.env.OYSTER_ORIGIN));
|
|
407
|
+
}
|
|
399
408
|
/** The Discord replies this Agent owes; a full option override must run it. */
|
|
400
409
|
discordReplyWork() {
|
|
401
410
|
return this.discordReplies().work;
|
|
@@ -408,13 +417,28 @@ export class StandaloneAgentBase extends ShiitakeDO {
|
|
|
408
417
|
/** One attempt at one owed reply; intake is idempotent per interaction. */
|
|
409
418
|
async deliverDiscord(reply) {
|
|
410
419
|
const { ask } = reply;
|
|
411
|
-
|
|
420
|
+
// While the interaction token lives the answer fills the original and
|
|
421
|
+
// follows it; once it has lapsed (or Discord says it is gone) the same
|
|
422
|
+
// messages go to the channel as the owner's bot, mentioning the member.
|
|
423
|
+
const sayPart = async (content, index, withReply) => {
|
|
412
424
|
try {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
425
|
+
if (reply.tokenLive) {
|
|
426
|
+
const outcome = await (index === 0 ? patchOriginal : postFollowUp)(fetch, {
|
|
427
|
+
applicationId: ask.applicationId,
|
|
428
|
+
interactionToken: ask.interactionToken,
|
|
429
|
+
content,
|
|
430
|
+
withReply,
|
|
431
|
+
});
|
|
432
|
+
if (outcome !== "gone")
|
|
433
|
+
return outcome;
|
|
434
|
+
this.discordReplies().tokenGone(reply.interactionId);
|
|
435
|
+
return "waiting";
|
|
436
|
+
}
|
|
437
|
+
return await this.discordDirectory().discordSend(reply.bindingId, {
|
|
438
|
+
channelId: ask.channelId,
|
|
439
|
+
content: index === 0 ? `<@${ask.userId}> ${content}` : content,
|
|
417
440
|
withReply,
|
|
441
|
+
mentionUserId: index === 0 ? ask.userId : null,
|
|
418
442
|
});
|
|
419
443
|
}
|
|
420
444
|
catch (cause) {
|
|
@@ -422,7 +446,7 @@ export class StandaloneAgentBase extends ShiitakeDO {
|
|
|
422
446
|
return "retry";
|
|
423
447
|
}
|
|
424
448
|
};
|
|
425
|
-
const say = (content, withReply) => sayPart(content,
|
|
449
|
+
const say = (content, withReply) => sayPart(content, 0, withReply);
|
|
426
450
|
const binding = await this.loadChannelBinding(reply.bindingId);
|
|
427
451
|
if (binding === null ||
|
|
428
452
|
!isDiscordBinding(binding) ||
|
|
@@ -451,10 +475,17 @@ export class StandaloneAgentBase extends ShiitakeDO {
|
|
|
451
475
|
}
|
|
452
476
|
const session = (await this.shiitake()).session(accepted.sessionId);
|
|
453
477
|
const settlement = await session.readSettlement(accepted.commandId, {
|
|
454
|
-
timeoutMs:
|
|
478
|
+
timeoutMs: this.discordSettlementWaitMs(),
|
|
455
479
|
});
|
|
456
|
-
if (settlement === undefined)
|
|
480
|
+
if (settlement === undefined) {
|
|
481
|
+
if (reply.stillWorkingDue) {
|
|
482
|
+
// The token is about to lapse: say so now; the answer follows in the channel.
|
|
483
|
+
const told = await sayPart(STILL_WORKING_TEXT, 0, false);
|
|
484
|
+
if (told === "delivered")
|
|
485
|
+
this.discordReplies().markStillWorking(reply.interactionId);
|
|
486
|
+
}
|
|
457
487
|
return "waiting";
|
|
488
|
+
}
|
|
458
489
|
const answered = settlement.terminal.outcome === "completed" &&
|
|
459
490
|
settlement.content.trim().length > 0;
|
|
460
491
|
if (!answered) {
|
|
@@ -475,11 +506,13 @@ export class StandaloneAgentBase extends ShiitakeDO {
|
|
|
475
506
|
// in as many messages as it takes, in order.
|
|
476
507
|
const parts = splitDiscordMessage(ask.echo === undefined
|
|
477
508
|
? settlement.content
|
|
478
|
-
: `${quoted(ask.echo)}\n\n${settlement.content}
|
|
509
|
+
: `${quoted(ask.echo)}\n\n${settlement.content}`,
|
|
510
|
+
// A channel message opens with a mention of the member.
|
|
511
|
+
reply.tokenLive ? undefined : 1_950);
|
|
479
512
|
let done = reply.deliveredParts;
|
|
480
513
|
for (; done < parts.length; done += 1) {
|
|
481
514
|
const last = done === parts.length - 1;
|
|
482
|
-
const outcome = await sayPart(parts[done] ?? "", done
|
|
515
|
+
const outcome = await sayPart(parts[done] ?? "", done, last);
|
|
483
516
|
if (outcome !== "delivered")
|
|
484
517
|
return outcome;
|
|
485
518
|
this.discordReplies().progress(reply.interactionId, done + 1);
|
|
@@ -1006,6 +1039,18 @@ export class StandaloneAgentBase extends ShiitakeDO {
|
|
|
1006
1039
|
});
|
|
1007
1040
|
});
|
|
1008
1041
|
}
|
|
1042
|
+
instructionsOwner;
|
|
1043
|
+
ownerInstructions() {
|
|
1044
|
+
return (this.instructionsOwner ??= createAgentInstructions(this.ctx.storage.sql));
|
|
1045
|
+
}
|
|
1046
|
+
/** The owner's standing instructions for this Agent; the host admits the owner first. */
|
|
1047
|
+
readInstructions() {
|
|
1048
|
+
return this.ownerInstructions().read().instructions;
|
|
1049
|
+
}
|
|
1050
|
+
/** Replace them. The next turn follows the new text; a run already going does not change. */
|
|
1051
|
+
writeInstructions(instructions) {
|
|
1052
|
+
return this.ownerInstructions().write(instructions).instructions;
|
|
1053
|
+
}
|
|
1009
1054
|
/** Secret-free default of this Agent; stored separately from Session history. */
|
|
1010
1055
|
async readModelChoice() {
|
|
1011
1056
|
return this.choice().read();
|
|
@@ -1204,10 +1249,10 @@ export class StandaloneAgentBase extends ShiitakeDO {
|
|
|
1204
1249
|
instructions: this.channelInstructions({
|
|
1205
1250
|
load: async () => {
|
|
1206
1251
|
const { appApprovalInstructions } = await import("../mcp.js");
|
|
1207
|
-
return {
|
|
1252
|
+
return withOwnerInstructions({
|
|
1208
1253
|
revision: "oyster-7",
|
|
1209
1254
|
text: instructions + "\n" + appApprovalInstructions,
|
|
1210
|
-
};
|
|
1255
|
+
}, this.ownerInstructions().read());
|
|
1211
1256
|
},
|
|
1212
1257
|
}),
|
|
1213
1258
|
tools: {
|
|
@@ -1965,6 +2010,24 @@ export class AgentDirectory extends DurableObject {
|
|
|
1965
2010
|
}
|
|
1966
2011
|
return { registered, failed };
|
|
1967
2012
|
}
|
|
2013
|
+
/**
|
|
2014
|
+
* Host-only: post one channel message as this binding's bot, for an answer
|
|
2015
|
+
* that outlived its interaction token. The sealed token stays inside this call.
|
|
2016
|
+
*/
|
|
2017
|
+
async discordSend(bindingId, message) {
|
|
2018
|
+
const credentialId = this.discords().tokenCredentialId(bindingId);
|
|
2019
|
+
if (credentialId === null)
|
|
2020
|
+
return "gone";
|
|
2021
|
+
try {
|
|
2022
|
+
return await this.discordVault().withSecret(credentialId, (botToken) => postChannelMessage(fetch, { ...message, botToken }));
|
|
2023
|
+
}
|
|
2024
|
+
catch (cause) {
|
|
2025
|
+
if (cause instanceof CredentialError)
|
|
2026
|
+
return cause.code === "absent" ? "gone" : "retry";
|
|
2027
|
+
console.warn("discord channel message failed", cause instanceof Error ? cause.name : "unknown");
|
|
2028
|
+
return "retry";
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
1968
2031
|
/** Host-only: the website or Discord binding an Agent serves, read fresh on every use. */
|
|
1969
2032
|
channelBinding(bindingId) {
|
|
1970
2033
|
return (this.websites().bindings.read(bindingId) ??
|
|
@@ -2370,6 +2433,26 @@ export function standaloneAgents(env, scope) {
|
|
|
2370
2433
|
const parsed = Schema.decodeUnknownOption(Schema.fromJsonString(agentModelChoiceSchema), { onExcessProperty: "error" })(json);
|
|
2371
2434
|
return parsed._tag === "None" ? null : parsed.value;
|
|
2372
2435
|
},
|
|
2436
|
+
readInstructions: async (agentId, principal) => {
|
|
2437
|
+
if (!oysterPrincipalIsOwner(principal))
|
|
2438
|
+
return { error: "not_granted" };
|
|
2439
|
+
if (!(await directory().has(agentId)))
|
|
2440
|
+
return { error: "not_found" };
|
|
2441
|
+
return {
|
|
2442
|
+
agentId,
|
|
2443
|
+
instructions: await env.AGENTS.getByName(agentId).readInstructions(),
|
|
2444
|
+
};
|
|
2445
|
+
},
|
|
2446
|
+
setInstructions: async (agentId, instructions, principal) => {
|
|
2447
|
+
if (!oysterPrincipalIsOwner(principal))
|
|
2448
|
+
return { error: "not_granted" };
|
|
2449
|
+
if (!(await directory().has(agentId)))
|
|
2450
|
+
return { error: "not_found" };
|
|
2451
|
+
return {
|
|
2452
|
+
agentId,
|
|
2453
|
+
instructions: await env.AGENTS.getByName(agentId).writeInstructions(instructions),
|
|
2454
|
+
};
|
|
2455
|
+
},
|
|
2373
2456
|
setModelChoice: async (agentId, choice, principal) => {
|
|
2374
2457
|
if (!oysterPrincipalIsOwner(principal))
|
|
2375
2458
|
return { error: "not_granted" };
|
|
@@ -6,7 +6,7 @@ import * as z from "zod";
|
|
|
6
6
|
import { computerProcessSchema, computerToolResultSchema, readOutputSchema } from "@fungi.computer/computer-contract";
|
|
7
7
|
import { ComputerDO as NativeComputerDO, type AttachedBackend, type ComputerEnv, type ComputerFilesRpc } from "@fungi.computer/computer";
|
|
8
8
|
import { patchInputSchema, patchOutputSchema } from "@fungi.computer/knapsack/files-patch";
|
|
9
|
-
import { listOutputSchema, writeOutputSchema, mkdirOutputSchema, computerPortsOutputSchema, computerPortOutputSchema, computerPortRemovalOutputSchema, processListOutputSchema, processKillOutputSchema, processLogsOutputSchema, computerOperationResultSchema, type ComputerExecutionHostHooks, type ComputerValue } from "@fungi.computer/computer-contract";
|
|
9
|
+
import { listOutputSchema, writeOutputSchema, mkdirOutputSchema, moveOutputSchema, computerPortsOutputSchema, computerPortOutputSchema, computerPortRemovalOutputSchema, processListOutputSchema, processKillOutputSchema, processLogsOutputSchema, computerOperationResultSchema, type ComputerExecutionHostHooks, type ComputerValue } from "@fungi.computer/computer-contract";
|
|
10
10
|
import { type WorkflowGitCredential, type WorkflowGitPassGrant } from "@fungi.computer/braid/runtime";
|
|
11
11
|
import { type ComputerAction, type ComputerBackendView, type ComputerGrant, type LocalBackendAttachInput, type LocalBackendDetachInput } from "@fungi.computer/computer/fleet";
|
|
12
12
|
import type { InvocationFrame } from "../invocation.js";
|
|
@@ -39,8 +39,8 @@ export type StandaloneComputerResult = z.output<typeof listOutputSchema> | Reado
|
|
|
39
39
|
encoding: "base64";
|
|
40
40
|
truncated: boolean;
|
|
41
41
|
}> | Readonly<{
|
|
42
|
-
error: "conflict" | "no_runtime" | "not_found";
|
|
43
|
-
}> | z.output<typeof writeOutputSchema> | 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 computerProcessSchema> | ComputerPorts["ports"][number] | z.output<typeof computerOperationResultSchema> | z.output<typeof readOutputSchema> | z.output<typeof computerToolResultSchema>;
|
|
42
|
+
error: "conflict" | "no_runtime" | "not_found" | "invalid";
|
|
43
|
+
}> | 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 computerProcessSchema> | ComputerPorts["ports"][number] | z.output<typeof computerOperationResultSchema> | z.output<typeof readOutputSchema> | z.output<typeof computerToolResultSchema>;
|
|
44
44
|
/**
|
|
45
45
|
* A port-preview listing, or the typed refusal the owner route presents with
|
|
46
46
|
* {@link appMethodRefusalStatus}. A refusal never escapes as a 500.
|
|
@@ -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, computerExecutionRequestSchema, computerValueSchema, computerPortInputSchema, listInputSchema, listOutputSchema, readBytesInputSchema, writeInputSchema, replaceInputSchema, writeOutputSchema, mkdirOutputSchema, computerPortsOutputSchema, computerPortOutputSchema, computerPortRemovalOutputSchema, processListOutputSchema, processKillOutputSchema, processLogsInputSchema, processLogsOutputSchema, computerOperationResultSchema, mintComputerRequestId, processIdInputSchema, } from "@fungi.computer/computer-contract";
|
|
15
|
+
import { ComputerFileConflict, ComputerFileMoveError, computerExecutionRequestSchema, computerValueSchema, computerPortInputSchema, listInputSchema, listOutputSchema, readBytesInputSchema, writeInputSchema, replaceInputSchema, writeOutputSchema, mkdirOutputSchema, moveInputSchema, moveOutputSchema, computerPortsOutputSchema, computerPortOutputSchema, computerPortRemovalOutputSchema, processListOutputSchema, processKillOutputSchema, processLogsInputSchema, processLogsOutputSchema, 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";
|
|
@@ -84,6 +84,7 @@ const computerTools = {
|
|
|
84
84
|
read: { action: "files.read", output: readOutputSchema },
|
|
85
85
|
list: { action: "files.list", output: listOutputSchema },
|
|
86
86
|
write: { action: "files.write", output: writeOutputSchema },
|
|
87
|
+
move: { action: "files.move", output: moveOutputSchema },
|
|
87
88
|
mkdir: { action: "mkdir", output: mkdirOutputSchema },
|
|
88
89
|
bash: { action: "bash", output: computerToolResultSchema },
|
|
89
90
|
exec: { action: "exec", output: computerToolResultSchema },
|
|
@@ -95,6 +96,7 @@ const computerTool = z.enum([
|
|
|
95
96
|
"read",
|
|
96
97
|
"list",
|
|
97
98
|
"write",
|
|
99
|
+
"move",
|
|
98
100
|
"mkdir",
|
|
99
101
|
"bash",
|
|
100
102
|
"exec",
|
|
@@ -156,6 +158,9 @@ export class ComputerDO extends NativeComputerDO {
|
|
|
156
158
|
describeBackends: () => this.describeBackends(),
|
|
157
159
|
requireHostedRoute: () => this.requireHostedRoute(),
|
|
158
160
|
containerRunning: (backing) => this.containerRunning(backing),
|
|
161
|
+
endedByIdleSleep: (backendId) => {
|
|
162
|
+
this.endedByIdleSleep(backendId);
|
|
163
|
+
},
|
|
159
164
|
// Standalone boots use the native host directly, not Hub's admission queue.
|
|
160
165
|
vmQueuePosition: () => Promise.resolve(null),
|
|
161
166
|
},
|
|
@@ -531,6 +536,21 @@ export class ComputerDO extends NativeComputerDO {
|
|
|
531
536
|
}
|
|
532
537
|
case "files.write":
|
|
533
538
|
return writeOutputSchema.parse(await this.callAfterAcceptance("write", input, accept));
|
|
539
|
+
case "files.move":
|
|
540
|
+
try {
|
|
541
|
+
return moveOutputSchema.parse(await this.callAfterAcceptance("move", input, accept));
|
|
542
|
+
}
|
|
543
|
+
catch (error) {
|
|
544
|
+
if (error instanceof ComputerFileMoveError)
|
|
545
|
+
return {
|
|
546
|
+
error: error.reason === "exists"
|
|
547
|
+
? "conflict"
|
|
548
|
+
: error.reason === "missing"
|
|
549
|
+
? "not_found"
|
|
550
|
+
: "invalid",
|
|
551
|
+
};
|
|
552
|
+
throw error;
|
|
553
|
+
}
|
|
534
554
|
case "mkdir":
|
|
535
555
|
return mkdirOutputSchema.parse(await this.callAfterAcceptance("mkdir", input, accept));
|
|
536
556
|
default:
|
|
@@ -775,6 +795,18 @@ export const computerFrameMethods = {
|
|
|
775
795
|
.parse(value),
|
|
776
796
|
requiredOperations: () => ["write"],
|
|
777
797
|
},
|
|
798
|
+
move: {
|
|
799
|
+
decodeArgs: (args) => z.tuple([moveInputSchema]).parse(args),
|
|
800
|
+
decodeResult: (value) => z
|
|
801
|
+
.union([
|
|
802
|
+
moveOutputSchema,
|
|
803
|
+
z.strictObject({
|
|
804
|
+
error: z.enum(["conflict", "not_found", "invalid"]),
|
|
805
|
+
}),
|
|
806
|
+
])
|
|
807
|
+
.parse(value),
|
|
808
|
+
requiredOperations: () => ["move"],
|
|
809
|
+
},
|
|
778
810
|
ports: {
|
|
779
811
|
decodeArgs: (args) => z.tuple([empty]).parse(args),
|
|
780
812
|
decodeResult: (value) => computerPortsOutputSchema.parse(value),
|
|
@@ -904,6 +936,10 @@ export async function computerInvocation(env, scope, frame, method, args) {
|
|
|
904
936
|
};
|
|
905
937
|
break;
|
|
906
938
|
}
|
|
939
|
+
case "move":
|
|
940
|
+
action = "files.move";
|
|
941
|
+
[input] = z.tuple([moveInputSchema]).parse(args);
|
|
942
|
+
break;
|
|
907
943
|
case "ports":
|
|
908
944
|
action = "listPorts";
|
|
909
945
|
[input] = z.tuple([empty]).parse(args);
|
|
@@ -103,7 +103,7 @@ export declare function createStandaloneWorkflowHost(owner: WatchdogSqliteOwner,
|
|
|
103
103
|
authorityVersion: number;
|
|
104
104
|
declaredOperationsDigest: import("@fungi.computer/puffball").Sha256Digest;
|
|
105
105
|
approvedGrants: readonly Readonly<{
|
|
106
|
-
capability: "computer.list" | "computer.readFile" | "computer.writeFile" | "computer.execute" | "approvals" | "agent.list" | "agent.manage" | "agent.rename" | "agent.avatar" | "agent.toolPolicy" | "agent.read" | "agent.send" | "llm.generation" | "media.generation" | "media.share" | "games:servers" | "git.repository" | "apps.open" | "apps.call" | "app.storage" | "app.events.emit" | "team.workbenchHost" | "marketplace.browse" | "marketplace.purchase" | "workflow.run" | "workflow.publish" | "workflow.arm" | "world" | "channels.read" | "channels.personal.manage";
|
|
106
|
+
capability: "computer.list" | "computer.readFile" | "computer.writeFile" | "computer.execute" | "approvals" | "agent.list" | "agent.manage" | "agent.rename" | "agent.avatar" | "agent.instructions" | "agent.toolPolicy" | "agent.read" | "agent.send" | "llm.generation" | "media.generation" | "media.share" | "games:servers" | "git.repository" | "apps.open" | "apps.call" | "app.storage" | "app.events.emit" | "team.workbenchHost" | "marketplace.browse" | "marketplace.purchase" | "workflow.run" | "workflow.publish" | "workflow.arm" | "world" | "channels.read" | "channels.personal.manage";
|
|
107
107
|
capabilityApproved: true;
|
|
108
108
|
operations: readonly string[];
|
|
109
109
|
resources: "tenant-scope" | readonly Readonly<{
|
|
@@ -220,7 +220,7 @@ export declare function createStandaloneWorkflowHost(owner: WatchdogSqliteOwner,
|
|
|
220
220
|
authorityVersion: number;
|
|
221
221
|
declaredOperationsDigest: import("@fungi.computer/puffball").Sha256Digest;
|
|
222
222
|
approvedGrants: readonly Readonly<{
|
|
223
|
-
capability: "computer.list" | "computer.readFile" | "computer.writeFile" | "computer.execute" | "approvals" | "agent.list" | "agent.manage" | "agent.rename" | "agent.avatar" | "agent.toolPolicy" | "agent.read" | "agent.send" | "llm.generation" | "media.generation" | "media.share" | "games:servers" | "git.repository" | "apps.open" | "apps.call" | "app.storage" | "app.events.emit" | "team.workbenchHost" | "marketplace.browse" | "marketplace.purchase" | "workflow.run" | "workflow.publish" | "workflow.arm" | "world" | "channels.read" | "channels.personal.manage";
|
|
223
|
+
capability: "computer.list" | "computer.readFile" | "computer.writeFile" | "computer.execute" | "approvals" | "agent.list" | "agent.manage" | "agent.rename" | "agent.avatar" | "agent.instructions" | "agent.toolPolicy" | "agent.read" | "agent.send" | "llm.generation" | "media.generation" | "media.share" | "games:servers" | "git.repository" | "apps.open" | "apps.call" | "app.storage" | "app.events.emit" | "team.workbenchHost" | "marketplace.browse" | "marketplace.purchase" | "workflow.run" | "workflow.publish" | "workflow.arm" | "world" | "channels.read" | "channels.personal.manage";
|
|
224
224
|
capabilityApproved: true;
|
|
225
225
|
operations: readonly string[];
|
|
226
226
|
resources: "tenant-scope" | readonly Readonly<{
|
|
@@ -287,7 +287,7 @@ export declare function createStandaloneWorkflowHost(owner: WatchdogSqliteOwner,
|
|
|
287
287
|
authorityVersion: number;
|
|
288
288
|
declaredOperationsDigest: import("@fungi.computer/puffball").Sha256Digest;
|
|
289
289
|
approvedGrants: readonly Readonly<{
|
|
290
|
-
capability: "computer.list" | "computer.readFile" | "computer.writeFile" | "computer.execute" | "approvals" | "agent.list" | "agent.manage" | "agent.rename" | "agent.avatar" | "agent.toolPolicy" | "agent.read" | "agent.send" | "llm.generation" | "media.generation" | "media.share" | "games:servers" | "git.repository" | "apps.open" | "apps.call" | "app.storage" | "app.events.emit" | "team.workbenchHost" | "marketplace.browse" | "marketplace.purchase" | "workflow.run" | "workflow.publish" | "workflow.arm" | "world" | "channels.read" | "channels.personal.manage";
|
|
290
|
+
capability: "computer.list" | "computer.readFile" | "computer.writeFile" | "computer.execute" | "approvals" | "agent.list" | "agent.manage" | "agent.rename" | "agent.avatar" | "agent.instructions" | "agent.toolPolicy" | "agent.read" | "agent.send" | "llm.generation" | "media.generation" | "media.share" | "games:servers" | "git.repository" | "apps.open" | "apps.call" | "app.storage" | "app.events.emit" | "team.workbenchHost" | "marketplace.browse" | "marketplace.purchase" | "workflow.run" | "workflow.publish" | "workflow.arm" | "world" | "channels.read" | "channels.personal.manage";
|
|
291
291
|
capabilityApproved: true;
|
|
292
292
|
operations: readonly string[];
|
|
293
293
|
resources: "tenant-scope" | readonly Readonly<{
|
|
@@ -387,7 +387,7 @@ export declare function createStandaloneWorkflowHost(owner: WatchdogSqliteOwner,
|
|
|
387
387
|
authorityVersion: number;
|
|
388
388
|
declaredOperationsDigest: import("@fungi.computer/puffball").Sha256Digest;
|
|
389
389
|
approvedGrants: readonly Readonly<{
|
|
390
|
-
capability: "computer.list" | "computer.readFile" | "computer.writeFile" | "computer.execute" | "approvals" | "agent.list" | "agent.manage" | "agent.rename" | "agent.avatar" | "agent.toolPolicy" | "agent.read" | "agent.send" | "llm.generation" | "media.generation" | "media.share" | "games:servers" | "git.repository" | "apps.open" | "apps.call" | "app.storage" | "app.events.emit" | "team.workbenchHost" | "marketplace.browse" | "marketplace.purchase" | "workflow.run" | "workflow.publish" | "workflow.arm" | "world" | "channels.read" | "channels.personal.manage";
|
|
390
|
+
capability: "computer.list" | "computer.readFile" | "computer.writeFile" | "computer.execute" | "approvals" | "agent.list" | "agent.manage" | "agent.rename" | "agent.avatar" | "agent.instructions" | "agent.toolPolicy" | "agent.read" | "agent.send" | "llm.generation" | "media.generation" | "media.share" | "games:servers" | "git.repository" | "apps.open" | "apps.call" | "app.storage" | "app.events.emit" | "team.workbenchHost" | "marketplace.browse" | "marketplace.purchase" | "workflow.run" | "workflow.publish" | "workflow.arm" | "world" | "channels.read" | "channels.personal.manage";
|
|
391
391
|
capabilityApproved: true;
|
|
392
392
|
operations: readonly string[];
|
|
393
393
|
resources: "tenant-scope" | readonly Readonly<{
|
|
@@ -468,7 +468,7 @@ export declare function createStandaloneWorkflowHost(owner: WatchdogSqliteOwner,
|
|
|
468
468
|
authorityVersion: number;
|
|
469
469
|
declaredOperationsDigest: import("@fungi.computer/puffball").Sha256Digest;
|
|
470
470
|
approvedGrants: readonly Readonly<{
|
|
471
|
-
capability: "computer.list" | "computer.readFile" | "computer.writeFile" | "computer.execute" | "approvals" | "agent.list" | "agent.manage" | "agent.rename" | "agent.avatar" | "agent.toolPolicy" | "agent.read" | "agent.send" | "llm.generation" | "media.generation" | "media.share" | "games:servers" | "git.repository" | "apps.open" | "apps.call" | "app.storage" | "app.events.emit" | "team.workbenchHost" | "marketplace.browse" | "marketplace.purchase" | "workflow.run" | "workflow.publish" | "workflow.arm" | "world" | "channels.read" | "channels.personal.manage";
|
|
471
|
+
capability: "computer.list" | "computer.readFile" | "computer.writeFile" | "computer.execute" | "approvals" | "agent.list" | "agent.manage" | "agent.rename" | "agent.avatar" | "agent.instructions" | "agent.toolPolicy" | "agent.read" | "agent.send" | "llm.generation" | "media.generation" | "media.share" | "games:servers" | "git.repository" | "apps.open" | "apps.call" | "app.storage" | "app.events.emit" | "team.workbenchHost" | "marketplace.browse" | "marketplace.purchase" | "workflow.run" | "workflow.publish" | "workflow.arm" | "world" | "channels.read" | "channels.personal.manage";
|
|
472
472
|
capabilityApproved: true;
|
|
473
473
|
operations: readonly string[];
|
|
474
474
|
resources: "tenant-scope" | readonly Readonly<{
|
|
@@ -344,7 +344,7 @@ export declare function createStandaloneWorkflowTriggerHost(options: {
|
|
|
344
344
|
readonly operations: readonly string[];
|
|
345
345
|
}[];
|
|
346
346
|
readonly nodeId: string;
|
|
347
|
-
readonly capabilities: readonly ("approvals" | "agent.list" | "agent.manage" | "agent.rename" | "agent.avatar" | "agent.toolPolicy" | "agent.read" | "agent.send" | "computer.list" | "computer.readFile" | "computer.writeFile" | "computer.execute" | "llm.generation" | "media.generation" | "media.share" | "games:servers" | "git.repository" | "apps.open" | "apps.call" | "app.storage" | "app.events.emit" | "team.workbenchHost" | "marketplace.browse" | "marketplace.purchase" | "workflow.run" | "workflow.publish" | "workflow.arm" | "world" | "channels.read" | "channels.personal.manage")[];
|
|
347
|
+
readonly capabilities: readonly ("approvals" | "agent.list" | "agent.manage" | "agent.rename" | "agent.avatar" | "agent.instructions" | "agent.toolPolicy" | "agent.read" | "agent.send" | "computer.list" | "computer.readFile" | "computer.writeFile" | "computer.execute" | "llm.generation" | "media.generation" | "media.share" | "games:servers" | "git.repository" | "apps.open" | "apps.call" | "app.storage" | "app.events.emit" | "team.workbenchHost" | "marketplace.browse" | "marketplace.purchase" | "workflow.run" | "workflow.publish" | "workflow.arm" | "world" | "channels.read" | "channels.personal.manage")[];
|
|
348
348
|
readonly graphId?: string;
|
|
349
349
|
}[];
|
|
350
350
|
readonly nodeGitAccess: readonly {
|
package/docs/api/agents.md
CHANGED
|
@@ -269,6 +269,24 @@ type OysterAgents = Readonly<{
|
|
|
269
269
|
};
|
|
270
270
|
keyId?: string;
|
|
271
271
|
} | null>;
|
|
272
|
+
readInstructions: Promise<
|
|
273
|
+
| Readonly<{
|
|
274
|
+
agentId: string;
|
|
275
|
+
instructions: string;
|
|
276
|
+
}>
|
|
277
|
+
| Readonly<{
|
|
278
|
+
error: "not_found" | "not_granted";
|
|
279
|
+
}>
|
|
280
|
+
>;
|
|
281
|
+
setInstructions: Promise<
|
|
282
|
+
| Readonly<{
|
|
283
|
+
agentId: string;
|
|
284
|
+
instructions: string;
|
|
285
|
+
}>
|
|
286
|
+
| Readonly<{
|
|
287
|
+
error: "not_found" | "not_granted";
|
|
288
|
+
}>
|
|
289
|
+
>;
|
|
272
290
|
decodeModelChoice: {
|
|
273
291
|
keySource: "workers-ai" | "ai-gateway" | "byok";
|
|
274
292
|
model: {
|