@fungi.computer/oyster 0.19.27 → 0.19.29

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 CHANGED
@@ -60,8 +60,8 @@ MCP and deployment.
60
60
 
61
61
  ## What you get
62
62
 
63
- Deploying Oyster and running `npx oyster install-apps` installs seven Apps. Each
64
- lives in its own repository under
63
+ Deploying Oyster and running `npx @fungi.computer/oyster install-apps` installs
64
+ seven Apps. Each lives in its own repository under
65
65
  [github.com/fungi-computer](https://github.com/fungi-computer), and each
66
66
  installed App is also a template your agents can fork and rebuild.
67
67
 
@@ -120,7 +120,7 @@ printf '%s' "$(cat .oyster-owner)" | npx wrangler secret put OYSTER_OWNER_KEY
120
120
  openssl rand -base64 32 | tr '+/' '-_' | tr -d '=\n' |
121
121
  npx wrangler secret put OYSTER_CREDENTIAL_KEY
122
122
  export OYSTER_OWNER_KEY=$(cat .oyster-owner)
123
- npx oyster install-apps
123
+ npx @fungi.computer/oyster install-apps
124
124
  ```
125
125
 
126
126
  Your workers.dev subdomain is on the Workers & Pages overview in the Cloudflare
package/dist/agents.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { AppSetup } from "@fungi.computer/agar";
2
2
  import type { TenantPrincipal } from "./tenant.js";
3
3
  import type { ModelKeyRecord, ModelKeyRefusal, ModelKeySealInput } from "./standalone/model-key-vault.js";
4
- export type { ModelKeyRefusal, ModelKeySealInput, } from "./standalone/model-key-vault.js";
4
+ export type { ModelKeyRecord, ModelKeyRefusal, ModelKeySealInput, } from "./standalone/model-key-vault.js";
5
5
  import { type Routes } from "./authorization.js";
6
6
  import type { AppToolPolicy } from "./apps/tools.js";
7
7
  import * as Schema from "effect/Schema";
package/dist/agents.js CHANGED
@@ -412,7 +412,13 @@ export function agentApprovalRoutes(agents) {
412
412
  }
413
413
  const keyIdPattern = /^cred_[A-Za-z0-9_-]{1,64}$/u;
414
414
  const sealRequestSchema = Schema.Struct({
415
- provider: Schema.Literals(["anthropic", "openai", "openrouter"]),
415
+ provider: Schema.Literals([
416
+ "anthropic",
417
+ "openai",
418
+ "openrouter",
419
+ "cloudflare-workers-ai",
420
+ ]),
421
+ accountId: Schema.optional(Schema.String.check(Schema.isPattern(/^[a-f0-9]{32}$/u))),
416
422
  label: Schema.String.check(Schema.isMinLength(1), Schema.isMaxLength(64)),
417
423
  apiKey: Schema.String.check(Schema.isMinLength(1), Schema.isMaxLength(16_384)),
418
424
  });
@@ -198,6 +198,11 @@ export declare const appPermissionPageSchema: z.ZodObject<{
198
198
  installationId: z.ZodString;
199
199
  appId: z.ZodString;
200
200
  appName: z.ZodString;
201
+ appCalls: z.ZodArray<z.ZodObject<{
202
+ operation: z.ZodString;
203
+ method: z.ZodString;
204
+ targetName: z.ZodString;
205
+ }, z.core.$strict>>;
201
206
  artifactDigest: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@fungi.computer/puffball").Sha256Digest, unknown>>;
202
207
  permissions: z.ZodObject<{
203
208
  authority: z.ZodObject<{
@@ -257,6 +257,11 @@ export const appPermissionPageSchema = z.strictObject({
257
257
  installationId: z.string(),
258
258
  appId: z.string(),
259
259
  appName: z.string(),
260
+ appCalls: z.array(z.strictObject({
261
+ operation: z.string(),
262
+ method: z.string(),
263
+ targetName: z.string(),
264
+ })),
260
265
  artifactDigest: ownerCodec(sha256DigestSchema),
261
266
  permissions: appPermissionsWireSchema,
262
267
  canEdit: z.boolean(),
package/dist/host-page.js CHANGED
@@ -211,9 +211,9 @@ function pageContent(options, url) {
211
211
  state === "empty" ||
212
212
  state === "desktop-missing") {
213
213
  if (options.reset)
214
- content.push(h("p", { className: "detail" }, "This update reset your installed Apps. Reinstall them with npx oyster install-apps."));
214
+ content.push(h("p", { className: "detail" }, "This update reset your installed Apps. Reinstall them with npx @fungi.computer/oyster install-apps."));
215
215
  if (state === "empty")
216
- content.push(h("p", { className: "detail" }, "Install Apps with ", h("code", null, "npx oyster install-apps"), ". Follow the quickstart for your local or hosted Oyster."));
216
+ content.push(h("p", { className: "detail" }, "Install Apps with ", h("code", null, "npx @fungi.computer/oyster install-apps"), ". Follow the quickstart for your local or hosted Oyster."));
217
217
  if ((options.apps?.length ?? 0) > 0)
218
218
  content.push(h("div", { className: "app-grid" }, ...(options.apps ?? []).map((app) => h(Card, { key: app.id, variant: "interactive" }, h(CardHeader, null, h(CardTitle, null, h("a", { href: url(`/apps/${encodeURIComponent(app.id)}/`) }, app.name))), app.accessHref
219
219
  ? h(CardContent, null, h("a", { href: url(app.accessHref) }, "App access"))
package/dist/host.js CHANGED
@@ -692,11 +692,24 @@ export function oysterRouteTable(host) {
692
692
  const verified = await releaseOf(current.release);
693
693
  const declaration = verified.declaration ?? emptyAppDeclaration;
694
694
  const declared = await deriveDeclaredOperations(current.release, declaration, operationDescriptors);
695
+ const directory = host.workbench
696
+ ? await host.workbench.directory()
697
+ : null;
698
+ const appCalls = (declaration.calls ?? []).flatMap((call) => {
699
+ const targetName = directory?.apps.find((app) => app.appId === call.appId)
700
+ ?.displayName ?? `App ${call.appId}`;
701
+ return call.methods.map((method) => ({
702
+ operation: appCallOperation(call.appId, method),
703
+ method,
704
+ targetName,
705
+ }));
706
+ });
695
707
  const config = appPermissionPageSchema.parse({
696
708
  storeGeneration: generation,
697
709
  installationId: current.installationId,
698
710
  appId: current.appId,
699
711
  appName: declaration.displayName ?? current.installationId,
712
+ appCalls,
700
713
  artifactDigest: current.release.artifact.artifactDigest,
701
714
  canEdit: oysterPrincipalIsOwner(principal),
702
715
  resources: host.permissionResources === undefined
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { appCallMethodLabel } from "@fungi.computer/nacre/app-directory";
2
3
  import { useCallback, useEffect, useId, useRef, useState } from "react";
3
4
  import { Disclosure } from "@fungi.computer/caps/components/disclosure";
4
5
  import { Alert } from "@fungi.computer/caps/components/alert";
@@ -33,15 +34,6 @@ const gridHeadings = {
33
34
  scope: "Applies to",
34
35
  control: "Change",
35
36
  };
36
- /** "publishDraft" and "publish_draft" read as "Publish draft". */
37
- function methodLabel(operation) {
38
- const words = operation
39
- .replace(/([a-z0-9])([A-Z])/gu, "$1 $2")
40
- .replace(/[._-]+/gu, " ")
41
- .trim()
42
- .toLowerCase();
43
- return words.charAt(0).toUpperCase() + words.slice(1);
44
- }
45
37
  /** One grid row per grant: a label, its state in words and a labelled switch. */
46
38
  function grantRow(context, input) {
47
39
  return {
@@ -112,25 +104,31 @@ function appRows(context, group) {
112
104
  },
113
105
  });
114
106
  }),
115
- ...group.operations.map((operation) => grantRow(context, {
116
- id: `${operation.capability}:${operation.operation}`,
117
- capability: operation.capability,
118
- sigil: permissionCatalog["apps.call"].sigil,
119
- label: methodLabel(operation.operation),
120
- chip: groupLabels[group.id],
121
- scopeName: "Other Apps",
122
- pending: false,
123
- on: operation.on,
124
- locked: false,
125
- onChange: (on) => {
126
- context.edit({
127
- kind: "operation",
128
- capability: operation.capability,
129
- operation: operation.operation,
130
- on,
131
- });
132
- },
133
- })),
107
+ ...group.operations.map((operation) => {
108
+ const call = context.appCalls.find((call) => call.operation === operation.operation);
109
+ const words = call === undefined
110
+ ? "Use another App"
111
+ : appCallMethodLabel(call.method);
112
+ return grantRow(context, {
113
+ id: `${operation.capability}:${operation.operation}`,
114
+ capability: operation.capability,
115
+ sigil: permissionCatalog["apps.call"].sigil,
116
+ label: words.charAt(0).toUpperCase() + words.slice(1),
117
+ chip: groupLabels[group.id],
118
+ scopeName: call?.targetName ?? operation.operation,
119
+ pending: false,
120
+ on: operation.on,
121
+ locked: false,
122
+ onChange: (on) => {
123
+ context.edit({
124
+ kind: "operation",
125
+ capability: operation.capability,
126
+ operation: operation.operation,
127
+ on,
128
+ });
129
+ },
130
+ });
131
+ }),
134
132
  ];
135
133
  }
136
134
  /** Every row of a group: its resources' grants, then the App's own switches. */
@@ -334,6 +332,7 @@ function PermissionEditor({ port, appKey, onAccepted, onStateChange, }) {
334
332
  const pending = baseline.pending.filter((capability) => capability !== "team.workbenchHost");
335
333
  const context = {
336
334
  disabled,
335
+ appCalls: view.appCalls,
337
336
  describedBy: (capability) => `${describeId}-${capability}`,
338
337
  edit,
339
338
  };
@@ -345,7 +344,7 @@ function PermissionEditor({ port, appKey, onAccepted, onStateChange, }) {
345
344
  const first = rowsOf(askedIds.size > 0 ? groups.filter((g) => askedIds.has(g.id)) : groups);
346
345
  const later = askedIds.size > 0 ? rowsOf(groups.filter((g) => !askedIds.has(g.id))) : [];
347
346
  const showFooter = (groups.length > 0 && !shellChanged) || uncertain || refreshNeeded;
348
- return (_jsxs(Form, { style: { maxWidth: "var(--container-2xl)", marginInline: "auto" }, onSubmit: (event) => {
347
+ return (_jsxs(Form, { onSubmit: (event) => {
349
348
  event.preventDefault();
350
349
  void save();
351
350
  }, children: [_jsx(Toaster, { id: describeId }), !screen.canEdit && _jsx("p", { children: "Only an owner can change these permissions." }), pending.length > 0 && (_jsx(Alert, { tone: "warning", title: `${String(pending.length)} ${pending.length === 1 ? "permission needs" : "permissions need"} your OK`, action: screen.canEdit ? (_jsxs(Button, { type: "button", size: "xs", variant: "primary", disabled: disabled || shellChanged, onClick: () => {