@fungi.computer/tourtois 0.12.15 → 0.12.16
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/AppCallPermissions.js +2 -13
- package/dist/ModelKeys.d.ts +3 -0
- package/dist/ModelKeys.js +42 -5
- package/package.json +3 -3
|
@@ -1,21 +1,10 @@
|
|
|
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 { DataList, DataListHeading, DataRow, } from "@fungi.computer/caps/components/data-list";
|
|
3
|
-
const methodLabels = new Map([
|
|
4
|
-
["files.tree", "browse files"],
|
|
5
|
-
["files.list", "list files"],
|
|
6
|
-
["files.read", "read files"],
|
|
7
|
-
["commits.list", "read commits"],
|
|
8
|
-
["rebuildCopies", "refresh file views"],
|
|
9
|
-
["files.save", "save files"],
|
|
10
|
-
["files.sync", "sync files"],
|
|
11
|
-
["files.discard", "discard edits"],
|
|
12
|
-
]);
|
|
13
4
|
/** The declared deputy ceiling, shown identically on both hosts; this grants nothing. */
|
|
14
5
|
export function AppCallPermissions({ calls, apps, }) {
|
|
15
6
|
if (!calls?.length)
|
|
16
7
|
return null;
|
|
17
8
|
return (_jsxs("section", { "aria-label": "Calls to other Apps", children: [_jsx(DataListHeading, { level: 3, children: "Other Apps" }), _jsx(DataList, { density: "compact", children: calls.map((call) => (_jsx(DataRow, { children: _jsxs("span", { children: ["Can use", " ", apps.find((app) => app.appId === call.appId)?.displayName ??
|
|
18
|
-
call.appId, ":", " ", call.methods
|
|
19
|
-
.map((method) => methodLabels.get(method) ?? method)
|
|
20
|
-
.join(", ")] }) }, call.appId))) }), _jsx("p", { className: "mt-1 text-xs", children: "Calls use your permissions in the other App. Renamed target methods need approval again." })] }));
|
|
9
|
+
call.appId, ": ", call.methods.map(appCallMethodLabel).join(", ")] }) }, call.appId))) }), _jsx("p", { className: "mt-1 text-xs", children: "Calls use your permissions in the other App. Renamed target methods need approval again." })] }));
|
|
21
10
|
}
|
package/dist/ModelKeys.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
2
|
declare const providers: {
|
|
3
|
+
readonly "cloudflare-workers-ai": "Cloudflare Workers AI";
|
|
3
4
|
readonly anthropic: "Anthropic";
|
|
4
5
|
readonly openai: "OpenAI";
|
|
5
6
|
readonly openrouter: "OpenRouter";
|
|
@@ -10,6 +11,7 @@ export declare const modelKeysViewSchema: z.ZodObject<{
|
|
|
10
11
|
keys: z.ZodArray<z.ZodObject<{
|
|
11
12
|
keyId: z.ZodString;
|
|
12
13
|
provider: z.ZodEnum<{
|
|
14
|
+
"cloudflare-workers-ai": "cloudflare-workers-ai";
|
|
13
15
|
anthropic: "anthropic";
|
|
14
16
|
openai: "openai";
|
|
15
17
|
openrouter: "openrouter";
|
|
@@ -42,6 +44,7 @@ export type ModelKeyDraft = Readonly<{
|
|
|
42
44
|
provider: Provider;
|
|
43
45
|
label: string;
|
|
44
46
|
apiKey: string;
|
|
47
|
+
accountId?: string;
|
|
45
48
|
}>;
|
|
46
49
|
/** The Agent's next model: the instance default, or a stored key's provider. */
|
|
47
50
|
export type AgentModelChoiceDraft = Readonly<{
|
package/dist/ModelKeys.js
CHANGED
|
@@ -4,18 +4,24 @@ import { Button } from "@fungi.computer/caps/components/button";
|
|
|
4
4
|
import { DataList, DataListHeading, DataRow, FactRow, } from "@fungi.computer/caps/components/data-list";
|
|
5
5
|
import { FormFooter } from "@fungi.computer/caps/components/field";
|
|
6
6
|
import { KeycapButton } from "@fungi.computer/caps/components/keycap";
|
|
7
|
-
import { SchemaForm, field, useSchemaForm } from "@fungi.computer/caps/form";
|
|
7
|
+
import { FormFields, SchemaForm, field, useSchemaForm, } from "@fungi.computer/caps/form";
|
|
8
8
|
import { Sigil } from "@fungi.computer/sigils";
|
|
9
9
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
10
10
|
import { useCallback, useMemo, useState } from "react";
|
|
11
11
|
import * as z from "zod";
|
|
12
12
|
import { SettingsItem } from "./settings-item.js";
|
|
13
13
|
const providers = {
|
|
14
|
+
"cloudflare-workers-ai": "Cloudflare Workers AI",
|
|
14
15
|
anthropic: "Anthropic",
|
|
15
16
|
openai: "OpenAI",
|
|
16
17
|
openrouter: "OpenRouter",
|
|
17
18
|
};
|
|
18
|
-
const providerSchema = z.enum([
|
|
19
|
+
const providerSchema = z.enum([
|
|
20
|
+
"cloudflare-workers-ai",
|
|
21
|
+
"anthropic",
|
|
22
|
+
"openai",
|
|
23
|
+
"openrouter",
|
|
24
|
+
]);
|
|
19
25
|
/** One stored key as the host lists it; the secret never comes back. */
|
|
20
26
|
const modelKeySchema = z.strictObject({
|
|
21
27
|
keyId: z.string().min(1),
|
|
@@ -103,6 +109,15 @@ function AddModelKey({ onAdd, }) {
|
|
|
103
109
|
maxLength: 64,
|
|
104
110
|
placeholder: "Work key",
|
|
105
111
|
})),
|
|
112
|
+
accountId: z
|
|
113
|
+
.string()
|
|
114
|
+
.max(32)
|
|
115
|
+
.meta(field({
|
|
116
|
+
label: "Account ID",
|
|
117
|
+
icon: _jsx(Sigil, { name: "internet" }),
|
|
118
|
+
help: "Find this in your Cloudflare dashboard. The token needs Workers AI access for this account.",
|
|
119
|
+
maxLength: 32,
|
|
120
|
+
})),
|
|
106
121
|
apiKey: z
|
|
107
122
|
.string()
|
|
108
123
|
.min(1, "Paste the key")
|
|
@@ -117,10 +132,30 @@ function AddModelKey({ onAdd, }) {
|
|
|
117
132
|
const add = useMutation({ mutationFn: onAdd });
|
|
118
133
|
const model = useSchemaForm({
|
|
119
134
|
schema,
|
|
120
|
-
defaultValues: {
|
|
135
|
+
defaultValues: {
|
|
136
|
+
provider: "cloudflare-workers-ai",
|
|
137
|
+
label: "",
|
|
138
|
+
apiKey: "",
|
|
139
|
+
accountId: "",
|
|
140
|
+
},
|
|
121
141
|
onSubmit: async (value) => {
|
|
122
142
|
try {
|
|
123
|
-
|
|
143
|
+
if (value.provider === "cloudflare-workers-ai" &&
|
|
144
|
+
!/^[a-f0-9]{32}$/u.test(value.accountId))
|
|
145
|
+
return {
|
|
146
|
+
kind: "refused",
|
|
147
|
+
fields: {
|
|
148
|
+
accountId: "Enter your 32-character Cloudflare account ID.",
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
const draft = {
|
|
152
|
+
provider: value.provider,
|
|
153
|
+
label: value.label,
|
|
154
|
+
apiKey: value.apiKey,
|
|
155
|
+
};
|
|
156
|
+
await add.mutateAsync(value.provider === "cloudflare-workers-ai"
|
|
157
|
+
? { ...draft, accountId: value.accountId }
|
|
158
|
+
: draft);
|
|
124
159
|
return { kind: "saved" };
|
|
125
160
|
}
|
|
126
161
|
catch (cause) {
|
|
@@ -133,7 +168,9 @@ function AddModelKey({ onAdd, }) {
|
|
|
133
168
|
}
|
|
134
169
|
},
|
|
135
170
|
});
|
|
136
|
-
return (_jsx(SchemaForm, { model: model, layout: "columns", "aria-label": "Add model key", disabled: add.isPending, footer: _jsx(FormFooter, { divider: false, error: model.error, children: _jsx(Button, { type: "submit", children: add.isPending ? "Checking…" : "Add model key" }) })
|
|
171
|
+
return (_jsx(SchemaForm, { model: model, layout: "columns", "aria-label": "Add model key", disabled: add.isPending, footer: _jsx(FormFooter, { divider: false, error: model.error, children: _jsx(Button, { type: "submit", children: add.isPending ? "Checking…" : "Add model key" }) }), children: _jsx(model.form.Subscribe, { selector: (state) => state.values.provider, children: (provider) => (_jsx(FormFields, { model: model, names: provider === "cloudflare-workers-ai"
|
|
172
|
+
? ["provider", "label", "accountId", "apiKey"]
|
|
173
|
+
: ["provider", "label", "apiKey"], layout: "columns" })) }) }));
|
|
137
174
|
}
|
|
138
175
|
function ChooseAgentModel({ agents, keys, onChoose, }) {
|
|
139
176
|
const schema = useMemo(() => z.object({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/tourtois",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.16",
|
|
4
4
|
"author": "Levi <levi@technomancy.dev>",
|
|
5
5
|
"description": "Tourtois: the trusted desktop shell for Oyster and Fungi, with host-supplied Settings sections",
|
|
6
6
|
"type": "module",
|
|
@@ -100,13 +100,13 @@
|
|
|
100
100
|
"lucide-react": "0.460.0",
|
|
101
101
|
"react-dom": "18.3.1",
|
|
102
102
|
"zod": "4.4.3",
|
|
103
|
-
"@fungi.computer/nacre": "0.4.
|
|
103
|
+
"@fungi.computer/nacre": "0.4.5"
|
|
104
104
|
},
|
|
105
105
|
"peerDependencies": {
|
|
106
106
|
"react": "^18.3.1 || ^19.2.0"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
|
-
"@fungi.computer/oyster": "0.19.
|
|
109
|
+
"@fungi.computer/oyster": "0.19.28",
|
|
110
110
|
"@cloudflare/workers-types": "5.20260828.1",
|
|
111
111
|
"@fungi.computer/forage": "0.3.5",
|
|
112
112
|
"@fungi.computer/mycelium": "0.3.8",
|