@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.
Files changed (42) hide show
  1. package/dist/agents.d.ts +8 -0
  2. package/dist/agents.js +6 -0
  3. package/dist/apps/permissions.js +8 -1
  4. package/dist/auth.d.ts +2 -0
  5. package/dist/auth.js +9 -8
  6. package/dist/boot-host-script.js +1 -1
  7. package/dist/build/candidate-cli.mjs +4 -0
  8. package/dist/computer.d.ts +5 -0
  9. package/dist/computer.js +1 -0
  10. package/dist/embed-metafiles.js +2 -2
  11. package/dist/embed-scripts.js +2 -2
  12. package/dist/hello-app-script.js +1 -1
  13. package/dist/host-page-assets.js +1 -1
  14. package/dist/host-page.d.ts +5 -1
  15. package/dist/host-page.js +23 -23
  16. package/dist/host.js +6 -1
  17. package/dist/page/app-access.js +23 -1
  18. package/dist/page/app-rights.d.ts +8 -0
  19. package/dist/page/app-rights.js +13 -0
  20. package/dist/page/computer-handles.d.ts +15 -0
  21. package/dist/page/computer-handles.js +4 -1
  22. package/dist/page/mount.d.ts +5 -0
  23. package/dist/page/mount.js +4 -0
  24. package/dist/page-script.js +3 -3
  25. package/dist/standalone/agents.js +10 -0
  26. package/dist/standalone/cloudflare-account.d.ts +10 -0
  27. package/dist/standalone/cloudflare-account.js +17 -0
  28. package/dist/standalone/computer.d.ts +2 -2
  29. package/dist/standalone/computer.js +16 -1
  30. package/dist/standalone/media.d.ts +2 -0
  31. package/dist/standalone/media.js +17 -1
  32. package/dist/standalone/sign-in-link.d.ts +1 -1
  33. package/dist/standalone/sign-in-link.js +9 -18
  34. package/dist/starter-agent.d.ts +59 -0
  35. package/dist/starter-agent.js +85 -0
  36. package/docs/api/agents.md +6 -0
  37. package/docs/api/auth.md +10 -0
  38. package/docs/api/computer.md +4 -0
  39. package/docs/api/page/mount.md +2 -0
  40. package/docs/api/workers-git.md +14 -9
  41. package/docs/api/workers.md +8 -3
  42. package/package.json +25 -21
@@ -45,6 +45,7 @@ import { configuredProviderEgress, providerFetch, } from "@fungi.computer/veil/g
45
45
  import { createAssistantMessageEventStream } from "@earendil-works/pi-ai/utils/event-stream";
46
46
  import { agentModelChoice, agentModelChoiceSchema, AgentModelRefused, selectAgentModel, } from "./agent-model-choice.js";
47
47
  import { CLOUDFLARE_GATEWAY_BINDING_AUTH_SENTINEL, createAiBindingFetch, } from "@earendil-works/pi-ai/api/cloudflare-ai-binding";
48
+ import { cloudflareAccountReady } from "./cloudflare-account.js";
48
49
  import { cloudflareWorkersAIProvider } from "@earendil-works/pi-ai/providers/cloudflare-workers-ai";
49
50
  import { getSupportedThinkingLevels } from "@earendil-works/pi-ai/models";
50
51
  import { agentModelListSchema } from "@fungi.computer/shiitake/model-list";
@@ -2023,6 +2024,15 @@ export function standaloneAgents(env, scope) {
2023
2024
  return { error: "not_found" };
2024
2025
  return env.AGENTS.getByName(agentId).setModelChoice(choice);
2025
2026
  },
2027
+ setup: async () => {
2028
+ const account = cloudflareAccountReady(env);
2029
+ const gateway = configuredProviderEgress(env).baseUrl("ai-gateway") !== null;
2030
+ const stored = (await directory().listModelKeys()).length > 0;
2031
+ return {
2032
+ models: account || gateway || stored ? "ready" : "missing",
2033
+ media: account ? "ready" : "missing",
2034
+ };
2035
+ },
2026
2036
  modelKeys: () => directory().listModelKeys(),
