@fungi.computer/oyster 0.15.0 → 0.16.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 +8 -0
- package/dist/agents.js +6 -0
- 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/standalone/agents.js +10 -0
- 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/sign-in-link.d.ts +1 -1
- package/dist/standalone/sign-in-link.js +9 -18
- package/dist/starter-agent.d.ts +59 -0
- package/dist/starter-agent.js +85 -0
- package/docs/api/agents.md +6 -0
- package/docs/api/auth.md +10 -0
- package/docs/api/computer.md +4 -0
- package/docs/api/page/mount.md +2 -0
- package/docs/api/workers-git.md +14 -9
- package/docs/api/workers.md +8 -3
- package/package.json +25 -21
package/dist/agents.d.ts
CHANGED
|
@@ -149,6 +149,14 @@ export type OysterAgents = Readonly<{
|
|
|
149
149
|
approveAppToolPolicy(agentId: string, principal: TenantPrincipal, level: AppToolPolicy["level"], expectedRevision: string | null, actor: AgentPolicyActor): Promise<AppToolPolicy | PendingAgentPolicy | Readonly<{
|
|
150
150
|
error: "not_found" | "revision_conflict" | "not_granted";
|
|
151
151
|
}>>;
|
|
152
|
+
/**
|
|
153
|
+
* Whether a model and an image provider are connected, so an App can say so
|
|
154
|
+
* before it takes a prompt. Reads configuration; never reaches a provider.
|
|
155
|
+
*/
|
|
156
|
+
setup(): Promise<Readonly<{
|
|
157
|
+
models: "ready" | "missing";
|
|
158
|
+
media: "ready" | "missing";
|
|
159
|
+
}>>;
|
|
152
160
|
/** The instance's sealed model keys, never their secrets. */
|
|
153
161
|
modelKeys(): Promise<readonly ModelKeyRecord[]>;
|
|
154
162
|
/** Validate with the provider, then seal one key; or an explicit refusal. */
|
package/dist/agents.js
CHANGED
|
@@ -429,6 +429,12 @@ const modelKeyRefusalStatus = {
|
|
|
429
429
|
export function modelKeyRoutes(agents) {
|
|
430
430
|
return routes()
|
|
431
431
|
.get("/api/model-keys", owner("direct"), async () => Response.json({ keys: await agents.modelKeys() }))
|
|
432
|
+
.get("/api/setup", owner("direct"), async () => Response.json({
|
|
433
|
+
...(await agents.setup()),
|
|
434
|
+
// Git and the terminal are read from the Computer, which reports them.
|
|
435
|
+
git: "unknown",
|
|
436
|
+
terminal: "unknown",
|
|
437
|
+
}))
|
|
432
438
|
.post("/api/model-keys", owner("direct"), async (context) => {
|
|
433
439
|
const length = Number(context.req.header("content-length") ?? "0");
|
|
434
440
|
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
|
}
|