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.
- package/dist/adapters/index.d.ts +2 -1
- package/dist/adapters/index.js +2 -1
- package/dist/adapters/server-git-host.js +67 -0
- package/dist/adapters/server-host.js +9 -0
- package/dist/adapters/server-oauth-flow.d.ts +2 -2
- package/dist/adapters/server-oauth-flow.js +1 -1
- package/dist/adapters/server-projects.d.ts +53 -2
- package/dist/adapters/server-projects.js +4 -3
- package/dist/adapters/server-session-host.js +112 -4
- package/dist/channels/BindingEditorDialog.js +1 -1
- package/dist/channels/ChannelDefaultsSection.js +1 -1
- package/dist/channels/ChannelsSettingsSection.js +1 -1
- package/dist/channels/ConnectionSetupDialog.js +1 -1
- package/dist/channels/HeldRepliesList.js +1 -1
- package/dist/channels/ProjectChannelsSection.js +1 -1
- package/dist/chat/HostTranscript.js +1 -0
- package/dist/chat/SessionGroupHeader.js +2 -2
- package/dist/chat/composer/ComposerBadges.d.ts +27 -1
- package/dist/chat/composer/ComposerBadges.js +41 -5
- package/dist/chat/composer/ConversationBadges.d.ts +6 -0
- package/dist/chat/composer/ConversationBadges.js +70 -3
- package/dist/chat/composer/DraftPickers.js +4 -0
- package/dist/chat/composer/ServerScopeToggle.d.ts +16 -1
- package/dist/chat/composer/ServerScopeToggle.js +90 -47
- package/dist/chat/composer/index.d.ts +2 -2
- package/dist/chat/composer/use-draft-target.d.ts +18 -2
- package/dist/chat/composer/use-draft-target.js +74 -7
- package/dist/chat/composer/use-new-session-defaults.d.ts +3 -1
- package/dist/chat/composer/use-new-session-defaults.js +19 -14
- package/dist/chat/composer/use-send-prompt.js +2 -2
- package/dist/chat/headless/composer/index.d.ts +2 -2
- package/dist/chat/headless/composer/index.js +2 -2
- package/dist/chat/headless/composer/labels-chrome.d.ts +7 -0
- package/dist/chat/headless/composer/labels-chrome.js +7 -0
- package/dist/chat/headless/composer/labels-editor.d.ts +4 -0
- package/dist/chat/headless/composer/labels-editor.js +4 -0
- package/dist/chat/headless/composer/models.d.ts +2 -0
- package/dist/chat/headless/composer/new-session-defaults.d.ts +12 -1
- package/dist/chat/headless/composer/new-session-defaults.js +30 -1
- package/dist/chat/headless/draft-target.d.ts +27 -6
- package/dist/chat/headless/draft-target.js +36 -3
- package/dist/chat/headless/host.d.ts +7 -0
- package/dist/chat/headless/index.d.ts +4 -4
- package/dist/chat/headless/index.js +26 -26
- package/dist/chat/headless/labels.d.ts +4 -0
- package/dist/chat/headless/send-flow.d.ts +2 -0
- package/dist/chat/headless/send-flow.js +2 -1
- package/dist/chat/headless/session-list.d.ts +4 -0
- package/dist/chat/headless/sidebar/index.d.ts +2 -2
- package/dist/chat/headless/sidebar/labels.d.ts +9 -1
- package/dist/chat/headless/sidebar/labels.js +4 -0
- package/dist/chat/headless/sidebar/rows.d.ts +48 -7
- package/dist/chat/headless/sidebar/rows.js +121 -22
- package/dist/chat/headless/sidebar/types.d.ts +5 -0
- package/dist/chat/headless/transcript/fold-actions.d.ts +8 -3
- package/dist/chat/headless/transcript/fold-actions.js +29 -1
- package/dist/chat/index.d.ts +2 -2
- package/dist/chat/index.js +2 -2
- package/dist/chat/rich-composer/RichComposer.js +58 -11
- package/dist/chat/rich-composer/composer-controls.d.ts +5 -1
- package/dist/chat/rich-composer/composer-controls.js +4 -4
- package/dist/chat/rich-composer/composer-keys.js +2 -2
- package/dist/chat/rich-composer/draft-collab.d.ts +91 -0
- package/dist/chat/rich-composer/draft-collab.js +310 -0
- package/dist/chat/rich-composer/use-composer-editor.d.ts +2 -0
- package/dist/chat/rich-composer/use-draft-collab.d.ts +53 -0
- package/dist/chat/rich-composer/use-draft-collab.js +92 -0
- package/dist/chat/rich-composer/use-draft-mirror.d.ts +11 -0
- package/dist/chat/rich-composer/use-draft-mirror.js +38 -9
- package/dist/chat/sidebar/InboxList.js +1 -1
- package/dist/chat/sidebar/ProjectIcon.d.ts +6 -2
- package/dist/chat/sidebar/ProjectIcon.js +7 -3
- package/dist/chat/sidebar/SessionSidebar.d.ts +30 -1
- package/dist/chat/sidebar/SessionSidebar.js +79 -7
- package/dist/chat/sidebar/SidebarGroupHeader.d.ts +12 -4
- package/dist/chat/sidebar/SidebarGroupHeader.js +70 -28
- package/dist/chat/sidebar/index.d.ts +2 -2
- package/dist/chat/transcript/actions.d.ts +6 -0
- package/dist/chat/transcript/fold.d.ts +2 -1
- package/dist/chat/transcript/fold.js +26 -1
- package/dist/chat/transcript/index.js +3 -3
- package/dist/chat/transcript/notices.d.ts +5 -2
- package/dist/chat/transcript/notices.js +23 -3
- package/dist/chat/transcript/script-input.d.ts +1 -1
- package/dist/components/Avatar.d.ts +36 -0
- package/dist/components/Avatar.js +56 -0
- package/dist/components/AvatarStack.d.ts +58 -0
- package/dist/components/AvatarStack.js +187 -0
- package/dist/components/Tabs.d.ts +6 -1
- package/dist/components/Tabs.js +43 -39
- package/dist/core.css +19 -1
- package/dist/dist/{index-BsoTsm0E.d.ts → index-ChabiHpR.d.ts} +1 -1
- package/dist/dist/index.d.ts +1 -1
- package/dist/git/headless/environment.d.ts +15 -0
- package/dist/git/headless/environment.js +18 -1
- package/dist/git/headless/github.d.ts +11 -0
- package/dist/git/headless/github.js +15 -0
- package/dist/git/headless/host.d.ts +109 -0
- package/dist/git/headless/index.d.ts +5 -4
- package/dist/git/headless/index.js +4 -3
- package/dist/git/headless/labels.d.ts +16 -1
- package/dist/git/headless/labels.js +25 -1
- package/dist/git/testing/contract.d.ts +22 -4
- package/dist/git/testing/contract.js +173 -3
- package/dist/git/testing/index.d.ts +22 -1
- package/dist/git/testing/index.js +135 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/labels.d.ts +4 -0
- package/dist/labels.js +4 -0
- package/dist/onboarding/headless/labels.d.ts +4 -0
- package/dist/session/DraftPeopleStack.d.ts +24 -0
- package/dist/session/DraftPeopleStack.js +48 -0
- package/dist/session/NewProjectDialog.d.ts +28 -8
- package/dist/session/NewProjectDialog.js +225 -40
- package/dist/session/PersonCard.d.ts +29 -0
- package/dist/session/PersonCard.js +199 -0
- package/dist/session/ProjectArtifactsSection.d.ts +4 -1
- package/dist/session/ProjectArtifactsSection.js +149 -34
- package/dist/session/ProjectHome.d.ts +1 -1
- package/dist/session/ProjectHome.js +23 -4
- package/dist/session/ProjectName.d.ts +11 -6
- package/dist/session/ProjectName.js +27 -13
- package/dist/session/ProjectPeopleStack.d.ts +26 -0
- package/dist/session/ProjectPeopleStack.js +56 -0
- package/dist/session/ProjectPublishDialog.js +9 -3
- package/dist/session/ProjectSettingsDialog.d.ts +1 -1
- package/dist/session/ProjectSettingsDialog.js +171 -66
- package/dist/session/ProjectShareDialog.d.ts +1 -1
- package/dist/session/ProjectShareDialog.js +16 -6
- package/dist/session/ProjectToolsSection.js +88 -96
- package/dist/session/ProjectUsage.d.ts +4 -1
- package/dist/session/ProjectUsage.js +13 -4
- package/dist/session/SessionDetailsDialog.d.ts +5 -1
- package/dist/session/SessionDetailsDialog.js +67 -10
- package/dist/session/SessionPeopleStack.js +19 -37
- package/dist/session/SessionProjectPicker.d.ts +54 -0
- package/dist/session/SessionProjectPicker.js +175 -0
- package/dist/session/SessionProvider.d.ts +15 -1
- package/dist/session/SessionProvider.js +28 -6
- package/dist/session/UsageSection.d.ts +2 -4
- package/dist/session/UsageSection.js +57 -55
- package/dist/session/headless/draft-collab.d.ts +55 -0
- package/dist/session/headless/draft-collab.js +127 -0
- package/dist/session/headless/draft-room.d.ts +124 -0
- package/dist/session/headless/draft-room.js +340 -0
- package/dist/session/headless/drafts.d.ts +93 -0
- package/dist/session/headless/drafts.js +79 -0
- package/dist/session/headless/fixture-drafts.d.ts +54 -0
- package/dist/session/headless/fixture-drafts.js +286 -0
- package/dist/session/headless/fixture-host.d.ts +18 -2
- package/dist/session/headless/fixture-host.js +41 -7
- package/dist/session/headless/fixture-projects.d.ts +6 -4
- package/dist/session/headless/fixture-projects.js +25 -4
- package/dist/session/headless/host.d.ts +34 -6
- package/dist/session/headless/index.d.ts +6 -3
- package/dist/session/headless/index.js +6 -3
- package/dist/session/headless/labels.d.ts +47 -2
- package/dist/session/headless/labels.js +17 -1
- package/dist/session/headless/people.d.ts +27 -3
- package/dist/session/headless/people.js +38 -20
- package/dist/session/headless/project-artifact-labels.d.ts +7 -0
- package/dist/session/headless/project-artifact-labels.js +7 -0
- package/dist/session/headless/project-artifacts.d.ts +8 -0
- package/dist/session/headless/project-artifacts.js +15 -1
- package/dist/session/headless/project-labels.d.ts +25 -0
- package/dist/session/headless/project-labels.js +25 -0
- package/dist/session/headless/shared-with.d.ts +28 -0
- package/dist/session/headless/shared-with.js +51 -0
- package/dist/session/host-context.d.ts +11 -0
- package/dist/session/host-context.js +14 -0
- package/dist/session/index.d.ts +7 -3
- package/dist/session/index.js +6 -2
- package/dist/session/new-project-parts.d.ts +67 -0
- package/dist/session/new-project-parts.js +470 -0
- package/dist/session/project-artifact-parts.d.ts +2 -1
- package/dist/session/project-artifact-parts.js +5 -2
- package/dist/session/project-people.d.ts +14 -0
- package/dist/session/project-people.js +86 -0
- package/dist/session/share-people.d.ts +12 -0
- package/dist/session/share-people.js +1 -1
- package/dist/session/testing/contract.d.ts +6 -3
- package/dist/session/testing/contract.js +24 -3
- package/dist/session/testing/drafts.contract.d.ts +30 -0
- package/dist/session/testing/drafts.contract.js +126 -0
- package/dist/session/testing/index.d.ts +2 -1
- package/dist/session/testing/index.js +2 -1
- package/dist/session/use-home-projects.d.ts +11 -2
- package/dist/session/use-home-projects.js +142 -5
- package/dist/session/useDraftCollab.d.ts +24 -0
- package/dist/session/useDraftCollab.js +78 -0
- package/dist/settings/headless/search.d.ts +1 -1
- package/dist/settings/index.js +3 -3
- package/dist/settings/sections/providers/CredentialSources.d.ts +5 -5
- package/dist/settings/sections/providers/CredentialSources.js +5 -22
- package/dist/settings/sections/providers/labels.d.ts +1 -9
- package/dist/settings/sections/providers/labels.js +1 -9
- package/dist/styles.css +20 -9
- package/package.json +4 -3
- package/src/styles/sidebar.css +2 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useReadable } from "../chat/headless/store.js";
|
|
1
|
+
import { constant, useReadable } from "../chat/headless/store.js";
|
|
2
2
|
import { errorMessage } from "../components/report-error.js";
|
|
3
3
|
import { Tooltip, useTooltip } from "../components/Tooltip.js";
|
|
4
4
|
import { RoutedLink } from "../extensions/links.js";
|
|
@@ -35,18 +35,21 @@ const KIND_GLYPH = {
|
|
|
35
35
|
function artifactKindGlyph(kind, icon) {
|
|
36
36
|
return icon || (KIND_GLYPH[kind] ?? "i-ph-cube");
|
|
37
37
|
}
|
|
38
|
+
const NO_ROWS = constant(null);
|
|
38
39
|
/**
|
|
39
40
|
* Reads a project's artifacts: `fresh` reads them again on mount (a dialog that opens), else once if never read.
|
|
41
|
+
* Without `artifacts` (a host with none) it reads nothing and holds no rows.
|
|
40
42
|
*
|
|
41
43
|
* @param artifacts - The host's artifacts.
|
|
42
44
|
* @param projectId - The project.
|
|
43
45
|
* @param fresh - Read again on mount.
|
|
44
46
|
*/
|
|
45
47
|
function useArtifactsRead(artifacts, projectId, fresh) {
|
|
46
|
-
const rows = useReadable(useMemo(() => artifacts
|
|
48
|
+
const rows = useReadable(useMemo(() => artifacts?.view(projectId) ?? NO_ROWS, [artifacts, projectId]));
|
|
47
49
|
const [failed, setFailed] = useState(null);
|
|
48
50
|
const [attempt, setAttempt] = useState(0);
|
|
49
51
|
useEffect(() => {
|
|
52
|
+
if (!artifacts) return void 0;
|
|
50
53
|
if (!fresh && attempt === 0) {
|
|
51
54
|
artifacts.ensure(projectId);
|
|
52
55
|
return;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SessionProjectSharing } from "./headless/host.js";
|
|
2
|
+
/** Props for {@link ProjectPeopleList}. */
|
|
3
|
+
export interface ProjectPeopleListProps {
|
|
4
|
+
projectId: string;
|
|
5
|
+
sharing: SessionProjectSharing;
|
|
6
|
+
/** Bumped to read who shares it again. */
|
|
7
|
+
reads: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The people of a project, as rows of its Sharing section.
|
|
11
|
+
*
|
|
12
|
+
* @param props - The {@link ProjectPeopleListProps}.
|
|
13
|
+
*/
|
|
14
|
+
export declare function ProjectPeopleList({ projectId, sharing, reads }: ProjectPeopleListProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { errorMessage } from "../components/report-error.js";
|
|
2
|
+
import { Skeleton } from "../components/Skeleton.js";
|
|
3
|
+
import { ROW, SectionRetry } from "./project-settings-parts.js";
|
|
4
|
+
import { Face, PersonName } from "./share-people.js";
|
|
5
|
+
import { useSessionLabels } from "./useSessionLabels.js";
|
|
6
|
+
import { useEffect, useState } from "react";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
// src/session/project-people.tsx
|
|
9
|
+
/**
|
|
10
|
+
* The people of a project, as rows of its Sharing section.
|
|
11
|
+
*
|
|
12
|
+
* @param props - The {@link ProjectPeopleListProps}.
|
|
13
|
+
*/
|
|
14
|
+
function ProjectPeopleList({ projectId, sharing, reads }) {
|
|
15
|
+
const labels = useSessionLabels();
|
|
16
|
+
const [view, setView] = useState(null);
|
|
17
|
+
const [attempt, setAttempt] = useState(0);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
let live = true;
|
|
20
|
+
sharing.get(projectId).then((next) => live && setView(next), (err) => live && setView({ failed: errorMessage(err) }));
|
|
21
|
+
return () => {
|
|
22
|
+
live = false;
|
|
23
|
+
};
|
|
24
|
+
}, [
|
|
25
|
+
sharing,
|
|
26
|
+
projectId,
|
|
27
|
+
reads,
|
|
28
|
+
attempt
|
|
29
|
+
]);
|
|
30
|
+
if (view === null) return /* @__PURE__ */ jsx("div", {
|
|
31
|
+
role: "status",
|
|
32
|
+
"aria-busy": "true",
|
|
33
|
+
"aria-label": labels.projectPeopleLoading,
|
|
34
|
+
children: [120, 96].map((width) => /* @__PURE__ */ jsxs("span", {
|
|
35
|
+
"aria-hidden": true,
|
|
36
|
+
className: ROW,
|
|
37
|
+
children: [/* @__PURE__ */ jsx(Skeleton, {
|
|
38
|
+
width: 28,
|
|
39
|
+
height: 28,
|
|
40
|
+
className: "rounded-full"
|
|
41
|
+
}), /* @__PURE__ */ jsx(Skeleton, {
|
|
42
|
+
width,
|
|
43
|
+
height: 12
|
|
44
|
+
})]
|
|
45
|
+
}, width))
|
|
46
|
+
});
|
|
47
|
+
if ("failed" in view) return /* @__PURE__ */ jsx(SectionRetry, {
|
|
48
|
+
message: labels.projectShareLoadFailed,
|
|
49
|
+
detail: view.failed,
|
|
50
|
+
retry: () => {
|
|
51
|
+
setView(null);
|
|
52
|
+
setAttempt((n) => n + 1);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
const people = [...view.owner ? [{
|
|
56
|
+
person: view.owner,
|
|
57
|
+
grant: labels.projectShareOwner
|
|
58
|
+
}] : [], ...view.members.map((member) => ({
|
|
59
|
+
person: member,
|
|
60
|
+
grant: labels.projectShareGrants[member.grant]
|
|
61
|
+
}))];
|
|
62
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("ul", {
|
|
63
|
+
"aria-label": labels.projectPeopleList,
|
|
64
|
+
"data-testid": "project-people",
|
|
65
|
+
className: "m-0 p-0 list-none flex flex-col",
|
|
66
|
+
children: people.map(({ person, grant }) => /* @__PURE__ */ jsxs("li", {
|
|
67
|
+
className: ROW,
|
|
68
|
+
"data-testid": `project-person-${person.userId}`,
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ jsx(Face, { person }),
|
|
71
|
+
/* @__PURE__ */ jsx(PersonName, { person }),
|
|
72
|
+
/* @__PURE__ */ jsx("span", {
|
|
73
|
+
className: "shrink-0 max-sm:ml-9 text-zg-label text-[var(--zg-text-muted)]",
|
|
74
|
+
children: grant
|
|
75
|
+
})
|
|
76
|
+
]
|
|
77
|
+
}, person.userId))
|
|
78
|
+
}), view.members.length === 0 && /* @__PURE__ */ jsx("div", {
|
|
79
|
+
className: ROW,
|
|
80
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
81
|
+
className: "text-xs text-[var(--zg-text-muted)]",
|
|
82
|
+
children: labels.projectPeopleOnlyOwner
|
|
83
|
+
})
|
|
84
|
+
})] });
|
|
85
|
+
}
|
|
86
|
+
export { ProjectPeopleList };
|
|
@@ -83,6 +83,18 @@ export declare function useShareDialog<V>(source: ShareSource<V> | undefined, id
|
|
|
83
83
|
busy: boolean;
|
|
84
84
|
run: (change: () => Promise<V | void>, { done, failed: refused }?: RunOptions) => void;
|
|
85
85
|
};
|
|
86
|
+
/** A person's photo, else the first letter of their name. */
|
|
87
|
+
export declare function Face({ person }: {
|
|
88
|
+
person: ParticipantView;
|
|
89
|
+
}): import("react").JSX.Element;
|
|
90
|
+
/**
|
|
91
|
+
* The name over the email, in the muted voice: each line has the column's whole width, so a long name never cuts an
|
|
92
|
+
* email that fits. Either line is cut short only past that width, the whole in a tooltip. A person with no name: the
|
|
93
|
+
* email alone.
|
|
94
|
+
*/
|
|
95
|
+
export declare function PersonName({ person }: {
|
|
96
|
+
person: ParticipantView;
|
|
97
|
+
}): import("react").JSX.Element;
|
|
86
98
|
/** The lines under the title: what each armed step does, else what the dialog is about. */
|
|
87
99
|
export interface ShareLeadWords {
|
|
88
100
|
idle: string;
|
|
@@ -454,4 +454,4 @@ function ShareLeave({ prefix, busy, armed, label, confirm, onClick }) {
|
|
|
454
454
|
children: armed ? confirm : label
|
|
455
455
|
});
|
|
456
456
|
}
|
|
457
|
-
export { ACTION_COL, GRANT_COL, SHARE_PICKER, SHARE_ROW, ShareInviteRow, ShareLeave, ShareLoading, ShareMembers, ShareOpenRow, SharePanel, ShareRetry, ShareTransferBar, ShareTransferOpen, personName, useShareDialog };
|
|
457
|
+
export { ACTION_COL, Face, GRANT_COL, PersonName, SHARE_PICKER, SHARE_ROW, ShareInviteRow, ShareLeave, ShareLoading, ShareMembers, ShareOpenRow, SharePanel, ShareRetry, ShareTransferBar, ShareTransferOpen, personName, useShareDialog };
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
* so a message added to the queue waits there (delivered `queued`); removing, editing or pushing an
|
|
17
17
|
* entry announces the queue; pushing an entry that is gone answers `missing`; removing an artifact
|
|
18
18
|
* announces the change; cancelling work removes it (`all`: every item) and announces the session's work;
|
|
19
|
-
* a fork answers a new session id;
|
|
19
|
+
* a fork answers a new session id; moving a session to a project files it there (`null`: Chats) as `projects.sessions`
|
|
20
|
+
* then answers, and a project it does not have is refused; editing a turn's text replaces its text blocks; deleting a turn removes
|
|
20
21
|
* it; generating a title answers a non-empty title, an export a path; the usage summary of a range covers
|
|
21
22
|
* that range; saving a secret stores its entry (name, expiry, the saving session; never the value) and
|
|
22
23
|
* announces a change, revoking one removes it and announces a change; the reminders are served as
|
|
@@ -33,10 +34,11 @@
|
|
|
33
34
|
*/
|
|
34
35
|
import { Project as Project$1, ProjectPublishTarget, PromptAttachment, RunningWorkItem as RunningWorkItem$1, Schedule as Schedule$1, ScheduleFire as ScheduleFire$1, SessionArtifact, SessionHost, SessionSecretEntry, SessionTurn, TodoItem } from "../headless/host.js";
|
|
35
36
|
import { SessionHostContractContent } from "./project-content.contract.js";
|
|
37
|
+
import { SessionDraftsHarness, describeSessionDraftsContract } from "./drafts.contract.js";
|
|
36
38
|
import { ProjectArtifact, ProjectContentInput } from "zidane/chat/pure";
|
|
37
39
|
import { ParticipantView, ProjectGrant, SessionRow } from "zidane/ipc";
|
|
38
40
|
/** An optional `SessionHost` member, by its path. */
|
|
39
|
-
export type SessionHostCapability = 'plans' | 'plans.edit' | 'plans.control' | 'plans.retry' | 'queue' | 'queue.add' | 'queue.remove' | 'queue.update' | 'queue.attachments' | 'queue.pushNow' | 'artifacts' | 'artifacts.remove' | 'artifacts.refreshRow' | 'runningWork' | 'runningWork.cancel' | 'turns' | 'turns.fork' | 'turns.editText' | 'turns.delete' | 'turns.rewind' | 'details' | 'details.titleStatus' | 'details.generateTitle' | 'details.export' | 'details.compact' | 'details.setFolder' | 'details.cacheReport' | 'usage' | 'usage.summary' | 'usage.providers' | 'usage.github' | 'usage.redeemReset' | 'side' | 'side.subscribe' | 'secrets' | 'secrets.save' | 'secrets.revoke' | 'schedules' | 'schedules.create' | 'schedules.update' | 'schedules.remove' | 'schedules.runNow' | 'schedules.fires' | 'projects' | 'projects.resolve' | 'projects.sessionProjects' | 'projects.create' | 'projects.update' | 'projects.delete' | 'projects.setSettings' | 'projects.folderExists' | 'projects.pickFolder' | 'projects.mcpServers' | 'projects.mcpSignOut' | 'projects.mcpSignIns' | 'projects.mcpSignIn' | 'projects.sharing' | 'projects.publish' | 'projects.content' | 'projects.content.put' | 'projects.content.remove' | 'projects.content.restore' | 'projects.content.saveToRepo' | 'projects.artifacts' | 'projects.artifacts.add' | 'projects.artifacts.pin' | 'projects.artifacts.unpin' | 'projects.artifacts.remove' | 'projects.sessions' | 'projects.main' | 'projects.sharing.setSessionAccess';
|
|
41
|
+
export type SessionHostCapability = 'plans' | 'plans.edit' | 'plans.control' | 'plans.retry' | 'queue' | 'queue.add' | 'queue.remove' | 'queue.update' | 'queue.attachments' | 'queue.pushNow' | 'artifacts' | 'artifacts.remove' | 'artifacts.refreshRow' | 'runningWork' | 'runningWork.cancel' | 'turns' | 'turns.fork' | 'turns.editText' | 'turns.delete' | 'turns.rewind' | 'details' | 'details.titleStatus' | 'details.generateTitle' | 'details.export' | 'details.compact' | 'details.setFolder' | 'details.setProject' | 'details.cacheReport' | 'usage' | 'usage.summary' | 'usage.providers' | 'usage.github' | 'usage.redeemReset' | 'side' | 'side.subscribe' | 'secrets' | 'secrets.save' | 'secrets.revoke' | 'schedules' | 'schedules.create' | 'schedules.update' | 'schedules.remove' | 'schedules.runNow' | 'schedules.fires' | 'projects' | 'projects.resolve' | 'projects.sessionProjects' | 'projects.create' | 'projects.update' | 'projects.delete' | 'projects.setSettings' | 'projects.folderExists' | 'projects.pickFolder' | 'projects.mcpServers' | 'projects.mcpSignOut' | 'projects.mcpSignIns' | 'projects.mcpSignIn' | 'projects.sharing' | 'projects.publish' | 'projects.content' | 'projects.content.put' | 'projects.content.remove' | 'projects.content.restore' | 'projects.content.saveToRepo' | 'projects.artifacts' | 'projects.artifacts.add' | 'projects.artifacts.pin' | 'projects.artifacts.unpin' | 'projects.artifacts.remove' | 'projects.sessions' | 'projects.main' | 'projects.sharing.setSessionAccess' | 'projectsOf';
|
|
40
42
|
/** A queued message the backend holds, with its attachments' bytes. */
|
|
41
43
|
export interface SessionHostContractEntry {
|
|
42
44
|
/** The entry's id. */
|
|
@@ -154,4 +156,5 @@ export declare function contractSessionBackend(): SessionHostContractBackend;
|
|
|
154
156
|
* @param makeHarness - Builds a fresh host over a backend that holds what it is given, once per test.
|
|
155
157
|
* @param capabilities - The optional members the host offers. Every other optional member must be undefined.
|
|
156
158
|
*/
|
|
157
|
-
export declare function describeSessionHostContract(name: string, makeHarness: SessionHostHarnessFactory, capabilities: readonly SessionHostCapability[]): void;
|
|
159
|
+
export declare function describeSessionHostContract(name: string, makeHarness: SessionHostHarnessFactory, capabilities: readonly SessionHostCapability[]): void;
|
|
160
|
+
export { type SessionDraftsHarness, describeSessionDraftsContract };
|
|
@@ -3,6 +3,7 @@ import { createSessionActions } from "../headless/session-actions.js";
|
|
|
3
3
|
import { contractProjectArtifacts, describeProjectArtifactsContract } from "./project-artifacts.contract.js";
|
|
4
4
|
import { contractProjectContent, describeProjectContentContract } from "./project-content.contract.js";
|
|
5
5
|
import { contractSessionRows, describeProjectSessionsContract } from "./project-sessions.contract.js";
|
|
6
|
+
import { describeSessionDraftsContract } from "./drafts.contract.js";
|
|
6
7
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
7
8
|
// src/session/testing/contract.ts
|
|
8
9
|
const CAPABILITIES = [
|
|
@@ -32,6 +33,7 @@ const CAPABILITIES = [
|
|
|
32
33
|
"details.export",
|
|
33
34
|
"details.compact",
|
|
34
35
|
"details.setFolder",
|
|
36
|
+
"details.setProject",
|
|
35
37
|
"details.cacheReport",
|
|
36
38
|
"usage",
|
|
37
39
|
"usage.summary",
|
|
@@ -76,7 +78,8 @@ const CAPABILITIES = [
|
|
|
76
78
|
"projects.artifacts.remove",
|
|
77
79
|
"projects.sessions",
|
|
78
80
|
"projects.main",
|
|
79
|
-
"projects.sharing.setSessionAccess"
|
|
81
|
+
"projects.sharing.setSessionAccess",
|
|
82
|
+
"projectsOf"
|
|
80
83
|
];
|
|
81
84
|
/** The capabilities that are an object of methods, not one method. */
|
|
82
85
|
const GROUPS = /* @__PURE__ */ new Set([
|
|
@@ -86,6 +89,8 @@ const GROUPS = /* @__PURE__ */ new Set([
|
|
|
86
89
|
"projects.sessions",
|
|
87
90
|
"projects.artifacts"
|
|
88
91
|
]);
|
|
92
|
+
/** The top-level capabilities that are one method. */
|
|
93
|
+
const METHODS = /* @__PURE__ */ new Set(["projectsOf"]);
|
|
89
94
|
function artifact(id, kind, label) {
|
|
90
95
|
return {
|
|
91
96
|
id,
|
|
@@ -353,7 +358,7 @@ function describeSessionHostContract(name, makeHarness, capabilities) {
|
|
|
353
358
|
expect(value, capability).toBeUndefined();
|
|
354
359
|
continue;
|
|
355
360
|
}
|
|
356
|
-
expect(typeof value, capability).toBe(capability.includes(".") && !GROUPS.has(capability) ? "function" : "object");
|
|
361
|
+
expect(typeof value, capability).toBe(capability.includes(".") && !GROUPS.has(capability) || METHODS.has(capability) ? "function" : "object");
|
|
357
362
|
}
|
|
358
363
|
if (has("plans")) expect(typeof host.plans?.snapshot).toBe("function");
|
|
359
364
|
if (has("queue")) expect(typeof host.queue?.items).toBe("function");
|
|
@@ -799,6 +804,13 @@ function describeSessionHostContract(name, makeHarness, capabilities) {
|
|
|
799
804
|
"Ideas"
|
|
800
805
|
]));
|
|
801
806
|
});
|
|
807
|
+
it.skipIf(!has("projectsOf"))("projectsOf gives its own projects for no id, none for a host it does not reach, one store per id", async () => {
|
|
808
|
+
const { host } = await setup();
|
|
809
|
+
expect(host.projectsOf().get()).toBe(host.projects);
|
|
810
|
+
expect(host.projectsOf()).toBe(host.projectsOf());
|
|
811
|
+
expect(host.projectsOf("zz-unreached-host").get()).toBeUndefined();
|
|
812
|
+
expect(host.projectsOf("zz-unreached-host")).toBe(host.projectsOf("zz-unreached-host"));
|
|
813
|
+
});
|
|
802
814
|
it.skipIf(!has("projects.resolve"))("resolve answers the longest home that holds a folder, makes none", async () => {
|
|
803
815
|
const { host } = await setup();
|
|
804
816
|
expect((await host.projects.resolve("/w/app/api/src"))?.id).toBe("p-api");
|
|
@@ -1086,6 +1098,15 @@ function describeSessionHostContract(name, makeHarness, capabilities) {
|
|
|
1086
1098
|
await expect(host.details.setFolder("s-1", "/work/app")).resolves.toBeUndefined();
|
|
1087
1099
|
await expect(host.details.setFolder("s-1", null)).resolves.toBeUndefined();
|
|
1088
1100
|
});
|
|
1101
|
+
it.skipIf(!has("details.setProject"))("setProject files a session in a project, then in Chats, and refuses a project the host does not have", async () => {
|
|
1102
|
+
const { host } = await setup();
|
|
1103
|
+
const filedIn = async () => has("projects.sessionProjects") ? (await host.projects.sessionProjects())["s-2"] : void 0;
|
|
1104
|
+
await expect(host.details.setProject("s-2", "p-app")).resolves.toBeUndefined();
|
|
1105
|
+
if (has("projects.sessionProjects")) expect(await filedIn()).toBe("p-app");
|
|
1106
|
+
await expect(host.details.setProject("s-2", null)).resolves.toBeUndefined();
|
|
1107
|
+
expect(await filedIn()).toBeUndefined();
|
|
1108
|
+
await expect(host.details.setProject("s-2", "p-none")).rejects.toThrow();
|
|
1109
|
+
});
|
|
1089
1110
|
it.skipIf(!has("details.cacheReport"))("cacheReport answers the requests and their cache numbers, or null", async () => {
|
|
1090
1111
|
const { host } = await setup();
|
|
1091
1112
|
const report = await host.details.cacheReport("s-1");
|
|
@@ -1141,4 +1162,4 @@ function describeSessionHostContract(name, makeHarness, capabilities) {
|
|
|
1141
1162
|
});
|
|
1142
1163
|
});
|
|
1143
1164
|
}
|
|
1144
|
-
export { contractSessionBackend, describeSessionHostContract };
|
|
1165
|
+
export { contractSessionBackend, describeSessionDraftsContract, describeSessionHostContract };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shared suite every implementation of `SessionSharingHost.drafts` runs (docs/MULTIPLAYER.md, Collaborative
|
|
3
|
+
* drafts): who drafts in a session, kept from the first read and the signals, read again after a reconnect; a draft
|
|
4
|
+
* room's calls answered by its authority; its signals; and the caller's id.
|
|
5
|
+
*
|
|
6
|
+
* The harness's backend holds session `s1` (`SessionDraftsHarness.sessionId` as the implementation keys it), shared, in which the caller is `u-ann` and Bob (`u-bob`, named `Bob`)
|
|
7
|
+
* drafts `bob drafts` from a window that edits drafts together. It is the central authority of Bob's draft (a fresh
|
|
8
|
+
* room at version 0, from that text), and its server tells people drafting when `drafting` says so.
|
|
9
|
+
*/
|
|
10
|
+
import { DraftRoomSignal, DraftingPerson, SessionDrafts } from "../headless/drafts.js";
|
|
11
|
+
/** One implementation over its scripted backend. */
|
|
12
|
+
export interface SessionDraftsHarness {
|
|
13
|
+
/** The implementation under test. */
|
|
14
|
+
drafts: SessionDrafts;
|
|
15
|
+
/** The backend says someone starts (`on`) or stops drafting in `s1`. */
|
|
16
|
+
drafting: (person: DraftingPerson, on: boolean) => void;
|
|
17
|
+
/** The backend sends a room signal. */
|
|
18
|
+
signal: (signal: DraftRoomSignal) => void;
|
|
19
|
+
/** The connection to the backend drops and comes back. */
|
|
20
|
+
reconnect: () => void;
|
|
21
|
+
/** Session `s1` as the implementation keys it (the desktop app's key on its server). Default `s1`. */
|
|
22
|
+
sessionId?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Runs the drafts suite against an implementation.
|
|
26
|
+
*
|
|
27
|
+
* @param name - The implementation's name, in the suite's title.
|
|
28
|
+
* @param makeHarness - Builds the implementation over a fresh backend.
|
|
29
|
+
*/
|
|
30
|
+
export declare function describeSessionDraftsContract(name: string, makeHarness: () => Promise<SessionDraftsHarness> | SessionDraftsHarness): void;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from "vitest";
|
|
2
|
+
// src/session/testing/drafts.contract.ts
|
|
3
|
+
const STEP = {
|
|
4
|
+
stepType: "replace",
|
|
5
|
+
from: 1,
|
|
6
|
+
to: 1,
|
|
7
|
+
slice: { content: [{
|
|
8
|
+
type: "text",
|
|
9
|
+
text: "a"
|
|
10
|
+
}] }
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Runs the drafts suite against an implementation.
|
|
14
|
+
*
|
|
15
|
+
* @param name - The implementation's name, in the suite's title.
|
|
16
|
+
* @param makeHarness - Builds the implementation over a fresh backend.
|
|
17
|
+
*/
|
|
18
|
+
function describeSessionDraftsContract(name, makeHarness) {
|
|
19
|
+
describe(`SessionDrafts contract: ${name}`, () => {
|
|
20
|
+
it("names the caller on the session's server", async () => {
|
|
21
|
+
const { drafts, sessionId = "s1" } = await makeHarness();
|
|
22
|
+
expect(drafts.self(sessionId)).toBe("u-ann");
|
|
23
|
+
});
|
|
24
|
+
it("lists who drafts from the first read, then from each signal, newest first", async () => {
|
|
25
|
+
const harness = await makeHarness();
|
|
26
|
+
const seen = [];
|
|
27
|
+
const stop = harness.drafts.drafting.watch(harness.sessionId ?? "s1", (people) => seen.push(people));
|
|
28
|
+
await vi.waitFor(() => expect(seen.at(-1)?.map((p) => p.userId)).toEqual(["u-bob"]));
|
|
29
|
+
expect(seen.at(-1)[0]).toMatchObject({
|
|
30
|
+
userId: "u-bob",
|
|
31
|
+
name: "Bob"
|
|
32
|
+
});
|
|
33
|
+
harness.drafting({
|
|
34
|
+
userId: "u-cy",
|
|
35
|
+
name: "Cy",
|
|
36
|
+
since: Number.MAX_SAFE_INTEGER
|
|
37
|
+
}, true);
|
|
38
|
+
await vi.waitFor(() => expect(seen.at(-1)?.map((p) => p.userId)).toEqual(["u-cy", "u-bob"]));
|
|
39
|
+
harness.drafting({
|
|
40
|
+
userId: "u-bob",
|
|
41
|
+
name: "Bob",
|
|
42
|
+
since: 0
|
|
43
|
+
}, false);
|
|
44
|
+
await vi.waitFor(() => expect(seen.at(-1)?.map((p) => p.userId)).toEqual(["u-cy"]));
|
|
45
|
+
stop();
|
|
46
|
+
});
|
|
47
|
+
it("hears a reconnect", async () => {
|
|
48
|
+
const harness = await makeHarness();
|
|
49
|
+
const heard = vi.fn();
|
|
50
|
+
const stop = harness.drafts.onReconnect?.(heard);
|
|
51
|
+
expect(stop).toBeTypeOf("function");
|
|
52
|
+
harness.reconnect();
|
|
53
|
+
await vi.waitFor(() => expect(heard).toHaveBeenCalled());
|
|
54
|
+
stop?.();
|
|
55
|
+
});
|
|
56
|
+
it("joins Bob's draft from his text, pushes at its version, catches up, snapshots and leaves", async () => {
|
|
57
|
+
const { drafts, sessionId: s1 = "s1" } = await makeHarness();
|
|
58
|
+
const state = await drafts.join(s1, "u-bob", "c1");
|
|
59
|
+
expect(state).toMatchObject({
|
|
60
|
+
version: 0,
|
|
61
|
+
base: 0,
|
|
62
|
+
doc: null,
|
|
63
|
+
text: "bob drafts",
|
|
64
|
+
steps: [],
|
|
65
|
+
clientIds: []
|
|
66
|
+
});
|
|
67
|
+
expect(state.people.map((p) => p.userId)).toEqual(["u-bob", "u-ann"]);
|
|
68
|
+
const room = state.room;
|
|
69
|
+
expect(await drafts.push(s1, "u-bob", room, 0, [STEP], "c1")).toEqual({
|
|
70
|
+
ok: true,
|
|
71
|
+
version: 1
|
|
72
|
+
});
|
|
73
|
+
expect(await drafts.push(s1, "u-bob", room, 0, [STEP], "c1")).toEqual({
|
|
74
|
+
ok: false,
|
|
75
|
+
version: 1
|
|
76
|
+
});
|
|
77
|
+
expect(await drafts.since(s1, "u-bob", room, 0)).toEqual({
|
|
78
|
+
kind: "steps",
|
|
79
|
+
room,
|
|
80
|
+
base: 0,
|
|
81
|
+
steps: [STEP],
|
|
82
|
+
clientIds: ["c1"]
|
|
83
|
+
});
|
|
84
|
+
await expect(drafts.snapshot(s1, "u-bob", room, 1, { type: "doc" }, "bob drafts a")).resolves.toBeUndefined();
|
|
85
|
+
await expect(drafts.leave(s1, "u-bob", "c1")).resolves.toBeUndefined();
|
|
86
|
+
expect(await drafts.join(s1, "u-ann", "c2", { ifOpen: true })).toBeNull();
|
|
87
|
+
});
|
|
88
|
+
it("hands each room signal on as the backend sent it", async () => {
|
|
89
|
+
const harness = await makeHarness();
|
|
90
|
+
const s1 = harness.sessionId ?? "s1";
|
|
91
|
+
const seen = [];
|
|
92
|
+
const stop = harness.drafts.onSignal((signal) => seen.push(signal));
|
|
93
|
+
const signals = [
|
|
94
|
+
{
|
|
95
|
+
kind: "draft:steps",
|
|
96
|
+
sessionId: s1,
|
|
97
|
+
ownerId: "u-bob",
|
|
98
|
+
room: "r1",
|
|
99
|
+
version: 3,
|
|
100
|
+
steps: [STEP],
|
|
101
|
+
clientIds: ["c9"]
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
kind: "draft:room",
|
|
105
|
+
sessionId: s1,
|
|
106
|
+
ownerId: "u-bob",
|
|
107
|
+
room: "r1",
|
|
108
|
+
people: [{
|
|
109
|
+
userId: "u-bob",
|
|
110
|
+
name: "Bob"
|
|
111
|
+
}]
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
kind: "draft:reset",
|
|
115
|
+
sessionId: s1,
|
|
116
|
+
ownerId: "u-bob",
|
|
117
|
+
room: "r1"
|
|
118
|
+
}
|
|
119
|
+
];
|
|
120
|
+
for (const signal of signals) harness.signal(signal);
|
|
121
|
+
await vi.waitFor(() => expect(seen).toEqual(signals));
|
|
122
|
+
stop();
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
export { describeSessionDraftsContract };
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* (`createFixtureSessionHost`) and demo data, for docs, demos, galleries and
|
|
4
4
|
* an app's own tests. Not for production hosts.
|
|
5
5
|
*/
|
|
6
|
+
import { FixtureDraftConnection, FixtureDraftServer, FixtureDraftServerOptions, createFixtureDraftServer } from "../headless/fixture-drafts.js";
|
|
6
7
|
import { FixtureQueuedEntry, FixtureSessionControl, FixtureSessionHost, SessionFixture, SessionSharingFixture, createFixtureSessionHost } from "../headless/fixture-host.js";
|
|
7
8
|
import { FixturePlansBackend, FixturePlansSeed, createFixturePlansBackend, planOf, plansSnapshotOf, tallyTodos } from "../headless/fixture-plans.js";
|
|
8
9
|
import { FixtureProjectArtifacts, FixtureProjectArtifactsDeps, FixtureProjectArtifactsOptions, FixtureRecordedArtifact, createFixtureProjectArtifacts } from "../headless/fixture-project-artifacts.js";
|
|
@@ -11,4 +12,4 @@ import { FIXTURE_MCP_SIGN_IN_URL, FixtureProjectBackend, FixtureProjectOptions,
|
|
|
11
12
|
import { FixtureScheduleBackend, FixtureScheduleOptions, SCHEDULES_OFF_MESSAGE, createFixtureScheduleBackend } from "../headless/fixture-schedules.js";
|
|
12
13
|
import { DEMO_ARTIFACT_KIND_LABELS, DEMO_GITHUB_USAGE, DEMO_PROVIDER_USAGE, DEMO_SESSION_FIXTURE, DEMO_TURNS, demoUsageSummary } from "./demo.js";
|
|
13
14
|
import { WORST_CASE_SESSION_HEADER } from "./worst-case.js";
|
|
14
|
-
export { DEMO_ARTIFACT_KIND_LABELS, DEMO_GITHUB_USAGE, DEMO_PROVIDER_USAGE, DEMO_SESSION_FIXTURE, DEMO_TURNS, FIXTURE_MCP_SIGN_IN_URL, FixturePlansBackend, FixturePlansSeed, FixtureProjectArtifacts, FixtureProjectArtifactsDeps, FixtureProjectArtifactsOptions, FixtureProjectBackend, FixtureProjectContent, FixtureProjectContentDeps, FixtureProjectContentOptions, FixtureProjectOptions, FixtureProjectOrganization, FixtureProjectShare, FixtureProjectSharing, FixturePublishTarget, FixtureQueuedEntry, FixtureRecordedArtifact, FixtureScheduleBackend, FixtureScheduleOptions, FixtureSessionControl, FixtureSessionHost, SCHEDULES_OFF_MESSAGE, SessionFixture, SessionSharingFixture, WORST_CASE_SESSION_HEADER, createFixturePlansBackend, createFixtureProjectArtifacts, createFixtureProjectBackend, createFixtureProjectContent, createFixtureScheduleBackend, createFixtureSessionHost, createFixtureSessionProjects, demoUsageSummary, planOf, plansSnapshotOf, tallyTodos };
|
|
15
|
+
export { DEMO_ARTIFACT_KIND_LABELS, DEMO_GITHUB_USAGE, DEMO_PROVIDER_USAGE, DEMO_SESSION_FIXTURE, DEMO_TURNS, FIXTURE_MCP_SIGN_IN_URL, FixtureDraftConnection, FixtureDraftServer, FixtureDraftServerOptions, FixturePlansBackend, FixturePlansSeed, FixtureProjectArtifacts, FixtureProjectArtifactsDeps, FixtureProjectArtifactsOptions, FixtureProjectBackend, FixtureProjectContent, FixtureProjectContentDeps, FixtureProjectContentOptions, FixtureProjectOptions, FixtureProjectOrganization, FixtureProjectShare, FixtureProjectSharing, FixturePublishTarget, FixtureQueuedEntry, FixtureRecordedArtifact, FixtureScheduleBackend, FixtureScheduleOptions, FixtureSessionControl, FixtureSessionHost, SCHEDULES_OFF_MESSAGE, SessionFixture, SessionSharingFixture, WORST_CASE_SESSION_HEADER, createFixtureDraftServer, createFixturePlansBackend, createFixtureProjectArtifacts, createFixtureProjectBackend, createFixtureProjectContent, createFixtureScheduleBackend, createFixtureSessionHost, createFixtureSessionProjects, demoUsageSummary, planOf, plansSnapshotOf, tallyTodos };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createFixtureDraftServer } from "../headless/fixture-drafts.js";
|
|
1
2
|
import { createFixtureSessionHost } from "../headless/fixture-host.js";
|
|
2
3
|
import { createFixturePlansBackend, planOf, plansSnapshotOf, tallyTodos } from "../headless/fixture-plans.js";
|
|
3
4
|
import { createFixtureProjectArtifacts } from "../headless/fixture-project-artifacts.js";
|
|
@@ -6,4 +7,4 @@ import { FIXTURE_MCP_SIGN_IN_URL, createFixtureProjectBackend, createFixtureSess
|
|
|
6
7
|
import { SCHEDULES_OFF_MESSAGE, createFixtureScheduleBackend } from "../headless/fixture-schedules.js";
|
|
7
8
|
import { DEMO_ARTIFACT_KIND_LABELS, DEMO_GITHUB_USAGE, DEMO_PROVIDER_USAGE, DEMO_SESSION_FIXTURE, DEMO_TURNS, demoUsageSummary } from "./demo.js";
|
|
8
9
|
import { WORST_CASE_SESSION_HEADER } from "./worst-case.js";
|
|
9
|
-
export { DEMO_ARTIFACT_KIND_LABELS, DEMO_GITHUB_USAGE, DEMO_PROVIDER_USAGE, DEMO_SESSION_FIXTURE, DEMO_TURNS, FIXTURE_MCP_SIGN_IN_URL, SCHEDULES_OFF_MESSAGE, WORST_CASE_SESSION_HEADER, createFixturePlansBackend, createFixtureProjectArtifacts, createFixtureProjectBackend, createFixtureProjectContent, createFixtureScheduleBackend, createFixtureSessionHost, createFixtureSessionProjects, demoUsageSummary, planOf, plansSnapshotOf, tallyTodos };
|
|
10
|
+
export { DEMO_ARTIFACT_KIND_LABELS, DEMO_GITHUB_USAGE, DEMO_PROVIDER_USAGE, DEMO_SESSION_FIXTURE, DEMO_TURNS, FIXTURE_MCP_SIGN_IN_URL, SCHEDULES_OFF_MESSAGE, WORST_CASE_SESSION_HEADER, createFixtureDraftServer, createFixturePlansBackend, createFixtureProjectArtifacts, createFixtureProjectBackend, createFixtureProjectContent, createFixtureScheduleBackend, createFixtureSessionHost, createFixtureSessionProjects, demoUsageSummary, planOf, plansSnapshotOf, tallyTodos };
|
|
@@ -30,10 +30,17 @@
|
|
|
30
30
|
* On a server in organization mode (`sharing`) only the project's owner and
|
|
31
31
|
* maintainers set its icon, with or without a folder: for anyone else it
|
|
32
32
|
* shows with no picker (`iconLocked`), and the window's icon is not sent.
|
|
33
|
+
*
|
|
34
|
+
* servers each server the sidebar lists sessions of, through
|
|
35
|
+
* `projectsOf(hostId)`: its projects (name, home, icon on
|
|
36
|
+
* the server) and the sessions filed in each, read when its
|
|
37
|
+
* list is read (a rename, an icon, a new project or member, a
|
|
38
|
+
* move: `projects:changed`) and when its sessions' set or
|
|
39
|
+
* their folders change. Listed once its list is read
|
|
33
40
|
*/
|
|
34
41
|
import { ProjectIcon } from "../chat/headless/sidebar/project-icons.js";
|
|
35
42
|
import { SidebarListSession } from "../chat/headless/sidebar/types.js";
|
|
36
|
-
import { SidebarHomeProject, SidebarProjectRecord } from "../chat/sidebar/SessionSidebar.js";
|
|
43
|
+
import { SidebarHomeProject, SidebarProjectRecord, SidebarServerProjects } from "../chat/sidebar/SessionSidebar.js";
|
|
37
44
|
/** What {@link useHomeProjects} gives the sidebar. */
|
|
38
45
|
export interface HomeProjects {
|
|
39
46
|
/** `SessionSidebar`'s `homeProjects`: empty while off, or before the host answers. */
|
|
@@ -42,12 +49,14 @@ export interface HomeProjects {
|
|
|
42
49
|
folderlessProjects: readonly SidebarProjectRecord[];
|
|
43
50
|
/** `SessionSidebar`'s `onSetProjectIcon`. Absent: the host's projects are read-only, or off. */
|
|
44
51
|
onSetProjectIcon?: (projectId: string, icon: ProjectIcon | null) => void;
|
|
52
|
+
/** `SessionSidebar`'s `serverProjects`: each listed server whose projects are read. Empty while off, or without `projectsOf`. */
|
|
53
|
+
serverProjects: readonly SidebarServerProjects[];
|
|
45
54
|
}
|
|
46
55
|
/** A session as the sidebar groups it: by its project, else its folder. */
|
|
47
56
|
export type GroupedSession = Pick<SidebarListSession, 'projectRoot' | 'cwd' | 'hostId'> & Partial<Pick<SidebarListSession, 'id'>>;
|
|
48
57
|
/**
|
|
49
58
|
* The sidebar's projects: those with a home folder, their folders and their icons, and the window's icons sent to the
|
|
50
|
-
* host once; and those with no folder, with their icons.
|
|
59
|
+
* host once; and those with no folder, with their icons; and each listed server's.
|
|
51
60
|
*
|
|
52
61
|
* @param enabled - Read them (`Settings.projectHome`). Off, nothing is read or written.
|
|
53
62
|
* @param sessions - The sessions the sidebar lists: their folders that are no project's home are resolved on the host.
|