zidane-ui 9.5.3 → 9.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/dist/adapters/index.d.ts +2 -1
  2. package/dist/adapters/index.js +2 -1
  3. package/dist/adapters/server-git-host.js +67 -0
  4. package/dist/adapters/server-host.js +9 -0
  5. package/dist/adapters/server-oauth-flow.d.ts +2 -2
  6. package/dist/adapters/server-oauth-flow.js +1 -1
  7. package/dist/adapters/server-projects.d.ts +53 -2
  8. package/dist/adapters/server-projects.js +4 -3
  9. package/dist/adapters/server-session-host.js +112 -4
  10. package/dist/channels/BindingEditorDialog.js +1 -1
  11. package/dist/channels/ChannelDefaultsSection.js +1 -1
  12. package/dist/channels/ChannelsSettingsSection.js +1 -1
  13. package/dist/channels/ConnectionSetupDialog.js +1 -1
  14. package/dist/channels/HeldRepliesList.js +1 -1
  15. package/dist/channels/ProjectChannelsSection.js +1 -1
  16. package/dist/chat/HostTranscript.js +1 -0
  17. package/dist/chat/SessionGroupHeader.js +2 -2
  18. package/dist/chat/composer/ComposerBadges.d.ts +27 -1
  19. package/dist/chat/composer/ComposerBadges.js +41 -5
  20. package/dist/chat/composer/ConversationBadges.d.ts +6 -0
  21. package/dist/chat/composer/ConversationBadges.js +70 -3
  22. package/dist/chat/composer/DraftPickers.js +4 -0
  23. package/dist/chat/composer/ServerScopeToggle.d.ts +16 -1
  24. package/dist/chat/composer/ServerScopeToggle.js +90 -47
  25. package/dist/chat/composer/index.d.ts +2 -2
  26. package/dist/chat/composer/use-draft-target.d.ts +18 -2
  27. package/dist/chat/composer/use-draft-target.js +74 -7
  28. package/dist/chat/composer/use-new-session-defaults.d.ts +3 -1
  29. package/dist/chat/composer/use-new-session-defaults.js +19 -14
  30. package/dist/chat/composer/use-send-prompt.js +2 -2
  31. package/dist/chat/headless/composer/index.d.ts +2 -2
  32. package/dist/chat/headless/composer/index.js +2 -2
  33. package/dist/chat/headless/composer/labels-chrome.d.ts +7 -0
  34. package/dist/chat/headless/composer/labels-chrome.js +7 -0
  35. package/dist/chat/headless/composer/labels-editor.d.ts +4 -0
  36. package/dist/chat/headless/composer/labels-editor.js +4 -0
  37. package/dist/chat/headless/composer/models.d.ts +2 -0
  38. package/dist/chat/headless/composer/new-session-defaults.d.ts +12 -1
  39. package/dist/chat/headless/composer/new-session-defaults.js +30 -1
  40. package/dist/chat/headless/draft-target.d.ts +27 -6
  41. package/dist/chat/headless/draft-target.js +36 -3
  42. package/dist/chat/headless/host.d.ts +7 -0
  43. package/dist/chat/headless/index.d.ts +4 -4
  44. package/dist/chat/headless/index.js +26 -26
  45. package/dist/chat/headless/labels.d.ts +4 -0
  46. package/dist/chat/headless/send-flow.d.ts +2 -0
  47. package/dist/chat/headless/send-flow.js +2 -1
  48. package/dist/chat/headless/session-list.d.ts +4 -0
  49. package/dist/chat/headless/sidebar/index.d.ts +2 -2
  50. package/dist/chat/headless/sidebar/labels.d.ts +9 -1
  51. package/dist/chat/headless/sidebar/labels.js +4 -0
  52. package/dist/chat/headless/sidebar/rows.d.ts +48 -7
  53. package/dist/chat/headless/sidebar/rows.js +121 -22
  54. package/dist/chat/headless/sidebar/types.d.ts +5 -0
  55. package/dist/chat/headless/transcript/fold-actions.d.ts +8 -3
  56. package/dist/chat/headless/transcript/fold-actions.js +29 -1
  57. package/dist/chat/index.d.ts +2 -2
  58. package/dist/chat/index.js +2 -2
  59. package/dist/chat/rich-composer/RichComposer.js +58 -11
  60. package/dist/chat/rich-composer/composer-controls.d.ts +5 -1
  61. package/dist/chat/rich-composer/composer-controls.js +4 -4
  62. package/dist/chat/rich-composer/composer-keys.js +2 -2
  63. package/dist/chat/rich-composer/draft-collab.d.ts +91 -0
  64. package/dist/chat/rich-composer/draft-collab.js +310 -0
  65. package/dist/chat/rich-composer/use-composer-editor.d.ts +2 -0
  66. package/dist/chat/rich-composer/use-draft-collab.d.ts +53 -0
  67. package/dist/chat/rich-composer/use-draft-collab.js +92 -0
  68. package/dist/chat/rich-composer/use-draft-mirror.d.ts +11 -0
  69. package/dist/chat/rich-composer/use-draft-mirror.js +38 -9
  70. package/dist/chat/sidebar/InboxList.js +1 -1
  71. package/dist/chat/sidebar/ProjectIcon.d.ts +6 -2
  72. package/dist/chat/sidebar/ProjectIcon.js +7 -3
  73. package/dist/chat/sidebar/SessionSidebar.d.ts +30 -1
  74. package/dist/chat/sidebar/SessionSidebar.js +79 -7
  75. package/dist/chat/sidebar/SidebarGroupHeader.d.ts +12 -4
  76. package/dist/chat/sidebar/SidebarGroupHeader.js +70 -28
  77. package/dist/chat/sidebar/index.d.ts +2 -2
  78. package/dist/chat/transcript/actions.d.ts +6 -0
  79. package/dist/chat/transcript/fold.d.ts +2 -1
  80. package/dist/chat/transcript/fold.js +26 -1
  81. package/dist/chat/transcript/index.js +3 -3
  82. package/dist/chat/transcript/notices.d.ts +5 -2
  83. package/dist/chat/transcript/notices.js +23 -3
  84. package/dist/chat/transcript/script-input.d.ts +1 -1
  85. package/dist/components/Avatar.d.ts +36 -0
  86. package/dist/components/Avatar.js +56 -0
  87. package/dist/components/AvatarStack.d.ts +58 -0
  88. package/dist/components/AvatarStack.js +187 -0
  89. package/dist/components/Tabs.d.ts +6 -1
  90. package/dist/components/Tabs.js +43 -39
  91. package/dist/core.css +19 -1
  92. package/dist/dist/{index-BsoTsm0E.d.ts → index-ChabiHpR.d.ts} +1 -1
  93. package/dist/dist/index.d.ts +1 -1
  94. package/dist/git/headless/environment.d.ts +15 -0
  95. package/dist/git/headless/environment.js +18 -1
  96. package/dist/git/headless/github.d.ts +11 -0
  97. package/dist/git/headless/github.js +15 -0
  98. package/dist/git/headless/host.d.ts +109 -0
  99. package/dist/git/headless/index.d.ts +5 -4
  100. package/dist/git/headless/index.js +4 -3
  101. package/dist/git/headless/labels.d.ts +16 -1
  102. package/dist/git/headless/labels.js +25 -1
  103. package/dist/git/testing/contract.d.ts +22 -4
  104. package/dist/git/testing/contract.js +173 -3
  105. package/dist/git/testing/index.d.ts +22 -1
  106. package/dist/git/testing/index.js +135 -1
  107. package/dist/index.d.ts +3 -1
  108. package/dist/index.js +3 -1
  109. package/dist/labels.d.ts +4 -0
  110. package/dist/labels.js +4 -0
  111. package/dist/onboarding/headless/labels.d.ts +4 -0
  112. package/dist/session/DraftPeopleStack.d.ts +24 -0
  113. package/dist/session/DraftPeopleStack.js +48 -0
  114. package/dist/session/NewProjectDialog.d.ts +28 -8
  115. package/dist/session/NewProjectDialog.js +225 -40
  116. package/dist/session/PersonCard.d.ts +29 -0
  117. package/dist/session/PersonCard.js +199 -0
  118. package/dist/session/ProjectArtifactsSection.d.ts +4 -1
  119. package/dist/session/ProjectArtifactsSection.js +149 -34
  120. package/dist/session/ProjectHome.d.ts +1 -1
  121. package/dist/session/ProjectHome.js +23 -4
  122. package/dist/session/ProjectName.d.ts +11 -6
  123. package/dist/session/ProjectName.js +27 -13
  124. package/dist/session/ProjectPeopleStack.d.ts +26 -0
  125. package/dist/session/ProjectPeopleStack.js +56 -0
  126. package/dist/session/ProjectPublishDialog.js +9 -3
  127. package/dist/session/ProjectSettingsDialog.d.ts +1 -1
  128. package/dist/session/ProjectSettingsDialog.js +171 -66
  129. package/dist/session/ProjectShareDialog.d.ts +1 -1
  130. package/dist/session/ProjectShareDialog.js +16 -6
  131. package/dist/session/ProjectToolsSection.js +88 -96
  132. package/dist/session/ProjectUsage.d.ts +4 -1
  133. package/dist/session/ProjectUsage.js +13 -4
  134. package/dist/session/SessionDetailsDialog.d.ts +5 -1
  135. package/dist/session/SessionDetailsDialog.js +67 -10
  136. package/dist/session/SessionPeopleStack.js +19 -37
  137. package/dist/session/SessionProjectPicker.d.ts +54 -0
  138. package/dist/session/SessionProjectPicker.js +175 -0
  139. package/dist/session/SessionProvider.d.ts +15 -1
  140. package/dist/session/SessionProvider.js +28 -6
  141. package/dist/session/UsageSection.d.ts +2 -4
  142. package/dist/session/UsageSection.js +57 -55
  143. package/dist/session/headless/draft-collab.d.ts +55 -0
  144. package/dist/session/headless/draft-collab.js +127 -0
  145. package/dist/session/headless/draft-room.d.ts +124 -0
  146. package/dist/session/headless/draft-room.js +340 -0
  147. package/dist/session/headless/drafts.d.ts +93 -0
  148. package/dist/session/headless/drafts.js +79 -0
  149. package/dist/session/headless/fixture-drafts.d.ts +54 -0
  150. package/dist/session/headless/fixture-drafts.js +286 -0
  151. package/dist/session/headless/fixture-host.d.ts +18 -2
  152. package/dist/session/headless/fixture-host.js +41 -7
  153. package/dist/session/headless/fixture-projects.d.ts +6 -4
  154. package/dist/session/headless/fixture-projects.js +25 -4
  155. package/dist/session/headless/host.d.ts +34 -6
  156. package/dist/session/headless/index.d.ts +6 -3
  157. package/dist/session/headless/index.js +6 -3
  158. package/dist/session/headless/labels.d.ts +47 -2
  159. package/dist/session/headless/labels.js +17 -1
  160. package/dist/session/headless/people.d.ts +27 -3
  161. package/dist/session/headless/people.js +38 -20
  162. package/dist/session/headless/project-artifact-labels.d.ts +7 -0
  163. package/dist/session/headless/project-artifact-labels.js +7 -0
  164. package/dist/session/headless/project-artifacts.d.ts +8 -0
  165. package/dist/session/headless/project-artifacts.js +15 -1
  166. package/dist/session/headless/project-labels.d.ts +25 -0
  167. package/dist/session/headless/project-labels.js +25 -0
  168. package/dist/session/headless/shared-with.d.ts +28 -0
  169. package/dist/session/headless/shared-with.js +51 -0
  170. package/dist/session/host-context.d.ts +11 -0
  171. package/dist/session/host-context.js +14 -0
  172. package/dist/session/index.d.ts +7 -3
  173. package/dist/session/index.js +6 -2
  174. package/dist/session/new-project-parts.d.ts +67 -0
  175. package/dist/session/new-project-parts.js +470 -0
  176. package/dist/session/project-artifact-parts.d.ts +2 -1
  177. package/dist/session/project-artifact-parts.js +5 -2
  178. package/dist/session/project-people.d.ts +14 -0
  179. package/dist/session/project-people.js +86 -0
  180. package/dist/session/share-people.d.ts +12 -0
  181. package/dist/session/share-people.js +1 -1
  182. package/dist/session/testing/contract.d.ts +6 -3
  183. package/dist/session/testing/contract.js +24 -3
  184. package/dist/session/testing/drafts.contract.d.ts +30 -0
  185. package/dist/session/testing/drafts.contract.js +126 -0
  186. package/dist/session/testing/index.d.ts +2 -1
  187. package/dist/session/testing/index.js +2 -1
  188. package/dist/session/use-home-projects.d.ts +11 -2
  189. package/dist/session/use-home-projects.js +142 -5
  190. package/dist/session/useDraftCollab.d.ts +24 -0
  191. package/dist/session/useDraftCollab.js +78 -0
  192. package/dist/settings/headless/search.d.ts +1 -1
  193. package/dist/settings/index.js +3 -3
  194. package/dist/settings/sections/providers/CredentialSources.d.ts +5 -5
  195. package/dist/settings/sections/providers/CredentialSources.js +5 -22
  196. package/dist/settings/sections/providers/labels.d.ts +1 -9
  197. package/dist/settings/sections/providers/labels.js +1 -9
  198. package/dist/styles.css +20 -9
  199. package/package.json +4 -3
  200. package/src/styles/sidebar.css +2 -3
