@fungi.computer/oyster 0.15.0 → 0.17.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/agents.d.ts +15 -0
- package/dist/agents.js +10 -1
- package/dist/apps/permissions.js +8 -1
- package/dist/auth.d.ts +2 -0
- package/dist/auth.js +9 -8
- package/dist/boot-host-script.js +1 -1
- package/dist/build/candidate-cli.mjs +4 -0
- package/dist/computer.d.ts +5 -0
- package/dist/computer.js +1 -0
- package/dist/embed-metafiles.js +2 -2
- package/dist/embed-scripts.js +2 -2
- package/dist/hello-app-script.js +1 -1
- package/dist/host-page-assets.js +1 -1
- package/dist/host-page.d.ts +5 -1
- package/dist/host-page.js +23 -23
- package/dist/host.js +6 -1
- package/dist/page/app-access.js +23 -1
- package/dist/page/app-rights.d.ts +8 -0
- package/dist/page/app-rights.js +13 -0
- package/dist/page/computer-handles.d.ts +15 -0
- package/dist/page/computer-handles.js +4 -1
- package/dist/page/mount.d.ts +5 -0
- package/dist/page/mount.js +4 -0
- package/dist/page-script.js +3 -3
- package/dist/root-data.d.ts +3 -0
- package/dist/standalone/agents.d.ts +8 -0
- package/dist/standalone/agents.js +61 -12
- package/dist/standalone/cloudflare-account.d.ts +10 -0
- package/dist/standalone/cloudflare-account.js +17 -0
- package/dist/standalone/computer.d.ts +2 -2
- package/dist/standalone/computer.js +16 -1
- package/dist/standalone/media.d.ts +2 -0
- package/dist/standalone/media.js +17 -1
- package/dist/standalone/owner-routes.js +2 -0
- package/dist/standalone/registry.d.ts +16 -0
- package/dist/standalone/registry.js +30 -0
- package/dist/standalone/sign-in-link.d.ts +1 -1
- package/dist/standalone/sign-in-link.js +9 -18
- package/dist/standalone/trial-starters.d.ts +52 -0
- package/dist/standalone/trial-starters.js +67 -0
- package/dist/starter-agent.d.ts +65 -0
- package/dist/starter-agent.js +85 -0
- package/docs/api/agents.md +23 -0
- package/docs/api/auth.md +10 -0
- package/docs/api/computer.md +4 -0
- package/docs/api/host.md +1 -0
- package/docs/api/page/mount.md +2 -0
- package/docs/api/root-data.md +10 -9
- package/docs/api/workers-git.md +14 -9
- package/docs/api/workers.md +28 -20
- package/package.json +25 -21
package/dist/agents.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ import * as Schema from "effect/Schema";
|
|
|
7
7
|
import { type OysterCapability, type OysterEnv } from "./host.js";
|
|
8
8
|
import type { HostActor } from "@fungi.computer/puffball/app";
|
|
9
9
|
import type { Avatar } from "@fungi.computer/sprite/avatar";
|
|
10
|
+
import type { StarterOutcome } from "./starter-agent.js";
|
|
11
|
+
export type { StarterOutcome };
|
|
10
12
|
import type { AgentModelChoice, AgentModelRefusal } from "./standalone/agent-model-choice.js";
|
|
11
13
|
export type { AgentModelChoice, AgentModelRefusal, } from "./standalone/agent-model-choice.js";
|
|
12
14
|
import type { MemberInboxItem, MemberInboxSession } from "@fungi.computer/puffball/inbox";
|
|
@@ -104,6 +106,11 @@ export type OysterAgents = Readonly<{
|
|
|
104
106
|
list(options?: Readonly<{
|
|
105
107
|
archived?: boolean;
|
|
106
108
|
}>): Promise<readonly OysterAgent[]>;
|
|
109
|
+
/**
|
|
110
|
+
* Offer the owner their starter Agent on an empty Team's first owner read;
|
|
111
|
+
* it creates through this host's ordinary `create` and never fails the read.
|
|
112
|
+
*/
|
|
113
|
+
ensureStarter(principal: TenantPrincipal): Promise<StarterOutcome>;
|
|
107
114
|
/** Owner-only HTTP transition; creator Agents use their own control tool. */
|
|
108
115
|
setArchived(agentId: string, archived: boolean, principal: TenantPrincipal): Promise<Readonly<{
|
|
109
116
|
archived: boolean;
|
|
@@ -149,6 +156,14 @@ export type OysterAgents = Readonly<{
|
|
|
149
156
|
approveAppToolPolicy(agentId: string, principal: TenantPrincipal, level: AppToolPolicy["level"], expectedRevision: string | null, actor: AgentPolicyActor): Promise<AppToolPolicy | PendingAgentPolicy | Readonly<{
|
|
150
157
|
error: "not_found" | "revision_conflict" | "not_granted";
|
|
151
158
|
}>>;
|
|
159
|
+
/**
|
|
160
|
+
* Whether a model and an image provider are connected, so an App can say so
|
|
161
|
+
* before it takes a prompt. Reads configuration; never reaches a provider.
|
|
162
|
+
*/
|
|
163
|
+
setup(): Promise<Readonly<{
|
|
164
|
+
models: "ready" | "missing";
|
|
165
|
+
media: "ready" | "missing";
|
|
166
|
+
}>>;
|
|
152
167
|
/** The instance's sealed model keys, never their secrets. */
|
|
153
168
|
modelKeys(): Promise<readonly ModelKeyRecord[]>;
|
|
154
169
|
/** Validate with the provider, then seal one key; or an explicit refusal. */
|
package/dist/agents.js
CHANGED
|
@@ -185,12 +185,15 @@ function createAgentRoutes(agents) {
|
|
|
185
185
|
.include(ownerAgentRoutes(agents, "direct-or-app"))
|
|
186
186
|
// Standalone Agents choose no Computer at creation; the owner attaches one.
|
|
187
187
|
.get("/agent-computers", owner("direct-or-app"), () => Response.json(null))
|
|
188
|
-
.get("/agents", agentCollection(), async (context, { reaches }) => {
|
|
188
|
+
.get("/agents", agentCollection(), async (context, { reaches, everyAgent, authority }) => {
|
|
189
189
|
const selected = context.req.query("archived");
|
|
190
190
|
if (selected !== undefined &&
|
|
191
191
|
selected !== "true" &&
|
|
192
192
|
selected !== "false")
|
|
193
193
|
return refusal(400, "Choose a valid archive view");
|
|
194
|
+
// The owner's own directory read is the starter Agent's one trigger.
|
|
195
|
+
if (everyAgent && authority.kind === "owner" && selected !== "true")
|
|
196
|
+
await agents.ensureStarter(authority.principal);
|
|
194
197
|
const listed = await agents.list({ archived: selected === "true" });
|
|
195
198
|
const reached = [];
|
|
196
199
|
for (const item of listed)
|
|
@@ -429,6 +432,12 @@ const modelKeyRefusalStatus = {
|
|
|
429
432
|
export function modelKeyRoutes(agents) {
|
|
430
433
|
return routes()
|
|
431
434
|
.get("/api/model-keys", owner("direct"), async () => Response.json({ keys: await agents.modelKeys() }))
|
|
435
|
+
.get("/api/setup", owner("direct"), async () => Response.json({
|
|
436
|
+
...(await agents.setup()),
|
|
437
|
+
// Git and the terminal are read from the Computer, which reports them.
|
|
438
|
+
git: "unknown",
|
|
439
|
+
terminal: "unknown",
|
|
440
|
+
}))
|
|
432
441
|
.post("/api/model-keys", owner("direct"), async (context) => {
|
|
433
442
|
const length = Number(context.req.header("content-length") ?? "0");
|
|
434
443
|
if (length > 32 * 1024)
|
package/dist/apps/permissions.js
CHANGED
|
@@ -20,7 +20,14 @@ export function grantRequestFor(authority, facts, request, window) {
|
|
|
20
20
|
if (authority.declaredOperationsDigest !== facts.declaredOperations.digest)
|
|
21
21
|
return { kind: "refused", code: "stale_authority" };
|
|
22
22
|
const requested = [
|
|
23
|
-
...new Set([
|
|
23
|
+
...new Set([
|
|
24
|
+
...(request.agents ?? []),
|
|
25
|
+
...(request.computers ?? []),
|
|
26
|
+
...(request.git ?? []),
|
|
27
|
+
...(request.workflows ?? []),
|
|
28
|
+
...(request.events ?? []),
|
|
29
|
+
...(request.generation ?? []),
|
|
30
|
+
]),
|
|
24
31
|
];
|
|
25
32
|
if (requested.some((capability) => !facts.declaration.capabilities.includes(capability)))
|
|
26
33
|
return { kind: "refused", code: "not_declared" };
|
package/dist/auth.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import type { OysterAuth } from "./host.js";
|
|
|
2
2
|
import type { OysterKeyStore } from "./keys.js";
|
|
3
3
|
/** Cookie emitted by ownerKeyAuth, for composing credential-specific adapters. */
|
|
4
4
|
export declare const ownerKeyCookieName = "oyster_session";
|
|
5
|
+
/** Marks a browser that has signed in here before; it carries no authority. */
|
|
6
|
+
export declare const returningCookieName = "oyster_returning";
|
|
5
7
|
/**
|
|
6
8
|
* Single-owner sign-in: a bearer token or a session cookie holding the
|
|
7
9
|
* owner key's digest. The key itself is never stored in the browser.
|
package/dist/auth.js
CHANGED
|
@@ -4,6 +4,8 @@ import { presentedGitKey } from "./git-auth.js";
|
|
|
4
4
|
import { sha256 } from "./release.js";
|
|
5
5
|
/** Cookie emitted by ownerKeyAuth, for composing credential-specific adapters. */
|
|
6
6
|
export const ownerKeyCookieName = "oyster_session";
|
|
7
|
+
/** Marks a browser that has signed in here before; it carries no authority. */
|
|
8
|
+
export const returningCookieName = "oyster_returning";
|
|
7
9
|
const loginFormSchema = Schema.Struct({ key: Schema.String });
|
|
8
10
|
/** Compare two secrets through their fixed-length digests, in constant time. */
|
|
9
11
|
async function constantTimeEqual(a, b) {
|
|
@@ -56,17 +58,16 @@ export function ownerKeyAuth(ownerKey, ownerId = "owner") {
|
|
|
56
58
|
});
|
|
57
59
|
if (fields === null)
|
|
58
60
|
return new Response("Expected a sign-in form", { status: 400 });
|
|
59
|
-
const form = Schema.decodeUnknownOption(loginFormSchema)(
|
|
61
|
+
const form = Schema.decodeUnknownOption(loginFormSchema)({
|
|
62
|
+
key: fields.get("key"),
|
|
63
|
+
});
|
|
60
64
|
if (Option.isNone(form) ||
|
|
61
65
|
!(await constantTimeEqual(form.value.key, ownerKey)))
|
|
62
66
|
return new Response("Wrong key", { status: 401 });
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"Set-Cookie": `${ownerKeyCookieName}=${await sessionValue}; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=2592000`,
|
|
68
|
-
},
|
|
69
|
-
});
|
|
67
|
+
const headers = new Headers({ Location: "/" });
|
|
68
|
+
headers.append("Set-Cookie", `${ownerKeyCookieName}=${await sessionValue}; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=2592000`);
|
|
69
|
+
headers.append("Set-Cookie", `${returningCookieName}=1; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=31536000`);
|
|
70
|
+
return new Response(null, { status: 303, headers });
|
|
70
71
|
},
|
|
71
72
|
};
|
|
72
73
|
}
|