@fungi.computer/oyster 0.9.0 → 0.10.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/README.md +13 -0
- package/dist/agents.d.ts +16 -1
- package/dist/agents.js +60 -3
- package/dist/computer-control-port.d.ts +20 -1
- package/dist/mcp.d.ts +128 -0
- package/dist/mcp.js +63 -1
- package/dist/standalone/agent-computers.d.ts +12 -1
- package/dist/standalone/agent-computers.js +35 -0
- package/dist/standalone/agent-connections.d.ts +47 -0
- package/dist/standalone/agent-connections.js +170 -0
- package/dist/standalone/agent-model-choice.d.ts +7 -3
- package/dist/standalone/agent-model-choice.js +33 -4
- package/dist/standalone/agents.d.ts +70 -9
- package/dist/standalone/agents.js +187 -110
- package/dist/standalone/browser.d.ts +4 -3
- package/dist/standalone/browser.js +4 -3
- package/dist/standalone/computer-control.js +55 -1
- package/dist/standalone/computer-fleet.d.ts +21 -0
- package/dist/standalone/computer-fleet.js +30 -6
- package/dist/standalone/computer.d.ts +20 -1
- package/dist/standalone/computer.js +63 -1
- package/dist/standalone/model-key-vault.d.ts +50 -0
- package/dist/standalone/model-key-vault.js +147 -0
- package/dist/standalone/registry.d.ts +23 -0
- package/dist/standalone/registry.js +30 -0
- package/dist/standalone/web.d.ts +10 -0
- package/dist/standalone/web.js +34 -0
- package/dist/standalone/worker-routes.d.ts +3 -1
- package/dist/standalone/worker-routes.js +1 -0
- package/dist/standalone/worker.js +9 -1
- package/dist/web/index.d.ts +3 -0
- package/dist/web/index.js +3 -0
- package/dist/web/search-contract.d.ts +19 -0
- package/dist/web/search-contract.js +14 -0
- package/dist/web/search.d.ts +25 -0
- package/dist/web/search.js +123 -0
- package/dist/web/source.d.ts +46 -0
- package/dist/web/source.js +335 -0
- package/dist/workers-git.js +2 -1
- package/docs/api/agents.md +81 -3
- package/docs/api/apps.md +129 -111
- package/docs/api/build-contract.md +27 -21
- package/docs/api/build.md +55 -54
- package/docs/api/git.md +3 -3
- package/docs/api/host.md +69 -60
- package/docs/api/mcp.md +81 -44
- package/docs/api/workers-git.md +6 -6
- package/docs/api/workers.md +53 -47
- package/package.json +27 -22
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { defineIdFamily } from "@fungi.computer/cairn";
|
|
2
|
+
import { ConnectionsError, createConnections, createSealedCustody, } from "@fungi.computer/veil/connections";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import { maxAgentMcpServers, } from "../agents.js";
|
|
5
|
+
const ids = defineIdFamily({
|
|
6
|
+
family: "oyster-connection",
|
|
7
|
+
version: 1,
|
|
8
|
+
kinds: { connection: { prefix: "conn" } },
|
|
9
|
+
});
|
|
10
|
+
/** The Oyster owner is the only actor that manages connections. */
|
|
11
|
+
const owner = "owner";
|
|
12
|
+
export async function mcpRequestData(request) {
|
|
13
|
+
return {
|
|
14
|
+
url: request.url,
|
|
15
|
+
method: request.method,
|
|
16
|
+
headers: [...request.headers],
|
|
17
|
+
body: request.body === null ? null : await request.arrayBuffer(),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* This instance's Agent MCP connections over Veil's connections core. The
|
|
22
|
+
* owner holds every credential; an Agent receives a secret-free projection and
|
|
23
|
+
* a fetch that only the owner side can complete.
|
|
24
|
+
*/
|
|
25
|
+
export function createAgentMcpConnections(options) {
|
|
26
|
+
const connections = createConnections({
|
|
27
|
+
ownerId: options.ownerId,
|
|
28
|
+
store: options.store,
|
|
29
|
+
custody: createSealedCustody({
|
|
30
|
+
vault: options.vault,
|
|
31
|
+
send: options.send,
|
|
32
|
+
}),
|
|
33
|
+
authorize: (actor) => actor === owner,
|
|
34
|
+
clock: () => Date.now(),
|
|
35
|
+
ids: () => ids.connection.generate(),
|
|
36
|
+
});
|
|
37
|
+
const run = (effect) => Effect.runPromise(effect);
|
|
38
|
+
const projection = (agentId) => run(connections.projection(agentId));
|
|
39
|
+
async function servers(agentId) {
|
|
40
|
+
if (!options.hasAgent(agentId))
|
|
41
|
+
return null;
|
|
42
|
+
const [granted, listed] = await Promise.all([
|
|
43
|
+
projection(agentId),
|
|
44
|
+
run(connections.list(owner)),
|
|
45
|
+
]);
|
|
46
|
+
return granted.connections.flatMap((connection) => connection.surface.kind === "mcp"
|
|
47
|
+
? [
|
|
48
|
+
{
|
|
49
|
+
serverId: connection.connectionId,
|
|
50
|
+
name: connection.name,
|
|
51
|
+
url: connection.surface.url,
|
|
52
|
+
hasBearer: listed.find((row) => row.connectionId === connection.connectionId)?.credentialKind === "static",
|
|
53
|
+
},
|
|
54
|
+
]
|
|
55
|
+
: []);
|
|
56
|
+
}
|
|
57
|
+
async function add(agentId, input) {
|
|
58
|
+
const current = await servers(agentId);
|
|
59
|
+
if (current === null)
|
|
60
|
+
return { error: "not_found" };
|
|
61
|
+
const url = new URL(input.url).href;
|
|
62
|
+
if (current.some((server) => server.name === input.name || server.url === url))
|
|
63
|
+
return { error: "duplicate_name" };
|
|
64
|
+
if (current.length >= maxAgentMcpServers)
|
|
65
|
+
return { error: "limit" };
|
|
66
|
+
try {
|
|
67
|
+
const draft = {
|
|
68
|
+
requestId: ids.connection.generate(),
|
|
69
|
+
name: input.name,
|
|
70
|
+
surface: { kind: "mcp", url },
|
|
71
|
+
};
|
|
72
|
+
const { connectionId } = await run(input.bearer === null
|
|
73
|
+
? connections.begin(owner, { ...draft, credential: { kind: "none" } })
|
|
74
|
+
: connections.begin(owner, {
|
|
75
|
+
...draft,
|
|
76
|
+
credential: { kind: "static", placement: "bearer" },
|
|
77
|
+
secret: input.bearer,
|
|
78
|
+
}));
|
|
79
|
+
await run(connections.grant(owner, { connectionId, agentId, tools: "all" }));
|
|
80
|
+
await options.notify(agentId);
|
|
81
|
+
return {
|
|
82
|
+
serverId: connectionId,
|
|
83
|
+
name: input.name,
|
|
84
|
+
url,
|
|
85
|
+
hasBearer: input.bearer !== null,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
catch (cause) {
|
|
89
|
+
if (cause instanceof ConnectionsError &&
|
|
90
|
+
(cause.code === "invalid_input" || cause.code === "denied"))
|
|
91
|
+
return { error: "invalid_endpoint" };
|
|
92
|
+
throw cause;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async function remove(agentId, serverId) {
|
|
96
|
+
const current = await servers(agentId);
|
|
97
|
+
if (current?.some((server) => server.serverId === serverId) !== true)
|
|
98
|
+
return false;
|
|
99
|
+
const holders = (await run(connections.list(owner))).flatMap((row) => row.connectionId === serverId ? row.grants.map((g) => g.agentId) : []);
|
|
100
|
+
await run(connections.revoke(owner, { connectionId: serverId }));
|
|
101
|
+
await Promise.all(holders.map((holder) => options.notify(holder)));
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
/** Complete one Agent request on the owner side: the only place a credential opens. */
|
|
105
|
+
async function fetchFor(agentId, ref, data) {
|
|
106
|
+
try {
|
|
107
|
+
const init = {
|
|
108
|
+
method: data.method,
|
|
109
|
+
headers: data.headers.map(([name, value]) => [name, value]),
|
|
110
|
+
redirect: "error",
|
|
111
|
+
};
|
|
112
|
+
if (data.body !== null)
|
|
113
|
+
init.body = data.body;
|
|
114
|
+
return await connections.egress(agentId, ref)(new Request(data.url, init));
|
|
115
|
+
}
|
|
116
|
+
catch (cause) {
|
|
117
|
+
if (cause instanceof ConnectionsError)
|
|
118
|
+
return { error: cause.code };
|
|
119
|
+
throw cause;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return { servers, add, remove, projection, fetch: fetchFor };
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* The Agent half: Knapsack connects to each granted server through a fetch that
|
|
126
|
+
* is completed by the owner. No header, token or locator is ever held here.
|
|
127
|
+
*/
|
|
128
|
+
export function agentMcpSourceOptions(input) {
|
|
129
|
+
const refs = new Map();
|
|
130
|
+
return {
|
|
131
|
+
id: "agent-mcp",
|
|
132
|
+
read: async () => {
|
|
133
|
+
const granted = await input.read();
|
|
134
|
+
refs.clear();
|
|
135
|
+
const list = granted.connections.flatMap((connection) => {
|
|
136
|
+
if (connection.surface.kind !== "mcp")
|
|
137
|
+
return [];
|
|
138
|
+
refs.set(new URL(connection.surface.url).href, {
|
|
139
|
+
connectionId: connection.connectionId,
|
|
140
|
+
grantVersion: connection.grantVersion,
|
|
141
|
+
});
|
|
142
|
+
return [
|
|
143
|
+
{
|
|
144
|
+
id: `mcp.${connection.connectionId}`,
|
|
145
|
+
name: connection.name,
|
|
146
|
+
url: new URL(connection.surface.url),
|
|
147
|
+
},
|
|
148
|
+
];
|
|
149
|
+
});
|
|
150
|
+
return {
|
|
151
|
+
// Secret-free: ids, versions and endpoints.
|
|
152
|
+
version: JSON.stringify(granted.connections.map((c) => [
|
|
153
|
+
c.connectionId,
|
|
154
|
+
c.grantVersion,
|
|
155
|
+
c.authorityVersion,
|
|
156
|
+
])),
|
|
157
|
+
servers: list,
|
|
158
|
+
};
|
|
159
|
+
},
|
|
160
|
+
subscribe: input.subscribe,
|
|
161
|
+
onUnavailable: input.onUnavailable,
|
|
162
|
+
fetch: (url, init) => {
|
|
163
|
+
const request = new Request(url, init);
|
|
164
|
+
const ref = refs.get(request.url);
|
|
165
|
+
return ref === undefined
|
|
166
|
+
? Promise.reject(new Error("MCP server is not connected"))
|
|
167
|
+
: input.fetch(ref, request);
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { Api, Model } from "@earendil-works/pi-ai";
|
|
2
2
|
import * as Schema from "effect/Schema";
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* A credential-source address, not credential material. `byok` names one of the
|
|
5
|
+
* instance's sealed model keys by id; no other source carries a key id.
|
|
6
|
+
*/
|
|
4
7
|
export declare const agentModelChoiceSchema: Schema.Struct<{
|
|
5
8
|
readonly keySource: Schema.Literals<readonly ["workers-ai", "ai-gateway", "byok"]>;
|
|
6
9
|
readonly model: Schema.Struct<{
|
|
@@ -8,11 +11,12 @@ export declare const agentModelChoiceSchema: Schema.Struct<{
|
|
|
8
11
|
readonly modelId: Schema.String;
|
|
9
12
|
readonly reasoning: Schema.optional<Schema.Literals<readonly ["minimal", "low", "medium", "high", "xhigh", "max"]>>;
|
|
10
13
|
}>;
|
|
14
|
+
readonly keyId: Schema.optional<Schema.NonEmptyString>;
|
|
11
15
|
}>;
|
|
12
16
|
/** The Agent's model preference and source reference, never credential material. */
|
|
13
17
|
export type AgentModelChoice = typeof agentModelChoiceSchema.Type;
|
|
14
18
|
/** Stable reason for rejecting a model or credential source before a run. */
|
|
15
|
-
export type AgentModelRefusal = "invalid_model_choice" | "unsupported_key_source" | "key_source_mismatch" | "model_unavailable" | "key_not_connected";
|
|
19
|
+
export type AgentModelRefusal = "invalid_model_choice" | "unsupported_key_source" | "key_source_mismatch" | "model_unavailable" | "key_not_connected" | "key_removed";
|
|
16
20
|
export declare class AgentModelRefused extends Error {
|
|
17
21
|
readonly reason: AgentModelRefusal;
|
|
18
22
|
constructor(reason: AgentModelRefusal);
|
|
@@ -23,7 +27,7 @@ export declare function selectAgentModel(choice: AgentModelChoice): Promise<Mode
|
|
|
23
27
|
export declare function agentModelChoice(storage: Readonly<{
|
|
24
28
|
get<T = unknown>(key: string): Promise<T | undefined>;
|
|
25
29
|
put(key: string, value: AgentModelChoice): Promise<void>;
|
|
26
|
-
}>, admit: (choice: AgentModelChoice) => void): {
|
|
30
|
+
}>, admit: (choice: AgentModelChoice) => void | Promise<void>): {
|
|
27
31
|
read(): Promise<AgentModelChoice>;
|
|
28
32
|
set(input: AgentModelChoice): Promise<AgentModelChoice>;
|
|
29
33
|
};
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { ModelPreferenceSchema } from "@fungi.computer/shiitake/model-preference";
|
|
2
2
|
import { cloudflareWorkersAIProvider } from "@earendil-works/pi-ai/providers/cloudflare-workers-ai";
|
|
3
|
+
import { isModelKeyProvider } from "@fungi.computer/veil/model-keys";
|
|
3
4
|
import * as Schema from "effect/Schema";
|
|
4
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* A credential-source address, not credential material. `byok` names one of the
|
|
7
|
+
* instance's sealed model keys by id; no other source carries a key id.
|
|
8
|
+
*/
|
|
5
9
|
export const agentModelChoiceSchema = Schema.Struct({
|
|
6
10
|
keySource: Schema.Literals(["workers-ai", "ai-gateway", "byok"]),
|
|
7
11
|
model: ModelPreferenceSchema,
|
|
12
|
+
keyId: Schema.optional(Schema.NonEmptyString),
|
|
8
13
|
});
|
|
9
14
|
export class AgentModelRefused extends Error {
|
|
10
15
|
reason;
|
|
@@ -22,11 +27,32 @@ const defaultChoice = {
|
|
|
22
27
|
modelId: "@cf/moonshotai/kimi-k2.6",
|
|
23
28
|
},
|
|
24
29
|
};
|
|
30
|
+
/** Pi's maintained catalog for a provider a key may be brought for. */
|
|
31
|
+
async function byokCatalog(provider) {
|
|
32
|
+
if (provider === "anthropic")
|
|
33
|
+
return (await import("@earendil-works/pi-ai/providers/anthropic"))
|
|
34
|
+
.anthropicProvider()
|
|
35
|
+
.getModels();
|
|
36
|
+
if (provider === "openai")
|
|
37
|
+
return (await import("@earendil-works/pi-ai/providers/openai"))
|
|
38
|
+
.openaiProvider()
|
|
39
|
+
.getModels();
|
|
40
|
+
return (await import("@earendil-works/pi-ai/providers/openrouter"))
|
|
41
|
+
.openrouterProvider()
|
|
42
|
+
.getModels();
|
|
43
|
+
}
|
|
25
44
|
/** Read the maintained Pi catalog; never accept a model from a different egress. */
|
|
26
45
|
export async function selectAgentModel(choice) {
|
|
27
|
-
if (choice.keySource === "byok")
|
|
28
|
-
throw new AgentModelRefused("unsupported_key_source");
|
|
29
46
|
const { providerId, modelId, reasoning } = choice.model;
|
|
47
|
+
if (choice.keySource === "byok") {
|
|
48
|
+
// Only a catalogued provider's own models; an OpenAI-compatible base has none.
|
|
49
|
+
if (!isModelKeyProvider(providerId) || providerId === "openai-compatible")
|
|
50
|
+
throw new AgentModelRefused("unsupported_key_source");
|
|
51
|
+
const found = (await byokCatalog(providerId)).find((item) => item.id === modelId);
|
|
52
|
+
if (found === undefined || (reasoning !== undefined && !found.reasoning))
|
|
53
|
+
throw new AgentModelRefused("model_unavailable");
|
|
54
|
+
return found;
|
|
55
|
+
}
|
|
30
56
|
if ((choice.keySource === "workers-ai" &&
|
|
31
57
|
providerId !== "cloudflare-workers-ai") ||
|
|
32
58
|
(choice.keySource === "ai-gateway" &&
|
|
@@ -63,8 +89,11 @@ export function agentModelChoice(storage, admit) {
|
|
|
63
89
|
if (parsed._tag === "None")
|
|
64
90
|
throw new AgentModelRefused("invalid_model_choice");
|
|
65
91
|
const choice = parsed.value;
|
|
92
|
+
// A key id belongs to byok alone, and byok cannot run without one.
|
|
93
|
+
if ((choice.keySource === "byok") !== (choice.keyId !== undefined))
|
|
94
|
+
throw new AgentModelRefused("invalid_model_choice");
|
|
66
95
|
await selectAgentModel(choice);
|
|
67
|
-
admit(choice);
|
|
96
|
+
await admit(choice);
|
|
68
97
|
await storage.put(key, choice);
|
|
69
98
|
return choice;
|
|
70
99
|
},
|
|
@@ -15,6 +15,7 @@ import { type ComputerGrant } from "@fungi.computer/computer/fleet";
|
|
|
15
15
|
import { DurableObject } from "cloudflare:workers";
|
|
16
16
|
import type { StandaloneComputerEnv } from "./computer.js";
|
|
17
17
|
import { ShiitakeDO } from "@fungi.computer/shiitake/cloudflare";
|
|
18
|
+
import { type ModelKeyRecord, type ModelKeyRefusal, type ModelKeySealInput } from "./model-key-vault.js";
|
|
18
19
|
import type { CloudflareShiitakeOptions } from "@fungi.computer/shiitake/cloudflare";
|
|
19
20
|
import { type AgentModelChoice, type AgentModelRefusal } from "./agent-model-choice.js";
|
|
20
21
|
import * as Schema from "effect/Schema";
|
|
@@ -30,7 +31,9 @@ import { type TenantScope, type TenantId, type TenantPrincipal } from "../tenant
|
|
|
30
31
|
import type { ReadonlyTenancy } from "../tenancy/index.js";
|
|
31
32
|
import type { HostActor } from "@fungi.computer/puffball/app";
|
|
32
33
|
import type { OysterWorkerEnv } from "../workers.js";
|
|
33
|
-
import
|
|
34
|
+
import type { AgentMcpServerInput } from "../agents.js";
|
|
35
|
+
import type { EgressRef } from "@fungi.computer/veil/connections";
|
|
36
|
+
import type { McpRequestData } from "./agent-connections.js";
|
|
34
37
|
import type { AgentPolicyActor, OysterAgents, OysterSessionRow } from "../agents.js";
|
|
35
38
|
/** The model door an agent runs on; Shiitake's own contract. */
|
|
36
39
|
export type StandaloneModelSource = CloudflareShiitakeOptions["model"];
|
|
@@ -49,6 +52,8 @@ export type StandaloneAgentsEnv = Readonly<{
|
|
|
49
52
|
AI_GATEWAY_AUTH_TOKEN?: string;
|
|
50
53
|
AI_GATEWAY_ACCOUNT_ID?: string;
|
|
51
54
|
AI_GATEWAY_ID?: string;
|
|
55
|
+
/** Optional owner-funded Parallel key for `web.search`; Veil holds custody. */
|
|
56
|
+
PARALLEL_API_KEY?: string;
|
|
52
57
|
/** Workers AI, the default model door. */
|
|
53
58
|
AI?: AiBinding;
|
|
54
59
|
/** The AI Gateway the binding routes through (default `default`). */
|
|
@@ -59,6 +64,8 @@ export type StandaloneAgentsEnv = Readonly<{
|
|
|
59
64
|
KEYS?: StandaloneTenancyEnv["KEYS"];
|
|
60
65
|
OYSTER_ORIGIN: string;
|
|
61
66
|
OYSTER_OWNER_KEY?: string;
|
|
67
|
+
/** Instance credential key (32 bytes, base64url) that seals model API keys; generated at install, never in the repository. */
|
|
68
|
+
OYSTER_CREDENTIAL_KEY?: string;
|
|
62
69
|
AGENTS: DurableObjectNamespace<StandaloneAgentBase>;
|
|
63
70
|
/** Host-only directory custody. Guest entrypoints expose operations, not this binding; Codemode receives only Mycelium modules. */
|
|
64
71
|
AGENT_DIRECTORY: DurableObjectNamespace<AgentDirectory>;
|
|
@@ -92,6 +99,7 @@ export declare abstract class StandaloneAgentBase<Env extends StandaloneAgentEnv
|
|
|
92
99
|
private readonly computerInvalidations;
|
|
93
100
|
/** Host invalidation drops captured discovery, not just its displayed names. */
|
|
94
101
|
invalidateComputerConnections(): void;
|
|
102
|
+
private computerAccess;
|
|
95
103
|
private computerConnections;
|
|
96
104
|
/** Revalidate the owner's generation before reusing a Home or tool snapshot. */
|
|
97
105
|
private preparedComputerSnapshot;
|
|
@@ -114,6 +122,13 @@ export declare abstract class StandaloneAgentBase<Env extends StandaloneAgentEnv
|
|
|
114
122
|
settlement(principal: MachineAgentSettlementPrincipal, sessionId: string, commandId: string): Promise<string | undefined>;
|
|
115
123
|
/** The root host for this Agent's pinned policy directory; unpinned Agents have no App tools. */
|
|
116
124
|
private appHost;
|
|
125
|
+
/** The instance directory that owns this Agent's sealed model keys. */
|
|
126
|
+
private keyDirectory;
|
|
127
|
+
/** The instance directory that owns this Agent's MCP connections and their credentials. */
|
|
128
|
+
private mcpDirectory;
|
|
129
|
+
private agentName;
|
|
130
|
+
/** A byok choice must name a stored key of the chosen provider. */
|
|
131
|
+
private admitKey;
|
|
117
132
|
private choice;
|
|
118
133
|
/** Secret-free default of this Agent; stored separately from Session history. */
|
|
119
134
|
readModelChoice(): Promise<AgentModelChoice>;
|
|
@@ -138,14 +153,8 @@ export declare abstract class StandaloneAgentBase<Env extends StandaloneAgentEnv
|
|
|
138
153
|
controlSchedule(directory: typeof policyDirectorySchema.Type, input: AgentScheduleTarget, action: "pause" | "resume" | "delete"): Promise<AgentScheduleControlReceipt>;
|
|
139
154
|
/** Listeners from live codemode acquisitions, told when the server list changes. */
|
|
140
155
|
private readonly mcpInvalidations;
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
/** Host-only: this Agent's MCP servers, without their bearer tokens. */
|
|
144
|
-
mcpServers(): Promise<readonly AgentMcpServer[]>;
|
|
145
|
-
/** Host-only: connect one remote MCP server, admitted by the owner route. */
|
|
146
|
-
addMcpServer(input: AgentMcpServerInput): Promise<AgentMcpServer | AgentMcpServerRefusal>;
|
|
147
|
-
/** Host-only: disconnect one MCP server. */
|
|
148
|
-
removeMcpServer(serverId: string): Promise<boolean>;
|
|
156
|
+
/** Host-only: the directory told us this Agent's connections changed. */
|
|
157
|
+
invalidateMcpConnections(): void;
|
|
149
158
|
protected shiitakeOptions(): Promise<CloudflareShiitakeOptions>;
|
|
150
159
|
/** Send an installation-admitted message through fleet Session operations. */
|
|
151
160
|
sendFromApp(installationId: string, sessionId: string, message: FleetMessage): Promise<{
|
|
@@ -166,6 +175,58 @@ export declare class AgentDirectory extends DurableObject<StandaloneAgentEnv> {
|
|
|
166
175
|
recordArchive(agentId: string, archived: boolean, revision: number): boolean;
|
|
167
176
|
/** Directory's bounded-stale projection, never the Agent's flag authority. */
|
|
168
177
|
archived(agentId: string): boolean;
|
|
178
|
+
private modelKeys;
|
|
179
|
+
/** Domain refusals cross the DO RPC boundary as data, not as Error prototypes. */
|
|
180
|
+
sealModelKey(input: ModelKeySealInput): Promise<ModelKeyRecord | Readonly<{
|
|
181
|
+
error: ModelKeyRefusal;
|
|
182
|
+
}>>;
|
|
183
|
+
listModelKeys(): Promise<readonly ModelKeyRecord[]>;
|
|
184
|
+
modelKey(keyId: string): Promise<ModelKeyRecord | null>;
|
|
185
|
+
removeModelKey(keyId: string): Promise<"deleted" | "absent">;
|
|
186
|
+
/** Host-only: the one place a stored key meets a provider request. */
|
|
187
|
+
sendModelKey(keyId: string, request: Readonly<{
|
|
188
|
+
url: string;
|
|
189
|
+
method: string;
|
|
190
|
+
headers: readonly (readonly [string, string])[];
|
|
191
|
+
body: string | null;
|
|
192
|
+
}>): Promise<Response | Readonly<{
|
|
193
|
+
error: ModelKeyRefusal;
|
|
194
|
+
}>>;
|
|
195
|
+
private mcpOwner;
|
|
196
|
+
/** Loaded on the first MCP request: the SDK and OpenAPI decoders stay out of startup. */
|
|
197
|
+
private mcpConnections;
|
|
198
|
+
/** Host-only: an Agent's granted MCP servers, never their credentials. */
|
|
199
|
+
mcpServers(agentId: string): Promise<readonly Readonly<{
|
|
200
|
+
serverId: string;
|
|
201
|
+
name: string;
|
|
202
|
+
url: string;
|
|
203
|
+
hasBearer: boolean;
|
|
204
|
+
}>[] | null>;
|
|
205
|
+
addMcpServer(agentId: string, input: AgentMcpServerInput): Promise<Readonly<{
|
|
206
|
+
serverId: string;
|
|
207
|
+
name: string;
|
|
208
|
+
url: string;
|
|
209
|
+
hasBearer: boolean;
|
|
210
|
+
}> | Readonly<{
|
|
211
|
+
error: "not_found" | "duplicate_name" | "limit" | "invalid_endpoint";
|
|
212
|
+
}>>;
|
|
213
|
+
removeMcpServer(agentId: string, serverId: string): Promise<boolean>;
|
|
214
|
+
/** Secret-free grants for one Agent: ids, versions and endpoints. */
|
|
215
|
+
mcpProjection(agentId: string): Promise<Readonly<{
|
|
216
|
+
revision: number;
|
|
217
|
+
connections: readonly Readonly<{
|
|
218
|
+
connectionId: string;
|
|
219
|
+
name: string;
|
|
220
|
+
surface: import("@fungi.computer/veil/connections").SurfaceView;
|
|
221
|
+
tools: import("@fungi.computer/veil/connections").Tools;
|
|
222
|
+
authorityVersion: number;
|
|
223
|
+
grantVersion: number;
|
|
224
|
+
}>[];
|
|
225
|
+
}>>;
|
|
226
|
+
/** Host-only: complete one Agent MCP request; the credential opens only here. */
|
|
227
|
+
mcpFetch(agentId: string, ref: EgressRef, request: McpRequestData): Promise<Response | Readonly<{
|
|
228
|
+
error: string;
|
|
229
|
+
}>>;
|
|
169
230
|
private readonly computers;
|
|
170
231
|
private readonly computerNames;
|
|
171
232
|
private readonly directory;
|