2027
2037
  sealModelKey: (input) => directory().sealModelKey(input),
2028
2038
  removeModelKey: (keyId) => directory().removeModelKey(keyId),
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Whether this Worker can reach Workers AI. The AI binding is declared in
3
+ * every Oyster's wrangler config, but a local trial (`oyster try`, served from
4
+ * a loopback origin) has no Cloudflare account behind it: calls through it
5
+ * fail. A deployed Oyster, served from its own origin, does.
6
+ */
7
+ export declare function cloudflareAccountReady(env: Readonly<{
8
+ AI?: unknown;
9
+ OYSTER_ORIGIN?: string | undefined;
10
+ }>): boolean;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Whether this Worker can reach Workers AI. The AI binding is declared in
3
+ * every Oyster's wrangler config, but a local trial (`oyster try`, served from
4
+ * a loopback origin) has no Cloudflare account behind it: calls through it
5
+ * fail. A deployed Oyster, served from its own origin, does.
6
+ */
7
+ export function cloudflareAccountReady(env) {
8
+ if (env.AI === undefined)
9
+ return false;
10
+ // A host that names no origin has no loopback trial to tell apart.
11
+ if (env.OYSTER_ORIGIN === undefined)
12
+ return true;
13
+ if (!URL.canParse(env.OYSTER_ORIGIN))
14
+ return false;
15
+ const { hostname } = new URL(env.OYSTER_ORIGIN);
16
+ return !["localhost", "127.0.0.1", "[::1]"].includes(hostname);
17
+ }
@@ -6,7 +6,7 @@ import * as z from "zod";
6
6
  import { computerProcessSchema, computerToolResultSchema, readOutputSchema } from "@fungi.computer/computer-contract";
7
7
  import { ComputerDO as NativeComputerDO, type AttachedBackend, type ComputerEnv, type ComputerFilesRpc } from "@fungi.computer/computer";
8
8
  import { patchInputSchema, patchOutputSchema } from "@fungi.computer/knapsack/files-patch";
9
- import { listOutputSchema, writeOutputSchema, mkdirOutputSchema, computerPortsOutputSchema, computerPortOutputSchema, computerPortRemovalOutputSchema, processListOutputSchema, processKillOutputSchema, computerOperationResultSchema, type ComputerExecutionHostHooks, type ComputerValue } from "@fungi.computer/computer-contract";
9
+ import { listOutputSchema, writeOutputSchema, mkdirOutputSchema, computerPortsOutputSchema, computerPortOutputSchema, computerPortRemovalOutputSchema, processListOutputSchema, processKillOutputSchema, processLogsOutputSchema, computerOperationResultSchema, type ComputerExecutionHostHooks, type ComputerValue } from "@fungi.computer/computer-contract";
10
10
  import { type WorkflowGitCredential, type WorkflowGitPassGrant } from "@fungi.computer/braid/runtime";
11
11
  import { type ComputerAction, type ComputerBackendView, type ComputerGrant, type LocalBackendAttachInput, type LocalBackendDetachInput } from "@fungi.computer/computer/fleet";
12
12
  import type { InvocationFrame } from "../invocation.js";
@@ -38,7 +38,7 @@ export type StandaloneComputerResult = z.output<typeof listOutputSchema> | Reado
38
38
  truncated: boolean;
