zidane-ui 9.3.1 → 9.4.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.
- package/dist/adapters/live.d.ts +2 -0
- package/dist/adapters/live.js +3 -0
- package/dist/adapters/server-git-host.js +5 -2
- package/dist/adapters/server-host.js +17 -11
- package/dist/adapters/server-machines-host.js +7 -0
- package/dist/adapters/server-session-host.js +49 -0
- package/dist/adapters/server-settings-sections.js +4 -1
- package/dist/adapters/sse-host.js +3 -0
- package/dist/adapters/sse-protocol.d.ts +10 -0
- package/dist/appearance/ZoomIndicator.js +5 -8
- package/dist/chat/HostTranscript.js +15 -1
- package/dist/chat/SessionStreamsProvider.d.ts +1 -1
- package/dist/chat/Transcript.d.ts +3 -2
- package/dist/chat/Transcript.js +26 -7
- package/dist/chat/composer/ComposerEditor.js +1 -1
- package/dist/chat/composer/ModelOptionsPicker.js +6 -2
- package/dist/chat/composer/ModelPicker.d.ts +1 -1
- package/dist/chat/composer/PlacePicker.d.ts +3 -1
- package/dist/chat/composer/PlacePicker.js +5 -1
- package/dist/chat/composer/use-draft-target.js +15 -3
- package/dist/chat/headless/block-runs.js +26 -1
- package/dist/chat/headless/chip-views.js +1 -1
- package/dist/chat/headless/draft-target.d.ts +28 -1
- package/dist/chat/headless/draft-target.js +22 -1
- package/dist/chat/headless/hosts.d.ts +4 -0
- package/dist/chat/headless/index.d.ts +25 -25
- package/dist/chat/headless/index.js +6 -6
- package/dist/chat/headless/markdown-scan.d.ts +0 -2
- package/dist/chat/headless/markdown-scan.js +3 -8
- package/dist/chat/headless/markdown-stream.js +3 -3
- package/dist/chat/headless/prompt-origin.d.ts +2 -0
- package/dist/chat/headless/prompt-origin.js +6 -2
- package/dist/chat/headless/sidebar/directory.d.ts +10 -1
- package/dist/chat/headless/sidebar/directory.js +9 -1
- package/dist/chat/headless/sidebar/environment.d.ts +15 -4
- package/dist/chat/headless/sidebar/environment.js +27 -9
- package/dist/chat/headless/sidebar/index.d.ts +2 -2
- package/dist/chat/headless/sidebar/index.js +2 -2
- package/dist/chat/headless/sidebar/labels.d.ts +9 -2
- package/dist/chat/headless/sidebar/labels.js +8 -1
- package/dist/chat/headless/streams/actions.d.ts +2 -2
- package/dist/chat/headless/streams/actions.js +1 -1
- package/dist/chat/headless/streams/event-bytes.d.ts +12 -1
- package/dist/chat/headless/streams/event-bytes.js +13 -1
- package/dist/chat/headless/streams/store.d.ts +21 -5
- package/dist/chat/headless/streams/store.js +36 -7
- package/dist/chat/headless/streams/transcript-map.js +2 -5
- package/dist/chat/headless/streams/types.d.ts +2 -1
- package/dist/chat/headless/transcript/collapse.js +3 -0
- package/dist/chat/index.d.ts +2 -2
- package/dist/chat/index.js +2 -2
- package/dist/chat/sidebar/ProjectIcon.js +1 -1
- package/dist/chat/sidebar/RowChips.js +2 -2
- package/dist/chat/sidebar/SessionSidebar.d.ts +6 -0
- package/dist/chat/sidebar/SessionSidebar.js +23 -16
- package/dist/chat/sidebar/SidebarFilterMenu.js +0 -1
- package/dist/chat/sidebar/SidebarFold.js +17 -16
- package/dist/chat/sidebar/SidebarSessionRow.d.ts +7 -1
- package/dist/chat/sidebar/SidebarSessionRow.js +11 -8
- package/dist/chat/sidebar/session-menu.d.ts +4 -0
- package/dist/chat/sidebar/session-menu.js +14 -2
- package/dist/chat/sidebar/sidebar-live.js +28 -4
- package/dist/chat/sidebar/useInboxRows.js +6 -6
- package/dist/chat/sidebar/useInboxTriage.js +50 -47
- package/dist/chat/sidebar/useSessionSearch.js +19 -18
- package/dist/chat/transcript/FileChip.js +28 -0
- package/dist/chat/transcript/LazyRow.d.ts +1 -1
- package/dist/chat/transcript/LazyRow.js +3 -4
- package/dist/chat/transcript/PromptEcho.js +3 -11
- package/dist/chat/transcript/SessionChip.d.ts +11 -0
- package/dist/chat/transcript/SessionChip.js +34 -0
- package/dist/chat/transcript/TranscriptRail.d.ts +1 -1
- package/dist/chat/transcript/chip-details.d.ts +11 -0
- package/dist/chat/transcript/chip-details.js +17 -1
- package/dist/chat/transcript/fold-worker.js +2 -1
- package/dist/chat/transcript/fold.js +11 -3
- package/dist/chat/transcript/index.d.ts +2 -2
- package/dist/chat/transcript/index.js +2 -2
- package/dist/chat/transcript/markdown-cache.d.ts +10 -1
- package/dist/chat/transcript/markdown-cache.js +37 -4
- package/dist/chat/transcript/markdown.js +27 -34
- package/dist/chat/transcript/media-gallery.js +13 -16
- package/dist/chat/transcript/messages.js +5 -4
- package/dist/chat/transcript/prompt.d.ts +1 -1
- package/dist/chat/transcript/row-mount.d.ts +27 -8
- package/dist/chat/transcript/row-mount.js +114 -80
- package/dist/chat/transcript/row-parking.d.ts +27 -0
- package/dist/chat/transcript/row-parking.js +37 -1
- package/dist/chat/transcript/script-input.d.ts +1 -1
- package/dist/chat/transcript/tool-parts.js +0 -1
- package/dist/chat/transcript/use-transcript-rows.d.ts +1 -1
- package/dist/chat/transcript/useHistoryBackfill.d.ts +42 -0
- package/dist/chat/transcript/useHistoryBackfill.js +170 -0
- package/dist/chat/transcript/useTranscriptFind.js +2 -4
- package/dist/chat/transcript/useTranscriptScroll.d.ts +7 -4
- package/dist/chat/transcript/useTranscriptScroll.js +12 -1
- package/dist/chat/transcript/useTranscriptSearch.d.ts +2 -2
- package/dist/chat/transcript/useTranscriptSearch.js +6 -6
- package/dist/chat/transcript/useTranscriptSelectionCopy.d.ts +5 -5
- package/dist/chat/transcript/useTranscriptSelectionCopy.js +28 -7
- package/dist/code/editor/FileTree.d.ts +2 -0
- package/dist/code/editor/FileTree.js +1 -1
- package/dist/code/editor/FileView.js +16 -25
- package/dist/code/editor/find/useFind.js +17 -17
- package/dist/code/editor/useCodeDocument.js +22 -19
- package/dist/code/editor/useDetachCleanup.js +4 -3
- package/dist/code/use-highlighted-html.js +12 -13
- package/dist/components/IconButton.d.ts +3 -1
- package/dist/components/IconButton.js +7 -2
- package/dist/components/IconButtonTip.d.ts +3 -1
- package/dist/components/IconButtonTip.js +2 -1
- package/dist/components/RowActionsMenu.js +7 -14
- package/dist/components/Tooltip.d.ts +4 -1
- package/dist/components/Tooltip.js +8 -6
- package/dist/components/assign-ref.d.ts +8 -0
- package/dist/components/assign-ref.js +12 -0
- package/dist/components/floating/FloatingSurface.js +2 -2
- package/dist/components/floating/HoverCard.js +32 -14
- package/dist/components/floating/Popover.js +4 -7
- package/dist/components/floating/useAnchoredPosition.d.ts +5 -3
- package/dist/components/floating/useAnchoredPosition.js +7 -7
- package/dist/components/object-key.d.ts +7 -0
- package/dist/components/object-key.js +18 -0
- package/dist/components/palette/PaletteList.js +2 -7
- package/dist/components/tooltip-arming.d.ts +3 -0
- package/dist/components/tooltip-arming.js +8 -1
- package/dist/core.css +3 -3
- package/dist/dist/{index-C6-t1SS9.d.ts → index-BheVJOLc.d.ts} +1 -0
- package/dist/dist/index.d.ts +2 -2
- package/dist/files/FilesTab.js +0 -1
- package/dist/files/TreeColumn.d.ts +2 -4
- package/dist/files/TreeColumn.js +0 -5
- package/dist/files/headless/host.d.ts +3 -7
- package/dist/files/headless/labels.d.ts +0 -1
- package/dist/files/headless/labels.js +0 -1
- package/dist/files/headless/workspace-diff.js +1 -1
- package/dist/files/useCodeReview.js +1 -3
- package/dist/files/useFilesDiagnostics.d.ts +1 -1
- package/dist/files/useFilesDiagnostics.js +4 -11
- package/dist/files/useOpenFiles.js +9 -12
- package/dist/files/useWorkspace.d.ts +5 -7
- package/dist/files/useWorkspace.js +4 -15
- package/dist/git/GitBar.js +5 -3
- package/dist/git/MoveSessionDialog.d.ts +18 -8
- package/dist/git/MoveSessionDialog.js +32 -53
- package/dist/git/MoveToDialog.d.ts +61 -0
- package/dist/git/MoveToDialog.js +240 -0
- package/dist/git/SandboxManager.js +9 -4
- package/dist/git/SyncChip.js +11 -4
- package/dist/git/TeleportSessionDialog.d.ts +69 -0
- package/dist/git/TeleportSessionDialog.js +440 -0
- package/dist/git/headless/host.d.ts +14 -0
- package/dist/git/headless/index.d.ts +2 -1
- package/dist/git/headless/index.js +2 -1
- package/dist/git/headless/labels.d.ts +44 -1
- package/dist/git/headless/labels.js +50 -0
- package/dist/git/headless/sandboxes.d.ts +1 -1
- package/dist/git/headless/sandboxes.js +4 -3
- package/dist/git/headless/teleport.d.ts +76 -0
- package/dist/git/headless/teleport.js +19 -0
- package/dist/git/index.d.ts +4 -2
- package/dist/git/index.js +4 -2
- package/dist/git/useEnvironmentChoices.d.ts +5 -2
- package/dist/git/useEnvironmentChoices.js +12 -4
- package/dist/hooks/useLatest.d.ts +8 -0
- package/dist/hooks/useLatest.js +17 -0
- package/dist/hooks/useMinuteTick.d.ts +6 -2
- package/dist/hooks/useMinuteTick.js +12 -6
- package/dist/hooks/useNearViewport.js +11 -8
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/dist/keybindings/KeybindingsProvider.js +3 -4
- package/dist/keybindings/headless/catalog.d.ts +1 -1
- package/dist/keybindings/headless/catalog.js +18 -0
- package/dist/machines/AddServerForm.js +55 -3
- package/dist/machines/Banners.d.ts +2 -2
- package/dist/machines/Banners.js +3 -3
- package/dist/machines/DaemonMenu.js +1 -3
- package/dist/machines/HostsSection.js +5 -1
- package/dist/machines/OrganizationPanel.d.ts +25 -0
- package/dist/machines/OrganizationPanel.js +266 -0
- package/dist/machines/PersonalLayerPanel.d.ts +32 -0
- package/dist/machines/PersonalLayerPanel.js +360 -0
- package/dist/machines/headless/fixture-host.d.ts +10 -0
- package/dist/machines/headless/fixture-host.js +44 -0
- package/dist/machines/headless/host.d.ts +21 -1
- package/dist/machines/headless/index.d.ts +3 -1
- package/dist/machines/headless/index.js +3 -1
- package/dist/machines/headless/labels.d.ts +55 -0
- package/dist/machines/headless/labels.js +58 -1
- package/dist/machines/headless/layer.d.ts +64 -0
- package/dist/machines/headless/layer.js +56 -0
- package/dist/machines/headless/organization.d.ts +38 -0
- package/dist/machines/headless/organization.js +44 -0
- package/dist/machines/index.d.ts +3 -1
- package/dist/machines/index.js +3 -1
- package/dist/machines/testing/contract.d.ts +25 -1
- package/dist/machines/testing/contract.js +97 -1
- package/dist/motion/grow.js +12 -13
- package/dist/motion/swap.js +2 -5
- package/dist/motion/use-flip-list.d.ts +14 -0
- package/dist/motion/use-flip-list.js +17 -12
- package/dist/palette/headless/app-sources.js +37 -0
- package/dist/palette/headless/labels.js +3 -0
- package/dist/server/sse-handler.js +25 -2
- package/dist/session/DiffFileTree.js +1 -4
- package/dist/session/OpenSessionsDialog.d.ts +46 -0
- package/dist/session/OpenSessionsDialog.js +170 -0
- package/dist/session/PlanTracker.js +1 -2
- package/dist/session/ProjectHome.js +10 -9
- package/dist/session/RemindersPanel.js +10 -12
- package/dist/session/SecretsPanel.js +2 -1
- package/dist/session/SessionPeopleStack.d.ts +23 -0
- package/dist/session/SessionPeopleStack.js +65 -0
- package/dist/session/SessionPlaceMenu.js +5 -4
- package/dist/session/ShareSessionDialog.d.ts +32 -0
- package/dist/session/ShareSessionDialog.js +342 -0
- package/dist/session/TypingLine.d.ts +22 -0
- package/dist/session/TypingLine.js +31 -0
- package/dist/session/headless/host.d.ts +40 -1
- package/dist/session/headless/index.d.ts +4 -2
- package/dist/session/headless/index.js +3 -1
- package/dist/session/headless/labels.d.ts +49 -0
- package/dist/session/headless/labels.js +56 -0
- package/dist/session/headless/people.d.ts +29 -0
- package/dist/session/headless/people.js +53 -0
- package/dist/session/headless/place.d.ts +5 -0
- package/dist/session/headless/place.js +5 -1
- package/dist/session/headless/typing.d.ts +37 -0
- package/dist/session/headless/typing.js +60 -0
- package/dist/session/index.d.ts +5 -1
- package/dist/session/index.js +5 -1
- package/dist/settings/headless/search.d.ts +1 -1
- package/dist/settings/headless/sections-host.d.ts +7 -2
- package/dist/settings/section.d.ts +15 -3
- package/dist/settings/section.js +15 -3
- package/dist/settings/sections/environments/EnvironmentsSection.js +30 -6
- package/dist/settings/sections/keybindings/labels.d.ts +3 -0
- package/dist/settings/sections/keybindings/labels.js +3 -0
- package/dist/settings/sections/keybindings/rows.js +12 -0
- package/dist/settings/sections/logs/LogsSection.js +5 -8
- package/dist/styles.css +32 -7
- package/dist/terminal/HostTerminalSurface.js +28 -30
- package/dist/terminal/TerminalPanel.js +4 -12
- package/dist/terminal/TerminalProvider.d.ts +10 -2
- package/dist/terminal/TerminalProvider.js +10 -2
- package/dist/terminal/headless/labels.d.ts +0 -1
- package/dist/terminal/headless/labels.js +1 -2
- package/dist/terminal/headless/store.js +5 -1
- package/dist/workspace/LayoutBudget.js +1 -7
- package/package.json +2 -2
- package/src/styles/chat.css +3 -1
- package/src/styles/palette.css +3 -3
- package/src/styles/transcript.css +17 -3
- /package/dist/dist/{index-De9AbmxS.d.ts → index-ttmMvjgM.d.ts} +0 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { BTN_PRIMARY, BTN_SECONDARY } from "../components/button.js";
|
|
2
2
|
import { ErrorNote, FIELD_LABEL_CLASS, FORM_CARD_CLASS, INPUT_CLASS, OpLine } from "../components/Form.js";
|
|
3
|
+
import { RoutedLink } from "../extensions/links.js";
|
|
3
4
|
import { machinesError } from "./headless/host.js";
|
|
4
5
|
import { hostCheckMessage, hostCheckOkLine } from "./headless/messages.js";
|
|
5
6
|
import { useMachinesHost, useMachinesLabels } from "./MachinesProvider.js";
|
|
6
7
|
import { HOST_TOKEN_MAX, HOST_URL_MAX, escapeCancels } from "./ServerCard.js";
|
|
7
|
-
import { useState } from "react";
|
|
8
|
+
import { useEffect, useRef, useState } from "react";
|
|
8
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
10
|
// src/machines/AddServerForm.tsx
|
|
10
11
|
/**
|
|
@@ -14,7 +15,12 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
14
15
|
*/
|
|
15
16
|
function AddServerForm({ onCancel, onAdded, idPrefix = "host", className = "", style }) {
|
|
16
17
|
const labels = useMachinesLabels();
|
|
17
|
-
const { addHost, testHost } = useMachinesHost();
|
|
18
|
+
const { addHost, testHost, signInToServer, serverSignsIn } = useMachinesHost();
|
|
19
|
+
const [code, setCode] = useState(null);
|
|
20
|
+
/** The URL a probe found signing its users in with Google: the button shows for it only. */
|
|
21
|
+
const [signsIn, setSignsIn] = useState(null);
|
|
22
|
+
const signingIn = useRef(null);
|
|
23
|
+
useEffect(() => () => signingIn.current?.abort(), []);
|
|
18
24
|
const [url, setUrl] = useState("");
|
|
19
25
|
const [token, setToken] = useState("");
|
|
20
26
|
const [name, setName] = useState("");
|
|
@@ -49,6 +55,26 @@ function AddServerForm({ onCancel, onAdded, idPrefix = "host", className = "", s
|
|
|
49
55
|
}
|
|
50
56
|
await onAdded(result);
|
|
51
57
|
};
|
|
58
|
+
const signInWithGoogle = async () => {
|
|
59
|
+
if (!signInToServer) return;
|
|
60
|
+
setBusy(labels.machinesSigningIn);
|
|
61
|
+
setTested(null);
|
|
62
|
+
const abort = new AbortController();
|
|
63
|
+
signingIn.current = abort;
|
|
64
|
+
const result = await signInToServer({
|
|
65
|
+
url,
|
|
66
|
+
...name.trim() ? { name } : {}
|
|
67
|
+
}, setCode, abort.signal).catch(refused);
|
|
68
|
+
signingIn.current = null;
|
|
69
|
+
setBusy(null);
|
|
70
|
+
setCode(null);
|
|
71
|
+
if (abort.signal.aborted) return;
|
|
72
|
+
if (!result.ok) {
|
|
73
|
+
setTested(result);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
await onAdded(result);
|
|
77
|
+
};
|
|
52
78
|
return /* @__PURE__ */ jsxs("form", {
|
|
53
79
|
className: `${FORM_CARD_CLASS} ${className}`.trimEnd(),
|
|
54
80
|
style,
|
|
@@ -74,6 +100,10 @@ function AddServerForm({ onCancel, onAdded, idPrefix = "host", className = "", s
|
|
|
74
100
|
onChange: (event) => {
|
|
75
101
|
setUrl(event.target.value);
|
|
76
102
|
setTested(null);
|
|
103
|
+
},
|
|
104
|
+
onBlur: () => {
|
|
105
|
+
const asked = url.trim();
|
|
106
|
+
if (serverSignsIn && asked) serverSignsIn(asked).then((yes) => setSignsIn(yes ? asked : null), () => setSignsIn(null));
|
|
77
107
|
}
|
|
78
108
|
})] }),
|
|
79
109
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
@@ -108,6 +138,18 @@ function AddServerForm({ onCancel, onAdded, idPrefix = "host", className = "", s
|
|
|
108
138
|
kind: "busy",
|
|
109
139
|
children: busy
|
|
110
140
|
}),
|
|
141
|
+
code && /* @__PURE__ */ jsxs(OpLine, {
|
|
142
|
+
kind: "notice",
|
|
143
|
+
children: [
|
|
144
|
+
labels.machinesSignInCode(code.userCode),
|
|
145
|
+
" ",
|
|
146
|
+
/* @__PURE__ */ jsx(RoutedLink, {
|
|
147
|
+
href: code.verificationUrl,
|
|
148
|
+
source: "auth",
|
|
149
|
+
children: code.verificationUrl
|
|
150
|
+
})
|
|
151
|
+
]
|
|
152
|
+
}),
|
|
111
153
|
tested && !busy && (tested.ok ? /* @__PURE__ */ jsx(OpLine, {
|
|
112
154
|
kind: "notice",
|
|
113
155
|
children: hostCheckOkLine(tested, labels)
|
|
@@ -118,9 +160,19 @@ function AddServerForm({ onCancel, onAdded, idPrefix = "host", className = "", s
|
|
|
118
160
|
/* @__PURE__ */ jsx("button", {
|
|
119
161
|
type: "button",
|
|
120
162
|
className: BTN_SECONDARY,
|
|
121
|
-
onClick:
|
|
163
|
+
onClick: () => {
|
|
164
|
+
signingIn.current?.abort();
|
|
165
|
+
onCancel();
|
|
166
|
+
},
|
|
122
167
|
children: labels.machinesCancel
|
|
123
168
|
}),
|
|
169
|
+
signInToServer && (!serverSignsIn || signsIn === url.trim()) && /* @__PURE__ */ jsx("button", {
|
|
170
|
+
type: "button",
|
|
171
|
+
className: "zg-press inline-flex items-center justify-center gap-1.5 shrink-0 whitespace-nowrap rounded-zg-md cursor-pointer transition-colors disabled:opacity-zg-disabled disabled:cursor-default zg-focus-ring h-7 px-2.5 text-zg-label zg-raised border text-[var(--zg-text-muted)] hover:text-[var(--zg-text)]",
|
|
172
|
+
onClick: () => void signInWithGoogle(),
|
|
173
|
+
disabled: busy !== null || !url.trim(),
|
|
174
|
+
children: labels.machinesSignInGoogle
|
|
175
|
+
}),
|
|
124
176
|
testHost && /* @__PURE__ */ jsx("button", {
|
|
125
177
|
type: "button",
|
|
126
178
|
className: "zg-press inline-flex items-center justify-center gap-1.5 shrink-0 whitespace-nowrap rounded-zg-md cursor-pointer transition-colors disabled:opacity-zg-disabled disabled:cursor-default zg-focus-ring h-7 px-2.5 text-zg-label zg-raised border text-[var(--zg-text-muted)] hover:text-[var(--zg-text)]",
|
|
@@ -69,8 +69,8 @@ export interface DraftPlaceNoticeProps {
|
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
71
|
* The new chat's place, when it cannot be what the default says: the default names a server this device has not
|
|
72
|
-
* saved (Add it), a machine that left the server, a folder that is gone,
|
|
73
|
-
* computer instead). Nothing when all is well.
|
|
72
|
+
* saved (Add it), a machine that left the server, a folder that is gone, an isolation the folder can't run (the
|
|
73
|
+
* chat starts in the host's default), or its server is offline (use this computer instead). Nothing when all is well.
|
|
74
74
|
*
|
|
75
75
|
* @param props - The issue, the offline server, the actions and `className`.
|
|
76
76
|
*/
|
package/dist/machines/Banners.js
CHANGED
|
@@ -74,14 +74,14 @@ function ComposerNotice({ text, tone, detail, onDismiss, testId, className = "",
|
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
76
|
* The new chat's place, when it cannot be what the default says: the default names a server this device has not
|
|
77
|
-
* saved (Add it), a machine that left the server, a folder that is gone,
|
|
78
|
-
* computer instead). Nothing when all is well.
|
|
77
|
+
* saved (Add it), a machine that left the server, a folder that is gone, an isolation the folder can't run (the
|
|
78
|
+
* chat starts in the host's default), or its server is offline (use this computer instead). Nothing when all is well.
|
|
79
79
|
*
|
|
80
80
|
* @param props - The issue, the offline server, the actions and `className`.
|
|
81
81
|
*/
|
|
82
82
|
function DraftPlaceNotice({ issue, offlineServer, onUseThisComputer, onAddServer, onDismiss, className = "" }) {
|
|
83
83
|
const labels = useMachinesLabels();
|
|
84
|
-
const text = offlineServer ? labels.machinesDraftServerOffline(offlineServer) : issue?.kind === "unsaved" ? labels.machinesPlaceUnsaved(issue.hostName) : issue?.kind === "machine-gone" ? labels.machinesPlaceMachineGone(issue.machine, issue.hostName) : issue?.kind === "folder-gone" ? labels.machinesPlaceFolderGone(issue.folder) : null;
|
|
84
|
+
const text = offlineServer ? labels.machinesDraftServerOffline(offlineServer) : issue?.kind === "unsaved" ? labels.machinesPlaceUnsaved(issue.hostName) : issue?.kind === "machine-gone" ? labels.machinesPlaceMachineGone(issue.machine, issue.hostName) : issue?.kind === "folder-gone" ? labels.machinesPlaceFolderGone(issue.folder) : issue?.kind === "unavailable" ? labels.machinesPlaceUnavailable(issue.label, issue.reason, issue.fallback) : null;
|
|
85
85
|
if (!text) return null;
|
|
86
86
|
const action = offlineServer ? onUseThisComputer && /* @__PURE__ */ jsx("button", {
|
|
87
87
|
type: "button",
|
|
@@ -73,9 +73,7 @@ function DaemonMenuBody({ daemon, running: runningCount = 0, attention = 0, sess
|
|
|
73
73
|
const [busy, setBusy] = useState(false);
|
|
74
74
|
const wrapperRef = useRef(null);
|
|
75
75
|
const menuRef = useRef(null);
|
|
76
|
-
const refresh = useCallback(
|
|
77
|
-
setStatus(await daemon.status());
|
|
78
|
-
}, [daemon]);
|
|
76
|
+
const refresh = useCallback(() => daemon.status().then(setStatus), [daemon]);
|
|
79
77
|
useEffect(() => {
|
|
80
78
|
if (!open) return void 0;
|
|
81
79
|
refresh();
|
|
@@ -12,6 +12,8 @@ import { CapabilitiesView, CapabilityTags, useHostCapabilities } from "./HostCap
|
|
|
12
12
|
import { HostIcon } from "./HostIcon.js";
|
|
13
13
|
import { HostSyncPanel, useHostSync } from "./HostSyncPanel.js";
|
|
14
14
|
import { useMachinesConfirm, useMachinesHost, useMachinesLabels } from "./MachinesProvider.js";
|
|
15
|
+
import { OrganizationPanel } from "./OrganizationPanel.js";
|
|
16
|
+
import { PersonalLayerPanel } from "./PersonalLayerPanel.js";
|
|
15
17
|
import { ServerAddedCard } from "./ServerAddedCard.js";
|
|
16
18
|
import { ServerCard } from "./ServerCard.js";
|
|
17
19
|
import { ServerMachinesPanel } from "./ServerMachinesPanel.js";
|
|
@@ -305,7 +307,9 @@ function ServerDetail({ host, saved, onChanged, confirm, now, className = "", st
|
|
|
305
307
|
host,
|
|
306
308
|
confirm: ask,
|
|
307
309
|
...timed
|
|
308
|
-
})
|
|
310
|
+
}),
|
|
311
|
+
machinesHost.organization && /* @__PURE__ */ jsx(OrganizationPanel, { host }),
|
|
312
|
+
machinesHost.layer && /* @__PURE__ */ jsx(PersonalLayerPanel, { host })
|
|
309
313
|
]
|
|
310
314
|
});
|
|
311
315
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A server's People section (docs/IDENTITY.md): what organization mode is when the server does not sign its users in,
|
|
3
|
+
* with the command that turns it on; once it does, who you are there and whether people can share sessions. An admin
|
|
4
|
+
* also manages the people: Add person, then per person Make admin or Make user, Disable or Enable, and Remove (their
|
|
5
|
+
* sessions come to the admin, their tokens stop at once). Disable and Remove ask first.
|
|
6
|
+
*
|
|
7
|
+
* Needs the host's `organization`; nothing while the server is not connected.
|
|
8
|
+
*/
|
|
9
|
+
import { HostSummary } from "./headless/host.js";
|
|
10
|
+
import { CSSProperties } from "react";
|
|
11
|
+
/** Props for {@link OrganizationPanel}. */
|
|
12
|
+
export interface OrganizationPanelProps {
|
|
13
|
+
/** The server. */
|
|
14
|
+
host: HostSummary;
|
|
15
|
+
/** Extra classes on the root. */
|
|
16
|
+
className?: string;
|
|
17
|
+
/** Inline styles on the root. */
|
|
18
|
+
style?: CSSProperties;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Renders the server's People section, or nothing without the host's `organization` or a connection.
|
|
22
|
+
*
|
|
23
|
+
* @param props - The {@link OrganizationPanelProps}.
|
|
24
|
+
*/
|
|
25
|
+
export declare function OrganizationPanel(props: OrganizationPanelProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { BTN_PRIMARY, BTN_SECONDARY, buttonClass } from "../components/button.js";
|
|
2
|
+
import { CopyValue } from "../components/CopyValue.js";
|
|
3
|
+
import { Checkbox, ErrorNote, FormSection, INPUT_CLASS, MetaChip, RowText } from "../components/Form.js";
|
|
4
|
+
import { RowMenuButton } from "../components/RowMenuButton.js";
|
|
5
|
+
import { machinesError } from "./headless/host.js";
|
|
6
|
+
import { HostIcon } from "./HostIcon.js";
|
|
7
|
+
import { useMachinesConfirm, useMachinesHost, useMachinesLabels } from "./MachinesProvider.js";
|
|
8
|
+
import { useCallback, useEffect, useState } from "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
// src/machines/OrganizationPanel.tsx
|
|
11
|
+
/** The command that starts a server in organization mode. */
|
|
12
|
+
const TURN_ON = "zidane server --organization";
|
|
13
|
+
/**
|
|
14
|
+
* Renders the server's People section, or nothing without the host's `organization` or a connection.
|
|
15
|
+
*
|
|
16
|
+
* @param props - The {@link OrganizationPanelProps}.
|
|
17
|
+
*/
|
|
18
|
+
function OrganizationPanel(props) {
|
|
19
|
+
const organization = useMachinesHost().organization;
|
|
20
|
+
if (!organization || props.host.status !== "connected") return null;
|
|
21
|
+
return /* @__PURE__ */ jsx(PeopleBody, {
|
|
22
|
+
...props,
|
|
23
|
+
organization
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function PeopleBody({ host, organization, className = "", style }) {
|
|
27
|
+
const labels = useMachinesLabels();
|
|
28
|
+
const ask = useMachinesConfirm();
|
|
29
|
+
const [status, setStatus] = useState(null);
|
|
30
|
+
const [people, setPeople] = useState([]);
|
|
31
|
+
const [error, setError] = useState(null);
|
|
32
|
+
const [note, setNote] = useState(null);
|
|
33
|
+
const [adding, setAdding] = useState(false);
|
|
34
|
+
const [busy, setBusy] = useState(false);
|
|
35
|
+
const read = useCallback(async () => {
|
|
36
|
+
try {
|
|
37
|
+
const next = await organization.status(host.id);
|
|
38
|
+
setStatus(next);
|
|
39
|
+
setPeople(next.mode === "on" && next.role === "admin" ? await organization.users(host.id) : []);
|
|
40
|
+
} catch (err) {
|
|
41
|
+
setError(labels.machinesError(machinesError("people", err)));
|
|
42
|
+
}
|
|
43
|
+
}, [
|
|
44
|
+
organization,
|
|
45
|
+
host.id,
|
|
46
|
+
labels
|
|
47
|
+
]);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
read();
|
|
50
|
+
}, [read]);
|
|
51
|
+
const act = async (action) => {
|
|
52
|
+
setBusy(true);
|
|
53
|
+
setError(null);
|
|
54
|
+
setNote(null);
|
|
55
|
+
try {
|
|
56
|
+
const said = await action();
|
|
57
|
+
if (said) setNote(said);
|
|
58
|
+
} catch (err) {
|
|
59
|
+
setError(labels.machinesError(machinesError("people", err)));
|
|
60
|
+
} finally {
|
|
61
|
+
setBusy(false);
|
|
62
|
+
read();
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
if (!status) return error ? /* @__PURE__ */ jsx(ErrorNote, {
|
|
66
|
+
className,
|
|
67
|
+
style,
|
|
68
|
+
children: error
|
|
69
|
+
}) : null;
|
|
70
|
+
if (status.mode === "off") return /* @__PURE__ */ jsx(FormSection, {
|
|
71
|
+
title: labels.machinesPeopleTitle,
|
|
72
|
+
className,
|
|
73
|
+
style,
|
|
74
|
+
"data-testid": `people-${host.id}`,
|
|
75
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
76
|
+
className: "px-3 py-2 space-y-2",
|
|
77
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
78
|
+
className: "m-0 text-xs text-[var(--zg-text-muted)]",
|
|
79
|
+
children: labels.machinesPeopleOff
|
|
80
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
81
|
+
className: "flex items-center gap-2 text-xs text-[var(--zg-text-muted)]",
|
|
82
|
+
children: [/* @__PURE__ */ jsx("span", { children: labels.machinesPeopleTurnOn }), /* @__PURE__ */ jsx(CopyValue, {
|
|
83
|
+
text: TURN_ON,
|
|
84
|
+
label: TURN_ON,
|
|
85
|
+
copiedLabel: labels.machinesCopiedText(TURN_ON)
|
|
86
|
+
})]
|
|
87
|
+
})]
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
const admin = status.role === "admin";
|
|
91
|
+
const items = (person) => [
|
|
92
|
+
person.role === "admin" ? {
|
|
93
|
+
id: "user",
|
|
94
|
+
label: labels.machinesPeopleMakeUser,
|
|
95
|
+
icon: "i-ph-user",
|
|
96
|
+
onSelect: () => void act(() => organization.setRole(host.id, person.userId, "user"))
|
|
97
|
+
} : {
|
|
98
|
+
id: "admin",
|
|
99
|
+
label: labels.machinesPeopleMakeAdmin,
|
|
100
|
+
icon: "i-ph-shield-check",
|
|
101
|
+
onSelect: () => void act(() => organization.setRole(host.id, person.userId, "admin"))
|
|
102
|
+
},
|
|
103
|
+
person.disabled ? {
|
|
104
|
+
id: "enable",
|
|
105
|
+
label: labels.machinesPeopleEnable,
|
|
106
|
+
icon: "i-ph-play",
|
|
107
|
+
onSelect: () => void act(() => organization.setDisabled(host.id, person.userId, false))
|
|
108
|
+
} : {
|
|
109
|
+
id: "disable",
|
|
110
|
+
label: labels.machinesPeopleDisable,
|
|
111
|
+
icon: "i-ph-prohibit",
|
|
112
|
+
onSelect: () => void ask({
|
|
113
|
+
title: labels.machinesPeopleDisableTitle(person.email),
|
|
114
|
+
message: labels.machinesPeopleDisableMessage,
|
|
115
|
+
confirmLabel: labels.machinesPeopleDisable,
|
|
116
|
+
destructive: true
|
|
117
|
+
}).then((ok) => {
|
|
118
|
+
if (ok) act(() => organization.setDisabled(host.id, person.userId, true));
|
|
119
|
+
})
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: "remove",
|
|
123
|
+
label: labels.machinesRemove,
|
|
124
|
+
icon: "i-ph-trash",
|
|
125
|
+
destructive: true,
|
|
126
|
+
onSelect: () => void ask({
|
|
127
|
+
title: labels.machinesPeopleRemoveTitle(person.email),
|
|
128
|
+
message: labels.machinesPeopleRemoveMessage,
|
|
129
|
+
confirmLabel: labels.machinesRemove,
|
|
130
|
+
destructive: true
|
|
131
|
+
}).then((ok) => {
|
|
132
|
+
if (ok) act(async () => labels.machinesPeopleRemoved(await organization.removeUser(host.id, person.userId)));
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
];
|
|
136
|
+
return /* @__PURE__ */ jsxs(FormSection, {
|
|
137
|
+
title: labels.machinesPeopleTitle,
|
|
138
|
+
className,
|
|
139
|
+
style,
|
|
140
|
+
"data-testid": `people-${host.id}`,
|
|
141
|
+
...admin && !adding ? { trailing: /* @__PURE__ */ jsx("button", {
|
|
142
|
+
type: "button",
|
|
143
|
+
className: BTN_SECONDARY,
|
|
144
|
+
onClick: () => setAdding(true),
|
|
145
|
+
children: labels.machinesPeopleAdd
|
|
146
|
+
}) } : {},
|
|
147
|
+
children: [
|
|
148
|
+
/* @__PURE__ */ jsxs("div", {
|
|
149
|
+
className: "px-3 py-2 space-y-0.5 text-xs text-[var(--zg-text-muted)]",
|
|
150
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
151
|
+
className: "m-0",
|
|
152
|
+
children: labels.machinesPeopleYou(status.email, status.role)
|
|
153
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
154
|
+
className: "m-0",
|
|
155
|
+
"data-testid": "people-sharing",
|
|
156
|
+
children: status.sharing ? labels.machinesPeopleSharingOn : labels.machinesPeopleSharingOff
|
|
157
|
+
})]
|
|
158
|
+
}),
|
|
159
|
+
adding && /* @__PURE__ */ jsx(AddPerson, {
|
|
160
|
+
busy,
|
|
161
|
+
onCancel: () => setAdding(false),
|
|
162
|
+
onAdd: (input) => void act(async () => {
|
|
163
|
+
await organization.addUser(host.id, input);
|
|
164
|
+
setAdding(false);
|
|
165
|
+
})
|
|
166
|
+
}),
|
|
167
|
+
admin && /* @__PURE__ */ jsx("div", {
|
|
168
|
+
role: "list",
|
|
169
|
+
"aria-label": labels.machinesPeopleTitle,
|
|
170
|
+
className: "contents",
|
|
171
|
+
children: people.map((person) => /* @__PURE__ */ jsxs("div", {
|
|
172
|
+
role: "listitem",
|
|
173
|
+
className: "flex items-center gap-3 px-3 py-2",
|
|
174
|
+
"data-testid": `person-${person.email}`,
|
|
175
|
+
children: [
|
|
176
|
+
/* @__PURE__ */ jsx(HostIcon, { icon: person.role === "admin" ? "i-ph-shield-check" : "i-ph-user" }),
|
|
177
|
+
/* @__PURE__ */ jsx(RowText, { label: person.name ? `${person.name} (${person.email})` : person.email }),
|
|
178
|
+
/* @__PURE__ */ jsxs("span", {
|
|
179
|
+
className: "flex items-center gap-1 shrink-0",
|
|
180
|
+
children: [
|
|
181
|
+
person.role === "admin" && /* @__PURE__ */ jsx(MetaChip, { children: labels.machinesPeopleAdmin }),
|
|
182
|
+
person.disabled && /* @__PURE__ */ jsx(MetaChip, {
|
|
183
|
+
tone: "warn",
|
|
184
|
+
children: labels.machinesPeopleDisabled
|
|
185
|
+
}),
|
|
186
|
+
person.email === status.email && /* @__PURE__ */ jsx(MetaChip, { children: labels.machinesPeopleYouChip })
|
|
187
|
+
]
|
|
188
|
+
}),
|
|
189
|
+
person.email !== status.email && /* @__PURE__ */ jsx(RowMenuButton, {
|
|
190
|
+
label: labels.machinesPeopleRowActions(person.email),
|
|
191
|
+
items: items(person)
|
|
192
|
+
})
|
|
193
|
+
]
|
|
194
|
+
}, person.userId))
|
|
195
|
+
}),
|
|
196
|
+
note && /* @__PURE__ */ jsx("p", {
|
|
197
|
+
role: "status",
|
|
198
|
+
className: "m-0 px-3 pb-2 text-xs text-[var(--zg-text-muted)]",
|
|
199
|
+
children: note
|
|
200
|
+
}),
|
|
201
|
+
error && /* @__PURE__ */ jsx(ErrorNote, {
|
|
202
|
+
className: "mx-3",
|
|
203
|
+
children: error
|
|
204
|
+
})
|
|
205
|
+
]
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
/** Add person: an email, and whether they are an admin. */
|
|
209
|
+
function AddPerson({ busy, onAdd, onCancel }) {
|
|
210
|
+
const labels = useMachinesLabels();
|
|
211
|
+
const [email, setEmail] = useState("");
|
|
212
|
+
const [admin, setAdmin] = useState(false);
|
|
213
|
+
return /* @__PURE__ */ jsxs("form", {
|
|
214
|
+
className: "px-3 py-2 space-y-2",
|
|
215
|
+
onSubmit: (event) => {
|
|
216
|
+
event.preventDefault();
|
|
217
|
+
if (email.trim()) onAdd({
|
|
218
|
+
email: email.trim(),
|
|
219
|
+
role: admin ? "admin" : "user"
|
|
220
|
+
});
|
|
221
|
+
},
|
|
222
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
223
|
+
"aria-label": labels.machinesPeopleEmail,
|
|
224
|
+
placeholder: labels.machinesPeopleEmail,
|
|
225
|
+
type: "email",
|
|
226
|
+
autoComplete: "off",
|
|
227
|
+
autoFocus: true,
|
|
228
|
+
className: `${INPUT_CLASS} w-full`,
|
|
229
|
+
value: email,
|
|
230
|
+
onChange: (event) => setEmail(event.target.value),
|
|
231
|
+
onKeyDown: (event) => {
|
|
232
|
+
if (event.key === "Escape") {
|
|
233
|
+
event.stopPropagation();
|
|
234
|
+
onCancel();
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
238
|
+
className: "flex items-center justify-between gap-2",
|
|
239
|
+
children: [/* @__PURE__ */ jsxs("button", {
|
|
240
|
+
type: "button",
|
|
241
|
+
role: "checkbox",
|
|
242
|
+
"aria-checked": admin,
|
|
243
|
+
onClick: () => setAdmin((on) => !on),
|
|
244
|
+
className: "flex items-center gap-2 bg-transparent border-0 p-0 text-xs text-[var(--zg-text)] cursor-pointer",
|
|
245
|
+
children: [/* @__PURE__ */ jsx(Checkbox, { checked: admin }), /* @__PURE__ */ jsx("span", { children: labels.machinesPeopleAdmin })]
|
|
246
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
247
|
+
className: "flex gap-2",
|
|
248
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
249
|
+
type: "button",
|
|
250
|
+
className: buttonClass({
|
|
251
|
+
variant: "ghost",
|
|
252
|
+
size: "sm"
|
|
253
|
+
}),
|
|
254
|
+
onClick: onCancel,
|
|
255
|
+
children: labels.machinesCancel
|
|
256
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
257
|
+
type: "submit",
|
|
258
|
+
className: BTN_PRIMARY,
|
|
259
|
+
disabled: busy || !email.trim(),
|
|
260
|
+
children: labels.machinesPeopleAdd
|
|
261
|
+
})]
|
|
262
|
+
})]
|
|
263
|
+
})]
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
export { OrganizationPanel };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "Yours on this server": what the signed-in user keeps for themselves on a
|
|
3
|
+
* server in organization mode (docs/IDENTITY.md, Per-user layers). Sessions
|
|
4
|
+
* they own there use it on top of the server's.
|
|
5
|
+
*
|
|
6
|
+
* - **API keys**: the providers they hold a key for (never the key), Add key,
|
|
7
|
+
* Remove in the ⋯ menu.
|
|
8
|
+
* - **MCP servers**: their servers reached over HTTP, Add server, Sign in
|
|
9
|
+
* (theirs alone, through the host's `signIn`), Sign out, Remove.
|
|
10
|
+
* - **Skills**: their skills, Add skill, Edit and Remove.
|
|
11
|
+
* - **SYSTEM.md**: theirs instead of the server's, Save and Remove.
|
|
12
|
+
*
|
|
13
|
+
* Needs the host's `layer`; nothing when the server does not sign its users in.
|
|
14
|
+
*/
|
|
15
|
+
import { HostSummary } from "./headless/host.js";
|
|
16
|
+
import { CSSProperties } from "react";
|
|
17
|
+
/** Props for {@link PersonalLayerPanel}. */
|
|
18
|
+
export interface PersonalLayerPanelProps {
|
|
19
|
+
/** The server whose layer to show. */
|
|
20
|
+
host: HostSummary;
|
|
21
|
+
/** Extra classes on the root. */
|
|
22
|
+
className?: string;
|
|
23
|
+
/** Inline styles on the root. */
|
|
24
|
+
style?: CSSProperties;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Renders the signed-in user's keys, MCP servers, skills and SYSTEM.md on a server. Nothing without the host's
|
|
28
|
+
* `layer`, or when the server does not sign its users in.
|
|
29
|
+
*
|
|
30
|
+
* @param props - The server, `className` and `style`.
|
|
31
|
+
*/
|
|
32
|
+
export declare function PersonalLayerPanel(props: PersonalLayerPanelProps): import("react").JSX.Element | null;
|