@@ -3,18 +3,22 @@ import { BTN_PRIMARY, BTN_SECONDARY, buttonClass } from "../components/button.js
3
3
  import { Popover } from "../components/floating/Popover.js";
4
4
  import { FIELD_LABEL_CLASS, FormSection, INPUT_CLASS } from "../components/Form.js";
5
5
  import { IconButton } from "../components/IconButton.js";
6
+ import { lazyPart } from "../components/lazy-part.js";
6
7
  import { Menu, MenuRow, MenuSection, MenuSeparator } from "../components/Menu.js";
7
8
  import { SearchField } from "../components/SearchField.js";
9
+ import { Segmented } from "../components/Segmented.js";
8
10
  import { ShowMoreButton, useShowMore } from "../components/ShowMore.js";
9
11
  import { Skeleton } from "../components/Skeleton.js";
10
12
  import { Tooltip } from "../components/Tooltip.js";
11
- import { groupProjectArtifacts } from "./headless/project-artifacts.js";
13
+ import { useSettings } from "../settings/SettingsProvider.js";
14
+ import { useViewsHost } from "../views/ViewsProvider.js";
15
+ import { groupProjectArtifacts, projectArtifactImageUrl } from "./headless/project-artifacts.js";
12
16
  import { ArtifactFacts, ArtifactGlyph, ArtifactTitle, projectArtifactSearchText, useArtifactsRead } from "./project-artifact-parts.js";