39
39
  }> | Readonly<{
40
40
  error: "conflict";
41
- }> | z.output<typeof writeOutputSchema> | z.output<typeof mkdirOutputSchema> | z.output<typeof computerPortsOutputSchema> | z.output<typeof computerPortOutputSchema> | z.output<typeof computerPortRemovalOutputSchema> | z.output<typeof processListOutputSchema> | z.output<typeof processKillOutputSchema> | z.output<typeof computerProcessSchema> | ComputerPorts["ports"][number] | z.output<typeof computerOperationResultSchema> | z.output<typeof readOutputSchema> | z.output<typeof computerToolResultSchema>;
41
+ }> | z.output<typeof writeOutputSchema> | z.output<typeof mkdirOutputSchema> | z.output<typeof computerPortsOutputSchema> | z.output<typeof computerPortOutputSchema> | z.output<typeof computerPortRemovalOutputSchema> | z.output<typeof processListOutputSchema> | z.output<typeof processKillOutputSchema> | z.output<typeof processLogsOutputSchema> | z.output<typeof computerProcessSchema> | ComputerPorts["ports"][number] | z.output<typeof computerOperationResultSchema> | z.output<typeof readOutputSchema> | z.output<typeof computerToolResultSchema>;
42
42
  /**
43
43
  * A port-preview listing, or the typed refusal the owner route presents with
44
44
  * {@link appMethodRefusalStatus}. A refusal never escapes as a 500.
@@ -12,7 +12,7 @@ import * as z from "zod";
12
12
  import { ComputerPortConflictError, computerByteReadReplySchema, computerProcessSchema, installationProcessScope, processStartInputSchema, processStartToolInputSchema, computerCapabilities, computerToolResultSchema, readOutputSchema, } from "@fungi.computer/computer-contract";
13
13
  import { ComputerDO as NativeComputerDO, ComputerOperationConflictError, } from "@fungi.computer/computer";
14
14
  import { patchInputSchema, patchOutputSchema, } from "@fungi.computer/knapsack/files-patch";
15
- import { ComputerFileConflict, computerExecutionRequestSchema, computerValueSchema, computerPortInputSchema, listInputSchema, listOutputSchema, readBytesInputSchema, writeInputSchema, replaceInputSchema, writeOutputSchema, mkdirOutputSchema, computerPortsOutputSchema, computerPortOutputSchema, computerPortRemovalOutputSchema, processListOutputSchema, processKillOutputSchema, computerOperationResultSchema, mintComputerRequestId, processIdInputSchema, } from "@fungi.computer/computer-contract";
15
+ import { ComputerFileConflict, computerExecutionRequestSchema, computerValueSchema, computerPortInputSchema, listInputSchema, listOutputSchema, readBytesInputSchema, writeInputSchema, replaceInputSchema, writeOutputSchema, mkdirOutputSchema, computerPortsOutputSchema, computerPortOutputSchema, computerPortRemovalOutputSchema, processListOutputSchema, processKillOutputSchema, processLogsInputSchema, processLogsOutputSchema, computerOperationResultSchema, mintComputerRequestId, processIdInputSchema, } from "@fungi.computer/computer-contract";
16
16
  import { workflowGitExecutionEnvironment, workflowGitPassGrantSchema, } from "@fungi.computer/braid/runtime";
17
17
  import { checkComputerGrant, computerActionSchema, computerGrantSchema, ComputerBackingError, createFleetBacking, FleetGrantRefused, FleetLifecycle, } from "@fungi.computer/computer/fleet";
18
18
  import { AppInstanceError, selectionOf } from "../index.js";
@@ -461,6 +461,8 @@ export class ComputerDO extends NativeComputerDO {
461
461
  return { error: "conflict" };
462
462
  throw cause;
463
463
  }
464
+ case "processLogs":
465
+ return this.processLogsAfterAcceptance(processLogsInputSchema.parse(input), accept);
464
466
  case "processKill":
465
467
  return this.killProcessAfterAcceptance(processIdInputSchema.parse(input), accept);
466
468
  case "exec":
@@ -673,6 +675,19 @@ export function standaloneComputerCapabilities(env, workspace) {
673
675
  return context.json({ error: "invalid_input" }, 400);
674
676
  return Response.json(await computer().value(authority(principal), "processKill", input.data));
675
677
  });
678
+ routes.get("/processes/logs", reach, async (context, { principal }) => {
679
+ const query = {
680
+ id: context.req.query("id"),
681
+ lines: context.req.query("lines"),
682
+ };
683
+ const input = processLogsInputSchema.safeParse({
684
+ id: query.id,
685
+ lines: query.lines === undefined ? undefined : Number(query.lines),
686
+ });
687
+ if (!input.success)
688
+ return context.json({ error: "invalid_input" }, 400);
689
+ return Response.json(await computer().value(authority(principal), "processLogs", input.data));
690
+ });
676
691
  routes.get("/terminal", reach, async (context, { principal }) => {
677
692
  const terminal = authority(principal);
678
693
  const url = new URL(context.req.url);
@@ -10,6 +10,8 @@ import type { FileSource } from "../files.js";
10
10
  export type OysterMediaEnv = Readonly<{
11
11
  /** Workers AI provider, admitted by this Worker. */
