@fungi.computer/oyster 0.19.26 → 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/embed-metafiles.js +1 -1
- package/dist/embed-scripts.js +2 -2
- package/dist/host.js +13 -0
- package/dist/page/app-permissions.js +28 -29
- package/dist/page-script.js +3 -3
- 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/computer.js +1 -1
- package/dist/standalone/model-key-vault.d.ts +17 -5
- package/dist/standalone/model-key-vault.js +59 -12
- package/dist/standalone/try-cli.d.ts +1 -0
- package/dist/standalone/try-cli.js +50 -18
- 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 +5 -5
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: () => {
|