13
17
  import { ROW, SectionLead, SectionRetry } from "./project-settings-parts.js";
14
18
  import { useSessionLabels } from "./useSessionLabels.js";
15
- import { useState } from "react";
19
+ import { Suspense, useState } from "react";
16
20
  import { jsx, jsxs } from "react/jsx-runtime";
17
- import { ARTIFACT_CONTEXT_LEVELS } from "zidane/chat/pure";
21
+ import { ARTIFACT_CONTEXT_LEVELS, savedViewHeightsOfArtifact, savedViewRefOfArtifact } from "zidane/chat/pure";
18
22
  // src/session/ProjectArtifactsSection.tsx
19
23
  /** The rows past which the section offers a search. */
20
24
  const SEARCH_FROM = 20;
@@ -24,14 +28,38 @@ const LEVEL_ICON = {
24
28
  index: "i-ph-list-bullets",
25
29
  pinned: "i-ph-push-pin"
26
30
  };
31
+ /** The view of a `view` artifact, in the views chunk: it loads only when one opens. */
32
+ const SavedViewPart = lazyPart(() => import("../views/SavedViewArtifact.js").then((m) => m.SavedViewArtifact));
33
+ /** The kind filter's value for every kind. */
34
+ const ALL = "*";
35
+ /** Whether saved views draw as the view itself here, as the session's Artifacts panel draws them. */
36
+ function useSavedViews() {
37
+ const { settings } = useSettings();
38
+ return useViewsHost() && settings.views && settings.viewsSave === true ? { customCode: settings.viewsCustomCode !== false } : null;
39
+ }
27
40
  /**
28
41
  * The Artifacts section of a project's settings.
29
42
  *
30
43
  * @param props - The {@link ProjectArtifactsSectionProps}.
31
44
  */