12
12
  AI: MediaAiPort;
13
+ /** This Worker's own origin; a loopback origin has no Cloudflare account. */
14
+ OYSTER_ORIGIN?: string | undefined;
13
15
  /** Darkroom's durable operation namespace. */
14
16
  MEDIA_OPERATION: MediaServiceHost["operations"];
15
17
  /** Native image decoding and bounded reference fitting. */
@@ -12,6 +12,7 @@ import { createMediaService, estimateMediaModel, mediaPendingSchema, mediaResult
12
12
  import { createWorkersAiMediaProvider, createImagesReferenceFitter, } from "@fungi.computer/darkroom/cloudflare";
13
13
  import { oysterPrincipalId, } from "../host.js";
14
14
  import { normalizeFilePath } from "../files.js";
15
+ import { cloudflareAccountReady } from "./cloudflare-account.js";
15
16
  /** Media capability using Darkroom execution and the existing workspace FileSource. */
16
17
  export function workersMedia(env, workspace) {
17
18
  const { computerId } = workspace;
@@ -22,7 +23,7 @@ export function workersMedia(env, workspace) {
22
23
  const response = await service(principal).request("http://media/models");
23
24
  return context.json(Schema.decodeUnknownSync(mediaGenerationDescriptionSchema)({
24
25
  computerId,
25
- canGenerate: true,
26
+ canGenerate: cloudflareAccountReady(env),
26
27
  models: await response.json(),
27
28
  }));
28
29
  });
@@ -40,6 +41,8 @@ export function workersMedia(env, workspace) {
40
41
  }));
41
42
  if (references?.some((reference) => reference.path === null || reference.path === "/"))
42
43
  return context.json(invalidRequest());
44
+ if (!cloudflareAccountReady(env))
45
+ return context.json(setupRequired());
43
46
  const response = await service(principal).request("http://media/generate", {
44
47
  method: "POST",
45
48
  signal: context.req.raw.signal,
@@ -104,6 +107,19 @@ export function workersMedia(env, workspace) {
104
107
  },
105
108
  ];
106
109
  }
