@fungi.computer/tourtois 0.5.3 → 0.6.0

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.
@@ -1,15 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { SectionHeading } from "@fungi.computer/caps/blocks/section-heading";
3
- import { ActionRow } from "@fungi.computer/caps/components/action-row";
4
- import { Badge } from "@fungi.computer/caps/components/badge";
5
3
  import { Button } from "@fungi.computer/caps/components/button";
6
4
  import { DataList, DataListHeading, DataRow, } from "@fungi.computer/caps/components/data-list";
7
5
  import { FormFooter } from "@fungi.computer/caps/components/field";
6
+ import { KeycapButton } from "@fungi.computer/caps/components/keycap";
8
7
  import { SchemaForm, field, useSchemaForm } from "@fungi.computer/caps/form";
9
8
  import { Sigil } from "@fungi.computer/sigils";
10
9
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
11
10
  import { Fragment, useMemo, useState } from "react";
12
11
  import * as z from "zod";
12
+ import { SettingsItem } from "./settings-item.js";
13
13
  /** One connected MCP server as the host lists it; the token never comes back. */
14
14
  const agentMcpServerSchema = z.strictObject({
15
15
  serverId: z.string().min(1),
@@ -41,12 +41,12 @@ export function AgentMcpServers({ port }) {
41
41
  const agents = view.data?.agents ?? [];
42
42
  // A fresh form after each connected server, so the token field empties.
43
43
  const [formKey, setFormKey] = useState(0);
44
- return (_jsxs("section", { className: "tourtois-settings-content tourtois-connectors", "aria-label": "Connectors", children: [_jsx(SectionHeading, { children: "Connectors" }), _jsxs("p", { className: "tourtois-settings-lede", children: ["Connect a remote MCP server to an Agent. Its tools become", " ", _jsx("code", { children: "env.mcp.<name>" }), " in that Agent's code. A token stays with the Agent and is never shown again."] }), view.isPending ? _jsx("p", { children: "Loading MCP servers\u2026" }) : null, view.isError ? (_jsxs("div", { role: "status", children: [_jsx("p", { children: "MCP servers could not be loaded." }), _jsx(Button, { size: "sm", onClick: () => void view.refetch(), children: "Retry" })] })) : null, view.isSuccess && agents.length === 0 ? (_jsx("p", { children: "Create an Agent first, then connect MCP servers to it." })) : null, agents.length > 0 ? (_jsxs(_Fragment, { children: [_jsx(DataList, { "aria-label": "Agent MCP servers", children: agents.map((agent) => (_jsxs(Fragment, { children: [_jsx(DataListHeading, { children: agent.name }), agent.servers.length === 0 ? (_jsx(DataRow, { children: "No MCP servers." })) : null, agent.servers.map((server) => (_jsx(DataRow, { className: "p-0", children: _jsx(ActionRow, { icon: _jsx(Sigil, { name: "connected" }), label: _jsxs(_Fragment, { children: [server.name, " ", _jsx(Badge, { size: "sm", variant: "quiet", children: "MCP" })] }), description: server.url, trailing: _jsxs(_Fragment, { children: [server.hasBearer ? (_jsx(Badge, { size: "sm", variant: "quiet", children: "Token saved" })) : null, _jsx(Button, { size: "sm", variant: "ghost", "aria-label": `Remove ${server.name} from ${agent.name}`, disabled: remove.isPending, onClick: () => {
45
- remove.mutate({
46
- agentId: agent.agentId,
47
- serverId: server.serverId,
48
- });
49
- }, children: "Remove" })] }) }) }, server.serverId)))] }, agent.agentId))) }), remove.isError ? (_jsx("p", { role: "alert", children: "The MCP server could not be removed." })) : null, _jsx(AddMcpServer, { agents: agents, onAdd: async (agentId, draft) => {
44
+ return (_jsxs("section", { className: "tourtois-settings-content tourtois-connectors", "aria-label": "Connectors", children: [_jsx(SectionHeading, { children: "Connectors" }), _jsxs("p", { className: "tourtois-settings-lede", children: ["Connect a remote MCP server to an Agent. Its tools become", " ", _jsx("code", { children: "env.mcp.<name>" }), " in that Agent's code. A token stays with the Agent and is never shown again."] }), view.isPending ? _jsx("p", { children: "Loading MCP servers\u2026" }) : null, view.isError ? (_jsxs("div", { role: "status", className: "tourtois-settings-notice", children: [_jsx("p", { children: "MCP servers could not be loaded." }), _jsx(Button, { size: "sm", variant: "outline", onClick: () => void view.refetch(), children: "Retry" })] })) : null, view.isSuccess && agents.length === 0 ? (_jsx("p", { children: "Create an Agent first, then connect MCP servers to it." })) : null, agents.length > 0 ? (_jsxs(_Fragment, { children: [_jsx(DataList, { "aria-label": "Agent MCP servers", children: agents.map((agent) => (_jsxs(Fragment, { children: [_jsx(DataListHeading, { children: agent.name }), agent.servers.length === 0 ? (_jsx(DataRow, { className: "tourtois-settings-empty", children: "No MCP servers." })) : null, agent.servers.map((server) => (_jsx(DataRow, { children: _jsx(SettingsItem, { icon: _jsx(Sigil, { name: "connected" }), title: server.name, detail: _jsxs("p", { children: [server.url, server.hasBearer ? " · Token saved" : ""] }), actions: _jsx(KeycapButton, { density: "compact", tone: "destructive", label: "Remove", "aria-label": `Remove ${server.name} from ${agent.name}`, disabled: remove.isPending, onClick: () => {
45
+ remove.mutate({
46
+ agentId: agent.agentId,
47
+ serverId: server.serverId,
48
+ });
49
+ } }) }) }, server.serverId)))] }, agent.agentId))) }), remove.isError ? (_jsx("p", { role: "alert", children: "The MCP server could not be removed." })) : null, _jsx(AddMcpServer, { agents: agents, onAdd: async (agentId, draft) => {
50
50
  await port.add(agentId, draft);
51
51
  await refresh();
52
52
  setFormKey((current) => current + 1);
@@ -56,6 +56,7 @@ function AddMcpServer({ agents, onAdd, }) {
56
56
  const schema = useMemo(() => z.object({
57
57
  agentId: z.string().meta(field({
58
58
  label: "Agent",
59
+ icon: _jsx(Sigil, { name: "agent" }),
59
60
  kind: "select",
60
61
  options: Object.fromEntries(agents.map((agent) => [agent.agentId, agent.name])),
61
62
  })),
@@ -64,6 +65,7 @@ function AddMcpServer({ agents, onAdd, }) {
64
65
  .regex(/^[a-z][a-z0-9_]{0,31}$/u, "Lowercase letters, digits and _, starting with a letter")
65
66
  .meta(field({
66
67
  label: "Name",
68
+ icon: _jsx(Sigil, { name: "write" }),
67
69
  help: "The Agent calls its tools as env.mcp.<name>.",
68
70
  maxLength: 32,
69
71
  placeholder: "linear",
@@ -74,6 +76,7 @@ function AddMcpServer({ agents, onAdd, }) {
74
76
  .refine((value) => URL.canParse(value) && new URL(value).protocol === "https:", "Use the server's https:// address")
75
77
  .meta(field({
76
78
  label: "Server URL",
79
+ icon: _jsx(Sigil, { name: "internet" }),
77
80
  kind: "url",
78
81
  placeholder: "https://mcp.example.com/mcp",
79
82
  })),
@@ -82,8 +85,8 @@ function AddMcpServer({ agents, onAdd, }) {
82
85
  .max(4_096)
83
86
  .meta(field({
84
87
  label: "Bearer token",
85
- help: "Only if the server asks for one.",
86
- optional: true,
88
+ icon: _jsx(Sigil, { name: "restricted" }),
89
+ help: "Optional: only if the server asks for one.",
87
90
  kind: "secret",
88
91
  })),
89
92
  }), [agents]);
@@ -120,5 +123,5 @@ function AddMcpServer({ agents, onAdd, }) {
120
123
  }
121
124
  },
122
125
  });
123
- return (_jsx(SchemaForm, { model: model, "aria-label": "Add MCP server", disabled: add.isPending, footer: _jsx(FormFooter, { error: model.error, children: _jsx(Button, { type: "submit", children: add.isPending ? "Connecting…" : "Add MCP server" }) }) }));
126
+ return (_jsx(SchemaForm, { model: model, layout: "columns", "aria-label": "Add MCP server", disabled: add.isPending, footer: _jsx(FormFooter, { divider: false, error: model.error, children: _jsx(Button, { type: "submit", children: add.isPending ? "Connecting…" : "Add MCP server" }) }) }));
124
127
  }
@@ -1,14 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Card } from "@fungi.computer/caps/components/card";
3
- import { DataListHeading } from "@fungi.computer/caps/components/data-list";
4
- import { RadioGroup, RadioGroupItem, RadioGroupCard, } from "@fungi.computer/caps/components/radio-group";
3
+ import { Field, FieldSet } from "@fungi.computer/caps/components/field";
4
+ import { IconRadio, SwatchRadio, } from "@fungi.computer/caps/components/icon-radio";
5
+ import { RadioGroup } from "@fungi.computer/caps/components/radio-group";
5
6
  import { Switch } from "@fungi.computer/caps/components/switch";
6
7
  import { Input } from "@fungi.computer/caps/components/input";
7
- import { Field } from "@fungi.computer/caps/components/field";
8
8
  import { renderStyles, renderStyleLabels, renderStyleSchema, resolveAppearance, } from "@fungi.computer/sprite";
9
9
  import { avatarCharacters, avatarEnvelopeSchema, } from "@fungi.computer/sprite/avatar";
10
10
  import { avatarCatalog } from "@fungi.computer/sprite-zdog/catalog";
11
11
  import { memberAvatarSchema, deriveAgentAvatar, } from "@fungi.computer/sprite-zdog/avatar";
12
+ import { Sigil } from "@fungi.computer/sigils";
12
13
  import { AvatarPreview } from "./AvatarPreview.js";
13
14
  const names = { mushroom: "Shiitake", cat: "Cat", burger: "Burger" };
14
15
  const swatches = [
@@ -33,46 +34,54 @@ export function AvatarPicker({ value, disabled, onChange, }) {
33
34
  onChange(memberAvatarSchema.parse({ ...value, avatar: { ...avatar, ...next } }));
34
35
  };
35
36
  const primarySlot = catalog.identitySlots[0];
37
+ const colourLabel = avatar.character === "mushroom" ? "Cap colour" : "Colour";
36
38
  const selectedSwatch = swatches.find(([, primary, secondary]) => catalog.identitySlots.every((slot, index) => resolved[slot] === (index === 0 ? primary : secondary)))?.[0] ?? "";
37
- return (_jsxs("div", { className: "tourtois-avatar-picker", children: [_jsxs(Card, { className: "tourtois-avatar-preview", children: [_jsx(AvatarPreview, { avatar: avatar, className: "tourtois-avatar-large" }), _jsx("strong", { children: "Your avatar" }), _jsx("p", { children: "One look for your account, across Teams." })] }), _jsxs("fieldset", { disabled: disabled, className: "tourtois-avatar-controls", children: [_jsx("legend", { className: "sr-only", children: "Customize your avatar" }), _jsxs("section", { "aria-labelledby": "avatar-character", children: [_jsx(DataListHeading, { level: 3, id: "avatar-character", children: "Character" }), _jsx(RadioGroup, { "aria-labelledby": "avatar-character", className: "tourtois-avatar-characters", orientation: "horizontal", value: avatar.character, onValueChange: (raw) => {
38
- const character = avatarEnvelopeSchema.shape.character.parse(raw);
39
- change({ character, appearance: {}, expression: "normal" });
40
- }, children: avatarCharacters.map((character) => (_jsx(RadioGroupCard, { value: character, title: names[character], description: _jsx(AvatarPreview, { avatar: {
41
- ...avatar,
42
- character,
43
- appearance: character === avatar.character ? avatar.appearance : {},
44
- expression: "normal",
45
- }, className: "tourtois-avatar-character-preview" }) }, character))) })] }), _jsxs("section", { "aria-labelledby": "avatar-colours", children: [_jsx(DataListHeading, { level: 3, id: "avatar-colours", children: avatar.character === "mushroom" ? "Cap colour" : "Colour" }), _jsx(RadioGroup, { "aria-labelledby": "avatar-colours", className: "tourtois-avatar-swatches", orientation: "horizontal", value: selectedSwatch, onValueChange: (name) => {
46
- const swatch = swatches.find(([label]) => label === name);
47
- if (!swatch)
48
- return;
49
- change({
50
- appearance: {
51
- ...avatar.appearance,
52
- ...Object.fromEntries(catalog.identitySlots.map((slot, index) => [
53
- slot,
54
- swatch[index === 0 ? 1 : 2],
55
- ])),
56
- },
57
- });
58
- }, children: swatches.map(([name, color]) => (_jsx("label", { title: name, className: "tourtois-avatar-swatch", style: { backgroundColor: color }, children: _jsx(RadioGroupItem, { value: name, "aria-label": name }) }, name))) }), _jsx("div", { className: "tourtois-avatar-custom-colours", children: catalog.identitySlots.map((slot) => {
59
- const control = catalog.controls[slot];
60
- if (control?.type !== "color")
61
- return null;
62
- return (_jsx(Field, { label: slot === primarySlot ? "Custom colour" : "Accent colour", children: _jsx(Input, { type: "color", defaultValue: String(resolved[slot]), onBlur: (event) => {
63
- if (event.currentTarget.value !== resolved[slot])
64
- change({
65
- appearance: {
66
- ...avatar.appearance,
67
- [slot]: event.currentTarget.value,
68
- },
69
- });
70
- } }) }, `${avatar.character}:${slot}:${String(resolved[slot])}`));
71
- }) })] }), _jsxs("section", { "aria-labelledby": "avatar-expression", children: [_jsx(DataListHeading, { level: 3, id: "avatar-expression", children: "Resting face" }), _jsx(RadioGroup, { "aria-labelledby": "avatar-expression", className: "tourtois-avatar-faces", orientation: "horizontal", value: avatar.expression, onValueChange: (expression) => {
72
- change({ expression });
73
- }, children: catalog.expressions.map((expression) => (_jsx(RadioGroupCard, { value: expression, title: expression.charAt(0).toUpperCase() + expression.slice(1) }, expression))) })] }), _jsxs("section", { "aria-labelledby": "avatar-style", children: [_jsx(DataListHeading, { level: 3, id: "avatar-style", children: "Drawing style" }), _jsx(RadioGroup, { "aria-labelledby": "avatar-style", className: "tourtois-sprite-styles", orientation: "horizontal", value: avatar.renderStyle, onValueChange: (raw) => {
74
- change({ renderStyle: renderStyleSchema.parse(raw) });
75
- }, children: renderStyles.map((renderStyle) => (_jsx(RadioGroupCard, { value: renderStyle, title: renderStyleLabels[renderStyle], description: _jsx(AvatarPreview, { avatar: { ...avatar, renderStyle }, className: "tourtois-sprite-style-preview" }) }, renderStyle))) })] }), _jsxs("section", { "aria-labelledby": "avatar-agents", children: [_jsx(DataListHeading, { level: 3, id: "avatar-agents", children: "Your new Agents" }), _jsx(Field, { label: "Give each Agent its own colour", children: _jsx(Switch, { checked: agentColors === "shift", onCheckedChange: (checked) => {
76
- onChange({ ...value, agentColors: checked ? "shift" : "keep" });
77
- } }) }), _jsx("p", { className: "tourtois-settings-lede", children: "A preview of your preference for new Agents. Existing Agents keep their look." }), _jsx("div", { className: "tourtois-avatar-agents", children: exampleNames.map((name) => (_jsxs("div", { children: [_jsx(AvatarPreview, { avatar: deriveAgentAvatar(avatar, agentColors, name), className: "tourtois-avatar-agent-preview" }), _jsx("span", { children: name })] }, name))) })] })] })] }));
39
+ return (_jsxs("div", { className: "tourtois-avatar-picker", children: [_jsxs(Card, { className: "tourtois-avatar-preview", children: [_jsx(AvatarPreview, { avatar: avatar, className: "tourtois-avatar-large" }), _jsx("strong", { children: "Your avatar" }), _jsx("p", { children: "One look for your account, across Teams." })] }), _jsxs("fieldset", { disabled: disabled, className: "tourtois-avatar-controls", children: [_jsx("legend", { className: "sr-only", children: "Customize your avatar" }), _jsx(FieldSet, { legend: "Character", icon: _jsx(Sigil, { name: "agent" }), layout: "columns", children: _jsx(RadioGroup, { "aria-label": "Character", className: "caps-field-icon-choices", orientation: "horizontal", value: avatar.character, onValueChange: (raw) => {
40
+ const character = avatarEnvelopeSchema.shape.character.parse(raw);
41
+ change({ character, appearance: {}, expression: "normal" });
42
+ }, children: avatarCharacters.map((character) => (_jsx(IconRadio, { value: character, label: names[character], caption: names[character], art: "color", icon: _jsx(AvatarPreview, { avatar: {
43
+ ...avatar,
44
+ character,
45
+ appearance: character === avatar.character ? avatar.appearance : {},
46
+ expression: "normal",
47
+ }, className: "tourtois-avatar-key-art" }) }, character))) }) }), _jsx(FieldSet, { legend: colourLabel, icon: _jsx(Sigil, { name: "prints" }), layout: "columns", children: _jsx(RadioGroup, { "aria-label": colourLabel, className: "caps-field-icon-choices", orientation: "horizontal", value: selectedSwatch, onValueChange: (name) => {
48
+ const swatch = swatches.find(([label]) => label === name);
49
+ if (!swatch)
50
+ return;
51
+ change({
52
+ appearance: {
53
+ ...avatar.appearance,
54
+ ...Object.fromEntries(catalog.identitySlots.map((slot, index) => [
55
+ slot,
56
+ swatch[index === 0 ? 1 : 2],
57
+ ])),
58
+ },
59
+ });
60
+ }, children: swatches.map(([name, color]) => (_jsx(SwatchRadio, { value: name, label: name, color: color }, name))) }) }), _jsx(FieldSet, { legend: "Custom", icon: _jsx(Sigil, { name: "write" }), layout: "columns", children: _jsx("div", { className: "tourtois-avatar-custom-colours", children: catalog.identitySlots.map((slot) => {
61
+ const control = catalog.controls[slot];
62
+ if (control?.type !== "color")
63
+ return null;
64
+ const label = slot === primarySlot ? "Custom colour" : "Accent colour";
65
+ return (_jsx(Input, { type: "color", "aria-label": label, title: label, defaultValue: String(resolved[slot]), onBlur: (event) => {
66
+ if (event.currentTarget.value !== resolved[slot])
67
+ change({
68
+ appearance: {
69
+ ...avatar.appearance,
70
+ [slot]: event.currentTarget.value,
71
+ },
72
+ });
73
+ } }, `${avatar.character}:${slot}:${String(resolved[slot])}`));
74
+ }) }) }), _jsx(FieldSet, { legend: "Resting face", icon: _jsx(Sigil, { name: "chat" }), layout: "columns", children: _jsx(RadioGroup, { "aria-label": "Resting face", className: "caps-field-icon-choices", orientation: "horizontal", value: avatar.expression, onValueChange: (expression) => {
75
+ change({ expression });
76
+ }, children: catalog.expressions.map((expression) => {
77
+ const label = expression.charAt(0).toUpperCase() + expression.slice(1);
78
+ return (_jsx(IconRadio, { value: expression, label: label, caption: label, art: "color", icon: _jsx(AvatarPreview, { avatar: { ...avatar, expression }, className: "tourtois-avatar-key-art" }) }, expression));
79
+ }) }) }), _jsx(FieldSet, { legend: "Drawing style", icon: _jsx(Sigil, { name: "generateMedia" }), layout: "columns", children: _jsx(RadioGroup, { "aria-label": "Drawing style", className: "caps-field-icon-choices", orientation: "horizontal", value: avatar.renderStyle, onValueChange: (raw) => {
80
+ change({ renderStyle: renderStyleSchema.parse(raw) });
81
+ }, children: renderStyles.map((renderStyle) => (_jsx(IconRadio, { value: renderStyle, label: renderStyleLabels[renderStyle], caption: renderStyleLabels[renderStyle], art: "color", icon: _jsx(AvatarPreview, { avatar: { ...avatar, renderStyle }, className: "tourtois-avatar-key-art" }) }, renderStyle))) }) }), _jsx(FieldSet, { legend: "New Agents", icon: _jsx(Sigil, { name: "members" }), layout: "columns", description: "A preview of your preference for new Agents. Existing Agents keep their look.", children: _jsxs("div", { className: "tourtois-avatar-agents-panel", children: [_jsx(Field, { label: "Give each Agent its own colour", orientation: "inline", children: _jsx(Switch, { checked: agentColors === "shift", onCheckedChange: (checked) => {
82
+ onChange({
83
+ ...value,
84
+ agentColors: checked ? "shift" : "keep",
85
+ });
86
+ } }) }), _jsx("div", { className: "tourtois-avatar-agents", children: exampleNames.map((name) => (_jsxs("div", { children: [_jsx(AvatarPreview, { avatar: deriveAgentAvatar(avatar, agentColors, name), className: "tourtois-avatar-agent-preview" }), _jsx("span", { children: name })] }, name))) })] }) })] })] }));
78
87
  }
package/dist/Keys.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { Grant } from "@fungi.computer/ear-tag/grants";
2
2
  import type { IssueKeyInput, KeySummary, UpdateGrantsInput } from "@fungi.computer/ear-tag/keys";
3
3
  import { type ComponentType } from "react";
4
+ import { type SigilName } from "@fungi.computer/sigils";
4
5
  export type KeyAppOption = Readonly<{
5
6
  installationId: string;
6
7
  displayName: string;
@@ -13,6 +14,10 @@ export type KeyTargetOption = Readonly<{
13
14
  export type KeyGrantOption = Readonly<{
14
15
  capability: string;
15
16
  label: string;
17
+ /** The grant's Sigil on its check key; a lock when absent. */
18
+ icon?: SigilName;
19
+ /** One quiet line under the label, such as "Owner only". */
20
+ hint?: string;
16
21
  /** Omit for capabilities which have no selected-target form. */
17
22
  targets?: readonly KeyTargetOption[];
18
23
  }>;
package/dist/Keys.js CHANGED
@@ -1,15 +1,18 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { SectionHeading } from "@fungi.computer/caps/blocks/section-heading";
3
3
  import { Button } from "@fungi.computer/caps/components/button";
4
- import { Checkbox } from "@fungi.computer/caps/components/checkbox";
4
+ import { CheckKey, CheckKeys, } from "@fungi.computer/caps/components/icon-checkbox";
5
5
  import { DataList, DataRow } from "@fungi.computer/caps/components/data-list";
6
- import { Field, FormFooter } from "@fungi.computer/caps/components/field";
6
+ import { FieldSet, FormFooter } from "@fungi.computer/caps/components/field";
7
+ import { KeycapButton } from "@fungi.computer/caps/components/keycap";
7
8
  import { Input } from "@fungi.computer/caps/components/input";
8
- import { FormFields, SchemaForm, field, useSchemaForm, useSchemaFormStatus, } from "@fungi.computer/caps/form";
9
+ import { SchemaForm, field, useSchemaForm, useSchemaFormStatus, } from "@fungi.computer/caps/form";
9
10
  import { defineIdFamily } from "@fungi.computer/cairn/id";
10
11
  import { useQuery, useQueryClient } from "@tanstack/react-query";
11
12
  import { useState } from "react";
12
13
  import * as z from "zod";
14
+ import { Sigil } from "@fungi.computer/sigils";
15
+ import { SettingsItem } from "./settings-item.js";
13
16
  const mutationIds = defineIdFamily({
14
17
  family: "tourtois-keys-mutation",
15
18
  version: 1,
@@ -68,21 +71,22 @@ function KeysContent({ port, apps, }) {
68
71
  }
69
72
  };
70
73
  const labels = new Map(options.data?.map((option) => [option.capability, option.label]));
71
- return (_jsxs("section", { className: "tourtois-settings-content tourtois-keys", "aria-label": "Keys", children: [_jsx(SectionHeading, { children: "Keys" }), _jsx("p", { className: "tourtois-settings-lede", children: "Anyone holding a key can act with your current access, limited to its grants and expiry, without asking again. Read grants cannot make changes. Grants which run Workflows can also run them with your access, within the key's targets." }), view.isPending ? _jsx("p", { children: "Loading keys\u2026" }) : null, view.isError ? (_jsxs("p", { role: "alert", children: ["Keys could not be loaded.", " ", _jsx(Button, { onClick: () => void view.refetch(), children: "Retry" })] })) : null, options.isError ? (_jsxs("p", { role: "alert", children: ["Capability targets could not be loaded.", " ", _jsx(Button, { onClick: () => void options.refetch(), children: "Retry targets" })] })) : null, view.isSuccess && view.data.keys.length === 0 ? (_jsx("p", { children: "No keys yet." })) : null, _jsx(DataList, { "aria-label": "Keys", children: (view.data?.keys ?? []).map((key) => (_jsx(DataRow, { style: { gridTemplateColumns: "minmax(0, 1fr)" }, children: _jsxs("div", { className: "grid min-w-0 gap-sm", children: [_jsxs("div", { className: "grid min-w-0 gap-xs break-words", children: [_jsxs("strong", { children: [key.name, key.revokedAt !== null ? " · Revoked" : ""] }), _jsx("p", { children: key.grants.length === 0
72
- ? "Authority unavailable; revoke and issue a new key."
73
- : key.grants
74
- .map((grant) => `${labels.get(grant.capability) ?? grant.capability}: ${grant.targets.kind === "all" ? "all current and future targets" : grant.targets.ids.join(", ")}`)
75
- .join(" · ") }), _jsxs("p", { children: [key.expiresAt === null
76
- ? "Never expires"
77
- : `${key.expiresAt <= Date.now() ? "Expired" : "Expires"} ${new Date(key.expiresAt).toLocaleString()}`, " ", "\u00B7", " ", key.lastUsedAt === null
78
- ? "Use not recorded"
79
- : `Last used ${new Date(key.lastUsedAt).toLocaleString()}`] })] }), key.revokedAt === null ? (_jsxs("div", { className: "flex flex-wrap gap-sm", children: [port.updateGrants !== undefined && key.grants.length > 0 ? (_jsx(Button, { "aria-label": `Edit ${key.name}`, disabled: busy || command !== null, onClick: () => {
80
- setEditing(key);
81
- }, children: "Edit" })) : null, _jsx(Button, { "aria-label": `Revoke ${key.name}`, disabled: busy || command !== null, onClick: () => void mutate({
82
- kind: "revoke",
83
- keyId: key.keyId,
84
- requestId: mutationIds.request.generate(),
85
- }), children: "Revoke" })] })) : null] }) }, key.keyId))) }), notice ? _jsx("p", { role: "status", children: notice }) : null, error ? _jsx("p", { role: "alert", children: error }) : null, command !== null ? (_jsxs("div", { className: "flex gap-sm", children: [_jsx(Button, { disabled: busy, onClick: () => void mutate(command), children: "Retry key change" }), _jsx(Button, { disabled: busy, onClick: () => {
74
+ return (_jsxs("section", { className: "tourtois-settings-content tourtois-settings-stack tourtois-keys", "aria-label": "Keys", children: [_jsx(SectionHeading, { children: "Keys" }), _jsx("p", { className: "tourtois-settings-lede", children: "Anyone holding a key can act with your current access, limited to its grants and expiry, without asking again. Read grants cannot make changes. Grants which run Workflows can also run them with your access, within the key's targets." }), view.isPending ? _jsx("p", { children: "Loading keys\u2026" }) : null, view.isError ? (_jsxs("div", { role: "alert", className: "tourtois-settings-notice", children: [_jsx("p", { children: "Keys could not be loaded." }), _jsx(Button, { size: "sm", variant: "outline", onClick: () => void view.refetch(), children: "Retry" })] })) : null, options.isError ? (_jsxs("div", { role: "alert", className: "tourtois-settings-notice", children: [_jsx("p", { children: "Capability targets could not be loaded." }), _jsx(Button, { size: "sm", variant: "outline", onClick: () => void options.refetch(), children: "Retry targets" })] })) : null, view.isSuccess && view.data.keys.length === 0 ? (_jsx("p", { className: "tourtois-settings-empty", children: "No keys yet." })) : null, _jsx(DataList, { "aria-label": "Keys", children: (view.data?.keys ?? []).map((key) => (_jsx(DataRow, { children: _jsx(SettingsItem, { icon: _jsx(Sigil, { name: "restricted" }), title: `${key.name}${key.revokedAt !== null ? " · Revoked" : ""}`, detail: _jsxs(_Fragment, { children: [_jsx("p", { children: key.grants.length === 0
75
+ ? "Authority unavailable; revoke and issue a new key."
76
+ : key.grants
77
+ .map((grant) => `${labels.get(grant.capability) ?? grant.capability}: ${grant.targets.kind === "all" ? "all current and future targets" : grant.targets.ids.join(", ")}`)
78
+ .join(" · ") }), _jsxs("p", { children: [key.expiresAt === null
79
+ ? "Never expires"
80
+ : `${key.expiresAt <= Date.now() ? "Expired" : "Expires"} ${new Date(key.expiresAt).toLocaleString()}`, " ", "\u00B7", " ", key.lastUsedAt === null
81
+ ? "Use not recorded"
82
+ : `Last used ${new Date(key.lastUsedAt).toLocaleString()}`] })] }), actions: key.revokedAt === null ? (_jsxs(_Fragment, { children: [port.updateGrants !== undefined &&
83
+ key.grants.length > 0 ? (_jsx(KeycapButton, { density: "compact", label: "Edit", icon: _jsx(Sigil, { name: "write" }), "aria-label": `Edit ${key.name}`, disabled: busy || command !== null, onClick: () => {
84
+ setEditing(key);
85
+ } })) : null, _jsx(KeycapButton, { density: "compact", tone: "destructive", label: "Revoke", "aria-label": `Revoke ${key.name}`, disabled: busy || command !== null, onClick: () => void mutate({
86
+ kind: "revoke",
87
+ keyId: key.keyId,
88
+ requestId: mutationIds.request.generate(),
89
+ }) })] })) : undefined }) }, key.keyId))) }), notice ? _jsx("p", { role: "status", children: notice }) : null, error ? _jsx("p", { role: "alert", children: error }) : null, command !== null ? (_jsxs("div", { className: "tourtois-settings-notice", children: [_jsx(Button, { size: "sm", variant: "outline", disabled: busy, onClick: () => void mutate(command), children: "Retry key change" }), _jsx(Button, { size: "sm", variant: "outline", disabled: busy, onClick: () => {
86
90
  setCommand(null);
87
91
  setEditing(null);
88
92
  void refresh();
@@ -96,53 +100,60 @@ function KeysContent({ port, apps, }) {
96
100
  expectedGrantVersion: editing.grantVersion,
97
101
  grants,
98
102
  },
99
- }) }, editing.keyId + ":" + String(editing.grantVersion))) : null, _jsx(SectionHeading, { children: "New key" }), issued === null ? (options.data === undefined ? (_jsx("p", { children: "Loading capability targets\u2026" })) : (_jsx(IssueKey, { port: port, options: options.data, onIssue: async (draft) => {
103
+ }) }, editing.keyId + ":" + String(editing.grantVersion))) : null, _jsx(SectionHeading, { children: "New key" }), issued === null ? (options.data === undefined ? (_jsx("p", { className: "tourtois-settings-empty", children: "Loading capability targets\u2026" })) : (_jsx(IssueKey, { port: port, options: options.data, onIssue: async (draft) => {
100
104
  const result = await port.issue(draft);
101
105
  setIssued(result);
102
106
  await refresh();
103
- } }))) : (_jsxs("div", { className: "grid gap-sm", role: "status", children: [_jsx("p", { children: "Copy this key now. It is shown once and cannot be retrieved later." }), _jsx("code", { className: "break-all", children: issued.plaintext }), _jsx(Button, { onClick: () => {
104
- setIssued(null);
105
- }, children: "I copied the key" })] }))] }));
107
+ } }))) : (_jsxs("div", { className: "tourtois-settings-stack", role: "status", children: [_jsx("p", { className: "tourtois-settings-lede", children: "Copy this key now. It is shown once and cannot be retrieved later." }), _jsx("code", { className: "break-all", children: issued.plaintext }), _jsx("div", { className: "tourtois-settings-notice", children: _jsx(Button, { size: "sm", onClick: () => {
108
+ setIssued(null);
109
+ }, children: "I copied the key" }) })] }))] }));
106
110
  }
107
111
  function GrantEditor({ grants, onChange, options, disabled, }) {
108
- return (_jsxs("fieldset", { className: "grid gap-sm", disabled: disabled, children: [_jsx("legend", { children: "Capability grants" }), options.map((option) => {
112
+ return (_jsxs(FieldSet, { legend: "Grants", icon: _jsx(Sigil, { name: "restricted" }), layout: "columns", disabled: disabled, className: "tourtois-key-grants", children: [_jsx(CheckKeys, { children: options.map((option) => (_jsx(CheckKey, { name: "cap:" + option.capability, label: option.label, icon: _jsx(Sigil, { name: option.icon ?? "restricted" }), hint: option.hint, checked: grants.some((current) => current.capability === option.capability), onChange: (event) => {
113
+ onChange(event.currentTarget.checked
114
+ ? [
115
+ ...grants,
116
+ {
117
+ capability: option.capability,
118
+ targets: { kind: "all" },
119
+ },
120
+ ]
121
+ : grants.filter((current) => current.capability !== option.capability));
122
+ } }, option.capability))) }), options.map((option) => {
109
123
  const grant = grants.find((current) => current.capability === option.capability);
124
+ if (grant === undefined || option.targets === undefined)
125
+ return null;
110
126
  const replace = (targets) => {
111
127
  onChange(grants.map((current) => current.capability === option.capability
112
128
  ? { ...current, targets }
113
129
  : current));
114
130
  };
115
- return (_jsxs("div", { className: "grid gap-xs", children: [_jsx(Field, { label: option.label, orientation: "inline", children: _jsx(Checkbox, { name: "cap:" + option.capability, checked: grant !== undefined, onChange: (event) => {
116
- onChange(event.currentTarget.checked
117
- ? [
118
- ...grants,
119
- {
120
- capability: option.capability,
121
- targets: { kind: "all" },
122
- },
123
- ]
124
- : grants.filter((current) => current.capability !== option.capability));
125
- } }) }), grant !== undefined && option.targets !== undefined ? (_jsxs("div", { className: "grid gap-xs pl-md", children: [_jsx(Field, { label: "All current and future targets", orientation: "inline", children: _jsx(Checkbox, { name: "all:" + option.capability, checked: grant.targets.kind === "all", onChange: (event) => {
126
- replace(event.currentTarget.checked
127
- ? { kind: "all" }
128
- : { kind: "selected", ids: [] });
129
- } }) }), grant.targets.kind === "selected" ? (_jsxs(_Fragment, { children: [option.targets.length === 0 ? (_jsx("p", { children: "No targets available." })) : null, option.targets.map((target) => (_jsx(Field, { label: target.name, orientation: "inline", children: _jsx(Checkbox, { name: option.capability + ":" + target.id, checked: grant.targets.kind === "selected" &&
130
- grant.targets.ids.includes(target.id), onChange: (event) => {
131
- const ids = grant.targets.kind === "selected"
132
- ? grant.targets.ids
133
- : [];
134
- replace({
135
- kind: "selected",
136
- ids: event.currentTarget.checked
137
- ? [...ids, target.id]
138
- : ids.filter((id) => id !== target.id),
139
- });
140
- } }) }, target.id))), grant.targets.ids
141
- .filter((id) => !option.targets?.some((target) => target.id === id))
142
- .map((id) => (_jsxs("p", { children: ["Unavailable target: ", id] }, id)))] })) : null] })) : null] }, option.capability));
131
+ return (_jsxs("div", { role: "group", "aria-label": `${option.label} targets`, className: "tourtois-key-targets", children: [_jsx("p", { className: "tourtois-key-targets-label", children: option.label }), _jsxs(CheckKeys, { children: [_jsx(CheckKey, { name: "all:" + option.capability, label: "All targets", hint: "Current and future", checked: grant.targets.kind === "all", onChange: (event) => {
132
+ replace(event.currentTarget.checked
133
+ ? { kind: "all" }
134
+ : { kind: "selected", ids: [] });
135
+ } }), grant.targets.kind === "selected"
136
+ ? option.targets.map((target) => (_jsx(CheckKey, { name: option.capability + ":" + target.id, label: target.name, checked: grant.targets.kind === "selected" &&
137
+ grant.targets.ids.includes(target.id), onChange: (event) => {
138
+ const ids = grant.targets.kind === "selected"
139
+ ? grant.targets.ids
140
+ : [];
141
+ replace({
142
+ kind: "selected",
143
+ ids: event.currentTarget.checked
144
+ ? [...ids, target.id]
145
+ : ids.filter((id) => id !== target.id),
146
+ });
147
+ } }, target.id)))
148
+ : null] }), grant.targets.kind === "selected" &&
149
+ option.targets.length === 0 ? (_jsx("p", { className: "tourtois-settings-empty", children: "No targets available." })) : null, grant.targets.kind === "selected"
150
+ ? grant.targets.ids
151
+ .filter((id) => !option.targets?.some((target) => target.id === id))
152
+ .map((id) => (_jsxs("p", { className: "tourtois-settings-empty", children: ["Unavailable target: ", id] }, id)))
153
+ : null] }, option.capability));
143
154
  }), grants
144
155
  .filter((grant) => !options.some((option) => option.capability === grant.capability))
145
- .map((grant) => (_jsxs("div", { children: [_jsxs("p", { children: [grant.capability, " is no longer offered by this host."] }), _jsxs(Button, { type: "button", onClick: () => {
156
+ .map((grant) => (_jsxs("div", { children: [_jsxs("p", { children: [grant.capability, " is no longer offered by this host."] }), _jsxs(Button, { type: "button", size: "sm", variant: "outline", onClick: () => {
146
157
  onChange(grants.filter((current) => current !== grant));
147
158
  }, children: ["Remove ", grant.capability] })] }, grant.capability)))] }));
148
159
  }
@@ -174,7 +185,6 @@ function IssueKey({ port, options, onIssue, }) {
174
185
  } })) }));
175
186
  }
176
187
  function IssueForm({ port, grants, ready, onIssue, }) {
177
- const [custom, setCustom] = useState("");
178
188
  const expiryValues = port.expiry === "required"
179
189
  ? ["30", "90", "365", "custom"]
180
190
  : ["30", "90", "365", "custom", "never"];
@@ -191,19 +201,35 @@ function IssueForm({ port, grants, ready, onIssue, }) {
191
201
  .trim()
192
202
  .min(1, "Give this key a name.")
193
203
  .max(128)
194
- .meta(field({ label: "Name", required: true, maxLength: 128 })),
204
+ .meta(field({
205
+ label: "Name",
206
+ icon: _jsx(Sigil, { name: "write" }),
207
+ required: true,
208
+ maxLength: 128,
209
+ })),
195
210
  expiry: expiry.meta(field({
196
211
  label: "Expires after",
212
+ icon: _jsx(Sigil, { name: "schedule" }),
197
213
  options: port.expiry === "optional"
198
214
  ? { ...finiteExpiryOptions, never: "Never" }
199
215
  : finiteExpiryOptions,
200
216
  })),
217
+ // Only a custom expiry asks for its date.
218
+ customExpiry: z.string().meta(field({
219
+ label: "Custom expiry",
220
+ icon: _jsx(Sigil, { name: "schedule" }),
221
+ when: (values) => values.expiry === "custom",
222
+ render: (control) => (_jsx(Input, { type: "datetime-local", id: control.id, name: control.name, "aria-describedby": control["aria-describedby"], "aria-invalid": control["aria-invalid"], disabled: control.disabled, value: control.value, onBlur: control.onBlur, onChange: (event) => {
223
+ control.onChange(event.currentTarget.value);
224
+ } })),
225
+ })),
201
226
  });
202
227
  const model = useSchemaForm({
203
228
  schema,
204
229
  defaultValues: {
205
230
  name: "",
206
231
  expiry: port.expiry === "required" ? "30" : "never",
232
+ customExpiry: "",
207
233
  },
208
234
  onSubmit: async (value) => {
209
235
  if (!ready)
@@ -214,7 +240,7 @@ function IssueForm({ port, grants, ready, onIssue, }) {
214
240
  const expiresAt = value.expiry === "never"
215
241
  ? undefined
216
242
  : value.expiry === "custom"
217
- ? new Date(custom).getTime()
243
+ ? new Date(value.customExpiry).getTime()
218
244
  : Date.now() + Number(value.expiry) * 86_400_000;
219
245
  if (expiresAt !== undefined &&
220
246
  (!Number.isSafeInteger(expiresAt) || expiresAt <= Date.now()))
@@ -235,10 +261,8 @@ function IssueForm({ port, grants, ready, onIssue, }) {
235
261
  },
236
262
  });
237
263
  const { submitting } = useSchemaFormStatus(model);
238
- return (_jsxs(SchemaForm, { model: model, "aria-label": "Issue a key", footer: _jsx(FormFooter, { error: model.error, children: _jsx(Button, { type: "submit", disabled: !ready || submitting, children: "Issue key" }) }), children: [_jsx(FormFields, { model: model }), _jsx(Field, { label: "Custom expiry", children: _jsx(Input, { type: "datetime-local", name: "customExpiry", value: custom, disabled: submitting, onChange: (event) => {
239
- setCustom(event.currentTarget.value);
240
- } }) })] }));
264
+ return (_jsx(SchemaForm, { model: model, layout: "columns", "aria-label": "Issue a key", footer: _jsx(FormFooter, { divider: false, error: model.error, children: _jsx(Button, { type: "submit", disabled: !ready || submitting, children: "Issue key" }) }) }));
241
265
  }
242
266
  function EditKey({ record, port, options, disabled, onSave, onCancel, }) {
243
- return (_jsxs("section", { "aria-label": "Edit " + record.name, className: "grid gap-sm", children: [_jsxs(SectionHeading, { children: ["Edit ", record.name] }), _jsx(GrantDraft, { port: port, options: options, initial: record.grants, disabled: disabled, children: (grants, ready) => (_jsxs("div", { className: "flex gap-sm", children: [_jsx(Button, { disabled: disabled || !ready, onClick: () => void onSave(grants), children: "Save grants" }), _jsx(Button, { disabled: disabled, onClick: onCancel, children: "Cancel" })] })) })] }));
267
+ return (_jsxs("section", { "aria-label": "Edit " + record.name, className: "tourtois-settings-stack", children: [_jsxs(SectionHeading, { children: ["Edit ", record.name] }), _jsx(GrantDraft, { port: port, options: options, initial: record.grants, disabled: disabled, children: (grants, ready) => (_jsxs(FormFooter, { divider: false, children: [_jsx(Button, { type: "button", variant: "ghost", disabled: disabled, onClick: onCancel, children: "Cancel" }), _jsx(Button, { type: "button", disabled: disabled || !ready, onClick: () => void onSave(grants), children: "Save grants" })] })) })] }));
244
268
  }
@@ -1,4 +1,5 @@
1
1
  import { teamComputerDirectorySchema, type TeamComputer } from "@fungi.computer/nacre/workbench";
2
+ import { type ReactElement, type ReactNode } from "react";
2
3
  import * as z from "zod";
3
4
  /** One owner-fleet page returned by the public Computer controls port. */
4
5
  export type ComputerPage = z.output<typeof teamComputerDirectorySchema>;
@@ -9,6 +10,10 @@ export type OysterComputersPort = Readonly<{
9
10
  start(computerId: string): Promise<void>;
10
11
  internetAccess(computerId: string): Promise<boolean>;
11
12
  setInternetAccess(computerId: string, enabled: boolean): Promise<boolean>;
13
+ keepAwake(computerId: string): Promise<boolean>;
14
+ setKeepAwake(computerId: string, enabled: boolean): Promise<boolean>;
15
+ /** Hosts that bill a running Computer's idle time say so beside Keep awake. */
16
+ idleMetered?: true;
12
17
  /** Only hosts with a persisted default for new Apps supply selection. */
13
18
  selection?: Readonly<{
14
19
  selected(): Promise<string | null>;
@@ -17,8 +22,23 @@ export type OysterComputersPort = Readonly<{
17
22
  /** Operator policy readback, when the host exposes it. Unknown locks writes. */
18
23
  egressPolicy?(): Promise<"enabled" | "globally-disabled" | "team-disabled">;
19
24
  }>;
25
+ /** The durable per-Computer switches an owner manages. */
26
+ export type ComputerSwitchSetting = "internet-access" | "keep-awake";
20
27
  /** Bind owner-admitted fleet controls to this trusted shell's host origin. */
21
28
  export declare function createOysterComputersPort(origin: URL): OysterComputersPort;
29
+ /**
30
+ * One per-Computer setting row, the same wherever a Computer's switches show:
31
+ * a Sigil and label, help under it, and the control opposite.
32
+ */
33
+ export declare function ComputerSettingRow({ setting, description, error, children, }: {
34
+ setting: ComputerSwitchSetting;
35
+ description?: ReactNode;
36
+ error?: ReactNode;
37
+ /** The setting's Switch, or a retry key while it cannot be read. */
38
+ children: ReactElement;
39
+ }): import("react/jsx-runtime").JSX.Element;
40
+ /** Keep awake's help; hosts that bill idle time say so. */
41
+ export declare const keepAwakeHelp: (idleMetered: boolean) => string;
22
42
  /** Owner Settings over the host's existing inventory and optional default. */
23
43
  export declare function OysterComputers({ teamId, port, onChanged, }: {
24
44
  teamId: string;
@@ -1,12 +1,16 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { AppError } from "@fungi.computer/agar";
3
3
  import { optimisticMutation } from "@fungi.computer/agar/query";
4
4
  import { SectionHeading } from "@fungi.computer/caps/blocks/section-heading";
5
- import { ActionRow } from "@fungi.computer/caps/components/action-row";
6
5
  import { Button } from "@fungi.computer/caps/components/button";
7
6
  import { DataList, DataRow } from "@fungi.computer/caps/components/data-list";
8
- import { Input } from "@fungi.computer/caps/components/input";
7
+ import { Field, FormFooter } from "@fungi.computer/caps/components/field";
8
+ import { KeycapButton } from "@fungi.computer/caps/components/keycap";
9
+ import { Status } from "@fungi.computer/caps/components/status";
9
10
  import { Switch } from "@fungi.computer/caps/components/switch";
11
+ import { SchemaForm, field, useSchemaForm, } from "@fungi.computer/caps/form";
12
+ import { Sigil } from "@fungi.computer/sigils";
13
+ import { SettingsItem } from "./settings-item.js";
10
14
  import { teamComputerDirectorySchema, teamComputerSchema, } from "@fungi.computer/nacre/workbench";
11
15
  import { workbenchDirectorySchema } from "@fungi.computer/nacre/workbench-directory";
12
16
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
@@ -14,7 +18,7 @@ import { useRef, useState } from "react";
14
18
  import * as z from "zod";
15
19
  import { requestIds } from "./team-directory.js";
16
20
  import { tourtoisQueryKeys } from "./queries.js";
17
- const internetAccessSchema = z.strictObject({ enabled: z.boolean() });
21
+ const computerSwitchSchema = z.strictObject({ enabled: z.boolean() });
18
22
  async function request(url, init) {
19
23
  const response = await fetch(url, {
20
24
  ...init,
@@ -35,6 +39,18 @@ async function request(url, init) {
35
39
  /** Bind owner-admitted fleet controls to this trusted shell's host origin. */
36
40
  export function createOysterComputersPort(origin) {
37
41
  const read = (path, init) => request(new URL(path, origin), init);
42
+ const switchPath = (computerId, setting) => `/api/computers/${encodeURIComponent(computerId)}/${setting}`;
43
+ const readSwitch = async (computerId, setting) => {
44
+ const response = await read(switchPath(computerId, setting));
45
+ return computerSwitchSchema.parse(await response.json()).enabled;
46
+ };
47
+ const writeSwitch = async (computerId, setting, enabled) => {
48
+ const response = await read(switchPath(computerId, setting), {
49
+ method: "PUT",
50
+ body: JSON.stringify({ enabled }),
51
+ });
52
+ return computerSwitchSchema.parse(await response.json()).enabled;
53
+ };
38
54
  return {
39
55
  list: async (offset) => {
40
56
  const response = await read(`/api/computers?${new URLSearchParams({ limit: "100", offset: String(offset) })}`);
@@ -68,40 +84,75 @@ export function createOysterComputersPort(origin) {
68
84
  return teamComputerSchema.parse(await response.json());
69
85
  },
70
86
  },
71
- internetAccess: async (computerId) => {
72
- const response = await read(`/api/computers/${encodeURIComponent(computerId)}/internet-access`);
73
- return internetAccessSchema.parse(await response.json()).enabled;
74
- },
75
- setInternetAccess: async (computerId, enabled) => {
76
- const response = await read(`/api/computers/${encodeURIComponent(computerId)}/internet-access`, { method: "PUT", body: JSON.stringify({ enabled }) });
77
- return internetAccessSchema.parse(await response.json()).enabled;
78
- },
87
+ internetAccess: (computerId) => readSwitch(computerId, "internet-access"),
88
+ setInternetAccess: (computerId, enabled) => writeSwitch(computerId, "internet-access", enabled),
89
+ keepAwake: (computerId) => readSwitch(computerId, "keep-awake"),
90
+ setKeepAwake: (computerId, enabled) => writeSwitch(computerId, "keep-awake", enabled),
79
91
  };
80
92
  }
81
- function InternetAccess({ teamId, computer, port, policy, }) {
82
- const queryKey = tourtoisQueryKeys.oysterInternetAccess(teamId, computer.computerId);
83
- const current = useQuery({
84
- queryKey,
85
- queryFn: () => port.internetAccess(computer.computerId),
86
- });
93
+ const computerSettings = {
94
+ "internet-access": { label: "Internet access", sigil: "internet" },
95
+ "keep-awake": { label: "Keep awake", sigil: "schedule" },
96
+ };
97
+ /**
98
+ * One per-Computer setting row, the same wherever a Computer's switches show:
99
+ * a Sigil and label, help under it, and the control opposite.
100
+ */
101
+ export function ComputerSettingRow({ setting, description, error, children, }) {
102
+ const { label, sigil } = computerSettings[setting];
103
+ return (_jsx(DataRow, { children: _jsx(Field, { orientation: "horizontal", icon: _jsx(Sigil, { name: sigil }), label: label, description: description, error: error, children: children }) }));
104
+ }
105
+ /** One durable per-Computer switch: same read, save, retry and error shape. */
106
+ function ComputerSwitch({ setting, description, computer, queryKey, read, write, locked, }) {
107
+ const { label } = computerSettings[setting];
108
+ const current = useQuery({ queryKey, queryFn: read });
87
109
  const update = useMutation(optimisticMutation({
88
110
  queryKey,
89
111
  apply: (_previous, enabled) => enabled,
90
- mutationFn: (enabled) => port.setInternetAccess(computer.computerId, enabled),
112
+ mutationFn: write,
91
113
  }));
92
- return (_jsxs("div", { className: "grid gap-sm", children: [_jsxs("label", { className: "flex gap-sm", children: ["Internet access", _jsx(Switch, { "aria-label": `Internet access for ${computer.name}`, checked: current.data ?? false, disabled: policy !== "enabled" ||
93
- current.data === undefined ||
94
- update.isPending, onCheckedChange: (enabled) => {
95
- update.mutate(enabled);
96
- } })] }), current.isPending ? (_jsx("p", { role: "status", children: "Checking Internet access\u2026" })) : null, current.isError ? (_jsxs("div", { role: "alert", children: [_jsxs("p", { children: ["Could not check Internet access for ", computer.name, "."] }), _jsx(Button, { onClick: () => {
97
- void current.refetch();
98
- }, children: "Retry Internet access" })] })) : null, update.isError ? (_jsxs("p", { role: "alert", children: ["Could not save Internet access for ", computer.name, "."] })) : null, policy === "globally-disabled" ? (_jsx("p", { children: "Internet access is locked by the global off switch." })) : null, policy === "team-disabled" ? (_jsx("p", { children: "Internet access is locked for this Team." })) : null] }));
114
+ return (_jsx(ComputerSettingRow, { setting: setting, description: description, error: current.isError
115
+ ? `Could not check ${label} for ${computer.name}.`
116
+ : update.isError
117
+ ? `Could not save ${label} for ${computer.name}.`
118
+ : undefined, children: current.isError ? (_jsx(Button, { size: "sm", variant: "outline", "aria-label": `Retry ${label}`, onClick: () => {
119
+ void current.refetch();
120
+ }, children: "Retry" })) : (_jsx(Switch, { "aria-label": `${label} for ${computer.name}`, checked: current.data ?? false, disabled: locked || current.data === undefined || update.isPending, onCheckedChange: (enabled) => {
121
+ update.mutate(enabled);
122
+ } })) }));
123
+ }
124
+ const lockedReason = {
125
+ enabled: undefined,
126
+ "globally-disabled": "Internet access is locked by the global off switch.",
127
+ "team-disabled": "Internet access is locked for this Team.",
128
+ unavailable: undefined,
129
+ };
130
+ function InternetAccess({ teamId, computer, port, policy, }) {
131
+ return (_jsx(ComputerSwitch, { setting: "internet-access", description: lockedReason[policy], computer: computer, queryKey: tourtoisQueryKeys.oysterInternetAccess(teamId, computer.computerId), read: () => port.internetAccess(computer.computerId), write: (enabled) => port.setInternetAccess(computer.computerId, enabled), locked: policy !== "enabled" }));
132
+ }
133
+ function KeepAwake({ teamId, computer, port, }) {
134
+ return (_jsx(ComputerSwitch, { setting: "keep-awake", computer: computer, queryKey: tourtoisQueryKeys.oysterKeepAwake(teamId, computer.computerId), read: () => port.keepAwake(computer.computerId), write: (enabled) => port.setKeepAwake(computer.computerId, enabled), locked: false, description: keepAwakeHelp(port.idleMetered === true) }));
99
135
  }
136
+ /** Keep awake's help; hosts that bill idle time say so. */
137
+ export const keepAwakeHelp = (idleMetered) => `${idleMetered
138
+ ? "Stays on when idle, and idle time is charged."
139
+ : "Stays on when idle."} Off, it sleeps after 15 idle minutes.`;
140
+ const createComputerSchema = z.object({
141
+ name: z
142
+ .string()
143
+ .trim()
144
+ .max(256, "Use at most 256 characters.")
145
+ .meta(field({
146
+ label: "Name",
147
+ icon: _jsx(Sigil, { name: "computer" }),
148
+ placeholder: "Leave blank for a generated name",
149
+ maxLength: 256,
150
+ })),
151
+ });
100
152
  /** Owner Settings over the host's existing inventory and optional default. */
101
153
  export function OysterComputers({ teamId, port, onChanged, }) {
102
154
  const client = useQueryClient();
103
155
  const [offset, setOffset] = useState(0);
104
- const [name, setName] = useState("");
105
156
  const intent = useRef(null);
106
157
  const inventoryKey = tourtoisQueryKeys.oysterComputers(teamId);
107
158
  const selectionKey = tourtoisQueryKeys.oysterSelectedComputer(teamId);
@@ -142,7 +193,6 @@ export function OysterComputers({ teamId, port, onChanged, }) {
142
193
  onSuccess: async (_result, input) => {
143
194
  if (input.kind === "create") {
144
195
  intent.current = null;
145
- setName("");
146
196
  setOffset(0);
147
197
  }
148
198
  await Promise.all([
@@ -159,46 +209,61 @@ export function OysterComputers({ teamId, port, onChanged, }) {
159
209
  inventory.isFetching ||
160
210
  (selection !== undefined && selected.isFetching) ||
161
211
  action.isPending;
212
+ const create = useSchemaForm({
213
+ schema: createComputerSchema,
214
+ defaultValues: { name: "" },
215
+ failure: "Could not create the Computer.",
216
+ onSubmit: async ({ name }) => {
217
+ const requestedName = name === "" ? undefined : name;
218
+ // A retried create keeps its request identity until the host confirms it.
219
+ if (intent.current === null || intent.current.name !== requestedName)
220
+ intent.current = {
221
+ kind: "create",
222
+ name: requestedName,
223
+ requestId: requestIds.request.generate(),
224
+ };
225
+ try {
226
+ await action.mutateAsync(intent.current);
227
+ }
228
+ catch (cause) {
229
+ return cause instanceof Error
230
+ ? { kind: "refused", error: cause.message }
231
+ : { kind: "refused" };
232
+ }
233
+ return { kind: "saved", values: { name: "" } };
234
+ },
235
+ });
162
236
  const policyStatus = port.egressPolicy === undefined
163
237
  ? "enabled"
164
238
  : (policy.data ?? "unavailable");
165
- return (_jsxs("section", { className: "grid gap-sm", "aria-label": "Computers", children: [_jsx(SectionHeading, { children: "Computers" }), _jsx("p", { children: selection === undefined
239
+ const computers = inventory.data?.computers ?? [];
240
+ const paged = offset > 0 || inventory.data?.nextOffset != null;
241
+ return (_jsxs("section", { className: "tourtois-settings-stack", "aria-label": "Computers", children: [_jsx(SectionHeading, { children: "Computers" }), _jsx("p", { className: "tourtois-settings-lede", children: selection === undefined
166
242
  ? "Manage your Team's Computers."
167
- : "Choose the default Computer used for new App configurations." }), port.egressPolicy !== undefined && policyStatus === "unavailable" ? (_jsxs("div", { role: "alert", children: [_jsx("p", { children: "Internet access policy is unavailable; switches are locked." }), _jsx(Button, { onClick: () => void policy.refetch(), children: "Retry policy" })] })) : null, inventory.isPending ? _jsx("p", { role: "status", children: "Loading Computers\u2026" }) : null, inventory.isError || (selection !== undefined && selected.isError) ? (_jsxs("div", { role: "alert", children: [_jsx("p", { children: "Computer inventory or selection could not be loaded." }), _jsx(Button, { onClick: () => {
243
+ : "Choose the default Computer used for new App configurations." }), port.egressPolicy !== undefined && policyStatus === "unavailable" ? (_jsxs("div", { role: "alert", className: "tourtois-settings-notice", children: [_jsx("p", { children: "Internet access policy is unavailable; switches are locked." }), _jsx(Button, { size: "sm", variant: "outline", onClick: () => void policy.refetch(), children: "Retry policy" })] })) : null, inventory.isPending ? _jsx("p", { role: "status", children: "Loading Computers\u2026" }) : null, inventory.isError || (selection !== undefined && selected.isError) ? (_jsxs("div", { role: "alert", className: "tourtois-settings-notice", children: [_jsx("p", { children: "Computer inventory or selection could not be loaded." }), _jsx(Button, { size: "sm", variant: "outline", onClick: () => {
168
244
  void inventory.refetch();
169
245
  if (selection !== undefined)
170
246
  void selected.refetch();
171
- }, children: "Retry" })] })) : null, inventory.isSuccess && inventory.data.computers.length === 0 ? (_jsx("p", { children: "No Computers on this page." })) : null, inventory.data !== undefined ? (_jsx(DataList, { "aria-label": "Computer inventory", children: inventory.data.computers.map((computer) => (_jsx(DataRow, { className: "p-0", children: _jsxs("div", { className: "grid min-w-0 gap-sm", children: [_jsx(ActionRow, { label: computer.name, description: selection !== undefined &&
172
- selected.isSuccess &&
173
- selected.data === computer.computerId
174
- ? "Default for new Apps"
175
- : computer.computerId, trailing: _jsxs("div", { className: "flex flex-wrap gap-sm", children: [_jsx(Button, { "aria-label": `Start ${computer.name}`, disabled: unavailable, onClick: () => {
176
- action.mutate({
177
- kind: "start",
178
- computerId: computer.computerId,
179
- });
180
- }, children: "Start" }), selection !== undefined ? (_jsx(Button, { "aria-label": `Use ${computer.name} for new Apps`, disabled: unavailable || selected.data === computer.computerId, onClick: () => {
181
- action.mutate({
182
- kind: "select",
183
- computerId: computer.computerId,
184
- });
185
- }, children: "Use for new Apps" })) : null] }) }), _jsx(InternetAccess, { teamId: teamId, computer: computer, port: port, policy: policyStatus })] }) }, computer.computerId))) })) : null, _jsxs("div", { className: "flex gap-sm", "aria-label": "Computer pages", children: [_jsx(Button, { disabled: unavailable || offset === 0, onClick: () => {
247
+ }, children: "Retry" })] })) : null, inventory.isSuccess && computers.length === 0 ? (_jsx("p", { children: "No Computers on this page." })) : null, computers.map((computer) => {
248
+ const isDefault = selection !== undefined &&
249
+ selected.isSuccess &&
250
+ selected.data === computer.computerId;
251
+ return (_jsxs("section", { className: "tourtois-computer", "aria-label": computer.name, children: [_jsx(SettingsItem, { icon: _jsx(Sigil, { name: "computer" }), title: computer.name, actions: _jsxs(_Fragment, { children: [_jsx(KeycapButton, { density: "compact", label: "Start", icon: _jsx(Sigil, { name: "run" }), "aria-label": `Start ${computer.name}`, disabled: unavailable, onClick: () => {
252
+ action.mutate({
253
+ kind: "start",
254
+ computerId: computer.computerId,
255
+ });
256
+ } }), isDefault ? (_jsx(Status, { size: "compact", tone: "success", label: "Default for new Apps" })) : selection !== undefined ? (_jsx(KeycapButton, { density: "compact", label: "Use for new Apps", icon: _jsx(Sigil, { name: "allApps" }), "aria-label": `Use ${computer.name} for new Apps`, disabled: unavailable, onClick: () => {
257
+ action.mutate({
258
+ kind: "select",
259
+ computerId: computer.computerId,
260
+ });
261
+ } })) : null] }) }), _jsxs(DataList, { density: "compact", "aria-label": `${computer.name} settings`, children: [_jsx(InternetAccess, { teamId: teamId, computer: computer, port: port, policy: policyStatus }), _jsx(KeepAwake, { teamId: teamId, computer: computer, port: port })] })] }, computer.computerId));
262
+ }), paged ? (_jsxs("div", { className: "tourtois-settings-notice", "aria-label": "Computer pages", children: [_jsx(Button, { size: "sm", variant: "outline", disabled: unavailable || offset === 0, onClick: () => {
186
263
  setOffset(Math.max(0, offset - 100));
187
- }, children: "Previous" }), _jsx(Button, { disabled: unavailable || inventory.data?.nextOffset == null, onClick: () => {
264
+ }, children: "Previous" }), _jsx(Button, { size: "sm", variant: "outline", disabled: unavailable || inventory.data?.nextOffset == null, onClick: () => {
188
265
  const next = inventory.data?.nextOffset;
189
266
  if (next != null)
190
267
  setOffset(next);
191
- }, children: "Next" })] }), _jsxs("form", { className: "grid gap-sm", "aria-label": "Create Computer", onSubmit: (event) => {
192
- event.preventDefault();
193
- const requestedName = name === "" ? undefined : name;
194
- if (intent.current === null || intent.current.name !== requestedName)
195
- intent.current = {
196
- kind: "create",
197
- name: requestedName,
198
- requestId: requestIds.request.generate(),
199
- };
200
- action.mutate(intent.current);
201
- }, children: [_jsxs("label", { children: ["Computer name (optional)", _jsx(Input, { name: "computerName", maxLength: 256, value: name, disabled: unavailable, placeholder: "Leave blank for a generated name", onChange: (event) => {
202
- setName(event.currentTarget.value);
203
- } })] }), _jsx(Button, { type: "submit", disabled: unavailable, children: "Create Computer" })] }), action.isError ? _jsx("p", { role: "alert", children: action.error.message }) : null, action.isSuccess ? (_jsx("p", { role: "status", children: "Computer request completed." })) : null] }));
268
+ }, children: "Next" })] })) : null, _jsx(SchemaForm, { model: create, layout: "columns", "aria-label": "Create Computer", disabled: unavailable, footer: _jsx(FormFooter, { divider: false, error: create.error, children: _jsx(Button, { type: "submit", disabled: unavailable, children: "Create Computer" }) }) }), action.isError && action.variables.kind !== "create" ? (_jsx("p", { role: "alert", children: action.error.message })) : null, action.isSuccess ? (_jsx("p", { role: "status", children: "Computer request completed." })) : null] }));
204
269
  }
@@ -83,13 +83,26 @@ function createOysterKeysPort(oysterKeysWire) {
83
83
  name: app.displayName,
84
84
  }));
85
85
  return Promise.resolve([
86
- { capability: "apps.read", label: "Read Apps", targets },
86
+ {
87
+ capability: "apps.read",
88
+ label: "Read Apps",
89
+ icon: "read",
90
+ hint: "See Apps and their data",
91
+ targets,
92
+ },
87
93
  {
88
94
  capability: "apps.use",
89
95
  label: "Use Apps and run Workflows",
96
+ icon: "allApps",
97
+ hint: "Act through Apps",
90
98
  targets,
91
99
  },
92
- { capability: "computer.use", label: "Use the Computer" },
100
+ {
101
+ capability: "computer.use",
102
+ label: "Use the Computer",
103
+ icon: "computer",
104
+ hint: "Files and commands",
105
+ },
93
106
  ]);
94
107
  },
95
108
  list: async () => oysterKeysView.parse(await json("/api/keys")),
package/dist/queries.d.ts CHANGED
@@ -4,6 +4,7 @@ export declare const tourtoisQueryKeys: {
4
4
  oysterComputerPage: (teamId: string, offset: number) => readonly ["tourtois", "oyster-computers", string, number];
5
5
  oysterSelectedComputer: (teamId: string) => readonly ["tourtois", "oyster-selected-computer", string];
6
6
  oysterInternetAccess: (teamId: string, computerId: string) => readonly ["tourtois", "oyster-internet-access", string, string];
7
+ oysterKeepAwake: (teamId: string, computerId: string) => readonly ["tourtois", "oyster-keep-awake", string, string];
7
8
  oysterEgressPolicy: (teamId: string) => readonly ["tourtois", "oyster-egress-policy", string];
8
9
  hostSettings: (workspaceId: string) => readonly ["tourtois", "host-settings", string];
9
10
  workbench: () => readonly ["tourtois", "workbench"];
package/dist/queries.js CHANGED
@@ -4,6 +4,7 @@ export const tourtoisQueryKeys = {
4
4
  oysterComputerPage: (teamId, offset) => [...tourtoisQueryKeys.oysterComputers(teamId), offset],
5
5
  oysterSelectedComputer: (teamId) => ["tourtois", "oyster-selected-computer", teamId],
6
6
  oysterInternetAccess: (teamId, computerId) => ["tourtois", "oyster-internet-access", teamId, computerId],
7
+ oysterKeepAwake: (teamId, computerId) => ["tourtois", "oyster-keep-awake", teamId, computerId],
7
8
  oysterEgressPolicy: (teamId) => ["tourtois", "oyster-egress-policy", teamId],
8
9
  hostSettings: (workspaceId) => ["tourtois", "host-settings", workspaceId],
9
10
  workbench: () => ["tourtois", "workbench"],
@@ -0,0 +1,14 @@
1
+ import type { ReactNode } from "react";
2
+ /**
3
+ * One object on a settings page, the Prints details rhythm: a 16px Sigil and
4
+ * its name, quiet detail under it, and its compact keys opposite. Computers,
5
+ * keys and connected servers all use this line.
6
+ */
7
+ export declare function SettingsItem({ icon, title, detail, actions, }: {
8
+ /** A Sigil at 16px; decorative, the title names the item. */
9
+ icon: ReactNode;
10
+ title: ReactNode;
11
+ detail?: ReactNode;
12
+ /** Compact keycaps or a status dot. */
13
+ actions?: ReactNode;
14
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * One object on a settings page, the Prints details rhythm: a 16px Sigil and
4
+ * its name, quiet detail under it, and its compact keys opposite. Computers,
5
+ * keys and connected servers all use this line.
6
+ */
7
+ export function SettingsItem({ icon, title, detail, actions, }) {
8
+ return (_jsxs("div", { className: "tourtois-settings-item", children: [_jsxs("div", { className: "tourtois-settings-item-copy", children: [_jsxs("h3", { className: "tourtois-settings-item-title", children: [_jsx("span", { className: "tourtois-settings-item-icon", "aria-hidden": "true", children: icon }), _jsx("span", { className: "tourtois-settings-item-name", children: title })] }), detail ? (_jsx("div", { className: "tourtois-settings-item-detail", children: detail })) : null] }), actions ? (_jsx("div", { className: "tourtois-settings-item-keys", children: actions })) : null] }));
9
+ }
package/dist/shell.css CHANGED
@@ -168,45 +168,116 @@
168
168
  color: var(--stipe-fg-muted);
169
169
  }
170
170
 
171
- .tourtois-sprite-styles {
171
+ /* A settings page in the Prints details rhythm: heading, lede, then its
172
+ items and forms md apart. Caps owns every control's material; these rules
173
+ only place them. */
174
+ .tourtois-settings-stack {
172
175
  display: grid;
173
- grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
174
- gap: var(--spacing-sm);
176
+ align-content: start;
177
+ gap: var(--spacing-md);
178
+ min-width: 0;
179
+ /* Columns field sets outside a Caps Form stack at phone width with it. */
180
+ container-type: inline-size;
181
+ }
182
+ .tourtois-settings-stack > .tourtois-settings-lede {
175
183
  margin: 0;
176
- padding: 0;
177
- border: 0;
178
184
  }
179
-
180
- .tourtois-sprite-styles .caps-choice-card,
181
- .tourtois-avatar-characters .caps-choice-card {
185
+ .tourtois-settings-notice {
186
+ display: flex;
187
+ flex-wrap: wrap;
188
+ align-items: center;
189
+ gap: var(--spacing-xs) var(--spacing-sm);
190
+ }
191
+ .tourtois-settings-notice > p {
192
+ margin: 0;
193
+ }
194
+ .tourtois-settings-empty {
195
+ font-size: var(--text-sm);
196
+ color: var(--stipe-fg-muted);
197
+ }
198
+ /* Each Computer: its SettingsItem over its compact switch rows. */
199
+ .tourtois-computer {
182
200
  display: grid;
183
- grid-template-columns: auto minmax(0, 1fr);
184
- gap: var(--spacing-xs);
185
- padding: var(--spacing-sm);
201
+ gap: var(--spacing-2xs);
202
+ min-width: 0;
186
203
  }
187
- .tourtois-sprite-styles .caps-choice-card-copy,
188
- .tourtois-avatar-characters .caps-choice-card-copy {
189
- display: contents;
204
+
205
+ /* SettingsItem: one object's line on a settings page. */
206
+ .tourtois-settings-item {
207
+ display: flex;
208
+ flex-wrap: wrap;
209
+ align-items: center;
210
+ justify-content: space-between;
211
+ gap: var(--spacing-xs) var(--spacing-sm);
212
+ min-width: 0;
190
213
  }
191
- .tourtois-sprite-styles .caps-choice-card-description,
192
- .tourtois-avatar-characters .caps-choice-card-description {
214
+ .list-row > .tourtois-settings-item {
193
215
  grid-column: 1 / -1;
194
- grid-row: 1;
195
216
  }
196
- .tourtois-sprite-styles .caps-radio,
197
- .tourtois-avatar-characters .caps-radio {
198
- grid-column: 1;
199
- grid-row: 2;
217
+ /* A key's grants: one row of check keys, then each chosen grant's targets. */
218
+ .tourtois-key-grants > .caps-fieldset-fields {
219
+ flex-direction: column;
220
+ flex-wrap: nowrap;
200
221
  }
201
- .tourtois-sprite-styles .caps-choice-card-title,
202
- .tourtois-avatar-characters .caps-choice-card-title {
203
- grid-column: 2;
204
- grid-row: 2;
222
+ .tourtois-key-targets {
223
+ display: grid;
224
+ gap: var(--spacing-2xs);
225
+ min-width: 0;
205
226
  }
206
-
207
- .tourtois-sprite-style-preview {
227
+ .tourtois-key-targets-label {
228
+ margin: 0;
229
+ font-size: var(--text-xs);
230
+ color: var(--stipe-fg-muted);
231
+ }
232
+ .tourtois-settings-item-copy {
233
+ display: grid;
234
+ flex: 1 1 12rem;
235
+ gap: var(--spacing-2xs);
236
+ min-width: 0;
237
+ }
238
+ .tourtois-settings-item-title {
239
+ display: flex;
240
+ align-items: center;
241
+ gap: var(--spacing-xs);
242
+ min-width: 0;
243
+ margin: 0;
244
+ font-size: var(--text-base);
245
+ font-weight: 600;
246
+ }
247
+ .tourtois-settings-item-icon {
248
+ display: inline-flex;
249
+ flex: none;
250
+ width: 1rem;
251
+ height: 1rem;
252
+ }
253
+ .tourtois-settings-item-icon > svg {
208
254
  width: 100%;
209
- aspect-ratio: 1;
255
+ height: 100%;
256
+ }
257
+ .tourtois-settings-item-name {
258
+ min-width: 0;
259
+ overflow: hidden;
260
+ text-overflow: ellipsis;
261
+ white-space: nowrap;
262
+ }
263
+ /* Detail lines sit under the name, past the Sigil, in quiet small type. */
264
+ .tourtois-settings-item-detail {
265
+ display: grid;
266
+ gap: var(--spacing-2xs);
267
+ min-width: 0;
268
+ padding-inline-start: calc(1rem + var(--spacing-xs));
269
+ font-size: var(--text-xs);
270
+ color: var(--stipe-fg-muted);
271
+ overflow-wrap: anywhere;
272
+ }
273
+ .tourtois-settings-item-detail > p {
274
+ margin: 0;
275
+ }
276
+ .tourtois-settings-item-keys {
277
+ display: flex;
278
+ flex-wrap: wrap;
279
+ align-items: center;
280
+ gap: var(--spacing-xs) var(--spacing-sm);
210
281
  }
211
282
 
212
283
  .tourtois-settings-app-content:not([hidden]),
@@ -780,56 +851,44 @@
780
851
  }
781
852
  .tourtois-avatar-controls {
782
853
  display: grid;
783
- gap: var(--spacing-lg);
854
+ gap: var(--spacing-md);
784
855
  min-width: 0;
856
+ container-type: inline-size;
857
+ margin: 0;
785
858
  padding: 0;
786
859
  border: 0;
787
860
  }
788
- .tourtois-avatar-characters {
789
- display: grid;
790
- grid-template-columns: repeat(3, minmax(0, 1fr));
791
- gap: var(--spacing-sm);
792
- }
793
- .tourtois-avatar-character-preview {
794
- display: block;
795
- height: 4.5rem;
861
+ /* Sprite previews fill their icon key's art box. */
862
+ .tourtois-avatar-key-art {
796
863
  width: 100%;
797
- }
798
- .tourtois-avatar-swatches,
799
- .tourtois-avatar-faces {
800
- display: flex;
801
- flex-wrap: wrap;
802
- gap: var(--spacing-sm);
803
- }
804
- .tourtois-avatar-swatch {
805
- display: grid;
806
- place-items: center;
807
- width: 2.75rem;
808
- height: 2.75rem;
809
- border: 1px solid var(--color-base-300);
810
- border-radius: 50%;
811
- cursor: pointer;
864
+ height: 100%;
812
865
  }
813
866
  .tourtois-avatar-custom-colours {
814
- display: grid;
815
- grid-template-columns: repeat(2, minmax(0, 1fr));
816
- gap: var(--spacing-md);
817
- margin-top: var(--spacing-md);
867
+ display: flex;
868
+ gap: var(--spacing-xs);
818
869
  }
819
870
  .tourtois-avatar-custom-colours input {
820
- min-height: 2.75rem;
871
+ width: 4rem;
872
+ min-height: 2.25rem;
821
873
  padding: 0.25rem;
822
874
  }
875
+ .tourtois-avatar-agents-panel {
876
+ display: grid;
877
+ gap: var(--spacing-sm);
878
+ min-width: 0;
879
+ }
823
880
  .tourtois-avatar-agents {
824
881
  display: grid;
825
882
  grid-template-columns: repeat(5, minmax(0, 1fr));
883
+ max-width: 20rem;
826
884
  text-align: center;
827
885
  font-size: var(--text-xs);
886
+ color: var(--stipe-fg-muted);
828
887
  }
829
888
  .tourtois-avatar-agent-preview {
830
889
  display: block;
831
890
  width: 100%;
832
- height: 3rem;
891
+ height: 2.5rem;
833
892
  }
834
893
  @media (max-width: 700px) {
835
894
  .tourtois-avatar-picker {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/tourtois",
3
- "version": "0.5.3",
3
+ "version": "0.6.0",
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",
@@ -73,15 +73,15 @@
73
73
  "LICENSE"
74
74
  ],
75
75
  "dependencies": {
76
- "@fungi.computer/agar": "0.6.1",
76
+ "@fungi.computer/agar": "0.7.0",
77
77
  "@fungi.computer/cairn": "0.1.0",
78
- "@fungi.computer/caps": "0.6.0",
78
+ "@fungi.computer/caps": "0.7.0",
79
79
  "@fungi.computer/ear-tag": "0.1.0",
80
80
  "@fungi.computer/gills": "0.2.0",
81
81
  "@fungi.computer/maosaico": "0.1.0",
82
- "@fungi.computer/parakeet": "0.7.0",
83
- "@fungi.computer/puffball": "0.4.0",
84
- "@fungi.computer/shiitake": "0.9.0",
82
+ "@fungi.computer/parakeet": "0.7.1",
83
+ "@fungi.computer/puffball": "0.5.0",
84
+ "@fungi.computer/shiitake": "0.9.1",
85
85
  "@fungi.computer/sigils": "0.3.0",
86
86
  "@fungi.computer/sprite": "0.2.0",
87
87
  "@fungi.computer/sprite-zdog": "0.3.0",
@@ -96,16 +96,16 @@
96
96
  "lucide-react": "0.460.0",
97
97
  "react-dom": "18.3.1",
98
98
  "zod": "4.4.3",
99
- "@fungi.computer/nacre": "0.1.2"
99
+ "@fungi.computer/nacre": "0.1.3"
100
100
  },
101
101
  "peerDependencies": {
102
102
  "react": "^18.3.1 || ^19.2.0"
103
103
  },
104
104
  "devDependencies": {
105
- "@fungi.computer/oyster": "0.8.2",
105
+ "@fungi.computer/oyster": "0.9.0",
106
106
  "@cloudflare/workers-types": "5.20260828.1",
107
- "@fungi.computer/forage": "0.2.2",
108
- "@fungi.computer/mycelium": "0.3.2",
107
+ "@fungi.computer/forage": "0.3.0",
108
+ "@fungi.computer/mycelium": "0.3.3",
109
109
  "@ladle/react": "5.1.1",
110
110
  "@types/react": "18.3.3",
111
111
  "@vitejs/plugin-react": "6.1.1",
@@ -210,7 +210,7 @@
210
210
  },
211
211
  "smoke": {
212
212
  "status": "not-applicable",
213
- "reason": "The Bonsai standalone test:app-set and Hub browser proofs exercise the shell"
213
+ "reason": "The Oyster standalone capture:app-set review and Hub browser proofs exercise the shell"
214
214
  },
215
215
  "stranger": {
216
216
  "status": "not-applicable",
@@ -236,13 +236,13 @@
236
236
  "workbench:build": "ladle build --outDir ../../.botanical/tourtois-ladle",
237
237
  "test:overlay-layering": "node test/overlay-layering.browser.mjs",
238
238
  "test:window-new-version": "node test/window-new-version.browser.mjs",
239
- "test:workbench": "node test/workbench.browser.mjs && node test/desktop-gills.browser.mjs && node test/app-directory-isolation.browser.mjs && node test/workflows-launcher-icon.browser.mjs && node test/landing-bugs.browser.mjs && node test/desktop-under-windows.browser.mjs && node test/show-desktop.browser.mjs && node test/window-stack.browser.mjs && node test/region-layers.browser.mjs && node test/window-chrome-back.browser.mjs && node test/app-bar-menu.browser.mjs && node test/launcher-gill.browser.mjs && node test/desktop-storage.browser.mjs && node test/desktop-method-editing.browser.mjs && node test/phone-desktop.browser.mjs && node test/phone-layout.browser.mjs && node test/phone-app-switcher.browser.mjs && node test/computer-choice.browser.mjs",
239
+ "test:workbench": "node test/workbench.browser.mjs && node test/desktop-gills.browser.mjs && node test/app-directory-isolation.browser.mjs && node test/workflows-launcher-icon.browser.mjs && node test/landing-bugs.browser.mjs && node test/show-desktop.browser.mjs && node test/window-stack.browser.mjs && node test/window-chrome-back.browser.mjs && node test/app-bar-menu.browser.mjs && node test/launcher-gill.browser.mjs && node test/desktop-storage.browser.mjs && node test/desktop-method-editing.browser.mjs && node test/phone-layout.browser.mjs && node test/phone-app-switcher.browser.mjs && node test/computer-choice.browser.mjs",
240
240
  "test": "pnpm run test:unit && pnpm run test:merge",
241
241
  "test:settings-icons": "node --import tsx ../../tooling/repository/scripts/workbench-proofs.mjs --output ../../.botanical/tourtois-ladle --origin-env TOURTOIS_WORKBENCH_URL test/settings-icons.browser.mjs",
242
242
  "format:check": "node ../../tooling/repository/scripts/format-package-check.mjs",
243
243
  "lint:anti-slop": "node ../../tooling/repository/scripts/lint-package-anti-slop.mjs",
244
244
  "build:workbench": "pnpm run workbench:build",
245
- "test:nightly": "node test/permission-matrix.browser.mjs && node --import tsx ../../tooling/repository/scripts/workbench-proofs.mjs --output ../../.botanical/tourtois-ladle --origin-env TOURTOIS_WORKBENCH_URL test/member-avatar.browser.mjs test/settings-icons.browser.mjs",
245
+ "test:nightly": "node test/permission-matrix.browser.mjs && node --import tsx ../../tooling/repository/scripts/workbench-proofs.mjs --output ../../.botanical/tourtois-ladle --origin-env TOURTOIS_WORKBENCH_URL test/member-avatar.browser.mjs test/settings-icons.browser.mjs && node test/overlay-layering.browser.mjs",
246
246
  "test:unit": "vitest run",
247
247
  "test:merge": "node test/layout-backend.native.mjs && node --import tsx test/desktop-refresh.native.mjs",
248
248
  "test:app-call-permissions": "node --import tsx ../../tooling/repository/scripts/workbench-proofs.mjs --output ../../.botanical/tourtois-ladle --origin-env TOURTOIS_WORKBENCH_URL test/app-call-permissions.browser.mjs"