@fungi.computer/oyster 0.10.0 → 0.11.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 +33 -2
- package/dist/agents.d.ts +66 -22
- package/dist/agents.js +128 -38
- package/dist/authorization.d.ts +25 -3
- package/dist/authorization.js +47 -14
- package/dist/browser/capability-source.d.ts +23 -5
- package/dist/browser/capability-source.js +19 -22
- package/dist/browser/index.d.ts +2 -1
- package/dist/browser/index.js +1 -0
- package/dist/browser/live-view.d.ts +38 -0
- package/dist/browser/live-view.js +179 -0
- package/dist/channels/binding.d.ts +2 -0
- package/dist/channels/run-decision.d.ts +33 -0
- package/dist/channels/run-decision.js +25 -0
- package/dist/channels/visitor-channel.d.ts +84 -14
- package/dist/channels/visitor-channel.js +55 -32
- package/dist/channels/visitor-edge.d.ts +18 -2
- package/dist/channels/visitor-edge.js +67 -5
- package/dist/channels/visitors.d.ts +4 -0
- package/dist/channels/visitors.js +22 -1
- package/dist/channels/web-binding.d.ts +117 -0
- package/dist/channels/web-binding.js +227 -0
- package/dist/embed-metafiles.d.ts +8 -0
- package/dist/embed-metafiles.js +2 -0
- package/dist/embed-scripts.d.ts +8 -0
- package/dist/embed-scripts.js +3 -0
- package/dist/host.d.ts +3 -1
- package/dist/host.js +6 -1
- package/dist/page/embed-challenge.d.ts +19 -0
- package/dist/page/embed-challenge.js +45 -0
- package/dist/page/embed-error.d.ts +2 -0
- package/dist/page/embed-error.js +16 -0
- package/dist/page/embed-loader-protocol.d.ts +12 -0
- package/dist/page/embed-loader-protocol.js +29 -0
- package/dist/standalone/agent-connections.d.ts +22 -19
- package/dist/standalone/agent-connections.js +150 -106
- package/dist/standalone/agents.d.ts +168 -14
- package/dist/standalone/agents.js +310 -17
- package/dist/standalone/browser.d.ts +14 -2
- package/dist/standalone/browser.js +52 -4
- package/dist/standalone/channel-session-door.d.ts +4 -0
- package/dist/standalone/channel-session-door.js +72 -0
- package/dist/standalone/owner-routes.d.ts +4 -3
- package/dist/standalone/owner-routes.js +7 -1
- package/dist/standalone/visitor-edge.d.ts +36 -0
- package/dist/standalone/visitor-edge.js +67 -0
- package/dist/standalone/visitor-proof.d.ts +23 -0
- package/dist/standalone/visitor-proof.js +67 -0
- package/dist/standalone/website-channels.d.ts +134 -0
- package/dist/standalone/website-channels.js +262 -0
- package/dist/standalone/worker-routes.d.ts +4 -1
- package/dist/standalone/worker-routes.js +3 -0
- package/dist/standalone/worker.d.ts +2 -1
- package/dist/standalone/worker.js +4 -0
- package/dist/testing/capabilities.d.ts +3 -0
- package/dist/testing/capabilities.js +1 -0
- package/dist/testing/installation.d.ts +4 -2
- package/dist/testing/installation.js +7 -2
- package/dist/workers-git.js +2 -2
- package/docs/api/agents.md +103 -36
- package/docs/api/browser.md +115 -8
- package/docs/api/workers-git.md +6 -6
- package/package.json +31 -6
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { type StandaloneTenancyEnv } from "./tenancy.js";
|
|
2
2
|
import type { PostEnvelope } from "@fungi.computer/carrier/post";
|
|
3
|
+
import { type ChannelConversation, type ChannelConversations } from "../channels/conversations.js";
|
|
4
|
+
import { type WebsiteTranscript } from "@fungi.computer/nacre/website-channels";
|
|
5
|
+
import { type CreateWebsiteInput, type UpdateWebsiteInput, type WebsiteBinding } from "../channels/web-binding.js";
|
|
6
|
+
import { type WebsiteRefusal, type WebsiteSite } from "./website-channels.js";
|
|
7
|
+
import { type ProvenVisitor } from "./visitor-proof.js";
|
|
8
|
+
import type { VisitorReadOptions } from "../channels/conversations.js";
|
|
3
9
|
import { type StandaloneMachineLinkBindings, type StandaloneMachineJoinResult } from "./machine-link.js";
|
|
4
10
|
import { type MachineAgentSettlementPrincipal, type MachineAgentHome, type MachineEnrollment, type MachineLinkCaller, type MachineLinkIdentity } from "../machine-link/index.js";
|
|
5
11
|
/** Workers AI binding surface used by the standalone provider adapter. */
|
|
@@ -31,9 +37,8 @@ import { type TenantScope, type TenantId, type TenantPrincipal } from "../tenant
|
|
|
31
37
|
import type { ReadonlyTenancy } from "../tenancy/index.js";
|
|
32
38
|
import type { HostActor } from "@fungi.computer/puffball/app";
|
|
33
39
|
import type { OysterWorkerEnv } from "../workers.js";
|
|
34
|
-
import type {
|
|
35
|
-
import type { EgressRef } from "@fungi.computer/veil/connections";
|
|
36
|
-
import type { McpRequestData } from "./agent-connections.js";
|
|
40
|
+
import type { ConnectionAccess, ConnectionInput } from "../agents.js";
|
|
41
|
+
import type { EgressRef, McpRequestData } from "@fungi.computer/veil/connections";
|
|
37
42
|
import type { AgentPolicyActor, OysterAgents, OysterSessionRow } from "../agents.js";
|
|
38
43
|
/** The model door an agent runs on; Shiitake's own contract. */
|
|
39
44
|
export type StandaloneModelSource = CloudflareShiitakeOptions["model"];
|
|
@@ -46,6 +51,12 @@ export type AgentEntry = Readonly<{
|
|
|
46
51
|
}>;
|
|
47
52
|
/** Bindings the agent host reads. */
|
|
48
53
|
export type StandaloneAgentsEnv = Readonly<{
|
|
54
|
+
/**
|
|
55
|
+
* Host secret (at least 32 bytes) that signs a website visitor's identity
|
|
56
|
+
* between the public edge and its website Agent. Without it no website
|
|
57
|
+
* Agent admits a visitor. Never sent to a browser.
|
|
58
|
+
*/
|
|
59
|
+
OYSTER_WEBSITE_PROOF_KEY?: string;
|
|
49
60
|
/** Configured standalone-owner identity subject; never a stored member ID. */
|
|
50
61
|
OYSTER_OWNER_NAME?: string;
|
|
51
62
|
/** Gateway custody remains in Veil; only the host receives these bindings. */
|
|
@@ -90,6 +101,98 @@ export declare abstract class StandaloneAgentBase<Env extends StandaloneAgentEnv
|
|
|
90
101
|
setArchived(archived: boolean): Promise<import("./agent-archive-owner.js").AgentArchiveTransitionResult>;
|
|
91
102
|
/** The deployable root's host for this Agent's pinned tenant. */
|
|
92
103
|
protected abstract hostFor(scope: TenantScope): Promise<OysterHost>;
|
|
104
|
+
private channelOwner;
|
|
105
|
+
private channelDoor;
|
|
106
|
+
private readonly acquireChannelStream;
|
|
107
|
+
/** The website bindings that name this Agent, as the directory last said. */
|
|
108
|
+
private readonly websiteBindings;
|
|
109
|
+
/** The owner's current record of one binding; hosts and tests supply it. */
|
|
110
|
+
protected readChannelBinding(bindingId: string): Promise<WebsiteBinding | null>;
|
|
111
|
+
/**
|
|
112
|
+
* Read one binding afresh from its owner: suspension, persona and edits are
|
|
113
|
+
* never stale. A binding that names another Agent is not this Agent's.
|
|
114
|
+
*/
|
|
115
|
+
protected loadChannelBinding(bindingId: string): Promise<WebsiteBinding | null>;
|
|
116
|
+
/** A web host shares its edge's private assertion key with its Agent. */
|
|
117
|
+
protected channelProofKey(): string | null;
|
|
118
|
+
/**
|
|
119
|
+
* The one per-Session decision, with the binding read afresh: an owner
|
|
120
|
+
* Session is private, a visitor's runs only while its binding is active.
|
|
121
|
+
* Tools and permissions stay the Agent's own either way.
|
|
122
|
+
*/
|
|
123
|
+
private channelRun;
|
|
124
|
+
/** The same decision from what this Agent already read; unknown denies. */
|
|
125
|
+
private cachedChannelRun;
|
|
126
|
+
/** Shiitake calls instructions.load at the start of the actual model turn.
|
|
127
|
+
* Capture that command before any asynchronous guidance can change the
|
|
128
|
+
* handoff version; participant projection otherwise hides its reply. A
|
|
129
|
+
* visitor's Session adds the fixed channel rules and the owner's persona to
|
|
130
|
+
* the Agent's own instructions, never replacing them. */
|
|
131
|
+
protected channelInstructions(source: CloudflareShiitakeOptions["instructions"]): CloudflareShiitakeOptions["instructions"];
|
|
132
|
+
/** Owner read of one website's conversations; the host admits the owner first. */
|
|
133
|
+
websiteConversations(bindingId: string): Promise<readonly ChannelConversation[]>;
|
|
134
|
+
/** Owner read of one conversation of a website, from its Session. */
|
|
135
|
+
websiteTranscript(bindingId: string, sessionId: string): Promise<WebsiteTranscript | null>;
|
|
136
|
+
private channelBinding;
|
|
137
|
+
private channelSessionDoor;
|
|
138
|
+
/**
|
|
139
|
+
* Compose Oyster's channel owner on this Agent's real store and Shiitake.
|
|
140
|
+
* A host must supply its own binding lookup after authenticating its edge;
|
|
141
|
+
* this does not install an inbound route or mint provider credentials.
|
|
142
|
+
*/
|
|
143
|
+
protected channelConversations(): ChannelConversations;
|
|
144
|
+
/**
|
|
145
|
+
* Internal DO RPC only: the HTTP edge authenticates once in the central
|
|
146
|
+
* visitor owner, then selects this Agent. No bearer or client-provided
|
|
147
|
+
* visitor id enters this method. Its caller retains the SSE recheck callback.
|
|
148
|
+
*/
|
|
149
|
+
private visitorConversation;
|
|
150
|
+
private verifiedVisitor;
|
|
151
|
+
sendChannelVisitor(bindingId: string, visitor: ProvenVisitor, requestId: string, text: string): Promise<import("../channels/conversations.js").IntakeResult>;
|
|
152
|
+
withdrawChannelVisitor(bindingId: string, visitor: ProvenVisitor, requestId: string): Promise<import("../channels/conversations.js").ChannelWithdrawResult | Readonly<{
|
|
153
|
+
kind: "unauthorized";
|
|
154
|
+
}> | Readonly<{
|
|
155
|
+
kind: "denied";
|
|
156
|
+
reason: "event_conflict" | "new_party_limit" | "banned";
|
|
157
|
+
}>>;
|
|
158
|
+
latestPendingChannelVisitor(bindingId: string, visitor: ProvenVisitor): Promise<Readonly<{
|
|
159
|
+
requestId: string;
|
|
160
|
+
commandId: string;
|
|
161
|
+
text: string;
|
|
162
|
+
delivery: "steer" | "followUp";
|
|
163
|
+
images?: readonly Readonly<{
|
|
164
|
+
type: "image";
|
|
165
|
+
data: string;
|
|
166
|
+
mimeType: string;
|
|
167
|
+
}>[] | undefined;
|
|
168
|
+
}> | Readonly<{
|
|
169
|
+
kind: "unauthorized";
|
|
170
|
+
}> | null>;
|
|
171
|
+
openChannelVisitor(bindingId: string, visitor: ProvenVisitor, options: VisitorReadOptions): Promise<Readonly<{
|
|
172
|
+
kind: "session";
|
|
173
|
+
snapshot: string;
|
|
174
|
+
}> | Readonly<{
|
|
175
|
+
kind: "unauthorized";
|
|
176
|
+
}> | Readonly<{
|
|
177
|
+
kind: "denied";
|
|
178
|
+
reason: "new_party_limit" | "banned";
|
|
179
|
+
}>>;
|
|
180
|
+
/**
|
|
181
|
+
* A stream is reauthorized at every beat by the central visitor owner, not
|
|
182
|
+
* by a callback held across this Durable Object's RPC boundary: the site must
|
|
183
|
+
* still be active and the visitor still live.
|
|
184
|
+
*/
|
|
185
|
+
watchChannelVisitor(bindingId: string, visitor: ProvenVisitor): Promise<Readonly<{
|
|
186
|
+
kind: "stream";
|
|
187
|
+
body: ReadableStream<Uint8Array>;
|
|
188
|
+
}> | Readonly<{
|
|
189
|
+
kind: "empty" | "unauthorized";
|
|
190
|
+
}> | Readonly<{
|
|
191
|
+
kind: "denied";
|
|
192
|
+
reason: "suspended" | "stream_limit";
|
|
193
|
+
}>>;
|
|
194
|
+
/** Whether the central visitor owner still serves this visitor. */
|
|
195
|
+
protected channelVisitorLive(bindingId: string, visitorId: string): Promise<boolean>;
|
|
93
196
|
private uiOwner;
|
|
94
197
|
private machineClient;
|
|
95
198
|
private computerSnapshot;
|
|
@@ -155,6 +258,10 @@ export declare abstract class StandaloneAgentBase<Env extends StandaloneAgentEnv
|
|
|
155
258
|
private readonly mcpInvalidations;
|
|
156
259
|
/** Host-only: the directory told us this Agent's connections changed. */
|
|
157
260
|
invalidateMcpConnections(): void;
|
|
261
|
+
/**
|
|
262
|
+
* A full override must retain channelSource and channelInstructions:
|
|
263
|
+
* dropping them removes a suspended website's run refusal and turn capture.
|
|
264
|
+
*/
|
|
158
265
|
protected shiitakeOptions(): Promise<CloudflareShiitakeOptions>;
|
|
159
266
|
/** Send an installation-admitted message through fleet Session operations. */
|
|
160
267
|
sendFromApp(installationId: string, sessionId: string, message: FleetMessage): Promise<{
|
|
@@ -195,22 +302,45 @@ export declare class AgentDirectory extends DurableObject<StandaloneAgentEnv> {
|
|
|
195
302
|
private mcpOwner;
|
|
196
303
|
/** Loaded on the first MCP request: the SDK and OpenAPI decoders stay out of startup. */
|
|
197
304
|
private mcpConnections;
|
|
198
|
-
/** Host-only:
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
name: string;
|
|
202
|
-
url: string;
|
|
203
|
-
hasBearer: boolean;
|
|
204
|
-
}>[] | null>;
|
|
205
|
-
addMcpServer(agentId: string, input: AgentMcpServerInput): Promise<Readonly<{
|
|
206
|
-
serverId: string;
|
|
305
|
+
/** Host-only: every connection with the Agents that may use it, never a credential. */
|
|
306
|
+
connections(): Promise<readonly Readonly<{
|
|
307
|
+
connectionId: string;
|
|
207
308
|
name: string;
|
|
309
|
+
label: string;
|
|
310
|
+
kind: "mcp" | "openapi";
|
|
208
311
|
url: string;
|
|
209
|
-
|
|
312
|
+
auth: "none" | "token" | "oauth";
|
|
313
|
+
state: "connected" | "pending" | "reconnect_required";
|
|
314
|
+
grants: readonly Readonly<{
|
|
315
|
+
agentId: string;
|
|
316
|
+
access: ConnectionAccess;
|
|
317
|
+
}>[];
|
|
318
|
+
}>[]>;
|
|
319
|
+
addConnection(input: ConnectionInput): Promise<Readonly<{
|
|
320
|
+
connectionId: string;
|
|
321
|
+
authorizeUrl: string | null;
|
|
322
|
+
}> | Readonly<{
|
|
323
|
+
error: "not_found" | "duplicate_name" | "limit" | "invalid_endpoint";
|
|
324
|
+
}>>;
|
|
325
|
+
grantConnection(connectionId: string, agentId: string, access: ConnectionAccess): Promise<Readonly<{
|
|
326
|
+
error: "not_found" | "duplicate_name" | "limit" | "invalid_endpoint";
|
|
210
327
|
}> | Readonly<{
|
|
328
|
+
ok: true;
|
|
329
|
+
}>>;
|
|
330
|
+
ungrantConnection(connectionId: string, agentId: string): Promise<boolean>;
|
|
331
|
+
removeConnection(connectionId: string): Promise<boolean>;
|
|
332
|
+
connectionTools(connectionId: string): Promise<readonly string[] | Readonly<{
|
|
211
333
|
error: "not_found" | "duplicate_name" | "limit" | "invalid_endpoint";
|
|
212
334
|
}>>;
|
|
213
|
-
|
|
335
|
+
completeMcpConnection(query: {
|
|
336
|
+
state: string;
|
|
337
|
+
code: string;
|
|
338
|
+
iss: string | undefined;
|
|
339
|
+
}): Promise<Readonly<{
|
|
340
|
+
ok: true;
|
|
341
|
+
}> | Readonly<{
|
|
342
|
+
error: string;
|
|
343
|
+
}>>;
|
|
214
344
|
/** Secret-free grants for one Agent: ids, versions and endpoints. */
|
|
215
345
|
mcpProjection(agentId: string): Promise<Readonly<{
|
|
216
346
|
revision: number;
|
|
@@ -219,6 +349,7 @@ export declare class AgentDirectory extends DurableObject<StandaloneAgentEnv> {
|
|
|
219
349
|
name: string;
|
|
220
350
|
surface: import("@fungi.computer/veil/connections").SurfaceView;
|
|
221
351
|
tools: import("@fungi.computer/veil/connections").Tools;
|
|
352
|
+
version: number;
|
|
222
353
|
authorityVersion: number;
|
|
223
354
|
grantVersion: number;
|
|
224
355
|
}>[];
|
|
@@ -286,6 +417,29 @@ export declare class AgentDirectory extends DurableObject<StandaloneAgentEnv> {
|
|
|
286
417
|
readAgentComputers(agentId: string, principal: TenantPrincipal, tenantId?: TenantId): Promise<StandaloneAgentComputerReply>;
|
|
287
418
|
/** Every captured native call rechecks the exact live attachment and credential owner. */
|
|
288
419
|
admitAgentComputer(captured: Pick<AgentComputerConnection, "scopeId" | "agentId" | "attachment">, tenantId: TenantId): Promise<Omit<ComputerGrant, "egress">>;
|
|
420
|
+
private websiteChannelsOwner;
|
|
421
|
+
private websites;
|
|
422
|
+
/** Owner read of every website bound to one of this tenant's Agents. */
|
|
423
|
+
websiteList(principal: TenantPrincipal): readonly WebsiteBinding[] | WebsiteRefusal;
|
|
424
|
+
/** Owner-only: put a chosen Agent behind a new site key. */
|
|
425
|
+
websiteCreate(principal: TenantPrincipal, input: CreateWebsiteInput, requestId: string): WebsiteBinding | WebsiteRefusal;
|
|
426
|
+
/** Owner-only edit, fenced by the version the owner last read. */
|
|
427
|
+
websiteUpdate(principal: TenantPrincipal, bindingId: string, input: UpdateWebsiteInput): WebsiteBinding | WebsiteRefusal;
|
|
428
|
+
/** Host-only: the binding a website Agent serves, read fresh on every use. */
|
|
429
|
+
websiteBinding(bindingId: string): WebsiteBinding | null;
|
|
430
|
+
/** Host-only public lookup: a site key resolves to its site, or to nothing. */
|
|
431
|
+
websiteSite(siteKey: string): WebsiteSite | null;
|
|
432
|
+
websiteMint(bindingId: string, siteKey: string, addressHash: string): Promise<import("../channels/visitors.js").VisitorGrant>;
|
|
433
|
+
websiteRefresh(bindingId: string, refreshSecret: string): Promise<import("../channels/visitors.js").VisitorGrant>;
|
|
434
|
+
websiteRotate(bindingId: string, siteKey: string, accessToken: string, addressHash: string): Promise<import("../channels/visitors.js").VisitorGrant | Readonly<{
|
|
435
|
+
kind: "unauthorized";
|
|
436
|
+
}>>;
|
|
437
|
+
websiteVisitorLive(bindingId: string, visitorId: string): boolean;
|
|
438
|
+
websiteAuthenticate(bindingId: string, accessToken: string): Promise<Readonly<{
|
|
439
|
+
visitorId: string;
|
|
440
|
+
expiresAt: number;
|
|
441
|
+
addressHash: string;
|
|
442
|
+
}> | null>;
|
|
289
443
|
list(options?: Readonly<{
|
|
290
444
|
archived?: boolean;
|
|
291
445
|
}>): readonly AgentEntry[];
|