@fungi.computer/oyster 0.19.27 → 0.19.28
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 +1 -1
- package/dist/agents.js +7 -1
- package/dist/apps/permissions.d.ts +5 -0
- package/dist/apps/permissions.js +5 -0
- package/dist/host.js +13 -0
- package/dist/page/app-permissions.js +28 -29
- package/dist/page-script.js +2 -2
- package/dist/standalone/agent-model-choice.js +6 -2
- package/dist/standalone/agents.d.ts +5 -0
- package/dist/standalone/agents.js +17 -1
- package/dist/standalone/model-key-vault.d.ts +17 -5
- package/dist/standalone/model-key-vault.js +59 -12
- package/docs/api/agents.md +19 -16
- package/docs/api/apps.md +8 -2
- package/docs/api/workers-git.md +7 -7
- package/package.json +3 -3
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([
|
|
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<{
|
package/dist/apps/permissions.js
CHANGED
|
@@ -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.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) =>
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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, {
|
|
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: () => {
|