@fungi.computer/tourtois 0.27.2 → 0.28.1

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.
@@ -30,6 +30,8 @@ export function SettingsHome({ team, summary, sections, desktopOnly = false, onN
30
30
  category: "connectors",
31
31
  target: { kind: "list" },
32
32
  });
33
+ } }) })) : null, offers("vault") ? (_jsx(DataRow, { className: "p-0", children: _jsx(ActionRow, { "aria-label": "Vault", icon: _jsx(Sigil, { name: "restricted" }), label: "Vault", description: "Model keys and credentials, write-only.", onClick: () => {
34
+ onNavigate({ category: "vault", target: "all" });
33
35
  } }) })) : null, offers("computers") ? (_jsx(DataRow, { className: "p-0", children: _jsx(ActionRow, { "aria-label": "Computers", icon: _jsx(Sigil, { name: "internet" }), label: "Computers", description: "Each Computer\u2019s outside access.", trailing: summary.computerCount === null ? null : (_jsx(OverviewValue, { children: String(summary.computerCount) +
34
36
  (summary.computerCount === 1
35
37
  ? " Computer"
@@ -105,6 +105,11 @@ function navigationGroups(apps, sections, desktopOnly) {
105
105
  label: "Computers",
106
106
  location: { category: "computers" },
107
107
  },
108
+ {
109
+ value: "vault",
110
+ label: "Vault",
111
+ location: { category: "vault", target: "all" },
112
+ },
108
113
  {
109
114
  value: "keys",
110
115
  label: "Keys",
@@ -136,6 +141,8 @@ function navigationValue(location, apps) {
136
141
  return "computers";
137
142
  case "keys":
138
143
  return "keys";
144
+ case "vault":
145
+ return "vault";
139
146
  case "channels":
140
147
  return "channels";
141
148
  case "apps":
@@ -1,14 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { AppCallPermissions } from "./AppCallPermissions.js";
3
3
  import { SectionHeading } from "@fungi.computer/caps/blocks/section-heading";
4
- import { FormFooter } from "@fungi.computer/caps/components/field";
5
- import { Prose } from "@fungi.computer/caps/components/prose";
6
4
  import { AppDesktopSettings, } from "./AppDesktopSettings.js";
7
5
  import { addressKey, } from "@fungi.computer/nacre/app-directory";
8
6
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
9
7
  import { Connections } from "./Connections.js";
10
8
  import { Keys } from "./Keys.js";
11
- import { ModelKeys } from "./ModelKeys.js";
9
+ import { Vault } from "./Vault.js";
12
10
  import { AppIcon } from "./app-icon.js";
13
11
  import { AvatarSettings } from "./member-avatar.js";
14
12
  import { SettingsNavigation } from "./SettingsNavigation.js";
@@ -133,9 +131,9 @@ export function SystemSettings({ location: requestedLocation, sections: ceiling,
133
131
  }, onOpenChange: (next) => {
134
132
  if (!next)
135
133
  close();
136
- }, children: _jsxs(DialogContent, { finalFocus: restoreFocus, initialFocus: keysTarget === "all"
137
- ? true
138
- : () => keyContent.current?.querySelector(keysTarget === "model" ? "select" : "a") ?? true, render: _jsx(WindowFrame, { floating: true }), keepMounted: false, className: "tourtois-system-settings", children: [_jsx(DialogTitle, { className: "sr-only", children: "System Settings" }), _jsx(DialogDescription, { className: "sr-only", children: desktopOnly
134
+ }, children: _jsxs(DialogContent, { finalFocus: restoreFocus, initialFocus: keysTarget === "media"
135
+ ? () => keyContent.current?.querySelector("a") ?? true
136
+ : true, render: _jsx(WindowFrame, { floating: true }), keepMounted: false, className: "tourtois-system-settings", children: [_jsx(DialogTitle, { className: "sr-only", children: "System Settings" }), _jsx(DialogDescription, { className: "sr-only", children: desktopOnly
139
137
  ? "Your desktop and App settings."
140
138
  : "Your avatar, Channels, Connectors, App access and App settings." }), _jsx(WindowHeader, { ...headerProps }), _jsx(SettingsLeaveContext.Provider, { value: register, children: _jsxs("div", { className: "tourtois-settings-layout", children: [_jsx(SettingsNavigation, { sections: sections, desktopOnly: desktopOnly, location: location, apps: apps, onNavigate: (next) => {
141
139
  if (location?.category === "selling" && location.appId !== null)
@@ -146,11 +144,7 @@ export function SystemSettings({ location: requestedLocation, sections: ceiling,
146
144
  appCount,
147
145
  defaultAppCount: ports.summary?.defaultAppCount ?? null,
148
146
  computerCount: ports.summary?.computerCount ?? null,
149
- }, onNavigate: onNavigate })) : null, avatar && ports.avatar !== undefined ? (_jsx("div", { className: "tourtois-settings-content", children: _jsx(AvatarSettings, { save: ports.avatar.save }) })) : null, connectors && connections !== undefined ? (location.target.kind === "list" ? (_jsx(Connections, { port: connections, target: location.target, onNavigate: onNavigate })) : connections.hostSections ? (_jsx(connections.hostSections, { target: location.target, onNavigate: onNavigate })) : null) : null, location?.category === "selling" && ports.selling !== undefined ? (_jsx(ports.selling, { appId: location.appId, onNavigate: onNavigate })) : null, computersSection && ports.computers !== undefined ? (_jsx("div", { className: "tourtois-settings-content", children: _jsx(ports.computers, {}) })) : null, keysSection ? (_jsxs("div", { ref: keyContent, "aria-label": keysTarget === "model"
150
- ? "Model setup"
151
- : keysTarget === "media"
152
- ? "Image setup"
153
- : "Keys settings", className: "tourtois-settings-content tourtois-settings-stack", children: [keysTarget === "all" && keys !== undefined ? (_jsx(Keys, { port: keys, apps: keyableApps })) : null, keysTarget !== "media" && ports.modelKeys !== undefined ? (_jsx(ModelKeys, { port: ports.modelKeys, focus: keysTarget === "model" })) : null, keysTarget !== "model" && ports.modelKeys !== undefined ? (_jsxs("section", { className: "tourtois-settings-stack", "aria-label": "Image models", children: [_jsx(SectionHeading, { children: "Image models" }), _jsx("p", { className: "tourtois-settings-lede", children: "Flux images use Cloudflare Workers AI." }), _jsxs(Prose, { children: [_jsx("p", { children: "Local trials can upload images. To generate:" }), _jsxs("ol", { children: [_jsx("li", { children: "Enable Workers AI in your Cloudflare account." }), _jsx("li", { children: "Deploy this Oyster using the setup guide." }), _jsx("li", { children: "Open Prints at the deployed Oyster address." })] })] }), _jsx(FormFooter, { divider: false, children: _jsx(Button, { asChild: true, children: _jsx("a", { href: "https://docs.fungi.computer/guides/run-your-own-oyster/#image-models", target: "_blank", rel: "noreferrer", children: "Set up Cloudflare Workers AI" }) }) })] })) : null] })) : null, location?.category === "channels" &&
147
+ }, onNavigate: onNavigate })) : null, avatar && ports.avatar !== undefined ? (_jsx("div", { className: "tourtois-settings-content", children: _jsx(AvatarSettings, { save: ports.avatar.save }) })) : null, connectors && connections !== undefined ? (location.target.kind === "list" ? (_jsx(Connections, { port: connections, target: location.target, onNavigate: onNavigate })) : connections.hostSections ? (_jsx(connections.hostSections, { target: location.target, onNavigate: onNavigate })) : null) : null, location?.category === "selling" && ports.selling !== undefined ? (_jsx(ports.selling, { appId: location.appId, onNavigate: onNavigate })) : null, computersSection && ports.computers !== undefined ? (_jsx("div", { className: "tourtois-settings-content", children: _jsx(ports.computers, {}) })) : null, keysSection ? (_jsxs("div", { ref: keyContent, "aria-label": keysTarget === "media" ? "Image setup" : "Keys settings", className: "tourtois-settings-content tourtois-settings-stack", children: [keysTarget === "all" && keys !== undefined ? (_jsx(Keys, { port: keys, apps: keyableApps })) : null, ports.imageModels !== undefined ? _jsx(ports.imageModels, {}) : null] })) : null, location?.category === "vault" && ports.vault !== undefined ? (_jsx("div", { className: "tourtois-settings-content", children: _jsx(Vault, { port: ports.vault, focus: location.target === "model" }) })) : null, location?.category === "channels" &&
154
148
  ports.channels !== undefined ? (_jsx(ports.channels, {})) : null, defaults && ports.defaults !== undefined ? (_jsx("div", { className: "tourtois-settings-content", children: _jsx(ports.defaults, { onAccepted: onAccepted }) })) : null, appSection && appKey === null ? (_jsxs("section", { className: "tourtois-settings-content", "aria-label": "Choose an App", children: [_jsx(SectionHeading, { className: "tourtois-settings-app-heading", children: desktopOnly ? "App desktop" : "App permissions" }), _jsx(DataList, { density: "compact", "aria-label": "Apps to review", children: apps.map((app) => (_jsx(DataRow, { className: "p-0", children: _jsx(ActionRow, { label: app.displayName ?? app.appId, icon: _jsx(AppIcon, { roles: app.roles, icon: app.icon }), onClick: () => {
155
149
  onNavigate({
156
150
  category: "apps",
@@ -0,0 +1,341 @@
1
+ import * as z from "zod";
2
+ declare const methodSchema: z.ZodEnum<{
3
+ GET: "GET";
4
+ HEAD: "HEAD";
5
+ POST: "POST";
6
+ PUT: "PUT";
7
+ PATCH: "PATCH";
8
+ DELETE: "DELETE";
9
+ OPTIONS: "OPTIONS";
10
+ }>;
11
+ export type VaultMethod = z.output<typeof methodSchema>;
12
+ /** One site a secret is bound to: an exact host, a path and its methods. */
13
+ declare const destinationSchema: z.ZodObject<{
14
+ host: z.ZodString;
15
+ pathPrefix: z.ZodOptional<z.ZodString>;
16
+ methods: z.ZodArray<z.ZodEnum<{
17
+ GET: "GET";
18
+ HEAD: "HEAD";
19
+ POST: "POST";
20
+ PUT: "PUT";
21
+ PATCH: "PATCH";
22
+ DELETE: "DELETE";
23
+ OPTIONS: "OPTIONS";
24
+ }>>;
25
+ }, z.core.$strict>;
26
+ export type VaultDestination = z.output<typeof destinationSchema>;
27
+ /** Where the value goes on the way out. The host places it; nobody reads it. */
28
+ declare const placementSchema: z.ZodUnion<readonly [z.ZodLiteral<"bearer">, z.ZodLiteral<"basic">, z.ZodObject<{
29
+ header: z.ZodString;
30
+ }, z.core.$strict>, z.ZodObject<{
31
+ query: z.ZodString;
32
+ }, z.core.$strict>]>;
33
+ export type VaultPlacement = z.output<typeof placementSchema>;
34
+ /** Who may use a stored value: the broker's principal vocabulary. */
35
+ declare const subjectSchema: z.ZodObject<{
36
+ kind: z.ZodEnum<{
37
+ app: "app";
38
+ agent: "agent";
39
+ computer: "computer";
40
+ "team-key": "team-key";
41
+ }>;
42
+ id: z.ZodString;
43
+ }, z.core.$strict>;
44
+ export type VaultSubject = z.output<typeof subjectSchema>;
45
+ /** One stored credential as the owner lists it. No value, ever. */
46
+ declare const credentialSchema: z.ZodObject<{
47
+ connectionId: z.ZodString;
48
+ name: z.ZodString;
49
+ label: z.ZodString;
50
+ kind: z.ZodEnum<{
51
+ mcp: "mcp";
52
+ openapi: "openapi";
53
+ secret: "secret";
54
+ }>;
55
+ origin: z.ZodString;
56
+ destinations: z.ZodNullable<z.ZodArray<z.ZodObject<{
57
+ host: z.ZodString;
58
+ pathPrefix: z.ZodOptional<z.ZodString>;
59
+ methods: z.ZodArray<z.ZodEnum<{
60
+ GET: "GET";
61
+ HEAD: "HEAD";
62
+ POST: "POST";
63
+ PUT: "PUT";
64
+ PATCH: "PATCH";
65
+ DELETE: "DELETE";
66
+ OPTIONS: "OPTIONS";
67
+ }>>;
68
+ }, z.core.$strict>>>;
69
+ credential: z.ZodEnum<{
70
+ none: "none";
71
+ value: "value";
72
+ "sign-in": "sign-in";
73
+ }>;
74
+ placement: z.ZodNullable<z.ZodUnion<readonly [z.ZodLiteral<"bearer">, z.ZodLiteral<"basic">, z.ZodObject<{
75
+ header: z.ZodString;
76
+ }, z.core.$strict>, z.ZodObject<{
77
+ query: z.ZodString;
78
+ }, z.core.$strict>]>>;
79
+ state: z.ZodEnum<{
80
+ pending: "pending";
81
+ active: "active";
82
+ reconnect_required: "reconnect_required";
83
+ }>;
84
+ version: z.ZodNumber;
85
+ subjects: z.ZodArray<z.ZodObject<{
86
+ kind: z.ZodEnum<{
87
+ app: "app";
88
+ agent: "agent";
89
+ computer: "computer";
90
+ "team-key": "team-key";
91
+ }>;
92
+ id: z.ZodString;
93
+ }, z.core.$strict>>;
94
+ }, z.core.$strict>;
95
+ export type VaultCredential = z.output<typeof credentialSchema>;
96
+ /** One stored model key as the owner lists it. The key never comes back. */
97
+ declare const modelKeySchema: z.ZodObject<{
98
+ keyId: z.ZodString;
99
+ provider: z.ZodString;
100
+ label: z.ZodString;
101
+ scope: z.ZodEnum<{
102
+ team: "team";
103
+ user: "user";
104
+ }>;
105
+ createdAt: z.ZodNumber;
106
+ baseUrl: z.ZodNullable<z.ZodString>;
107
+ }, z.core.$strict>;
108
+ export type VaultModelKey = z.output<typeof modelKeySchema>;
109
+ /**
110
+ * Everything one owner holds, as the page shows it: model keys and
111
+ * Connection credentials together, what the viewer may manage, and the
112
+ * Agents and Computers a secret can be scoped to. No value appears.
113
+ */
114
+ export declare const vaultViewSchema: z.ZodObject<{
115
+ role: z.ZodObject<{
116
+ manageTeam: z.ZodBoolean;
117
+ managePersonal: z.ZodBoolean;
118
+ }, z.core.$strict>;
119
+ coverage: z.ZodDiscriminatedUnion<[z.ZodObject<{
120
+ state: z.ZodLiteral<"complete">;
121
+ }, z.core.$strict>, z.ZodObject<{
122
+ state: z.ZodLiteral<"incomplete">;
123
+ missing: z.ZodArray<z.ZodObject<{
124
+ kind: z.ZodEnum<{
125
+ connection: "connection";
126
+ "model-key": "model-key";
127
+ }>;
128
+ id: z.ZodString;
129
+ }, z.core.$strict>>;
130
+ }, z.core.$strict>], "state">;
131
+ providers: z.ZodArray<z.ZodObject<{
132
+ id: z.ZodString;
133
+ label: z.ZodString;
134
+ accountId: z.ZodBoolean;
135
+ baseUrl: z.ZodBoolean;
136
+ }, z.core.$strict>>;
137
+ scopes: z.ZodArray<z.ZodEnum<{
138
+ team: "team";
139
+ user: "user";
140
+ }>>;
141
+ modelKeys: z.ZodArray<z.ZodObject<{
142
+ keyId: z.ZodString;
143
+ provider: z.ZodString;
144
+ label: z.ZodString;
145
+ scope: z.ZodEnum<{
146
+ team: "team";
147
+ user: "user";
148
+ }>;
149
+ createdAt: z.ZodNumber;
150
+ baseUrl: z.ZodNullable<z.ZodString>;
151
+ }, z.core.$strict>>;
152
+ credentials: z.ZodArray<z.ZodObject<{
153
+ connectionId: z.ZodString;
154
+ name: z.ZodString;
155
+ label: z.ZodString;
156
+ kind: z.ZodEnum<{
157
+ mcp: "mcp";
158
+ openapi: "openapi";
159
+ secret: "secret";
160
+ }>;
161
+ origin: z.ZodString;
162
+ destinations: z.ZodNullable<z.ZodArray<z.ZodObject<{
163
+ host: z.ZodString;
164
+ pathPrefix: z.ZodOptional<z.ZodString>;
165
+ methods: z.ZodArray<z.ZodEnum<{
166
+ GET: "GET";
167
+ HEAD: "HEAD";
168
+ POST: "POST";
169
+ PUT: "PUT";
170
+ PATCH: "PATCH";
171
+ DELETE: "DELETE";
172
+ OPTIONS: "OPTIONS";
173
+ }>>;
174
+ }, z.core.$strict>>>;
175
+ credential: z.ZodEnum<{
176
+ none: "none";
177
+ value: "value";
178
+ "sign-in": "sign-in";
179
+ }>;
180
+ placement: z.ZodNullable<z.ZodUnion<readonly [z.ZodLiteral<"bearer">, z.ZodLiteral<"basic">, z.ZodObject<{
181
+ header: z.ZodString;
182
+ }, z.core.$strict>, z.ZodObject<{
183
+ query: z.ZodString;
184
+ }, z.core.$strict>]>>;
185
+ state: z.ZodEnum<{
186
+ pending: "pending";
187
+ active: "active";
188
+ reconnect_required: "reconnect_required";
189
+ }>;
190
+ version: z.ZodNumber;
191
+ subjects: z.ZodArray<z.ZodObject<{
192
+ kind: z.ZodEnum<{
193
+ app: "app";
194
+ agent: "agent";
195
+ computer: "computer";
196
+ "team-key": "team-key";
197
+ }>;
198
+ id: z.ZodString;
199
+ }, z.core.$strict>>;
200
+ }, z.core.$strict>>;
201
+ subjects: z.ZodObject<{
202
+ agents: z.ZodArray<z.ZodObject<{
203
+ id: z.ZodString;
204
+ name: z.ZodString;
205
+ }, z.core.$strict>>;
206
+ computers: z.ZodArray<z.ZodObject<{
207
+ id: z.ZodString;
208
+ name: z.ZodString;
209
+ }, z.core.$strict>>;
210
+ }, z.core.$strict>;
211
+ }, z.core.$strict>;
212
+ export type VaultView = z.output<typeof vaultViewSchema>;
213
+ /** One audited use: who, where and how it went. Never the value or path. */
214
+ export type VaultUse = Readonly<{
215
+ subject: VaultSubject | null;
216
+ /** The bound host the request went to; null for a model call. */
217
+ host: string | null;
218
+ method: string | null;
219
+ outcome: "placed" | "refused_destination" | "refused_grant" | "upstream_status" | "failed";
220
+ status: number | null;
221
+ count: number;
222
+ lastAt: number;
223
+ }>;
224
+ /** A new secret: its name, the sites it is bound to and its value. */
225
+ export type VaultSecretDraft = Readonly<{
226
+ name: string;
227
+ label?: string;
228
+ destinations: readonly VaultDestination[];
229
+ placement: VaultPlacement;
230
+ secret: string;
231
+ }>;
232
+ /** A write-only change to a stored credential. */
233
+ export type VaultCredentialChange = Readonly<{
234
+ expectedVersion: number;
235
+ label?: string;
236
+ destinations?: readonly VaultDestination[];
237
+ secret?: string;
238
+ }>;
239
+ /** What the owner submits to store one model key. */
240
+ export type VaultModelKeyDraft = Readonly<{
241
+ provider: string;
242
+ scope: "user" | "team";
243
+ label: string;
244
+ apiKey: string;
245
+ /** Only for a provider that asks for one. */
246
+ accountId: string | undefined;
247
+ /** Only for a provider that runs on the owner's own server. */
248
+ baseUrl: string | undefined;
249
+ }>;
250
+ /** Every Agent with its persisted model choice, and the models each key offers. */
251
+ export declare const agentModelsViewSchema: z.ZodObject<{
252
+ models: z.ZodEnum<{
253
+ ready: "ready";
254
+ unknown: "unknown";
255
+ missing: "missing";
256
+ }>;
257
+ catalogs: z.ZodRecord<z.ZodString & z.core.$partial, z.ZodArray<z.ZodObject<{
258
+ id: z.ZodString;
259
+ name: z.ZodString;
260
+ input: z.ZodNumber;
261
+ output: z.ZodNumber;
262
+ tools: z.ZodBoolean;
263
+ }, z.core.$strict>>>;
264
+ agents: z.ZodArray<z.ZodObject<{
265
+ agentId: z.ZodString;
266
+ name: z.ZodString;
267
+ choice: z.ZodNullable<z.ZodObject<{
268
+ keySource: z.ZodEnum<{
269
+ "workers-ai": "workers-ai";
270
+ "ai-gateway": "ai-gateway";
271
+ byok: "byok";
272
+ }>;
273
+ keyId: z.ZodOptional<z.ZodString>;
274
+ model: z.ZodObject<{
275
+ providerId: z.ZodString;
276
+ modelId: z.ZodString;
277
+ reasoning: z.ZodOptional<z.ZodString>;
278
+ }, z.core.$strict>;
279
+ }, z.core.$strict>>;
280
+ }, z.core.$strict>>;
281
+ }, z.core.$strict>;
282
+ export type AgentModelsView = z.output<typeof agentModelsViewSchema>;
283
+ /** The Agent's next model: the instance default, or a stored key's provider. */
284
+ export type AgentModelChoiceDraft = Readonly<{
285
+ keyId: null;
286
+ }> | Readonly<{
287
+ keyId: string;
288
+ provider: string;
289
+ modelId: string;
290
+ }>;
291
+ /**
292
+ * The host's owner door for everything it holds in custody. Values travel in
293
+ * on these calls and never come back out. Methods a host lacks are absent and
294
+ * the page offers no control for them; the server still decides each call.
295
+ */
296
+ export type VaultPort = Readonly<{
297
+ read(): Promise<VaultView>;
298
+ addSecret(draft: VaultSecretDraft): Promise<void>;
299
+ updateCredential(connectionId: string, change: VaultCredentialChange): Promise<void>;
300
+ /** A secret is revoked whole; a Connection only loses its value. */
301
+ revokeCredential(connectionId: string, expectedVersion: number): Promise<void>;
302
+ grant(connectionId: string, subject: VaultSubject): Promise<void>;
303
+ ungrant(connectionId: string, subject: VaultSubject): Promise<void>;
304
+ credentialUsage(connectionId: string): Promise<readonly VaultUse[]>;
305
+ modelKeys: Readonly<{
306
+ add(draft: VaultModelKeyDraft): Promise<void>;
307
+ remove(keyId: string): Promise<void>;
308
+ /** Replace a key's value in place; its Agent choices stay. */
309
+ rotate?(keyId: string, apiKey: string): Promise<void>;
310
+ usage?(keyId: string): Promise<readonly VaultUse[]>;
311
+ }>;
312
+ /** Which model each Agent runs on, where this host lets the page choose. */
313
+ agentModels?: Readonly<{
314
+ read(): Promise<AgentModelsView>;
315
+ choose(agentId: string, draft: AgentModelChoiceDraft): Promise<void>;
316
+ }>;
317
+ }>;
318
+ /** What the Vault is, in the one sentence pair every host opens it with. */
319
+ export declare const vaultLede = "Every key and credential your Agents use, in one place. A value goes in once and is never shown again, to you or to an Agent.";
320
+ /**
321
+ * A host's refusal, already a sentence the owner can act on. Anything else a
322
+ * port throws is shown as the page's own fallback, never as host detail.
323
+ */
324
+ export declare class VaultRefusal extends Error {
325
+ constructor(sentence: string, options?: ErrorOptions);
326
+ }
327
+ /**
328
+ * Vault: every key and credential this owner holds, in one place. Add one,
329
+ * replace its value, choose where and by whom it may be used, revoke it and
330
+ * see each use. A value goes in once and is never shown again.
331
+ */
332
+ export declare function Vault({ port, focus, toasterId, heading, }: {
333
+ port: VaultPort;
334
+ /** Open on the model-key form, as a setup step that needs a model does. */
335
+ focus?: boolean;
336
+ /** The toaster this page's notices go to. */
337
+ toasterId?: string;
338
+ /** False where the host's own page header already names the Vault. */
339
+ heading?: boolean;
340
+ }): import("react/jsx-runtime").JSX.Element;
341
+ export {};