32
- function ProjectArtifactsSection({ artifacts, project, run, grants, said }) {
45
+ function ProjectArtifactsSection({ artifacts, project, run, grants, said, read: given }) {
33
46
  const labels = useSessionLabels();
34
- const read = useArtifactsRead(artifacts, project.id, true);
47
+ const own = useArtifactsRead(given ? void 0 : artifacts, project.id, true);
48
+ const read = given ?? own;
49
+ const savedViews = useSavedViews();
50
+ const [kind, setKind] = useState(ALL);
51
+ const [open, setOpen] = useState(() => /* @__PURE__ */ new Set());
52
+ const toggle = (id) => setOpen((now) => {
53
+ const next = new Set(now);
54
+ if (!next.delete(id)) next.add(id);
55
+ return next;
56
+ });
57
+ const previewOf = (row) => {
58
+ const view = savedViews ? savedViewRefOfArtifact(row) : null;
59
+ if (view) return { view };
60
+ const image = projectArtifactImageUrl(row);
61
+ return image ? { image } : null;
62
+ };
35
63
  const [adding, setAdding] = useState(false);
36
64
  const { add } = artifacts;
37
65
  const addNew = add && grants.manage ? (input) => run("artifacts", async () => {
@@ -53,7 +81,10 @@ function ProjectArtifactsSection({ artifacts, project, run, grants, said }) {
53
81
  const [query, setQuery] = useState("");
54
82
  const needle = query.trim().toLowerCase();
55
83
  const matching = read.rows && needle ? read.rows.filter((row) => projectArtifactSearchText(row).join(" ").toLowerCase().includes(needle)) : read.rows;
56
- const groups = matching ? groupProjectArtifacts(matching) : [];
84
+ const every = read.rows ? groupProjectArtifacts(read.rows) : [];
85
+ const picked = every.some((group) => group.kind === kind) ? kind : ALL;
86
+ const groups = (matching ? groupProjectArtifacts(matching) : []).filter((group) => picked === ALL || group.kind === picked);
87
+ const kindName = (group) => labels.projectArtifactKind(group.kind, group.rows.find((row) => row.kindLabel)?.kindLabel);
57
88
  return /* @__PURE__ */ jsxs(FormSection, {
58
89
  title: labels.projectArtifacts,
59
90
  help: labels.projectArtifactsHint,
@@ -66,6 +97,28 @@ function ProjectArtifactsSection({ artifacts, project, run, grants, said }) {
66
97
  detail: read.failed,
67
98
  retry: read.retry
68
99
  }),
100
+ every.length > 1 && /* @__PURE__ */ jsx("div", {
101
+ className: "max-w-full overflow-x-auto zg-no-scrollbar px-2 pt-2 pb-1",
102
+ children: /* @__PURE__ */ jsx(Segmented, {
103
+ size: "sm",
104
+ value: picked,
105
+ onChange: setKind,
106
+ ariaLabel: labels.projectArtifactsKinds,
107
+ options: [{
108
+ value: ALL,
109
+ label: /* @__PURE__ */ jsx(KindOption, {
110
+ name: labels.projectArtifactsAllKinds,
111
+ count: read.rows?.length ?? 0
112
+ })
113
+ }, ...every.map((group) => ({
114
+ value: group.kind,
115
+ label: /* @__PURE__ */ jsx(KindOption, {
116
+ name: kindName(group),
117
+ count: group.rows.length
118
+ })
119
+ }))]
120
+ })
121
+ }),
69
122
  read.rows && read.rows.length > SEARCH_FROM && /* @__PURE__ */ jsx(SearchField, {
70
123
  variant: "strip",
71
124
  query,
@@ -82,14 +135,23 @@ function ProjectArtifactsSection({ artifacts, project, run, grants, said }) {
82
135
  groups.map((group) => /* @__PURE__ */ jsx(ArtifactGroup, {
83
136
  kind: group.kind,
84
137
  rows: group.rows,
85
- children: (row) => /* @__PURE__ */ jsx(ArtifactRow, {
86
- row,
87
- artifacts,
88
- projectId: project.id,
89
- cwd: project.home,
90
- run,
91
- manage: grants.manage
92
- }, row.id)
138
+ children: (row) => {
139
+ const preview = previewOf(row);
140
+ return /* @__PURE__ */ jsx(ArtifactRow, {
141
+ row,
142
+ artifacts,
143
+ projectId: project.id,
144
+ cwd: project.home,
145
+ run,
146
+ manage: grants.manage,
147
+ ...preview ? {
148
+ preview,
149
+ open: open.has(row.id),
150
+ onToggle: () => toggle(row.id),
151
+ customCode: savedViews?.customCode ?? false
152
+ } : {}
153
+ }, row.id);
154
+ }
93
155
  }, `${group.kind}:${needle}`)),
94
156
  adding && addNew && /* @__PURE__ */ jsx(AddArtifactForm, {
95
157
  onSave: addNew,
@@ -99,6 +161,16 @@ function ProjectArtifactsSection({ artifacts, project, run, grants, said }) {
99
161
  ]
100
162
  });
101
163
  }
164
+ /** A kind in the filter: its name, then its count. */
165
+ function KindOption({ name, count }) {
166
+ return /* @__PURE__ */ jsxs("span", {
167
+ className: "inline-flex items-center gap-1.5",
168
+ children: [name, /* @__PURE__ */ jsx("span", {
169
+ className: "zg-meta",
170
+ children: count
171
+ })]
172
+ });
173
+ }
102
174
  /** One kind's rows under its name and count: the first page, then Show more. */
103
175
  function ArtifactGroup({ kind, rows, children }) {
104
176
  const labels = useSessionLabels();
@@ -150,7 +222,7 @@ function ArtifactsLoading() {
150
222
  * One artifact, drawn as the session's Artifacts panel draws it (its state icon, title, state word and chips), then
151
223
  * who made it; its level, and for an owner or a maintainer the level's menu.
152
224
  */
153
- function ArtifactRow({ row, artifacts, projectId, cwd, run, manage }) {
225
+ function ArtifactRow({ row, artifacts, projectId, cwd, run, manage, preview, open = false, onToggle, customCode = false }) {
154
226
  const labels = useSessionLabels();
155
227
  const confirm = useOptionalConfirm();
156
228
  const pin = manage ? artifacts.pin : void 0;
@@ -164,29 +236,72 @@ function ArtifactRow({ row, artifacts, projectId, cwd, run, manage }) {
164
236
  confirmLabel: labels.projectArtifactRemoveConfirm,
165
237
  destructive: true
166
238
  }).then((ok) => ok && run("artifacts", () => remove(projectId, row.id), labels.projectArtifactRemoveFailed)));
239
+ const previewId = `project-artifact-preview-${row.id}`;
167
240
  return /* @__PURE__ */ jsxs("div", {
168
241
  role: "listitem",
169
242
  "data-testid": `project-artifact-${row.id}`,
170
- className: `${ROW} !items-start group`,
171
- children: [
172
- /* @__PURE__ */ jsx(ArtifactGlyph, { row }),
173
- /* @__PURE__ */ jsxs("span", {
174
- className: "flex-1 min-w-0 flex flex-col gap-0.5",
175
- children: [/* @__PURE__ */ jsx(ArtifactTitle, { row }), /* @__PURE__ */ jsx(ArtifactFacts, {
176
- row,
177
- cwd
178
- })]
179
- }),
180
- /* @__PURE__ */ jsx("span", {
181
- className: "flex items-center shrink-0 ml-auto self-start -mt-0.5",
182
- children: setLevel ? /* @__PURE__ */ jsx(LevelMenu, {
183
- row,
184
- onLevel: setLevel,
185
- ...reset ? { onReset: reset } : {},
186
- ...ask ? { onRemove: ask } : {}
187
- }) : /* @__PURE__ */ jsx(LevelGlyph, { level: row.level })
243
+ className: "flex flex-col group",
244
+ children: [/* @__PURE__ */ jsxs("div", {
245
+ className: `${ROW} !items-start`,
246
+ children: [
247
+ /* @__PURE__ */ jsx(ArtifactGlyph, { row }),
248
+ /* @__PURE__ */ jsxs("span", {
249
+ className: "flex-1 min-w-0 flex flex-col gap-0.5",
250
+ children: [/* @__PURE__ */ jsx(ArtifactTitle, { row }), /* @__PURE__ */ jsx(ArtifactFacts, {
251
+ row,
252
+ cwd
253
+ })]
254
+ }),
255
+ /* @__PURE__ */ jsxs("span", {
256
+ className: "flex items-center gap-0.5 shrink-0 ml-auto self-start -mt-0.5",
257
+ children: [preview && onToggle && /* @__PURE__ */ jsx(IconButton, {
258
+ icon: open ? "i-ph-caret-up" : "i-ph-caret-down",
259
+ size: "sm",
260
+ active: open,
261
+ "aria-expanded": open,
262
+ "aria-controls": previewId,
263
+ label: open ? labels.projectArtifactHide(row.label) : labels.projectArtifactShow(row.label),
264
+ onClick: onToggle
265
+ }), setLevel ? /* @__PURE__ */ jsx(LevelMenu, {
266
+ row,
267
+ onLevel: setLevel,
268
+ ...reset ? { onReset: reset } : {},
269
+ ...ask ? { onRemove: ask } : {}
270
+ }) : /* @__PURE__ */ jsx(LevelGlyph, { level: row.level })]
271
+ })
272
+ ]
273
+ }), preview && open && /* @__PURE__ */ jsx("div", {
274
+ id: previewId,
275
+ className: "px-3 pb-3",
276
+ children: "view" in preview ? /* @__PURE__ */ jsx(Suspense, {
277
+ fallback: null,
278
+ children: /* @__PURE__ */ jsx(SavedViewPart, {
279
+ viewRef: preview.view,
280
+ sessionId: row.sessions[0]?.sessionId ?? "",
281
+ heights: savedViewHeightsOfArtifact(row),
282
+ title: row.label,
283
+ ...customCode ? { customCode: true } : {}
284
+ })
285
+ }) : /* @__PURE__ */ jsx(ArtifactImage, {
286
+ src: preview.image,
287
+ label: row.label
188
288
  })
189
- ]
289
+ })]
290
+ });
291
+ }
292
+ /** An image artifact drawn in place, at its own size up to the list's width; one that fails to load says nothing. */
293
+ function ArtifactImage({ src, label }) {
294
+ const labels = useSessionLabels();
295
+ const [failed, setFailed] = useState(false);
296
+ if (failed) return null;
297
+ return /* @__PURE__ */ jsx("img", {
298
+ src,
299
+ alt: labels.projectArtifactPreview(label),
300
+ loading: "lazy",
301
+ decoding: "async",
302
+ referrerPolicy: "no-referrer",
303
+ onError: () => setFailed(true),
304
+ className: "block max-w-full max-h-[min(480px,60dvh)] rounded-zg-md object-contain bg-[var(--zg-track)]"
190
305
  });
191
306
  }
192
307
  /** A member's view of a row's level: its icon, its name in the tooltip. */
@@ -55,7 +55,7 @@ export interface ProjectHomeProject {
55
55
  path: string;
56
56
  /** The host the project is on (`HostView.id`), for showing its path. Absent: this computer. */
57
57
  hostId?: string;
58
- /** Its icon (the sidebar's project icon). */
58
+ /** Its icon (the sidebar's project icon). Absent: none, or the server's glyph (a cloud) for a project on a host (`hostId`). */
59
59
  icon?: ReactNode;
60
60
  /** Its repository (`owner/repo`), shown as a chip before the path. */
61
61
  repo?: ProjectHomeRepo;
@@ -1,6 +1,6 @@
1
1
  import { ProjectReadinessCard } from "../channels/ReadinessChecklist.js";
2
2
  import { ProjectMenu } from "../chat/composer/ProjectMenu.js";
3
- import { IconPicker } from "../chat/sidebar/ProjectIcon.js";
3
+ import { IconPicker, ProjectIconGlyph } from "../chat/sidebar/ProjectIcon.js";
4
4
  import { FloatingSurface } from "../components/floating/FloatingSurface.js";
5
5
  import { usePopover } from "../components/floating/usePopover.js";
6
6
  import { IconButton } from "../components/IconButton.js";
@@ -28,7 +28,7 @@ import { ProjectArtifactsHome } from "./ProjectArtifactsHome.js";
28
28
  import { ProjectMainButton } from "./ProjectMainButton.js";
29
29
  import { ProjectSessionsList } from "./ProjectSessionsList.js";
30
30
  import { ProjectSpendChip } from "./ProjectUsage.js";
31
- import { useSessionProjects } from "./SessionProvider.js";
31
+ import { useSessionProjects, useSessionSharing } from "./SessionProvider.js";
32
32
  import { useProjectHomeLayout } from "./use-project-home-layout.js";
33
33
  import { useSessionLabels } from "./useSessionLabels.js";
34
34
  import { useUsageSummary } from "./useUsageSummary.js";
@@ -537,12 +537,28 @@ function BuiltinBlock({ projectId, projectKey, onOpenSession, ...card }) {
537
537
  /** The kit's own blocks come after the panels' (`DEFAULT_ORDER` 100) unless the user places them. */
538
538
  const BUILTIN_ORDER = 1e3;
539
539
  /**
540
+ * Tells the host which project home this window shows (`sharing.showProject`), so the project's people see you
541
+ * there: the project while the home shows it, `null` when it leaves. Like a session's presence, it holds while the
542
+ * window is in the background.
543
+ *
544
+ * @param projectId - The project shown, if the home has one.
545
+ */
546
+ function useShowProject(projectId) {
547
+ const show = useSessionSharing()?.showProject;
548
+ useEffect(() => {
549
+ if (!show || !projectId) return void 0;
550
+ show(projectId).catch(() => {});
551
+ return () => void show(null).catch(() => {});
552
+ }, [show, projectId]);
553
+ }
554
+ /**
540
555
  * Renders the project home.
541
556
  *
542
557
  * @param props - The {@link ProjectHomeProps}.
543
558
  */
544
559
  function ProjectHome({ panels, cwd, projectKey, projectId, onOpenSettings, folderMissing, project, switcher, blocksUnavailable = false, defaultBlocks: givenDefaults, onOpenSession, onOpenPath, onStartSession, onOpenRepo, onOpenFiles, onRevealPath, onOpenInEditor, now: nowProp, headingLevel = 1, className = "", style }) {
545
560
  const labels = useSessionLabels();
561
+ useShowProject(projectId);
546
562
  const catalog = useExtensionPanels(panels, panels ? cwd : null);
547
563
  const projects = useSessionProjects();
548
564
  const sessionsBlock = Boolean(projectId && onOpenSession && projects?.sessions);
@@ -749,9 +765,12 @@ function ProjectHeader({ project, switcher, action, onOpenRepo, onOpenFiles, onR
749
765
  return /* @__PURE__ */ jsxs("div", {
750
766
  className: "mb-6 px-1 flex flex-wrap items-start gap-x-3 gap-y-2 min-w-0",
751
767
  children: [
752
- project.icon && /* @__PURE__ */ jsx("span", {
768
+ (project.icon || project.hostId) && /* @__PURE__ */ jsx("span", {
753
769
  className: "shrink-0 flex items-center h-7",
754
- children: project.icon
770
+ children: project.icon ?? /* @__PURE__ */ jsx(ProjectIconGlyph, {
771
+ size: "lg",
772
+ server: true
773
+ })
755
774
  }),
756
775
  /* @__PURE__ */ jsxs("div", {
757
776
  className: "flex-1 min-w-[min(100%,12rem)] flex flex-col items-start gap-1",
@@ -65,12 +65,17 @@ export interface SessionProjectRef extends ProjectLabel {
65
65
  home: string | null;
66
66
  }
67
67
  /**
68
- * The project a session of this host is in, named and with its icon as the sidebar shows it: the project it is filed
69
- * in (`SessionProjects.sessionProjects`), else the one whose home is its folder (`Settings.projectHome` on), else its
70
- * folder's name and the window's icon of it. `null` for a chat in no project, or while `enabled` is off.
68
+ * The project a session is in, named and with its icon as the sidebar shows it: the project its row names
69
+ * (`SessionRow.projectId`; `null`: none, even in a project's home), else the one it is filed in
70
+ * (`SessionProjects.sessionProjects`), else the one whose home is its folder (`Settings.projectHome` on), else its
71
+ * folder's name and the window's icon of it. A server's session (`hostId`) reads that server's projects
72
+ * (`SessionHost.projectsOf`) and names only a project of theirs, with the icon the server keeps. `null` for a chat in
73
+ * no project, or while `enabled` is off.
71
74
  *
72
- * @param sessionId - The session, `null` for none (a draft).
75
+ * @param sessionId - The session as its host's projects name it, `null` for none (a draft).
73
76
  * @param root - Its project root (a worktree's main checkout), `null` for a chat with no folder.
74
- * @param enabled - Off for a session this host does not hold (a server's): its icons and projects are not these.
77
+ * @param enabled - Off for a session whose host's projects are not these (a server's, without `hostId`).
78
+ * @param hostId - The saved server the session runs on. Absent: this host.
79
+ * @param projectId - The project its row names; `null`: none on purpose. Absent: the host does not say.
75
80
  */
76
- export declare function useSessionProject(sessionId: string | null, root: string | null, enabled?: boolean): SessionProjectRef | null;
81
+ export declare function useSessionProject(sessionId: string | null, root: string | null, enabled?: boolean, hostId?: string, projectId?: string | null): SessionProjectRef | null;
@@ -1,7 +1,8 @@
1
+ import { constant, useReadable } from "../chat/headless/store.js";
1
2
  import { ProjectIconGlyph, useProjectIcons } from "../chat/sidebar/ProjectIcon.js";
2
3
  import { useTooltip } from "../components/Tooltip.js";
3
4
  import { basename } from "../path.js";
4
- import { useProjectList, useSessionProjects } from "./SessionProvider.js";
5
+ import { useHostProjects, useProjectList, useSessionProjects } from "./SessionProvider.js";
5
6
  import { useProjectHomeOn } from "./use-project-home-on.js";
6
7
  import { useCallback, useEffect, useState } from "react";
7
8
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -80,21 +81,34 @@ function useFolderIcons(enabled = true) {
80
81
  icons
81
82
  ]);
82
83
  }
84
+ const NO_PROJECTS = constant(null);
83
85
  /**
84
- * The project a session of this host is in, named and with its icon as the sidebar shows it: the project it is filed
85
- * in (`SessionProjects.sessionProjects`), else the one whose home is its folder (`Settings.projectHome` on), else its
86
- * folder's name and the window's icon of it. `null` for a chat in no project, or while `enabled` is off.
86
+ * The project a session is in, named and with its icon as the sidebar shows it: the project its row names
87
+ * (`SessionRow.projectId`; `null`: none, even in a project's home), else the one it is filed in
88
+ * (`SessionProjects.sessionProjects`), else the one whose home is its folder (`Settings.projectHome` on), else its
89
+ * folder's name and the window's icon of it. A server's session (`hostId`) reads that server's projects
90
+ * (`SessionHost.projectsOf`) and names only a project of theirs, with the icon the server keeps. `null` for a chat in
91
+ * no project, or while `enabled` is off.
87
92
  *
88
- * @param sessionId - The session, `null` for none (a draft).
93
+ * @param sessionId - The session as its host's projects name it, `null` for none (a draft).
89
94
  * @param root - Its project root (a worktree's main checkout), `null` for a chat with no folder.
90
- * @param enabled - Off for a session this host does not hold (a server's): its icons and projects are not these.
95
+ * @param enabled - Off for a session whose host's projects are not these (a server's, without `hostId`).
96
+ * @param hostId - The saved server the session runs on. Absent: this host.
97
+ * @param projectId - The project its row names; `null`: none on purpose. Absent: the host does not say.
91
98
  */
92
- function useSessionProject(sessionId, root, enabled = true) {
99
+ function useSessionProject(sessionId, root, enabled = true, hostId, projectId) {
93
100
  const homeOn = useProjectHomeOn();
94
101
  const on = enabled && homeOn;
95
- const host = useSessionProjects();
96
- const list = useProjectList(on);
97
- const { icons } = useProjectIcons(enabled);
102
+ const server = hostId !== void 0;
103
+ const ownHost = useSessionProjects();
104
+ const theirs = useHostProjects(hostId ?? null);
105
+ const host = server ? theirs : ownHost;
106
+ const own = useProjectList(on && !server);
107
+ const shown = on && server ? theirs : void 0;
108
+ useEffect(() => shown?.ensure(), [shown]);
109
+ const listed = useReadable(shown?.list ?? NO_PROJECTS);
110
+ const list = server ? listed : own;
111
+ const { icons } = useProjectIcons(enabled && !server);
98
112
  const read = on && sessionId ? host?.sessionProjects : void 0;
99
113
  const [filed, setFiled] = useState(null);
100
114
  useEffect(() => {
@@ -115,10 +129,10 @@ function useSessionProject(sessionId, root, enabled = true) {
115
129
  sessionId,
116
130
  list
117
131
  ]);
118
- if (!enabled) return null;
132
+ if (!enabled || on && projectId === null) return null;
119
133
  const filedId = read && filed?.sessionId === sessionId ? filed.projectId : null;
120
134
  const home = root ? trimmed(root) : null;
121
- const record = (filedId ? list?.find((p) => p.id === filedId) : void 0) ?? (home ? list?.find((p) => p.home !== void 0 && trimmed(p.home) === home) : void 0);
135
+ const record = (on && projectId ? list?.find((p) => p.id === projectId) : void 0) ?? (filedId ? list?.find((p) => p.id === filedId) : void 0) ?? (home ? list?.find((p) => p.home !== void 0 && trimmed(p.home) === home) : void 0);
122
136
  if (record) {
123
137
  const icon = projectIconOf(record, icons);
124
138
  return {
@@ -128,7 +142,7 @@ function useSessionProject(sessionId, root, enabled = true) {
128
142
  ...icon ? { icon } : {}
129
143
  };
130
144
  }
131
- if (!home) return null;
145
+ if (!home || server) return null;
132
146
  const icon = icons[home];
133
147
  return {
134
148
  id: null,
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Who else is in a project now (organization mode, docs/MULTIPLAYER.md): the online people of
3
+ * `sharing.projectPeople`, as a small stack of faces (a project's sidebar header). At most three, then "+N". Each
4
+ * face opens the person's card (`PersonCard`) on hover or focus. Nothing when nobody else is there, or without
5
+ * `projectPeople`.
6
+ */
7
+ import { CSSProperties } from "react";
8
+ /** Props for {@link ProjectPeopleStack}. */
9
+ export interface ProjectPeopleStackProps {
10
+ /** The project. */
11
+ projectId: string;
12
+ /** Opens a project's home from a person's card; `hostId`: the server it is on. Absent: their card lists no projects. */
13
+ onOpenProject?: (projectId: string, hostId?: string) => void;
14
+ /** Opens a session from a person's card. Absent: their card lists no sessions. */
15
+ onOpenSession?: (sessionId: string) => void;
16
+ /** Extra classes on the root. */
17
+ className?: string;
18
+ /** Inline styles on the root. */
19
+ style?: CSSProperties;
20
+ }
21
+ /**
22
+ * Renders who else is in `projectId`, or nothing.
23
+ *
24
+ * @param props - The {@link ProjectPeopleStackProps}.
25
+ */
26
+ export declare function ProjectPeopleStack({ projectId, onOpenProject, onOpenSession, className, style }: ProjectPeopleStackProps): import("react").JSX.Element | null;
@@ -0,0 +1,56 @@
1
+ import { AvatarStack } from "../components/AvatarStack.js";
2
+ import { LabelsProvider } from "../labels.js";
3
+ import { PersonCard } from "./PersonCard.js";
4
+ import { useSessionSharing } from "./SessionProvider.js";
5
+ import { useSessionLabels } from "./useSessionLabels.js";
6
+ import { useCallback, useEffect, useMemo, useState } from "react";
7
+ import { jsx } from "react/jsx-runtime";
8
+ // src/session/ProjectPeopleStack.tsx
9
+ const NOBODY = [];
10
+ /**
11
+ * Renders who else is in `projectId`, or nothing.
12
+ *
13
+ * @param props - The {@link ProjectPeopleStackProps}.
14
+ */
15
+ function ProjectPeopleStack({ projectId, onOpenProject, onOpenSession, className, style }) {
16
+ const watcher = useSessionSharing()?.projectPeople;
17
+ const labels = useSessionLabels();
18
+ const [here, setHere] = useState(NOBODY);
19
+ useEffect(() => {
20
+ if (!watcher) return void 0;
21
+ return watcher.watch(projectId, setHere);
22
+ }, [watcher, projectId]);
23
+ const faces = useMemo(() => here.filter((person) => person.online).map((person) => ({
24
+ id: person.userId,
25
+ name: person.name,
26
+ ...person.avatar ? { avatar: person.avatar } : {},
27
+ ...person.email ? { email: person.email } : {},
28
+ online: true
29
+ })), [here]);
30
+ const renderCard = useCallback((face) => /* @__PURE__ */ jsx(PersonCard, {
31
+ person: {
32
+ userId: face.id,
33
+ name: face.name,
34
+ online: true,
35
+ ...face.avatar ? { avatar: face.avatar } : {},
36
+ ...face.email ? { email: face.email } : {}
37
+ },
38
+ ...onOpenProject ? { onOpenProject } : {},
39
+ ...onOpenSession ? { onOpenSession } : {}
40
+ }), [onOpenProject, onOpenSession]);
41
+ const more = useMemo(() => ({ avatarMore: labels.peopleMore }), [labels.peopleMore]);
42
+ if (!watcher || faces.length === 0) return null;
43
+ const line = labels.peopleHere(faces.map((face) => face.name.trim() || labels.peopleUnnamed));
44
+ return /* @__PURE__ */ jsx(LabelsProvider, {
45
+ labels: more,
46
+ children: /* @__PURE__ */ jsx(AvatarStack, {
47
+ people: faces,
48
+ renderCard,
49
+ label: line,
50
+ testId: "project-people",
51
+ className: `zg-no-drag shrink-0 ${className ?? ""}`.trimEnd(),
52
+ ...style ? { style } : {}
53
+ })
54
+ });
55
+ }
56
+ export { ProjectPeopleStack };
@@ -10,6 +10,7 @@ import { Skeleton } from "../components/Skeleton.js";
10
10
  import { useGitHost } from "../git/GitProvider.js";
11
11
  import { RemoteFolderBrowser } from "../git/RemoteFolderPicker.js";
12
12
  import { useDisplayPath } from "../hooks/useDisplayPath.js";
13
+ import { useCarrySessionHost } from "./host-context.js";
13
14
  import { useSessionProjects } from "./SessionProvider.js";
14
15
  import { useSessionLabels } from "./useSessionLabels.js";
15
16
  import { useCallback, useEffect, useId, useState } from "react";
@@ -405,16 +406,21 @@ function useProjectPublish() {
405
406
  const modal = useOptionalModal();
406
407
  const openLayer = modal?.openLayer;
407
408
  const closeLayer = modal?.closeLayer;
409
+ const carry = useCarrySessionHost();
408
410
  const open = useCallback((projectId) => {
409
411
  if (!openLayer || !closeLayer) return;
410
- openLayer(/* @__PURE__ */ jsx(ProjectPublishDialog, {
412
+ openLayer(carry(/* @__PURE__ */ jsx(ProjectPublishDialog, {
411
413
  projectId,
412
414
  onClose: () => closeLayer()
413
- }), {
415
+ })), {
414
416
  onDismiss: () => {},
415
417
  labelledBy: TITLE_ID
416
418
  });
417
- }, [openLayer, closeLayer]);
419
+ }, [
420
+ openLayer,
421
+ closeLayer,
422
+ carry
423
+ ]);
418
424
  return publish && openLayer && closeLayer ? open : void 0;
419
425
  }
420
426
  export { ProjectPublishDialog, useProjectPublish };
@@ -21,7 +21,7 @@ export interface ProjectSettingsDialogProps extends ProjectSettingsActions {
21
21
  */
22
22
  export declare function ProjectSettingsDialog({ projectId, onClose, ...actions }: ProjectSettingsDialogProps): import("react").JSX.Element;
23
23
  /**
24
- * Opens a project's settings on the modal layer. `undefined` without `SessionHost.projects` or a modal layer. A local
24
+ * Opens a project's settings on the modal layer, over the caller's host. `undefined` without `SessionHost.projects` or a modal layer. A local
25
25
  * file it names (a `file` artifact, an instructions file) opens where the caller would open it (`./project-files`),
26
26
  * once the dialog has closed.
27
27
  *