@fungi.computer/oyster 0.14.1 → 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/README.md +178 -1552
- package/dist/agents.d.ts +8 -0
- package/dist/agents.js +6 -0
- package/dist/app-builds.d.ts +5 -6
- package/dist/app-builds.js +3 -10
- 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/catalog-frame.d.ts +0 -1
- 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 +3 -3
- 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-permissions.js +165 -50
- 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/app-set.d.ts +9 -0
- package/dist/standalone/app-set.js +43 -0
- package/dist/standalone/app-source.js +16 -1
- package/dist/standalone/builds.d.ts +2 -2
- package/dist/standalone/builds.js +4 -0
- package/dist/standalone/cloudflare-account.d.ts +10 -0
- package/dist/standalone/cloudflare-account.js +17 -0
- package/dist/standalone/computer.d.ts +8 -3
- package/dist/standalone/computer.js +26 -3
- package/dist/standalone/install-apps-cli.js +1 -1
- package/dist/standalone/local-desktop.d.ts +19 -2
- package/dist/standalone/local-desktop.js +38 -15
- package/dist/standalone/media.d.ts +2 -0
- package/dist/standalone/media.js +17 -1
- package/dist/standalone/registry.d.ts +4 -1
- package/dist/standalone/registry.js +6 -0
- package/dist/standalone/sign-in-link.d.ts +1 -1
- package/dist/standalone/sign-in-link.js +9 -18
- package/dist/standalone/try-cli.d.ts +7 -0
- package/dist/standalone/try-cli.js +88 -8
- package/dist/starter-agent.d.ts +59 -0
- package/dist/starter-agent.js +85 -0
- package/docs/api/README.md +744 -88
- 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/docs/site/agent-quickstart.mdx +1 -1
- package/package.json +34 -50
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/app-builds.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export declare const oysterAppBuildTimeoutMs = 900000;
|
|
|
31
31
|
export declare const oysterBuildGitHost = "git.team.internal";
|
|
32
32
|
export declare const oysterBuildReportHost = "build.team.internal";
|
|
33
33
|
/** Where an App's source is cloned from. */
|
|
34
|
-
|
|
34
|
+
declare const oysterBuildLocationSchema: Schema.Union<readonly [Schema.Struct<{
|
|
35
35
|
readonly kind: Schema.Literal<"installation">;
|
|
36
36
|
/** The installation whose Git holds the repository (Bonsai for a fork). */
|
|
37
37
|
readonly installationId: Schema.String;
|
|
@@ -41,7 +41,7 @@ export declare const oysterBuildLocationSchema: Schema.Union<readonly [Schema.St
|
|
|
41
41
|
}>]>;
|
|
42
42
|
export type OysterBuildLocation = Schema.Schema.Type<typeof oysterBuildLocationSchema>;
|
|
43
43
|
/** An App's registered build source: where it is cloned and its pinned recipe. */
|
|
44
|
-
|
|
44
|
+
declare const oysterBuildSourceSchema: Schema.Struct<{
|
|
45
45
|
readonly appId: Schema.refine<import("@fungi.computer/puffball").AppId, Schema.String>;
|
|
46
46
|
readonly location: Schema.Union<readonly [Schema.Struct<{
|
|
47
47
|
readonly kind: Schema.Literal<"installation">;
|
|
@@ -79,9 +79,9 @@ export declare const oysterBuildSourceSchema: Schema.Struct<{
|
|
|
79
79
|
}>;
|
|
80
80
|
readonly buildRecipeDigest: Schema.refine<import("@fungi.computer/puffball").Sha256Digest, Schema.String>;
|
|
81
81
|
}>;
|
|
82
|
-
|
|
82
|
+
type OysterBuildSource = Schema.Schema.Type<typeof oysterBuildSourceSchema>;
|
|
83
83
|
/** Installation is a build outcome, never a pending consent/approval record. */
|
|
84
|
-
|
|
84
|
+
declare const oysterBuildInstallationSchema: Schema.Union<readonly [Schema.Struct<{
|
|
85
85
|
readonly kind: Schema.Literal<"pending">;
|
|
86
86
|
readonly installationId: Schema.String;
|
|
87
87
|
}>, Schema.Struct<{
|
|
@@ -105,8 +105,7 @@ export type OysterBuildView = Readonly<{
|
|
|
105
105
|
installation: OysterBuildInstallation | null;
|
|
106
106
|
}>;
|
|
107
107
|
/** Known preflight refusals, before a job or Computer run exists. */
|
|
108
|
-
export
|
|
109
|
-
export type OysterBuildStartReason = Schema.Schema.Type<typeof oysterBuildStartReasonSchema>;
|
|
108
|
+
export type OysterBuildStartReason = "invalid_revision" | "no_source" | "not_template_seed" | "no_backend";
|
|
110
109
|
export declare const oysterBuildStartMessages: {
|
|
111
110
|
invalid_revision: string;
|
|
112
111
|
no_source: string;
|
package/dist/app-builds.js
CHANGED
|
@@ -40,7 +40,7 @@ const jobTtlMs = oysterAppBuildTimeoutMs + 5 * 60_000;
|
|
|
40
40
|
export const oysterBuildGitHost = "git.team.internal";
|
|
41
41
|
export const oysterBuildReportHost = "build.team.internal";
|
|
42
42
|
/** Where an App's source is cloned from. */
|
|
43
|
-
|
|
43
|
+
const oysterBuildLocationSchema = Schema.Union([
|
|
44
44
|
Schema.Struct({
|
|
45
45
|
kind: Schema.Literal("installation"),
|
|
46
46
|
/** The installation whose Git holds the repository (Bonsai for a fork). */
|
|
@@ -51,14 +51,14 @@ export const oysterBuildLocationSchema = Schema.Union([
|
|
|
51
51
|
Schema.Struct({ kind: Schema.Literal("template") }),
|
|
52
52
|
]);
|
|
53
53
|
/** An App's registered build source: where it is cloned and its pinned recipe. */
|
|
54
|
-
|
|
54
|
+
const oysterBuildSourceSchema = Schema.Struct({
|
|
55
55
|
appId: appIdSchema,
|
|
56
56
|
location: oysterBuildLocationSchema,
|
|
57
57
|
recipe: capturedPinnedRecipeSchema,
|
|
58
58
|
buildRecipeDigest: sha256DigestSchema,
|
|
59
59
|
});
|
|
60
60
|
/** Installation is a build outcome, never a pending consent/approval record. */
|
|
61
|
-
|
|
61
|
+
const oysterBuildInstallationSchema = Schema.Union([
|
|
62
62
|
Schema.Struct({
|
|
63
63
|
kind: Schema.Literal("pending"),
|
|
64
64
|
installationId: Schema.String,
|
|
@@ -74,13 +74,6 @@ export const oysterBuildInstallationSchema = Schema.Union([
|
|
|
74
74
|
}),
|
|
75
75
|
]);
|
|
76
76
|
const installationCodec = Schema.fromJsonString(oysterBuildInstallationSchema);
|
|
77
|
-
/** Known preflight refusals, before a job or Computer run exists. */
|
|
78
|
-
export const oysterBuildStartReasonSchema = Schema.Literals([
|
|
79
|
-
"invalid_revision",
|
|
80
|
-
"no_source",
|
|
81
|
-
"not_template_seed",
|
|
82
|
-
"no_backend",
|
|
83
|
-
]);
|
|
84
77
|
export const oysterBuildStartMessages = {
|
|
85
78
|
invalid_revision: "Source revision must be git: followed by a full commit hash",
|
|
86
79
|
no_source: "App has no build source",
|
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
|
}
|