zidane-ui 9.5.2 → 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 +29 -29
- 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-DPbpsCtl.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 +9 -9
- package/dist/settings/sections/index.js +1 -1
- 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
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { createDraftLog } from "zidane/chat/pure";
|
|
2
|
+
// src/session/headless/fixture-drafts.ts
|
|
3
|
+
const keyOf = (sessionId, userId) => `${sessionId}\u0000${userId}`;
|
|
4
|
+
/**
|
|
5
|
+
* A fixture server of collaborative drafts.
|
|
6
|
+
*
|
|
7
|
+
* @param options - The people, the stored drafts, and how answers are delivered.
|
|
8
|
+
*/
|
|
9
|
+
function createFixtureDraftServer(options) {
|
|
10
|
+
const deliver = options.deliver ?? ((run) => queueMicrotask(run));
|
|
11
|
+
const people = new Map(options.people.map((person) => [person.userId, person]));
|
|
12
|
+
const stored = /* @__PURE__ */ new Map();
|
|
13
|
+
const since = /* @__PURE__ */ new Map();
|
|
14
|
+
let clock = 0;
|
|
15
|
+
for (const [sessionId, byUser] of Object.entries(options.drafts ?? {})) for (const [userId, text] of Object.entries(byUser)) {
|
|
16
|
+
stored.set(keyOf(sessionId, userId), text);
|
|
17
|
+
if (text.trim()) since.set(keyOf(sessionId, userId), ++clock);
|
|
18
|
+
}
|
|
19
|
+
const conns = /* @__PURE__ */ new Set();
|
|
20
|
+
const rooms = /* @__PURE__ */ new Map();
|
|
21
|
+
let roomsMade = 0;
|
|
22
|
+
const personOf = (userId) => people.get(userId) ?? {
|
|
23
|
+
userId,
|
|
24
|
+
name: userId
|
|
25
|
+
};
|
|
26
|
+
const answer = (compute) => new Promise((resolve, reject) => {
|
|
27
|
+
let result;
|
|
28
|
+
try {
|
|
29
|
+
result = compute();
|
|
30
|
+
} catch (error) {
|
|
31
|
+
deliver(() => reject(error));
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
deliver(() => resolve(result));
|
|
35
|
+
});
|
|
36
|
+
const send = (conn, signal) => {
|
|
37
|
+
if (!conn.open) return;
|
|
38
|
+
for (const listener of [...conn.signals]) deliver(() => listener(signal));
|
|
39
|
+
};
|
|
40
|
+
const peopleOf = (room) => [.../* @__PURE__ */ new Set([room.ownerId, ...room.clients.map((c) => c.conn.userId)])].map(personOf);
|
|
41
|
+
const stateOf = (room) => ({
|
|
42
|
+
room: room.id,
|
|
43
|
+
...room.log.state(),
|
|
44
|
+
people: peopleOf(room)
|
|
45
|
+
});
|
|
46
|
+
const connsOf = (room) => [...new Set(room.clients.map((c) => c.conn))];
|
|
47
|
+
const tellRoom = (room, except) => {
|
|
48
|
+
const signal = {
|
|
49
|
+
kind: "draft:room",
|
|
50
|
+
sessionId: room.sessionId,
|
|
51
|
+
ownerId: room.ownerId,
|
|
52
|
+
room: room.id,
|
|
53
|
+
people: peopleOf(room)
|
|
54
|
+
};
|
|
55
|
+
for (const conn of connsOf(room)) if (conn !== except) send(conn, signal);
|
|
56
|
+
};
|
|
57
|
+
const capableUser = (userId) => [...conns].some((c) => c.open && c.capable && c.userId === userId);
|
|
58
|
+
const tellDrafting = (sessionId, userId) => {
|
|
59
|
+
const at = since.get(keyOf(sessionId, userId));
|
|
60
|
+
const person = {
|
|
61
|
+
...personOf(userId),
|
|
62
|
+
since: at ?? 0
|
|
63
|
+
};
|
|
64
|
+
for (const conn of conns) {
|
|
65
|
+
if (!conn.open || conn.userId === userId) continue;
|
|
66
|
+
for (const listener of [...conn.drafting]) deliver(() => listener({
|
|
67
|
+
sessionId,
|
|
68
|
+
person,
|
|
69
|
+
drafting: at !== void 0
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const setStored = (sessionId, userId, text) => {
|
|
74
|
+
const key = keyOf(sessionId, userId);
|
|
75
|
+
const was = since.has(key);
|
|
76
|
+
stored.set(key, text);
|
|
77
|
+
const on = text.trim() !== "";
|
|
78
|
+
if (on === was) return;
|
|
79
|
+
if (on) since.set(key, ++clock);
|
|
80
|
+
else since.delete(key);
|
|
81
|
+
if (capableUser(userId)) tellDrafting(sessionId, userId);
|
|
82
|
+
};
|
|
83
|
+
const removeClients = (room, which) => {
|
|
84
|
+
const before = room.clients.length;
|
|
85
|
+
room.clients = room.clients.filter((client) => !which(client));
|
|
86
|
+
if (room.clients.length === before) return;
|
|
87
|
+
if (room.clients.length === 0) {
|
|
88
|
+
rooms.delete(keyOf(room.sessionId, room.ownerId));
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
tellRoom(room);
|
|
92
|
+
};
|
|
93
|
+
const drop = (conn) => {
|
|
94
|
+
for (const room of [...rooms.values()]) removeClients(room, (client) => client.conn === conn);
|
|
95
|
+
};
|
|
96
|
+
const roomIn = (conn, sessionId, ownerId, id) => {
|
|
97
|
+
const room = rooms.get(keyOf(sessionId, ownerId));
|
|
98
|
+
if (!room || room.id !== id) throw new Error("This draft was sent or closed.");
|
|
99
|
+
if (!room.clients.some((client) => client.conn === conn)) throw new Error("Join this draft first.");
|
|
100
|
+
return room;
|
|
101
|
+
};
|
|
102
|
+
return {
|
|
103
|
+
connect(userId) {
|
|
104
|
+
const conn = {
|
|
105
|
+
userId,
|
|
106
|
+
capable: false,
|
|
107
|
+
open: true,
|
|
108
|
+
signals: /* @__PURE__ */ new Set(),
|
|
109
|
+
drafting: /* @__PURE__ */ new Set(),
|
|
110
|
+
reconnects: /* @__PURE__ */ new Set()
|
|
111
|
+
};
|
|
112
|
+
conns.add(conn);
|
|
113
|
+
const markCapable = () => {
|
|
114
|
+
if (conn.capable) return;
|
|
115
|
+
const first = !capableUser(userId);
|
|
116
|
+
conn.capable = true;
|
|
117
|
+
if (!first) return;
|
|
118
|
+
for (const key of since.keys()) {
|
|
119
|
+
const [sessionId, owner] = key.split("\0");
|
|
120
|
+
if (owner === userId) tellDrafting(sessionId, userId);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
return {
|
|
124
|
+
userId,
|
|
125
|
+
self: () => userId,
|
|
126
|
+
drafting: { watch: (sessionId, listener) => {
|
|
127
|
+
let list = [];
|
|
128
|
+
let current = true;
|
|
129
|
+
let heard = false;
|
|
130
|
+
const show = (next) => {
|
|
131
|
+
list = next.sort((a, b) => b.since - a.since);
|
|
132
|
+
listener(list);
|
|
133
|
+
};
|
|
134
|
+
const onSignal = (signal) => {
|
|
135
|
+
if (!current || signal.sessionId !== sessionId) return;
|
|
136
|
+
heard = true;
|
|
137
|
+
const others = list.filter((p) => p.userId !== signal.person.userId);
|
|
138
|
+
show(signal.drafting ? [signal.person, ...others] : others);
|
|
139
|
+
};
|
|
140
|
+
conn.drafting.add(onSignal);
|
|
141
|
+
listener(list);
|
|
142
|
+
markCapable();
|
|
143
|
+
answer(() => [...since.entries()].flatMap(([key, at]) => {
|
|
144
|
+
const [s, owner] = key.split("\0");
|
|
145
|
+
return s === sessionId && owner !== userId && capableUser(owner) ? [{
|
|
146
|
+
...personOf(owner),
|
|
147
|
+
since: at
|
|
148
|
+
}] : [];
|
|
149
|
+
})).then((found) => current && !heard && show(found));
|
|
150
|
+
return () => {
|
|
151
|
+
current = false;
|
|
152
|
+
conn.drafting.delete(onSignal);
|
|
153
|
+
};
|
|
154
|
+
} },
|
|
155
|
+
join: (sessionId, ownerId, clientId, opts) => answer(() => {
|
|
156
|
+
markCapable();
|
|
157
|
+
let room = rooms.get(keyOf(sessionId, ownerId));
|
|
158
|
+
if (!room) {
|
|
159
|
+
if (ownerId === userId || opts?.ifOpen) return null;
|
|
160
|
+
const text = stored.get(keyOf(sessionId, ownerId)) ?? "";
|
|
161
|
+
if (!text.trim() || !capableUser(ownerId)) throw new Error("That person is not drafting here now.");
|
|
162
|
+
room = {
|
|
163
|
+
id: `room-${++roomsMade}`,
|
|
164
|
+
sessionId,
|
|
165
|
+
ownerId,
|
|
166
|
+
log: createDraftLog({
|
|
167
|
+
version: 0,
|
|
168
|
+
doc: null,
|
|
169
|
+
text
|
|
170
|
+
}, options.limits),
|
|
171
|
+
clients: []
|
|
172
|
+
};
|
|
173
|
+
rooms.set(keyOf(sessionId, ownerId), room);
|
|
174
|
+
}
|
|
175
|
+
room.clients = room.clients.filter((c) => !(c.conn === conn && c.clientId === clientId));
|
|
176
|
+
room.clients.push({
|
|
177
|
+
conn,
|
|
178
|
+
clientId
|
|
179
|
+
});
|
|
180
|
+
tellRoom(room, conn);
|
|
181
|
+
if (userId !== ownerId) {
|
|
182
|
+
const invite = {
|
|
183
|
+
kind: "draft:room",
|
|
184
|
+
sessionId,
|
|
185
|
+
ownerId,
|
|
186
|
+
room: room.id,
|
|
187
|
+
people: peopleOf(room)
|
|
188
|
+
};
|
|
189
|
+
const inRoom = new Set(connsOf(room));
|
|
190
|
+
for (const other of conns) if (other.userId === ownerId && other.capable && !inRoom.has(other)) send(other, invite);
|
|
191
|
+
}
|
|
192
|
+
return stateOf(room);
|
|
193
|
+
}),
|
|
194
|
+
push: (sessionId, ownerId, id, version, steps, clientId) => answer(() => {
|
|
195
|
+
const room = roomIn(conn, sessionId, ownerId, id);
|
|
196
|
+
const taken = room.log.push(version, steps, clientId);
|
|
197
|
+
if (!taken.ok) {
|
|
198
|
+
if (taken.full) throw new Error("This draft is catching up. Try again in a moment.");
|
|
199
|
+
return {
|
|
200
|
+
ok: false,
|
|
201
|
+
version: taken.version
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
const signal = {
|
|
205
|
+
kind: "draft:steps",
|
|
206
|
+
sessionId,
|
|
207
|
+
ownerId,
|
|
208
|
+
room: room.id,
|
|
209
|
+
version,
|
|
210
|
+
steps: [...steps],
|
|
211
|
+
clientIds: steps.map(() => clientId)
|
|
212
|
+
};
|
|
213
|
+
for (const to of connsOf(room)) send(to, signal);
|
|
214
|
+
return {
|
|
215
|
+
ok: true,
|
|
216
|
+
version: taken.version
|
|
217
|
+
};
|
|
218
|
+
}),
|
|
219
|
+
since: (sessionId, ownerId, id, version) => answer(() => {
|
|
220
|
+
const room = rooms.get(keyOf(sessionId, ownerId));
|
|
221
|
+
if (!room || room.id !== id || !room.clients.some((c) => c.conn === conn)) return null;
|
|
222
|
+
const got = room.log.since(version);
|
|
223
|
+
if (!got) throw new Error("That version is ahead of this draft.");
|
|
224
|
+
return got.kind === "resync" ? {
|
|
225
|
+
kind: "resync",
|
|
226
|
+
state: stateOf(room)
|
|
227
|
+
} : {
|
|
228
|
+
kind: "steps",
|
|
229
|
+
room: room.id,
|
|
230
|
+
base: got.base,
|
|
231
|
+
steps: got.steps,
|
|
232
|
+
clientIds: got.clientIds
|
|
233
|
+
};
|
|
234
|
+
}),
|
|
235
|
+
snapshot: (sessionId, ownerId, id, version, doc, text) => answer(() => {
|
|
236
|
+
if (roomIn(conn, sessionId, ownerId, id).log.setSnapshot(version, doc, text)) setStored(sessionId, ownerId, text);
|
|
237
|
+
}),
|
|
238
|
+
leave: (sessionId, ownerId, clientId) => answer(() => {
|
|
239
|
+
const room = rooms.get(keyOf(sessionId, ownerId));
|
|
240
|
+
if (room) removeClients(room, (c) => c.conn === conn && c.clientId === clientId);
|
|
241
|
+
}),
|
|
242
|
+
onSignal: (listener) => {
|
|
243
|
+
conn.signals.add(listener);
|
|
244
|
+
return () => void conn.signals.delete(listener);
|
|
245
|
+
},
|
|
246
|
+
onReconnect: (listener) => {
|
|
247
|
+
conn.reconnects.add(listener);
|
|
248
|
+
return () => void conn.reconnects.delete(listener);
|
|
249
|
+
},
|
|
250
|
+
reconnect() {
|
|
251
|
+
drop(conn);
|
|
252
|
+
for (const listener of [...conn.reconnects]) deliver(listener);
|
|
253
|
+
},
|
|
254
|
+
close() {
|
|
255
|
+
drop(conn);
|
|
256
|
+
conn.open = false;
|
|
257
|
+
conns.delete(conn);
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
},
|
|
261
|
+
setDraft: setStored,
|
|
262
|
+
draftOf: (sessionId, userId) => stored.get(keyOf(sessionId, userId)) ?? "",
|
|
263
|
+
roomOf: (sessionId, ownerId) => {
|
|
264
|
+
const room = rooms.get(keyOf(sessionId, ownerId));
|
|
265
|
+
return room ? stateOf(room) : void 0;
|
|
266
|
+
},
|
|
267
|
+
send(sessionId, ownerId) {
|
|
268
|
+
const room = rooms.get(keyOf(sessionId, ownerId));
|
|
269
|
+
if (room) {
|
|
270
|
+
rooms.delete(keyOf(sessionId, ownerId));
|
|
271
|
+
const signal = {
|
|
272
|
+
kind: "draft:reset",
|
|
273
|
+
sessionId,
|
|
274
|
+
ownerId,
|
|
275
|
+
room: room.id
|
|
276
|
+
};
|
|
277
|
+
for (const conn of connsOf(room)) send(conn, signal);
|
|
278
|
+
}
|
|
279
|
+
setStored(sessionId, ownerId, "");
|
|
280
|
+
},
|
|
281
|
+
emit(userId, signal) {
|
|
282
|
+
for (const conn of conns) if (conn.userId === userId) send(conn, signal);
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
export { createFixtureDraftServer };
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* (values are dropped at once, never kept). `control` changes the data from outside, as an agent
|
|
7
7
|
* or another window would.
|
|
8
8
|
*/
|
|
9
|
+
import { FixtureDraftServer, FixtureDraftServerOptions } from "./fixture-drafts.js";
|
|
9
10
|
import { FixtureRecordedArtifact } from "./fixture-project-artifacts.js";
|
|
10
11
|
import { FixtureProjectOptions } from "./fixture-projects.js";
|
|
11
12
|
import { PromptAttachment as PromptAttachment$1, RunningWorkItem as RunningWorkItem$1, SessionArtifactRow, SessionHost, SessionSecretEntry, SessionTurn } from "./host.js";
|
|
@@ -13,7 +14,7 @@ import { TypingPerson } from "./typing.js";
|
|
|
13
14
|
import { ProviderUsageSnapshot, UsageRange as UsageRange$1, UsageSummary } from "./usage.js";
|
|
14
15
|
import { ProjectContentInput, Schedule, ScheduleFire } from "zidane/chat/pure";
|
|
15
16
|
import { PlanView, TodoItem } from "zidane/chat";
|
|
16
|
-
import { OpenSessionView, ParticipantView, PresencePerson, SessionSharingView } from "zidane/ipc";
|
|
17
|
+
import { OpenSessionView, ParticipantView, PresencePerson, SessionSharingView, SharedWithView } from "zidane/ipc";
|
|
17
18
|
/** A queued entry the fixture holds, with its attachments' bytes. */
|
|
18
19
|
export interface FixtureQueuedEntry {
|
|
19
20
|
/** The entry's id. */
|
|
@@ -31,16 +32,27 @@ export interface SessionSharingFixture {
|
|
|
31
32
|
views?: Readonly<Record<string, SessionSharingView>>;
|
|
32
33
|
/** The organization's people (the invite picker). */
|
|
33
34
|
users?: readonly ParticipantView[];
|
|
35
|
+
/** Your user id (`SessionSharingHost.self`). Absent: no `self`. */
|
|
36
|
+
self?: string;
|
|
34
37
|
/** The open sessions ("Open sessions"). Absent: no directory. */
|
|
35
38
|
directory?: readonly OpenSessionView[];
|
|
36
39
|
/** Who else has each session open (the header's avatars), by session id. */
|
|
37
40
|
here?: Readonly<Record<string, readonly PresencePerson[]>>;
|
|
38
41
|
/** Who else types in each session, by session id. They never stop until `control.setTyping` says so. */
|
|
39
42
|
typing?: Readonly<Record<string, readonly TypingPerson[]>>;
|
|
43
|
+
/** Who else is in each project now (a project's sidebar header), by project id. Absent: no `projectPeople`. */
|
|
44
|
+
projectHere?: Readonly<Record<string, readonly PresencePerson[]>>;
|
|
45
|
+
/** What you share with each person (their card), by user id. Absent: no `shared`. */
|
|
46
|
+
shared?: Readonly<Record<string, SharedWithView>>;
|
|
40
47
|
/** These calls reject with this message. `change`: every change (invite, grant, remove, open, transfer, notify). */
|
|
41
48
|
errors?: Partial<Record<'get' | 'users' | 'change' | 'directory' | 'join' | 'leave', string>>;
|
|
42
49
|
/** These reads never answer (the loading state). */
|
|
43
|
-
pending?: readonly ('get' | 'users' | 'directory')[];
|
|
50
|
+
pending?: readonly ('get' | 'users' | 'directory' | 'shared')[];
|
|
51
|
+
/**
|
|
52
|
+
* Collaborative drafts (`sharing.drafts`): the people and their stored drafts. This window is `self` (default
|
|
53
|
+
* `you`); `control.drafts` connects the others. Absent: no draft tabs.
|
|
54
|
+
*/
|
|
55
|
+
drafts?: Omit<FixtureDraftServerOptions, 'deliver'>;
|
|
44
56
|
}
|
|
45
57
|
/** What a fixture session host starts with, per session id. */
|
|
46
58
|
export interface SessionFixture {
|
|
@@ -113,6 +125,10 @@ export interface FixtureSessionControl {
|
|
|
113
125
|
setHere: (sessionId: string, people: readonly PresencePerson[]) => void;
|
|
114
126
|
/** Replaces who else types in a session. */
|
|
115
127
|
setTyping: (sessionId: string, people: readonly TypingPerson[]) => void;
|
|
128
|
+
/** The collaborative drafts' server, to connect the other people's windows. Absent without `sharing.drafts`. */
|
|
129
|
+
drafts?: FixtureDraftServer;
|
|
130
|
+
/** Replaces who else is in a project (a person opened its home or left it). */
|
|
131
|
+
setProjectHere: (projectId: string, people: readonly PresencePerson[]) => void;
|
|
116
132
|
}
|
|
117
133
|
/** The fixture host: a full `SessionHost` plus its `control`. */
|
|
118
134
|
export interface FixtureSessionHost extends SessionHost {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { constant } from "../../chat/headless/store.js";
|
|
1
2
|
import { createArtifactsState, groupArtifactRows } from "./artifacts.js";
|
|
3
|
+
import { createFixtureDraftServer } from "./fixture-drafts.js";
|
|
2
4
|
import { createFixturePlansBackend } from "./fixture-plans.js";
|
|
3
5
|
import { createFixtureProjectBackend, createFixtureSessionProjects } from "./fixture-projects.js";
|
|
4
6
|
import { createFixtureScheduleBackend } from "./fixture-schedules.js";
|
|
@@ -90,6 +92,13 @@ function createFixtureSessionHost(fixture = {}) {
|
|
|
90
92
|
});
|
|
91
93
|
scheduleBackend.subscribe(() => schedulesState.wake());
|
|
92
94
|
const projectBackend = fixture.projects ? createFixtureProjectBackend(fixture.projects) : null;
|
|
95
|
+
const sessionProjects = projectBackend ? createFixtureSessionProjects(projectBackend, {
|
|
96
|
+
organization: fixture.projects?.organization !== void 0,
|
|
97
|
+
...fixture.projects?.publishTargets ? { publishTargets: fixture.projects.publishTargets } : {}
|
|
98
|
+
}) : void 0;
|
|
99
|
+
const ownProjects = constant(sessionProjects);
|
|
100
|
+
const noProjects = constant(void 0);
|
|
101
|
+
const projectsOf = (hostId) => hostId === void 0 ? ownProjects : noProjects;
|
|
93
102
|
const sharingFixture = fixture.sharing;
|
|
94
103
|
const sharing = createFixtureSharing(sharingFixture ?? {});
|
|
95
104
|
const items = (sessionId) => (queues.get(sessionId) ?? []).map((e) => ({
|
|
@@ -209,6 +218,12 @@ function createFixtureSessionHost(fixture = {}) {
|
|
|
209
218
|
export: async (sessionId, format) => `/tmp/${sessionId}.${format === "markdown" ? "md" : "json"}`,
|
|
210
219
|
async compact() {},
|
|
211
220
|
async setFolder() {},
|
|
221
|
+
...projectBackend ? { async setProject(sessionId, projectId) {
|
|
222
|
+
const row = projectBackend.sessionRows().find((r) => r.id === sessionId);
|
|
223
|
+
if (row?.isMain || row?.origin?.kind === "main") throw new Error("A Main stays in its project.");
|
|
224
|
+
if (row?.origin?.kind === "channel") throw new Error("A channel thread stays in its channel's project.");
|
|
225
|
+
projectBackend.fileSession(sessionId, projectId);
|
|
226
|
+
} } : {},
|
|
212
227
|
cacheReport: async () => ({
|
|
213
228
|
rows: [
|
|
214
229
|
{
|
|
@@ -288,10 +303,10 @@ function createFixtureSessionHost(fixture = {}) {
|
|
|
288
303
|
return after.length < before.length;
|
|
289
304
|
}
|
|
290
305
|
} } : {},
|
|
291
|
-
...
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
}
|
|
306
|
+
...sessionProjects ? {
|
|
307
|
+
projects: sessionProjects,
|
|
308
|
+
projectsOf
|
|
309
|
+
} : {},
|
|
295
310
|
...fixture.schedules ? { schedules: {
|
|
296
311
|
status: schedulesState.status,
|
|
297
312
|
all: schedulesState.all,
|
|
@@ -308,6 +323,8 @@ function createFixtureSessionHost(fixture = {}) {
|
|
|
308
323
|
control: {
|
|
309
324
|
setHere: sharing.setHere,
|
|
310
325
|
setTyping: sharing.setTyping,
|
|
326
|
+
...sharing.drafts ? { drafts: sharing.drafts } : {},
|
|
327
|
+
setProjectHere: sharing.setProjectHere,
|
|
311
328
|
setSchedules: (list) => scheduleBackend.replace(list),
|
|
312
329
|
setSchedulesEnabled: (enabled) => scheduleBackend.setEnabled(enabled),
|
|
313
330
|
renameProject: (projectId, name) => void projectBackend?.update(projectId, { name }),
|
|
@@ -356,6 +373,9 @@ function createFixtureSharing(fixture) {
|
|
|
356
373
|
const changed = /* @__PURE__ */ new Set();
|
|
357
374
|
const here = watchedLists(fixture.here);
|
|
358
375
|
const typing = watchedLists(fixture.typing);
|
|
376
|
+
const projectHere = watchedLists(fixture.projectHere);
|
|
377
|
+
const shared = fixture.shared;
|
|
378
|
+
const draftServer = fixture.drafts ? createFixtureDraftServer(fixture.drafts) : void 0;
|
|
359
379
|
const never = () => new Promise(() => {});
|
|
360
380
|
const viewOf = (sessionId) => views.get(sessionId) ?? {
|
|
361
381
|
sessionId,
|
|
@@ -379,7 +399,10 @@ function createFixtureSharing(fixture) {
|
|
|
379
399
|
return {
|
|
380
400
|
host: {
|
|
381
401
|
get: async (sessionId) => pending.includes("get") ? never() : errors.get ? Promise.reject(new Error(errors.get)) : viewOf(sessionId),
|
|
382
|
-
users: async () => pending.includes("users") ? never() : errors.users ? Promise.reject(new Error(errors.users)) :
|
|
402
|
+
users: async () => pending.includes("users") ? never() : errors.users ? Promise.reject(new Error(errors.users)) : users.map((user) => ({
|
|
403
|
+
online: false,
|
|
404
|
+
...user
|
|
405
|
+
})),
|
|
383
406
|
invite: async (sessionId, user, grant = "prompt") => change(sessionId, (view) => ({
|
|
384
407
|
...view,
|
|
385
408
|
members: [...view.members.filter((m) => m.userId !== person(user).userId), {
|
|
@@ -427,6 +450,7 @@ function createFixtureSharing(fixture) {
|
|
|
427
450
|
...view,
|
|
428
451
|
notify
|
|
429
452
|
})),
|
|
453
|
+
...fixture.self !== void 0 ? { self: () => fixture.self } : {},
|
|
430
454
|
...directory ? {
|
|
431
455
|
directory: async () => pending.includes("directory") ? never() : errors.directory ? Promise.reject(new Error(errors.directory)) : [...directory],
|
|
432
456
|
async join(sessionId) {
|
|
@@ -444,10 +468,20 @@ function createFixtureSharing(fixture) {
|
|
|
444
468
|
return () => void changed.delete(listener);
|
|
445
469
|
},
|
|
446
470
|
people: { watch: here.watch },
|
|
447
|
-
typing: { watch: typing.watch }
|
|
471
|
+
typing: { watch: typing.watch },
|
|
472
|
+
...fixture.projectHere ? { projectPeople: { watch: projectHere.watch } } : {},
|
|
473
|
+
...draftServer ? { drafts: draftServer.connect(fixture.self ?? "you") } : {},
|
|
474
|
+
...shared ? { shared: async (userId) => {
|
|
475
|
+
if (pending.includes("shared")) return never();
|
|
476
|
+
const view = shared[userId];
|
|
477
|
+
if (!view) throw new Error(`No one in the organization is ${userId}.`);
|
|
478
|
+
return view;
|
|
479
|
+
} } : {}
|
|
448
480
|
},
|
|
449
481
|
setHere: here.set,
|
|
450
|
-
setTyping: typing.set
|
|
482
|
+
setTyping: typing.set,
|
|
483
|
+
setProjectHere: projectHere.set,
|
|
484
|
+
drafts: draftServer
|
|
451
485
|
};
|
|
452
486
|
}
|
|
453
487
|
/** When a secret saved at `now` with `ttl` expires, as the backend computes it. */
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
import { FixtureProjectArtifacts, FixtureProjectArtifactsOptions } from "./fixture-project-artifacts.js";
|
|
16
16
|
import { FixtureProjectContent, FixtureProjectContentOptions } from "./fixture-project-content.js";
|
|
17
17
|
import { ProjectPublishTarget, SessionProjects } from "./host.js";
|
|
18
|
-
import { Project,
|
|
18
|
+
import { Project, ProjectPatch, ProjectSettingLayer, ProjectSettingsView } from "zidane/chat/pure";
|
|
19
19
|
import { Settings } from "zidane/chat";
|
|
20
|
-
import { OpenProjectView, ParticipantView, ProjectGrant, ProjectMcpSignInView, ProjectSessionAccess, ProjectSharingView, SessionRow } from "zidane/ipc";
|
|
20
|
+
import { OpenProjectView, ParticipantView, ProjectCreateParams, ProjectGrant, ProjectMcpSignInView, ProjectSessionAccess, ProjectSharingView, SessionRow } from "zidane/ipc";
|
|
21
21
|
/** The page a fixture project's MCP sign-in opens. */
|
|
22
22
|
export declare const FIXTURE_MCP_SIGN_IN_URL = "https://auth.example.com/authorize?client_id=zidane";
|
|
23
23
|
/** A server a fixture project publishes to, with the folders it offers there. */
|
|
@@ -33,8 +33,8 @@ export interface FixtureProjectBackend {
|
|
|
33
33
|
}) => Project[];
|
|
34
34
|
/** `projects.get`. */
|
|
35
35
|
get: (id: string) => Project | null;
|
|
36
|
-
/** `projects.create
|
|
37
|
-
create: (input:
|
|
36
|
+
/** `projects.create`: a repository home too, and in organization mode its members and the open flag. */
|
|
37
|
+
create: (input: ProjectCreateParams) => Project;
|
|
38
38
|
/** `projects.update`. */
|
|
39
39
|
update: (id: string, patch: ProjectPatch) => Project;
|
|
40
40
|
/** `projects.delete`: the record and everyone's layer of its settings. Returns the record it removed. */
|
|
@@ -43,6 +43,8 @@ export interface FixtureProjectBackend {
|
|
|
43
43
|
resolve: (folder: string) => Project | null;
|
|
44
44
|
/** `projects.sessions`: the project each session is filed in, by session id. A deleted project's sessions leave it. */
|
|
45
45
|
sessions: () => Record<string, string>;
|
|
46
|
+
/** `sessions.setProject`: files a session in a project, or in Chats (`null`). Throws for a project it does not have. */
|
|
47
|
+
fileSession: (sessionId: string, projectId: string | null) => void;
|
|
46
48
|
/** `projects.settings`. */
|
|
47
49
|
settings: (id: string) => ProjectSettingsView;
|
|
48
50
|
/** `projects.setSettings`: nothing written while the layer holds a key of `ifAbsent`. */
|
|
@@ -102,16 +102,26 @@ function createFixtureProjectBackend(options = {}) {
|
|
|
102
102
|
get: (id) => list.find((p) => p.id === id) ?? null,
|
|
103
103
|
create(input) {
|
|
104
104
|
const home = input.home === void 0 ? void 0 : checkHome(input.home);
|
|
105
|
-
if (home
|
|
105
|
+
if (home !== void 0 && input.homeRepo !== void 0) throw new Error("A project home is a folder or a repository, not both. Send home or homeRepo.");
|
|
106
|
+
const repoName = input.homeRepo?.url.replace(/\.git$/, "").split(/[/:]/).pop();
|
|
107
|
+
if (home === void 0 && !input.name?.trim() && !repoName) throw new Error("name is required for a project with no folder.");
|
|
108
|
+
if ((input.members?.length || input.open) && !sharing) throw new Error("members and open need organization mode.");
|
|
109
|
+
const people = new Set(sharing?.users().map((p) => p.userId));
|
|
110
|
+
for (const member of input.members ?? []) if (!people.has(member.userId)) throw new Error(`${member.userId} is not in the organization.`);
|
|
106
111
|
const at = now();
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
112
|
+
const id = `fixture-project-${++seq}`;
|
|
113
|
+
const made = write({
|
|
114
|
+
id,
|
|
115
|
+
name: checkName(input.name?.trim() || (home !== void 0 ? home.split("/").pop() || home : repoName)),
|
|
110
116
|
...home !== void 0 ? { home } : {},
|
|
117
|
+
...input.homeRepo ? { homeRepo: { ...input.homeRepo } } : {},
|
|
111
118
|
references: (input.references ?? []).map(trimmed),
|
|
112
119
|
createdAt: at,
|
|
113
120
|
updatedAt: at
|
|
114
121
|
});
|
|
122
|
+
for (const member of input.members ?? []) sharing.set(id, member.userId, member.grant);
|
|
123
|
+
if (input.open) sharing.setOpen(id, true);
|
|
124
|
+
return made;
|
|
115
125
|
},
|
|
116
126
|
update(id, patch) {
|
|
117
127
|
const found = find(id);
|
|
@@ -140,6 +150,17 @@ function createFixtureProjectBackend(options = {}) {
|
|
|
140
150
|
return found;
|
|
141
151
|
},
|
|
142
152
|
sessions: () => ({ ...filed }),
|
|
153
|
+
fileSession(sessionId, projectId) {
|
|
154
|
+
const from = filed[sessionId];
|
|
155
|
+
if (projectId !== null) find(projectId);
|
|
156
|
+
const { [sessionId]: _left, ...rest } = filed;
|
|
157
|
+
filed = projectId === null ? rest : {
|
|
158
|
+
...rest,
|
|
159
|
+
[sessionId]: projectId
|
|
160
|
+
};
|
|
161
|
+
if (from !== void 0 && from !== projectId) changed(from);
|
|
162
|
+
if (projectId !== null && from !== projectId) changed(projectId);
|
|
163
|
+
},
|
|
143
164
|
sessionRows: () => [...rows],
|
|
144
165
|
main(id) {
|
|
145
166
|
const found = find(id);
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
import { Readable } from "../../chat/headless/store.js";
|
|
14
14
|
import { SignInFlow } from "../../onboarding/headless/host.js";
|
|
15
15
|
import { SessionAccess } from "./access.js";
|
|
16
|
-
import {
|
|
16
|
+
import { SessionDrafts } from "./drafts.js";
|
|
17
|
+
import { ProjectPeople, SessionPeople } from "./people.js";
|
|
17
18
|
import { ProjectSessionRow as ProjectSessionRow$1 } from "./project-sessions.js";
|
|
18
19
|
import { ProjectPlace } from "./projects.js";
|
|
19
20
|
import { SessionTyping } from "./typing.js";
|
|
@@ -21,7 +22,7 @@ import { ProviderResetOutcome, ProviderResetTarget, ProviderUsageSnapshot, Usage
|
|
|
21
22
|
import { ArtifactContextLevel, ExtensionArtifactRowFact, ExtensionBadgeIcon, ExtensionBadgeTone, Project, ProjectArtifactView, ProjectContentInput, ProjectContentItem, ProjectContentVersion, ProjectContentView, ProjectInput, ProjectPatch, ProjectSettingLayer, ProjectSettingsView, Schedule, ScheduleFire, ScheduleInput, SchedulePatch, SecretTtl } from "zidane/chat/pure";
|
|
22
23
|
import { SessionArtifact } from "zidane";
|
|
23
24
|
import { ActivePlanSummary, MessageDelivery, PlanEditOp, PlanStep, PlanView, PlansSnapshot, PromptAttachment, QueuedAttachment, TodoItem } from "zidane/chat";
|
|
24
|
-
import { IpcResult, MemberGrant, NotifyLevel, OpenProjectView, OpenSessionView, ParticipantView, ProjectBudgets, ProjectGrant, ProjectSessionAccess, ProjectSharingView, ProjectUsageLive, ProjectUsageView, RunningWorkItem, SessionSharingView, UsageGroupBy, UsageRange } from "zidane/ipc";
|
|
25
|
+
import { IpcResult, MemberGrant, NotifyLevel, OpenProjectView, OpenSessionView, ParticipantView, PersonView, ProjectBudgets, ProjectCreateParams, ProjectGrant, ProjectSessionAccess, ProjectSharingView, ProjectUsageLive, ProjectUsageView, RunningWorkItem, SessionSharingView, SharedWithView, UsageGroupBy, UsageRange } from "zidane/ipc";
|
|
25
26
|
import { SessionTurn } from "zidane/types";
|
|
26
27
|
/** One message waiting in a session's queue, as the queue panel shows it. */
|
|
27
28
|
export interface QueuedMessage {
|
|
@@ -248,8 +249,11 @@ export interface SessionProjects {
|
|
|
248
249
|
* there. Absent: a session's project is the one its folder is the home of.
|
|
249
250
|
*/
|
|
250
251
|
sessionProjects?: () => Promise<Readonly<Record<string, string>>>;
|
|
251
|
-
/**
|
|
252
|
-
|
|
252
|
+
/**
|
|
253
|
+
* Creates a project. `members` and `open` share it from the start (a server in organization mode with multiplayer
|
|
254
|
+
* on): its members hear it as a new project. Absent: no New project.
|
|
255
|
+
*/
|
|
256
|
+
create?: (input: ProjectCreateParams) => Promise<Project>;
|
|
253
257
|
/** Changes a project's name, folders or defaults. Absent: its settings are read-only. */
|
|
254
258
|
update?: (projectId: string, patch: ProjectPatch) => Promise<Project>;
|
|
255
259
|
/** Deletes a project: its sessions go to Chats, its settings and data go. Absent: no Delete. */
|
|
@@ -508,6 +512,11 @@ export interface SessionDetailsActions {
|
|
|
508
512
|
compact?: (sessionId: string) => Promise<void>;
|
|
509
513
|
/** Attaches a folder (`null` detaches it: a plain chat). Refused mid-run. */
|
|
510
514
|
setFolder?: (sessionId: string, folder: string | null) => Promise<void>;
|
|
515
|
+
/**
|
|
516
|
+
* Files the session in a project whatever its folder, or in Chats (`null`). Refused for a Main, a channel thread, a
|
|
517
|
+
* side chat and a session a project owns. Its agent builds again for the project before its next run. Absent: no move.
|
|
518
|
+
*/
|
|
519
|
+
setProject?: (sessionId: string, projectId: string | null) => Promise<void>;
|
|
511
520
|
/** What the prompt cache did for the last requests (the numbers `/cache` prints); `null` when there is none. */
|
|
512
521
|
cacheReport?: (sessionId: string) => Promise<SessionCacheReport | null>;
|
|
513
522
|
}
|
|
@@ -572,8 +581,13 @@ export interface SessionSharingHost {
|
|
|
572
581
|
transfer: (sessionId: string, userId: string) => Promise<SessionSharingView>;
|
|
573
582
|
/** A member leaves the session. */
|
|
574
583
|
leave: (sessionId: string) => Promise<void>;
|
|
575
|
-
/** The organization's people, for the invite picker. */
|
|
576
|
-
users: (sessionId: string) => Promise<
|
|
584
|
+
/** The organization's people, for the invite picker: each with whether they are online and when they were last seen. */
|
|
585
|
+
users: (sessionId: string) => Promise<PersonView[]>;
|
|
586
|
+
/**
|
|
587
|
+
* The caller's user id on the server of a session (its hello's `identity.userId`), so a picker can leave them out.
|
|
588
|
+
* A function: in the desktop app each server knows the caller by its own id. `undefined`: not known yet. Absent: never known.
|
|
589
|
+
*/
|
|
590
|
+
self?: (sessionId: string) => string | undefined;
|
|
577
591
|
/** The open sessions anyone may join ("Open sessions"). Absent: no directory. */
|
|
578
592
|
directory?: () => Promise<OpenSessionView[]>;
|
|
579
593
|
/** Join an open session with its default grant. */
|
|
@@ -584,8 +598,16 @@ export interface SessionSharingHost {
|
|
|
584
598
|
setNotify?: (sessionId: string, notify: NotifyLevel) => Promise<SessionSharingView>;
|
|
585
599
|
/** Who else has a session open (the avatars at the right of its header). Absent: no avatars. */
|
|
586
600
|
people?: SessionPeople;
|
|
601
|
+
/** What the caller shares with a person: the projects both are in, the sessions both see. Absent: not shown. */
|
|
602
|
+
shared?: (userId: string) => Promise<SharedWithView>;
|
|
603
|
+
/** Who else is in a project now: a window on its home, or on a session filed in it. Absent: nobody shown. */
|
|
604
|
+
projectPeople?: ProjectPeople;
|
|
605
|
+
/** Tells the host which project home this window shows (`null`: none), so its people see you there. Absent: never told. */
|
|
606
|
+
showProject?: (projectId: string | null) => Promise<void>;
|
|
587
607
|
/** Who else is typing in a session ("Ann is typing…" under the composer). Absent: no typing line. */
|
|
588
608
|
typing?: SessionTyping;
|
|
609
|
+
/** Editing a person's draft together: the draft tabs over the composer and their rooms. Absent: neither. */
|
|
610
|
+
drafts?: SessionDrafts;
|
|
589
611
|
/** Whether a shared session is still yours to use: removed, or its live share ended. Absent: never lost. */
|
|
590
612
|
access?: SessionAccess;
|
|
591
613
|
}
|
|
@@ -615,5 +637,11 @@ export interface SessionHost {
|
|
|
615
637
|
schedules?: SessionSchedules;
|
|
616
638
|
/** Projects (`Settings.projectHome`). Absent: the project home keeps its layout in the window, and offers no project settings. */
|
|
617
639
|
projects?: SessionProjects;
|
|
640
|
+
/**
|
|
641
|
+
* The projects of a host this window reaches, by its id (a session's host, a machine's id): no id, or the window's
|
|
642
|
+
* own host's, is `projects`. The store holds `undefined` while that host offers none here (not connected yet, gone,
|
|
643
|
+
* no projects). The same store for the same id. Absent: only `projects`.
|
|
644
|
+
*/
|
|
645
|
+
projectsOf?: (hostId?: string) => Readable<SessionProjects | undefined>;
|
|
618
646
|
}
|
|
619
647
|
export type { ActivePlanSummary, PlanEditOp, PlanStep, PlanView, PlansSnapshot, Project, ProjectInput, ProjectPatch, ProjectSettingLayer, ProjectSettingsView, PromptAttachment, QueuedAttachment, RunningWorkItem, Schedule, ScheduleFire, ScheduleInput, SchedulePatch, SessionArtifact, SessionTurn, TodoItem };
|