@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/host-page.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type AppPermissionsViewData } from "./apps/permissions.js";
|
|
2
2
|
/** Human-facing states only. API refusals keep their original wire format. */
|
|
3
|
-
export type HostPageState = "permissions" | "root" | "empty" | "login" | "login-invalid" | "key-help" | "signing-in" | "
|
|
3
|
+
export type HostPageState = "permissions" | "root" | "empty" | "login" | "login-invalid" | "key-help" | "signing-in" | "not-found" | "server-error" | "access-denied" | "desktop-missing";
|
|
4
4
|
export type HostPageOptions = Readonly<{
|
|
5
5
|
state: HostPageState;
|
|
6
6
|
title?: string;
|
|
@@ -15,6 +15,10 @@ export type HostPageOptions = Readonly<{
|
|
|
15
15
|
accessHref?: string;
|
|
16
16
|
}>[];
|
|
17
17
|
reset?: boolean;
|
|
18
|
+
/** Login only: this browser has signed in to this Oyster before. */
|
|
19
|
+
returning?: boolean;
|
|
20
|
+
/** Login only: the visitor arrived through a one-time link that was already used. */
|
|
21
|
+
usedLink?: boolean;
|
|
18
22
|
/** Only the single-use helper passes a key, in a POST field, never a URL. */
|
|
19
23
|
signIn?: Readonly<{
|
|
20
24
|
action: string;
|
package/dist/host-page.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { createElement as h } from "react";
|
|
2
2
|
import { renderToStaticMarkup } from "react-dom/server";
|
|
3
3
|
import { TradingCard } from "@fungi.computer/caps/components/trading-card";
|
|
4
|
+
import { Alert } from "@fungi.computer/caps/components/alert";
|
|
5
|
+
import { Status } from "@fungi.computer/caps/components/status";
|
|
4
6
|
import { Button } from "@fungi.computer/caps/components/button";
|
|
5
7
|
import { Input } from "@fungi.computer/caps/components/input";
|
|
6
8
|
import { Card, CardHeader, CardTitle, CardContent, } from "@fungi.computer/caps/components/card";
|
|
@@ -25,7 +27,7 @@ const copy = {
|
|
|
25
27
|
"Your Oyster is running. Install an App to give it something to open.",
|
|
26
28
|
],
|
|
27
29
|
login: [
|
|
28
|
-
"Welcome
|
|
30
|
+
"Welcome.",
|
|
29
31
|
"Your Oyster · sign in",
|
|
30
32
|
"Use the owner key saved with this Oyster. It stays private; it never belongs in a shared link.",
|
|
31
33
|
],
|
|
@@ -44,14 +46,9 @@ const copy = {
|
|
|
44
46
|
"One-time sign-in",
|
|
45
47
|
"This private link signs you in on this computer. It works once. Continue to your Oyster below if it does not open automatically.",
|
|
46
48
|
],
|
|
47
|
-
"link-expired": [
|
|
48
|
-
"This link has had its turn.",
|
|
49
|
-
"One-time link · expired or already used",
|
|
50
|
-
"Start your local Oyster again with the same project directory to get a fresh link, or sign in with your saved owner key.",
|
|
51
|
-
],
|
|
52
49
|
"not-found": [
|
|
53
50
|
"Nothing growing here.",
|
|
54
|
-
"404
|
|
51
|
+
"404",
|
|
55
52
|
"This address doesn’t point to an available page. Your desktop is a good place to start again.",
|
|
56
53
|
],
|
|
57
54
|
"server-error": [
|
|
@@ -113,12 +110,6 @@ const abilities = {
|
|
|
113
110
|
"Continue below if it does not.",
|
|
114
111
|
"Use your saved key if needed.",
|
|
115
112
|
],
|
|
116
|
-
"link-expired": [
|
|
117
|
-
"Get back into Oyster",
|
|
118
|
-
"Sign in with your saved key.",
|
|
119
|
-
"Or restart the same local trial.",
|
|
120
|
-
"Open the fresh link once.",
|
|
121
|
-
],
|
|
122
113
|
"not-found": [
|
|
123
114
|
"Find an available page",
|
|
124
115
|
"Return to your Oyster.",
|
|
@@ -191,6 +182,12 @@ function pageContent(options, url) {
|
|
|
191
182
|
if (state === "login" || state === "login-invalid") {
|
|
192
183
|
content.push(h("form", { method: "post", action: url("/login"), className: "form-stack" }, state === "login-invalid"
|
|
193
184
|
? h("p", { className: "error-copy", role: "alert" }, "The key wasn’t accepted. Please check it and try again.")
|
|
185
|
+
: null, state === "login" && options.usedLink === true
|
|
186
|
+
? h(Alert, { tone: "warning", role: "status" }, h("div", { className: "notice" }, h(Status, {
|
|
187
|
+
glyph: "dot",
|
|
188
|
+
tone: "warning",
|
|
189
|
+
"aria-hidden": true,
|
|
190
|
+
}), h("span", null, "This link was already used. Paste the key from ", h("code", null, ".oyster-owner"), " in your Oyster project.")))
|
|
194
191
|
: null, h("label", { htmlFor: "owner-key" }, "Owner key"), h(Input, {
|
|
195
192
|
id: "owner-key",
|
|
196
193
|
name: "key",
|
|
@@ -199,7 +196,9 @@ function pageContent(options, url) {
|
|
|
199
196
|
autoComplete: "current-password",
|
|
200
197
|
placeholder: "Paste your owner key",
|
|
201
198
|
"aria-invalid": state === "login-invalid" ? true : undefined,
|
|
202
|
-
}),
|
|
199
|
+
}), options.usedLink === true
|
|
200
|
+
? null
|
|
201
|
+
: h("p", { className: "helper field-hint" }, "For a local trial: ", h("code", null, ".oyster-owner"), " in your Oyster project."), h("div", { className: "actions" }, h(Button, { type: "submit" }, state === "login" ? "Sign in" : "Try again"), link("Find my key", url("/login/key-help"), true))));
|
|
203
202
|
}
|
|
204
203
|
else if (state === "signing-in" && signIn) {
|
|
205
204
|
content.push(h("form", { method: "post", action: signIn.action, "data-auto-sign-in": true }, h("input", { type: "hidden", name: "key", value: signIn.key }), h("div", { className: "actions" }, h(Button, { type: "submit" }, "Continue to Oyster"), link("Having trouble?", url("/login/key-help"), true))));
|
|
@@ -208,9 +207,6 @@ function pageContent(options, url) {
|
|
|
208
207
|
content.push(h("p", { className: "detail" }, "If the original key is gone, follow the owner recovery instructions. Oyster cannot reveal or reconstruct it. No key reset happens from this page."));
|
|
209
208
|
actions.push(link("Back to sign-in", url("/login")), link("Read recovery steps", `${docs}/guides/run-your-own-oyster`, true));
|
|
210
209
|
}
|
|
211
|
-
else if (state === "link-expired") {
|
|
212
|
-
actions.push(link("Sign in with my key", url("/login")), link("Read restart steps", `${docs}/oyster-quickstart`, true));
|
|
213
|
-
}
|
|
214
210
|
else if (state === "root" ||
|
|
215
211
|
state === "empty" ||
|
|
216
212
|
state === "desktop-missing") {
|
|
@@ -242,7 +238,6 @@ function illustration(state, assetUrl) {
|
|
|
242
238
|
"login-invalid",
|
|
243
239
|
"key-help",
|
|
244
240
|
"signing-in",
|
|
245
|
-
"link-expired",
|
|
246
241
|
"access-denied",
|
|
247
242
|
].includes(state);
|
|
248
243
|
const art = keyArt
|
|
@@ -254,12 +249,12 @@ function illustration(state, assetUrl) {
|
|
|
254
249
|
name: keyArt
|
|
255
250
|
? "A little help"
|
|
256
251
|
: art === "offline"
|
|
257
|
-
? "
|
|
252
|
+
? "Page not found"
|
|
258
253
|
: "Room to grow",
|
|
259
254
|
stage: "OYSTER",
|
|
260
255
|
stat: "✦",
|
|
261
256
|
finish: "holo",
|
|
262
|
-
style: { aspectRatio: "
|
|
257
|
+
style: { aspectRatio: "auto" },
|
|
263
258
|
art: h("div", {
|
|
264
259
|
className: "ink-art",
|
|
265
260
|
"data-ink": assetUrl(`${art}.json`),
|
|
@@ -274,7 +269,7 @@ function illustration(state, assetUrl) {
|
|
|
274
269
|
src: assetUrl(`${art}-dark.avif`),
|
|
275
270
|
alt: "",
|
|
276
271
|
})), h("div", { className: "ink-live" })),
|
|
277
|
-
typeLine: eyebrow,
|
|
272
|
+
typeLine: state === "not-found" ? "Off the map" : eyebrow,
|
|
278
273
|
move: {
|
|
279
274
|
name: ability,
|
|
280
275
|
children: h("ol", { className: "ability-steps" }, ...steps.map((step) => h("li", { key: step }, step))),
|
|
@@ -286,7 +281,10 @@ function illustration(state, assetUrl) {
|
|
|
286
281
|
/** One server-rendered Caps composition, usable without styles, art or JS. */
|
|
287
282
|
export async function hostPage(options) {
|
|
288
283
|
const { state, title = "Oyster" } = options;
|
|
289
|
-
const [
|
|
284
|
+
const [baseHeading, eyebrow, description] = copy[state];
|
|
285
|
+
const heading = state === "login" && options.returning === true
|
|
286
|
+
? "Welcome back."
|
|
287
|
+
: baseHeading;
|
|
290
288
|
const url = (path) => options.oysterUrl ? new URL(path, options.oysterUrl).href : path;
|
|
291
289
|
// A failed decorative module must still leave the form and recovery readable.
|
|
292
290
|
let assets;
|
|
@@ -315,7 +313,9 @@ export async function hostPage(options) {
|
|
|
315
313
|
? h("div", { className: "actions" }, ...actions)
|
|
316
314
|
: null, h("p", { className: "helper" }, state === "login" || state === "login-invalid"
|
|
317
315
|
? "Your key is sent only to this Oyster."
|
|
318
|
-
:
|
|
316
|
+
: state === "not-found"
|
|
317
|
+
? null
|
|
318
|
+
: h("a", { href: `${docs}/agents/index.md` }, "Hand your LLM the setup guide →")))), h("footer", { className: "page-footer" }, h("span", null, "Oyster · A home for your Apps")), assetUrl("host-page.js")
|
|
319
319
|
? h("script", { type: "module", src: assetUrl("host-page.js") })
|
|
320
320
|
: null, options.permissions
|
|
321
321
|
? h("script", {
|
package/dist/host.js
CHANGED
|
@@ -28,6 +28,8 @@ export { capabilityDescriptorSchema, capabilityMethodKindSchema, capabilityMetho
|
|
|
28
28
|
import { selectionOf, } from "./index.js";
|
|
29
29
|
import { parseRelease, readCachedVerified, sha256, } from "./release.js";
|
|
30
30
|
import { createGitDoor } from "./git.js";
|
|
31
|
+
import { getCookie } from "hono/cookie";
|
|
32
|
+
import { returningCookieName } from "./auth.js";
|
|
31
33
|
import { buildGitPassPrefix, presentedGitKey } from "./git-auth.js";
|
|
32
34
|
import { workflowGitPassPrefix } from "@fungi.computer/braid/runtime";
|
|
33
35
|
import { loadPageAssets, PageAssetsLoadError, } from "./page-assets.js";
|
|
@@ -372,7 +374,10 @@ export function oysterRouteTable(host) {
|
|
|
372
374
|
});
|
|
373
375
|
};
|
|
374
376
|
table.get("/_oyster/host-assets/*", publicRoute("content-addressed host illustrations and layout"), (context) => hostPageAsset(new URL(context.req.url).pathname));
|
|
375
|
-
table.get("/login", publicRoute("the sign-in form"), () => page("login"
|
|
377
|
+
table.get("/login", publicRoute("the sign-in form"), (context) => page("login", {
|
|
378
|
+
returning: getCookie(context, returningCookieName) === "1",
|
|
379
|
+
usedLink: context.req.query("link") === "used",
|
|
380
|
+
}));
|
|
376
381
|
table.get("/login/key-help", publicRoute("owner key recovery instructions, without a reset"), () => page("key-help"));
|
|
377
382
|
table.post("/login", door("the host's own sign-in checks the posted key"), (context) => host.auth.login === undefined
|
|
378
383
|
? refusal(404, "Sign-in is not available")
|
package/dist/page/app-access.js
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
import { grantRequestFor, appPermissionPageSchema, } from "../apps/permissions.js";
|
|
2
|
+
/** The families beyond Agents and Computers, which the sheet lists in words. */
|
|
3
|
+
function otherFamilies(input) {
|
|
4
|
+
return {
|
|
5
|
+
git: input.git ?? [],
|
|
6
|
+
workflows: input.workflows ?? [],
|
|
7
|
+
events: input.events ?? [],
|
|
8
|
+
generation: input.generation ?? [],
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function asksForAnything(input) {
|
|
12
|
+
return [
|
|
13
|
+
input.agents,
|
|
14
|
+
input.computers,
|
|
15
|
+
input.git,
|
|
16
|
+
input.workflows,
|
|
17
|
+
input.events,
|
|
18
|
+
input.generation,
|
|
19
|
+
].some((list) => list !== undefined && list.length > 0);
|
|
20
|
+
}
|
|
2
21
|
/**
|
|
3
22
|
* Keep standalone consent in the Oyster host: the picked shell draws the
|
|
4
23
|
* prompt, while Oyster bounds the request and commits through its owner CAS.
|
|
@@ -10,7 +29,8 @@ export function createShellAppAccess(directory) {
|
|
|
10
29
|
const app = current.apps.find((row) => row.surfaceId === surfaceId);
|
|
11
30
|
const installationId = app?.installationId ?? null;
|
|
12
31
|
const customize = () => dialog.customize(installationId);
|
|
13
|
-
|
|
32
|
+
// An empty request is the App asking to open its permissions.
|
|
33
|
+
if (installationId === null || !asksForAnything(input))
|
|
14
34
|
return customize();
|
|
15
35
|
const path = `/api/installations/${encodeURIComponent(installationId)}/grants`;
|
|
16
36
|
const response = await fetch(path, {
|
|
@@ -38,6 +58,7 @@ export function createShellAppAccess(directory) {
|
|
|
38
58
|
appName: view.appName,
|
|
39
59
|
agents: input.agents ?? [],
|
|
40
60
|
computers: input.computers ?? [],
|
|
61
|
+
others: otherFamilies(input),
|
|
41
62
|
refusal: {
|
|
42
63
|
code: decision.code,
|
|
43
64
|
message: "Allow for this window is unavailable on this Oyster. No access was changed. Use Customize to review Computer permissions explicitly.",
|
|
@@ -52,6 +73,7 @@ export function createShellAppAccess(directory) {
|
|
|
52
73
|
appName: view.appName,
|
|
53
74
|
agents: input.agents ?? [],
|
|
54
75
|
computers: input.computers ?? [],
|
|
76
|
+
others: otherFamilies(input),
|
|
55
77
|
allow: async () => {
|
|
56
78
|
const saved = await fetch(path, {
|
|
57
79
|
method: "PUT",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type AppPermissions } from "@fungi.computer/agar";
|
|
2
|
+
import { type AppPermissionsViewData } from "../apps/permissions.js";
|
|
3
|
+
/**
|
|
4
|
+
* Which of an App's declared rights its owner's grants cover. Reads the same
|
|
5
|
+
* facts the permission page shows, so the two never disagree. A right the App
|
|
6
|
+
* does not declare is left out.
|
|
7
|
+
*/
|
|
8
|
+
export declare function appRightStates(page: Pick<AppPermissionsViewData, "permissions">): AppPermissions;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { APP_RIGHTS } from "@fungi.computer/agar";
|
|
2
|
+
import { pendingCapabilities, } from "../apps/permissions.js";
|
|
3
|
+
/**
|
|
4
|
+
* Which of an App's declared rights its owner's grants cover. Reads the same
|
|
5
|
+
* facts the permission page shows, so the two never disagree. A right the App
|
|
6
|
+
* does not declare is left out.
|
|
7
|
+
*/
|
|
8
|
+
export function appRightStates(page) {
|
|
9
|
+
const { authority, declaredOperations } = page.permissions;
|
|
10
|
+
const declared = declaredOperations.capabilities.map(({ capability }) => capability);
|
|
11
|
+
const missing = new Set(pendingCapabilities(authority, { capabilities: declared }, declaredOperations));
|
|
12
|
+
return Object.fromEntries(APP_RIGHTS.filter((right) => declared.some((name) => name === right)).map((right) => [right, missing.has(right) ? "missing" : "granted"]));
|
|
13
|
+
}
|
|
@@ -76,4 +76,19 @@ export declare class ComputerProcessesHandle extends RpcTarget implements Handle
|
|
|
76
76
|
};
|
|
77
77
|
readonly signalled: boolean;
|
|
78
78
|
}>;
|
|
79
|
+
logs(id: string, lines?: number): Promise<{
|
|
80
|
+
readonly process: {
|
|
81
|
+
readonly port: number | null;
|
|
82
|
+
readonly id: string;
|
|
83
|
+
readonly command: string;
|
|
84
|
+
readonly cwd: string | null;
|
|
85
|
+
readonly startedAt: number;
|
|
86
|
+
readonly state: "running" | "uncertain" | "exited";
|
|
87
|
+
readonly exitCode: number | null;
|
|
88
|
+
readonly sync: "unknown" | "pending" | "synced";
|
|
89
|
+
readonly endedAt: number | null;
|
|
90
|
+
};
|
|
91
|
+
readonly lines: readonly string[];
|
|
92
|
+
readonly truncated: boolean;
|
|
93
|
+
}>;
|
|
79
94
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RpcTarget } from "@fungi.computer/capnweb";
|
|
2
2
|
import * as Schema from "effect/Schema";
|
|
3
|
-
import { computerPortExposureSchema, computerPortRemovalSchema, computerPortsResultSchema, computerProcessKillSchema, computerProcessSchema, computerProcessesSchema, } from "@fungi.computer/agar/computer";
|
|
3
|
+
import { computerPortExposureSchema, computerPortRemovalSchema, computerPortsResultSchema, computerProcessKillSchema, computerProcessLogsSchema, computerProcessSchema, computerProcessesSchema, } from "@fungi.computer/agar/computer";
|
|
4
4
|
/**
|
|
5
5
|
* Agar's `computer.ports` handle over the host's wire. The App passes a bare
|
|
6
6
|
* port; Hub's routes and the Computer owner take `{ port }` as the body, so
|
|
@@ -41,4 +41,7 @@ export class ComputerProcessesHandle extends RpcTarget {
|
|
|
41
41
|
async kill(id) {
|
|
42
42
|
return Schema.decodeUnknownSync(computerProcessKillSchema)(await this.#call("kill", { id }));
|
|
43
43
|
}
|
|
44
|
+
async logs(id, lines) {
|
|
45
|
+
return Schema.decodeUnknownSync(computerProcessLogsSchema)(await this.#call("logs", lines === undefined ? { id } : { id, lines }));
|
|
46
|
+
}
|
|
44
47
|
}
|
package/dist/page/mount.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { OysterAgentBrowserHost } from "./agent-browser.js";
|
|
|
3
3
|
export type { OysterAgentBrowserHost } from "./agent-browser.js";
|
|
4
4
|
import type { WhistleRuntime } from "@fungi.computer/whistle";
|
|
5
5
|
import * as Schema from "effect/Schema";
|
|
6
|
+
import { type AppPermissions, type AppSetup } from "@fungi.computer/agar";
|
|
6
7
|
import { type AppHost, type AppHostLaunch, type AppHostHandlers } from "@fungi.computer/agar/host";
|
|
7
8
|
import type { WhistleJsonValue } from "@fungi.computer/whistle";
|
|
8
9
|
/** Current server-admitted configuration for one installed App page. */
|
|
@@ -157,6 +158,10 @@ export type OysterAppConnectionOptions = Readonly<{
|
|
|
157
158
|
appOpen?: OysterAppOpenRouting;
|
|
158
159
|
openRequest?: AppHostLaunch["context"]["value"]["openRequest"];
|
|
159
160
|
surfaceId?: string;
|
|
161
|
+
/** Host setup facts the App sees from its first message; absent on hosts with none. */
|
|
162
|
+
setup?: AppSetup | undefined;
|
|
163
|
+
/** Which declared rights this App holds, when the host can read its grants. */
|
|
164
|
+
permissions?: AppPermissions | undefined;
|
|
160
165
|
reservedChords: readonly import("@fungi.computer/agar/host").AppHostReservedChord[];
|
|
161
166
|
theme: string;
|
|
162
167
|
}>;
|
package/dist/page/mount.js
CHANGED
|
@@ -343,6 +343,10 @@ async function openOysterApp(options, appWindow, opening, navigate) {
|
|
|
343
343
|
focus: { editing: false, surface: null },
|
|
344
344
|
openRequest: options.openRequest ?? null,
|
|
345
345
|
visibility: "visible",
|
|
346
|
+
...(options.setup !== undefined && { setup: options.setup }),
|
|
347
|
+
...(options.permissions !== undefined && {
|
|
348
|
+
permissions: options.permissions,
|
|
349
|
+
}),
|
|
346
350
|
},
|
|
347
351
|
},
|
|
348
352
|
lifecycle: { version: 1, value: "connected" },
|