110
+ /** A missing provider or account is setup, not a failed generation. */
111
+ function setupRequired() {
112
+ return {
113
+ kind: "failed",
114
+ failure: {
115
+ message: "Media generation needs an image provider",
116
+ stage: "admission",
117
+ code: "SETUP_REQUIRED",
118
+ need: "an image provider",
119
+ retryable: false,
120
+ },
121
+ };
122
+ }
107
123
  function invalidRequest() {
108
124
  return {
109
125
  kind: "failed",
@@ -2,7 +2,7 @@ export type SignInLink = Readonly<{
2
2
  url: string;
3
3
  close: () => Promise<void>;
4
4
  }>;
5
- /** Serve one single-use page that signs the owner in to `oysterUrl`. */
5
+ /** Serve one single-use page that signs the owner in to `oysterUrl`, until closed. */
6
6
  export declare function startSignInLink(input: Readonly<{
7
7
  oysterUrl: string;
8
8
  key: string;
@@ -1,6 +1,7 @@
1
1
  // A one-time sign-in link for `oyster try`. The owner key never goes in a URL:
2
2
  // the link opens a page served by this process that posts the key to the local
3
- // Oyster's own /login form, then the server forgets the link.
3
+ // Oyster's own /login form, then the server forgets the key. The listener stays
4
+ // up for the whole try session, so a reused link lands on /login with a note.
4
5
  import { awaitCleanup } from "../build/process-group.js";
5
6
  import { createHash, randomBytes } from "node:crypto";
6
7
  import { addAbortListener } from "node:events";
@@ -9,8 +10,7 @@ import * as z from "zod";
9
10
  import { hostPage } from "../host-page.js";
10
11
  import { loadPageAssets } from "../page-assets.js";
11
12
  const addressSchema = z.object({ port: z.number() });
12
- const lifetimeMs = 10 * 60_000;
13
- /** Serve one single-use page that signs the owner in to `oysterUrl`. */
13
+ /** Serve one single-use page that signs the owner in to `oysterUrl`, until closed. */
14
14
  export async function startSignInLink(input) {
15
15
  const signal = input.signal ?? new AbortController().signal;
16
16
  signal.throwIfAborted();
@@ -32,10 +32,8 @@ export async function startSignInLink(input) {
32
32
  key: input.key,
33
33
  },
34
34
  })).text();
35
- const expired = await (await hostPage({ ...pageOptions, state: "link-expired", status: 404 })).text();
36
35
  const notFound = await (await hostPage({ ...pageOptions, state: "not-found", status: 404 })).text();
37
36
  signal.throwIfAborted();
38
- const timers = new Set();
39
37
  const server = createServer((request, response) => {
40
38
  const headers = {
41
39
  "Content-Type": "text/html; charset=utf-8",
@@ -49,21 +47,22 @@ export async function startSignInLink(input) {
49
47
  return;
50
48
  }
51
49
  if (used) {
52
- response.writeHead(404, headers).end(expired);
50
+ response
51
+ .writeHead(302, {
52
+ ...headers,
53
+ Location: new URL("/login?link=used", input.oysterUrl).href,
54
+ })
55
+ .end();
53
56
  return;
54
57
  }
55
58
  used = true;
56
59
  response.writeHead(200, headers).end(page);
57
60
  page = "";
58
- scheduleClose(1_000);
59
61
  });
60
62
  let closing;
61
63
  let abortListener;
62
64
  const beginClose = () => (closing ??= Promise.allSettled([
63
65
  (async () => {
64
- for (const timer of timers)
65
- clearTimeout(timer);
66
- timers.clear();
67
66
  page = "";
68
67
  abortListener?.[Symbol.dispose]();
69
68
  await new Promise((resolve, reject) => {
@@ -79,13 +78,6 @@ export async function startSignInLink(input) {
79
78
  })(),
80
79
  ]));
81
80
  const close = () => awaitCleanup(beginClose());
82
- function scheduleClose(ms) {
83
- const timer = setTimeout(() => {
84
- void beginClose();
85
- }, ms);
86
- timer.unref();
87
- timers.add(timer);
88
- }
89
81
  try {
90
82
  await new Promise((done, fail) => {
91
83
  server.once("error", fail);
@@ -100,7 +92,6 @@ export async function startSignInLink(input) {
100
92
  abortListener = addAbortListener(signal, () => {
101
93
  void beginClose();
102
94
  });
103
- scheduleClose(lifetimeMs);
104
95
  const { port } = addressSchema.parse(server.address());
105
96
  return { url: `http://127.0.0.1:${String(port)}/${nonce}`, close };
106
97
  }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * The starter Agent policy: an owner with an empty Team gets one Agent named
3
+ * "Shiitake", once, ever. This module owns only that rule and its one-row
4
+ * ledger. It never creates anything itself: the host supplies its ordinary,
5
+ * idempotent Agent create, so the starter has exactly the identity, Computer,
6
+ * App tools and funding checks of any other Agent. It stores no model, prompt,
7
+ * session or tool grant.
8
+ */
9
+ import type { WatchdogSqliteOwner } from "@fungi.computer/watchdog";
10
+ /** The declaration. Changing it affects only Teams with no ledger row. */
11
+ export declare const starterAgent: {
12
+ readonly version: 1;
13
+ readonly name: "Shiitake";
14
+ readonly requestId: "starter-agent:v1";
15
+ };
16
+ /** What the ledger remembers: that the starter was settled, never to be offered again. */
17
+ export type StarterLedgerRow = Readonly<{
18
+ version: number;
19
+ outcome: "created" | "team-not-empty";
20
+ agentId: string | null;
21
+ at: number;
22
+ }>;
23
+ /** One row per Team, in the host's own SQLite. */
24
+ export type StarterLedger = Readonly<{
25
+ read(): StarterLedgerRow | undefined;
26
+ /** First write wins; a later one is ignored. */
27
+ record(row: StarterLedgerRow): void;
28
+ }>;
29
+ /** The host's ordinary create, as the starter sees it. */
30
+ export type StarterCreateResult = Readonly<{
31
+ status: "created";
32
+ agentId: string;
33
+ }> | Readonly<{
34
+ status: "unfunded";
35
+ }>;
36
+ export type StarterAgentHost = Readonly<{
37
+ ledger: StarterLedger;
38
+ /** Only the Team owner's read may trigger the starter. */
39
+ isOwner(): boolean;
40
+ /** Agents in the Team, archived ones included. */
41
+ agentCount(): number;
42
+ /** The host's normal create, replayed by `requestId`; funding refusal is `unfunded`. */
43
+ create(request: {
44
+ name: string;
45
+ requestId: string;
46
+ }): Promise<StarterCreateResult>;
47
+ /** Where a failed attempt is reported; the caller's read never fails. */
48
+ report?(cause: unknown): void;
49
+ now?(): number;
50
+ }>;
51
+ export type StarterOutcome = "created" | "already-offered" | "team-not-empty" | "unfunded" | "not-owner" | "failed";
52
+ /** Open the one-row ledger in the host's own SQLite. */
53
+ export declare function createStarterLedger(sql: WatchdogSqliteOwner["sql"]): StarterLedger;
54
+ /**
55
+ * Offer the starter Agent if this Team never had its chance. Safe to call on
56
+ * every owner directory read: concurrent calls share one attempt, and the
57
+ * host's `requestId` replay makes a second attempt return the same Agent.
58
+ */
59
+ export declare function ensureStarterAgent(host: StarterAgentHost): Promise<StarterOutcome>;
@@ -0,0 +1,85 @@
1
+ import { z } from "zod";
2
+ /** The declaration. Changing it affects only Teams with no ledger row. */
3
+ export const starterAgent = {
4
+ version: 1,
5
+ name: "Shiitake",
6
+ requestId: "starter-agent:v1",
7
+ };
8
+ const ledgerRowSchema = z.strictObject({
9
+ version: z.number().int(),
10
+ outcome: z.enum(["created", "team-not-empty"]),
11
+ agent_id: z.string().nullable(),
12
+ at: z.number(),
13
+ });
14
+ /** Open the one-row ledger in the host's own SQLite. */
15
+ export function createStarterLedger(sql) {
16
+ sql.exec("CREATE TABLE IF NOT EXISTS starter_agent (id INTEGER PRIMARY KEY CHECK (id = 1), version INTEGER NOT NULL, outcome TEXT NOT NULL, agent_id TEXT, at INTEGER NOT NULL) STRICT");
17
+ return {
18
+ read() {
19
+ const row = sql
20
+ .exec("SELECT version, outcome, agent_id, at FROM starter_agent WHERE id = 1")
21
+ .toArray()[0];
22
+ if (row === undefined)
23
+ return undefined;
24
+ const stored = ledgerRowSchema.parse(row);
25
+ return {
26
+ version: stored.version,
27
+ outcome: stored.outcome,
28
+ agentId: stored.agent_id,
29
+ at: stored.at,
30
+ };
31
+ },
32
+ record(row) {
33
+ sql.exec("INSERT INTO starter_agent(id, version, outcome, agent_id, at) VALUES(1, ?, ?, ?, ?) ON CONFLICT(id) DO NOTHING", row.version, row.outcome, row.agentId, row.at);
34
+ },
35
+ };
36
+ }
37
+ const inFlight = new WeakMap();
38
+ /**
39
+ * Offer the starter Agent if this Team never had its chance. Safe to call on
40
+ * every owner directory read: concurrent calls share one attempt, and the
41
+ * host's `requestId` replay makes a second attempt return the same Agent.
42
+ */
43
+ export function ensureStarterAgent(host) {
44
+ const running = inFlight.get(host.ledger);
45
+ if (running !== undefined)
46
+ return running;
47
+ const attempt = settle(host).finally(() => inFlight.delete(host.ledger));
48
+ inFlight.set(host.ledger, attempt);
49
+ return attempt;
50
+ }
51
+ async function settle(host) {
52
+ try {
53
+ if (!host.isOwner())
54
+ return "not-owner";
55
+ if (host.ledger.read() !== undefined)
56
+ return "already-offered";
57
+ const at = (host.now ?? Date.now)();
58
+ if (host.agentCount() > 0) {
59
+ host.ledger.record({
60
+ version: starterAgent.version,
61
+ outcome: "team-not-empty",
62
+ agentId: null,
63
+ at,
64
+ });
65
+ return "team-not-empty";
66
+ }
67
+ const result = await host.create({
68
+ name: starterAgent.name,
69
+ requestId: starterAgent.requestId,
70
+ });
71
+ if (result.status === "unfunded")
72
+ return "unfunded";
73
+ host.ledger.record({
74
+ version: starterAgent.version,
75
+ outcome: "created",
76
+ agentId: result.agentId,
77
+ at,
78
+ });
79
+ return "created";
80
+ }
81
+ catch (cause) {
82
+ host.report?.(cause);
83
+ return "failed";
84
+ }
85
+ }
@@ -323,6 +323,12 @@ type OysterAgents = Readonly<{
323
323
  error: "not_found" | "revision_conflict" | "not_granted";
324
324
  }>
325
325
  >;
326
+ setup: Promise<
327
+ Readonly<{
328
+ models: "ready" | "missing";
329
+ media: "ready" | "missing";
330
+ }>
331
+ >;
326
332
  modelKeys: Promise<
327
333
  readonly Readonly<{
328
334
  keyId: string;
package/docs/api/auth.md CHANGED
@@ -18,6 +18,16 @@ const ownerKeyCookieName: "oyster_session" = "oyster_session";
18
18
 
19
19
  Cookie emitted by ownerKeyAuth, for composing credential-specific adapters.
20
20
 
21
+ ---
22
+
23
+ ### returningCookieName
24
+
25
+ ```ts
26
+ const returningCookieName: "oyster_returning" = "oyster_returning";
27
+ ```
28
+
29
+ Marks a browser that has signed in here before; it carries no authority.
30
+
21
31
  ## Functions
22
32
 
23
33
  ### ownerKeyAuth()
@@ -192,6 +192,10 @@ Computer routes supplied by the host; execution stays in the Computer runtime.
192
192
  | `processes.methods.kill.kind` | `"json"` | `"json"` |
193
193
  | `processes.methods.kill.method` | `"POST"` | `"POST"` |
194
194
  | `processes.methods.kill.path` | `"processes/kill"` | `"processes/kill"` |
195
+ | `processes.methods.logs` | `object` | - |
196
+ | `processes.methods.logs.kind` | `"json"` | `"json"` |
197
+ | `processes.methods.logs.method` | `"GET"` | `"GET"` |
198
+ | `processes.methods.logs.path` | `"processes/logs"` | `"processes/logs"` |
195
199
  | <a id="property-terminal"></a> `terminal` | `object` | - |
196
200
  | `terminal.id` | `string` | `computerTerminal.id` |
197
201
  | `terminal.version` | `number` | `computerTerminal.version` |
@@ -132,6 +132,8 @@ type OysterAppConnectionOptions = Readonly<{
132
132
  appOpen?: OysterAppOpenRouting;
133
133
  openRequest?: AppHostLaunch["context"]["value"]["openRequest"];
134
134
  surfaceId?: string;
135
+ setup?: AppSetup;
136
+ permissions?: AppPermissions;
135
137
  reservedChords: readonly AppHostReservedChord[];
136
138
  theme: string;
137
139
  }>;