@celljs/ta-channels 0.0.0-stage → 4.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/README.md +47 -2
- package/extension/index.mjs +651 -0
- package/host/index.mjs +921 -0
- package/package.json +44 -4
- package/web/index.js +3144 -0
- package/web-src/agent-menu.tsx +236 -0
- package/web-src/channel-menu.tsx +98 -0
- package/web-src/channels-model.ts +153 -0
- package/web-src/channels-util.spec.ts +312 -0
- package/web-src/channels-util.ts +551 -0
- package/web-src/channels.ts +235 -0
- package/web-src/create.tsx +273 -0
- package/web-src/extension.ts +91 -0
- package/web-src/faces.tsx +247 -0
- package/web-src/host.ts +12 -0
- package/web-src/i18n.ts +221 -0
- package/web-src/index.tsx +82 -0
- package/web-src/members.tsx +258 -0
- package/web-src/more-menu.tsx +113 -0
- package/web-src/react.ts +11 -0
- package/web-src/room.tsx +212 -0
- package/web-src/sidebar.tsx +293 -0
- package/web-src/style.ts +248 -0
- package/web-src/team-tools.ts +103 -0
- package/web-src/team.spec.ts +338 -0
- package/web-src/team.ts +537 -0
- package/web-src/views.spec.ts +66 -0
- package/web-src/views.tsx +228 -0
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { AgentMenu } from './agent-menu';
|
|
2
|
+
import { ChannelMenu } from './channel-menu';
|
|
3
|
+
import { type Agent, ChannelsUtil, SYSTEM } from './channels-util';
|
|
4
|
+
import { AGENT_PAGE, NewChannelDialog, newAgent } from './create';
|
|
5
|
+
import { Face, RoomFace } from './faces';
|
|
6
|
+
import { ChannelWords } from './i18n';
|
|
7
|
+
import { MoreMenu } from './more-menu';
|
|
8
|
+
import { React } from './react';
|
|
9
|
+
import {
|
|
10
|
+
AgentAvatar,
|
|
11
|
+
CHANNEL_PAGE,
|
|
12
|
+
type ChannelsContext,
|
|
13
|
+
ChannelViews,
|
|
14
|
+
DOUBLE_PAGE,
|
|
15
|
+
membersOf,
|
|
16
|
+
SidebarUtil,
|
|
17
|
+
useChannels,
|
|
18
|
+
useFaces,
|
|
19
|
+
useServerCwd,
|
|
20
|
+
useUi,
|
|
21
|
+
} from './views';
|
|
22
|
+
|
|
23
|
+
interface RowProps {
|
|
24
|
+
avatar: React.ReactNode;
|
|
25
|
+
title: string;
|
|
26
|
+
badge?: React.ReactNode;
|
|
27
|
+
preview: string;
|
|
28
|
+
/** The preview is what is going on now. */
|
|
29
|
+
live?: boolean;
|
|
30
|
+
time: string;
|
|
31
|
+
/** Something new the user has not looked at. */
|
|
32
|
+
fresh?: boolean;
|
|
33
|
+
hint?: string;
|
|
34
|
+
selected: boolean;
|
|
35
|
+
onSelect(): void;
|
|
36
|
+
/** Over the time while the row is hovered or its menu open: the … of an agent. */
|
|
37
|
+
more?: React.ReactNode;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** A row of the list: the face, the name and a line of what is going on, the time at the right. */
|
|
41
|
+
function Row({ avatar, title, badge, preview, live, time, fresh, hint, selected, onSelect, more }: RowProps) {
|
|
42
|
+
const row = (
|
|
43
|
+
<button type="button" className={`tac-item${selected ? ' tac-selected' : ''}`} aria-current={selected || undefined} title={hint} onClick={onSelect}>
|
|
44
|
+
{avatar}
|
|
45
|
+
<span className="tac-item-text">
|
|
46
|
+
<span className="tac-item-top">
|
|
47
|
+
<span className="tac-item-title">{title}</span>
|
|
48
|
+
{badge}
|
|
49
|
+
<span className="tac-item-time">{time}</span>
|
|
50
|
+
</span>
|
|
51
|
+
<span className="tac-item-bottom">
|
|
52
|
+
<span className={`tac-item-preview${live ? ' tac-live' : ''}`}>{preview}</span>
|
|
53
|
+
{fresh && <span className="tac-fresh" />}
|
|
54
|
+
</span>
|
|
55
|
+
</span>
|
|
56
|
+
</button>
|
|
57
|
+
);
|
|
58
|
+
return more ? (
|
|
59
|
+
<div className={`tac-item-row${selected ? ' tac-selected' : ''}`}>
|
|
60
|
+
{row}
|
|
61
|
+
{more}
|
|
62
|
+
</div>
|
|
63
|
+
) : (
|
|
64
|
+
row
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** The top of the side bar: a search, and + to make an agent or a channel. */
|
|
69
|
+
export function SidebarHead({ context }: { context: ChannelsContext }) {
|
|
70
|
+
const { pi, ui } = context;
|
|
71
|
+
const { query, creating } = useUi(ui);
|
|
72
|
+
const w = ChannelViews.words(pi);
|
|
73
|
+
const [menu, setMenu] = React.useState(false);
|
|
74
|
+
const menuRef = React.useRef<HTMLDivElement>(null);
|
|
75
|
+
const Plus = ChannelViews.icon(pi, 'Plus');
|
|
76
|
+
const Search = ChannelViews.icon(pi, 'Search');
|
|
77
|
+
const X = ChannelViews.icon(pi, 'X');
|
|
78
|
+
const Hash = ChannelViews.icon(pi, 'Hash');
|
|
79
|
+
const Bot = ChannelViews.icon(pi, 'Bot');
|
|
80
|
+
React.useEffect(() => {
|
|
81
|
+
if (!menu) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const close = (event: Event) => {
|
|
85
|
+
if (!menuRef.current?.contains(event.target as Node)) {
|
|
86
|
+
setMenu(false);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
document.addEventListener('pointerdown', close);
|
|
90
|
+
return () => document.removeEventListener('pointerdown', close);
|
|
91
|
+
}, [menu]);
|
|
92
|
+
const begin = (kind: 'agent' | 'channel') => {
|
|
93
|
+
setMenu(false);
|
|
94
|
+
if (kind === 'agent') {
|
|
95
|
+
newAgent(context);
|
|
96
|
+
} else {
|
|
97
|
+
ui.set({ creating: true });
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
return (
|
|
101
|
+
<div className="tac-toolbar">
|
|
102
|
+
<label className="tac-search">
|
|
103
|
+
<Search size={14} />
|
|
104
|
+
<input value={query} placeholder={w.search} aria-label={w.search} onChange={event => ui.set({ query: event.target.value })} />
|
|
105
|
+
{query && (
|
|
106
|
+
<button type="button" className="tac-action" title={w.clear} aria-label={w.clear} onClick={() => ui.set({ query: '' })}>
|
|
107
|
+
<X size={12} />
|
|
108
|
+
</button>
|
|
109
|
+
)}
|
|
110
|
+
</label>
|
|
111
|
+
<div className="tac-menu-anchor" ref={menuRef}>
|
|
112
|
+
<button
|
|
113
|
+
type="button"
|
|
114
|
+
className="tac-add"
|
|
115
|
+
title={w.new}
|
|
116
|
+
aria-label={w.new}
|
|
117
|
+
aria-haspopup="menu"
|
|
118
|
+
aria-expanded={menu}
|
|
119
|
+
onClick={() => setMenu(!menu)}
|
|
120
|
+
>
|
|
121
|
+
<Plus size={16} />
|
|
122
|
+
</button>
|
|
123
|
+
{menu && (
|
|
124
|
+
<div className="tac-menu" role="menu">
|
|
125
|
+
<button type="button" role="menuitem" onClick={() => begin('agent')}>
|
|
126
|
+
<Bot size={14} />
|
|
127
|
+
{w.newAgent}
|
|
128
|
+
</button>
|
|
129
|
+
<button type="button" role="menuitem" onClick={() => begin('channel')}>
|
|
130
|
+
<Hash size={14} />
|
|
131
|
+
{w.newChannel}
|
|
132
|
+
</button>
|
|
133
|
+
</div>
|
|
134
|
+
)}
|
|
135
|
+
</div>
|
|
136
|
+
{creating && <NewChannelDialog context={context} onClose={() => ui.set({ creating: false })} />}
|
|
137
|
+
</div>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** The side bar: the double, the channels, then the agents by directory. */
|
|
142
|
+
export function AgentsSidebar({ context }: { context: ChannelsContext }) {
|
|
143
|
+
const { pi, service, ui } = context;
|
|
144
|
+
const state = useChannels(service);
|
|
145
|
+
const { query, draft, channelId, fresh } = useUi(ui);
|
|
146
|
+
const w = ChannelViews.words(pi);
|
|
147
|
+
const faces = useFaces(state.team);
|
|
148
|
+
const serverCwd = useServerCwd(pi) ?? '';
|
|
149
|
+
const shownSession = pi.ui.useSessionId();
|
|
150
|
+
const double = pi.ui.useView(DOUBLE_PAGE);
|
|
151
|
+
const channelPage = pi.ui.useView(CHANNEL_PAGE);
|
|
152
|
+
const agentPage = pi.ui.useView(AGENT_PAGE);
|
|
153
|
+
const [opening, setOpening] = React.useState<string>();
|
|
154
|
+
const Folder = ChannelViews.icon(pi, 'Folder');
|
|
155
|
+
const Avatar = pi.ui.Avatar;
|
|
156
|
+
const { team, working } = state;
|
|
157
|
+
React.useEffect(() => {
|
|
158
|
+
for (const channel of team.channels) {
|
|
159
|
+
void service.messages(channel.id).catch(() => undefined);
|
|
160
|
+
}
|
|
161
|
+
}, [service, team.channels]);
|
|
162
|
+
const name = (id: string) => ChannelsUtil.authorName(team, id, { user: w.you, ta: w.ta });
|
|
163
|
+
const lastSaid = new Map<string, number>();
|
|
164
|
+
for (const messages of Object.values(state.messages)) {
|
|
165
|
+
for (const message of messages) {
|
|
166
|
+
lastSaid.set(message.author, Math.max(lastSaid.get(message.author) ?? 0, message.at));
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const channels = ChannelsUtil.pinnedFirst(team.channels).filter(channel =>
|
|
170
|
+
SidebarUtil.matches(query, channel.name, channel.topic, ...membersOf(team, channel).map(agent => agent.name)),
|
|
171
|
+
);
|
|
172
|
+
const agents = team.agents.filter(agent => SidebarUtil.matches(query, agent.name, agent.role));
|
|
173
|
+
const pageShown = !!double?.shown || !!channelPage?.shown || !!agentPage?.shown;
|
|
174
|
+
const openAgent = (agent: Agent) => {
|
|
175
|
+
setOpening(agent.id);
|
|
176
|
+
ChannelViews.openAgent(context, agent.id)
|
|
177
|
+
.catch(error => pi.ui.notify(ChannelViews.message(error), 'error'))
|
|
178
|
+
.finally(() => setOpening(undefined));
|
|
179
|
+
};
|
|
180
|
+
const agentSelected = (agent: Agent) => {
|
|
181
|
+
const sessionId = context.sessions.get(agent.id);
|
|
182
|
+
return opening === agent.id || (!pageShown && !!sessionId && sessionId === shownSession);
|
|
183
|
+
};
|
|
184
|
+
return (
|
|
185
|
+
<div className="tac-view">
|
|
186
|
+
<div className="tac-list">
|
|
187
|
+
{double && SidebarUtil.matches(query, double.title, w.myDouble) && (
|
|
188
|
+
<div className="tac-double-row">
|
|
189
|
+
<button
|
|
190
|
+
type="button"
|
|
191
|
+
className={`tac-double${double.shown ? ' tac-selected' : ''}`}
|
|
192
|
+
aria-current={double.shown || undefined}
|
|
193
|
+
onClick={() => pi.ui.showView(DOUBLE_PAGE)}
|
|
194
|
+
>
|
|
195
|
+
<Avatar size={44} />
|
|
196
|
+
<span className="tac-double-name">{double.title}</span>
|
|
197
|
+
</button>
|
|
198
|
+
{double.menu && (
|
|
199
|
+
<MoreMenu
|
|
200
|
+
pi={pi}
|
|
201
|
+
label={double.title}
|
|
202
|
+
items={() =>
|
|
203
|
+
(double.menu?.() ?? []).map(section =>
|
|
204
|
+
section.map(({ icon: Icon, ...item }) => ({ ...item, icon: Icon && <Icon size={15} /> })),
|
|
205
|
+
)
|
|
206
|
+
}
|
|
207
|
+
/>
|
|
208
|
+
)}
|
|
209
|
+
</div>
|
|
210
|
+
)}
|
|
211
|
+
{draft && (
|
|
212
|
+
<Row
|
|
213
|
+
avatar={<Face face={draft.face} size={36} />}
|
|
214
|
+
title={draft.name || w.newAgentName}
|
|
215
|
+
preview={w.notStarted}
|
|
216
|
+
time=""
|
|
217
|
+
selected={!!agentPage?.shown}
|
|
218
|
+
onSelect={() => pi.ui.showView(AGENT_PAGE)}
|
|
219
|
+
/>
|
|
220
|
+
)}
|
|
221
|
+
{state.loaded && team.agents.length === 0 && !draft && <div className="tac-empty">{w.noAgentsYet}</div>}
|
|
222
|
+
{state.loaded && team.agents.length > 0 && team.channels.length === 0 && !query && !draft && <div className="tac-empty">{w.empty}</div>}
|
|
223
|
+
{query && channels.length === 0 && agents.length === 0 && <div className="tac-empty">{w.noMatch}</div>}
|
|
224
|
+
{channels.map(channel => {
|
|
225
|
+
const members = membersOf(team, channel);
|
|
226
|
+
const busy = working[channel.id] ?? [];
|
|
227
|
+
const last = state.messages[channel.id]?.filter(message => message.author !== SYSTEM).at(-1);
|
|
228
|
+
const preview =
|
|
229
|
+
busy.length > 0
|
|
230
|
+
? ChannelWords.format(w.answeringNow, { name: busy.map(name).join('、') })
|
|
231
|
+
: last
|
|
232
|
+
? `${name(last.author)}:${last.text.replace(/\s+/g, ' ')}`
|
|
233
|
+
: (channel.topic ?? w.noMessages);
|
|
234
|
+
return (
|
|
235
|
+
<Row
|
|
236
|
+
key={channel.id}
|
|
237
|
+
avatar={<RoomFace members={members} faces={faces} size={36} working={busy} />}
|
|
238
|
+
title={channel.name}
|
|
239
|
+
badge={
|
|
240
|
+
<React.Fragment>
|
|
241
|
+
{members[0] && (
|
|
242
|
+
<span className="tac-lead" title={ChannelWords.format(w.leadOf, { name: members[0].name })}>
|
|
243
|
+
{ChannelViews.maybeIcon(pi, 'Crown', null, 11)}
|
|
244
|
+
<span>{w.lead}</span>
|
|
245
|
+
</span>
|
|
246
|
+
)}
|
|
247
|
+
{channel.pinned && (
|
|
248
|
+
<span className="tac-pinned" title={w.pinned} role="img" aria-label={w.pinned}>
|
|
249
|
+
{ChannelViews.maybeIcon(pi, 'Pin', null, 12)}
|
|
250
|
+
</span>
|
|
251
|
+
)}
|
|
252
|
+
</React.Fragment>
|
|
253
|
+
}
|
|
254
|
+
preview={preview}
|
|
255
|
+
live={busy.length > 0}
|
|
256
|
+
time={SidebarUtil.time(last?.at ?? channel.createdAt, pi.ui.language)}
|
|
257
|
+
fresh={fresh.includes(channel.id)}
|
|
258
|
+
hint={channel.topic ? `#${channel.name} · ${channel.topic}` : `#${channel.name}`}
|
|
259
|
+
selected={!!channelPage?.shown && channelId === channel.id}
|
|
260
|
+
onSelect={() => context.showChannel(channel.id)}
|
|
261
|
+
more={<ChannelMenu context={context} channel={channel} working={busy} />}
|
|
262
|
+
/>
|
|
263
|
+
);
|
|
264
|
+
})}
|
|
265
|
+
{SidebarUtil.byDirectory(agents, serverCwd).map(group => (
|
|
266
|
+
<React.Fragment key={group.cwd}>
|
|
267
|
+
<div className="tac-folder" title={group.cwd}>
|
|
268
|
+
<Folder size={12} />
|
|
269
|
+
<span>{SidebarUtil.folder(group.cwd)}</span>
|
|
270
|
+
</div>
|
|
271
|
+
{group.agents.map(agent => {
|
|
272
|
+
const where = team.channels.find(channel => working[channel.id]?.includes(agent.id));
|
|
273
|
+
return (
|
|
274
|
+
<Row
|
|
275
|
+
key={agent.id}
|
|
276
|
+
avatar={<AgentAvatar agent={agent} faces={faces} size={36} working={!!where} />}
|
|
277
|
+
title={agent.name}
|
|
278
|
+
preview={where ? ChannelWords.format(w.answeringIn, { channel: where.name }) : w.idle}
|
|
279
|
+
live={!!where}
|
|
280
|
+
time={SidebarUtil.time(lastSaid.get(agent.id) ?? agent.createdAt, pi.ui.language)}
|
|
281
|
+
hint={`@${agent.name} · ${agent.role}`}
|
|
282
|
+
selected={agentSelected(agent)}
|
|
283
|
+
onSelect={() => openAgent(agent)}
|
|
284
|
+
more={<AgentMenu context={context} agent={agent} cwd={agent.cwd ?? serverCwd} working={!!where} />}
|
|
285
|
+
/>
|
|
286
|
+
);
|
|
287
|
+
})}
|
|
288
|
+
</React.Fragment>
|
|
289
|
+
))}
|
|
290
|
+
</div>
|
|
291
|
+
</div>
|
|
292
|
+
);
|
|
293
|
+
}
|
package/web-src/style.ts
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/** The styles of the views; only the --ta-* variables of the page, so they follow its theme. */
|
|
2
|
+
export const STYLE = `
|
|
3
|
+
.tac-view { display: flex; flex-direction: column; height: 100%; min-height: 0; color: var(--ta-text); font-size: 13px; }
|
|
4
|
+
.tac-action { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex: none; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--ta-muted); cursor: pointer; }
|
|
5
|
+
.tac-action:hover { background: var(--ta-hover); color: var(--ta-text); }
|
|
6
|
+
.tac-toolbar { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
|
|
7
|
+
.tac-search { position: relative; display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; height: 36px; padding: 0 6px 0 11px; border: 1px solid transparent; border-radius: 10px; background: var(--ta-raised); color: var(--ta-muted); transition: border-color 120ms, background 120ms; box-sizing: border-box; }
|
|
8
|
+
.tac-search:focus-within { border-color: var(--ta-border-field); background: var(--ta-input); }
|
|
9
|
+
.tac-search input { flex: 1; min-width: 0; padding: 0; border: 0; background: none; color: var(--ta-text); font: inherit; font-size: 13.5px; outline: none; }
|
|
10
|
+
.tac-search input::placeholder { color: var(--ta-muted); }
|
|
11
|
+
.tac-search .tac-action { width: 20px; height: 20px; }
|
|
12
|
+
.tac-menu-anchor { position: relative; flex: none; }
|
|
13
|
+
.tac-add { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 10px; background: var(--ta-raised); color: var(--ta-secondary); cursor: pointer; transition: background 120ms, color 120ms; }
|
|
14
|
+
.tac-add:hover, .tac-add[aria-expanded="true"] { background: var(--ta-hover); color: var(--ta-text); }
|
|
15
|
+
.tac-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 160px; padding: 4px; border: 1px solid var(--ta-border-muted); border-radius: 10px; background: var(--ta-raised); box-shadow: var(--ta-shadow-pop); }
|
|
16
|
+
.tac-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; border-radius: 6px; background: none; color: var(--ta-body); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
|
|
17
|
+
.tac-menu button:hover { background: var(--ta-hover); color: var(--ta-text); }
|
|
18
|
+
.tac-menu button svg { color: var(--ta-muted); }
|
|
19
|
+
.tac-list { flex: 1; min-height: 0; overflow: auto; padding: 2px 0 12px; }
|
|
20
|
+
.tac-list > .tac-view > .tac-form { margin: 2px 10px 8px; }
|
|
21
|
+
.tac-double { display: flex; flex-direction: column; align-items: center; gap: 8px; width: calc(100% - 16px); margin: 6px 8px 10px; padding: 14px 10px 12px; border: 0; border-radius: 14px; background: none; color: var(--ta-text); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: background 120ms; }
|
|
22
|
+
.tac-double:hover { background: var(--ta-hover); }
|
|
23
|
+
.tac-double.tac-selected { background: var(--ta-hover-strong); }
|
|
24
|
+
.tac-double-row { position: relative; }
|
|
25
|
+
.tac-pinned { display: inline-flex; flex: none; color: var(--ta-muted); }
|
|
26
|
+
.tac-double-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
27
|
+
.tac-double-row > .tac-item-more { top: 14px; right: 16px; transform: none; }
|
|
28
|
+
.tac-double-row:hover .tac-item-more > .tac-action { opacity: 1; }
|
|
29
|
+
.tac-item-bottom { display: flex; align-items: center; gap: 6px; min-width: 0; }
|
|
30
|
+
.tac-item-bottom .tac-item-preview { flex: 1; min-width: 0; }
|
|
31
|
+
.tac-fresh { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--ta-green); }
|
|
32
|
+
.tac-head { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding-left: 8px; }
|
|
33
|
+
.tac-head-title { display: flex; align-items: baseline; gap: 8px; flex: 1; min-width: 0; white-space: nowrap; }
|
|
34
|
+
.tac-head-title strong { overflow: hidden; text-overflow: ellipsis; font-size: 14.5px; font-weight: 600; }
|
|
35
|
+
.tac-head-count { flex: none; color: var(--ta-muted); font-size: 12px; }
|
|
36
|
+
.tac-head-topic { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--ta-muted); font-size: 12.5px; }
|
|
37
|
+
.tac-head-members { display: flex; align-items: center; flex: none; height: 32px; padding: 0 6px 0 10px; border: 0; border-radius: 999px; background: none; color: inherit; font: inherit; cursor: pointer; transition: background 120ms; }
|
|
38
|
+
.tac-head-members:hover, .tac-head-members.tac-on { background: var(--ta-hover); }
|
|
39
|
+
.tac-head-members:focus-visible { outline: 1px solid var(--ta-border-focus); outline-offset: -1px; }
|
|
40
|
+
.tac-head-face { display: inline-flex; margin-left: -4px; padding: 1px; border-radius: 50%; background: var(--ta-main); }
|
|
41
|
+
.tac-head-members:hover .tac-head-face, .tac-head-members.tac-on .tac-head-face { background: var(--ta-hover); }
|
|
42
|
+
.tac-head-more { margin-left: 4px; color: var(--ta-muted); font-size: 11.5px; }
|
|
43
|
+
.tac-action.tac-on { background: var(--ta-hover-strong); color: var(--ta-text); }
|
|
44
|
+
.tac-room-page { display: flex; flex-direction: column; flex: 1; min-height: 0; background: var(--ta-main); color: var(--ta-text); }
|
|
45
|
+
.tac-room-none { display: grid; place-items: center; flex: 1; color: var(--ta-muted); font-size: 13px; }
|
|
46
|
+
.tac-chat { flex: 1; min-height: 0; overflow-y: auto; }
|
|
47
|
+
.tac-chat-col { display: flex; flex-direction: column; gap: 4px; max-width: calc(var(--ta-col) + 48px); margin: 0 auto; padding: 20px 24px 12px; box-sizing: border-box; }
|
|
48
|
+
.tac-chat-time { align-self: center; margin: 14px 0 6px; color: var(--ta-muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
|
|
49
|
+
.tac-chat-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 12vh auto 0; max-width: 360px; color: var(--ta-muted); font-size: 13px; text-align: center; }
|
|
50
|
+
.tac-chat-empty strong { margin-top: 6px; color: var(--ta-text); font-size: 16px; }
|
|
51
|
+
.tac-chat-hint { margin-top: 4px; font-size: 12px; }
|
|
52
|
+
.tac-mine { margin: 6px 0 2px; }
|
|
53
|
+
.tac-msg { display: flex; align-items: flex-start; gap: 10px; }
|
|
54
|
+
.tac-msg.tac-first { margin-top: 10px; }
|
|
55
|
+
.tac-msg-face { display: flex; justify-content: center; width: 28px; flex: none; }
|
|
56
|
+
.tac-msg-col { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; max-width: min(84%, var(--ta-col)); }
|
|
57
|
+
.tac-msg-name { display: flex; align-items: center; gap: 6px; margin: 0 2px 4px; color: var(--ta-muted); font-size: 12px; line-height: 16px; }
|
|
58
|
+
.tac-msg-lead { padding: 0 5px; border-radius: 999px; background: color-mix(in srgb, var(--ta-green) 12%, transparent); color: var(--ta-green); font-size: 10.5px; font-weight: 600; line-height: 15px; }
|
|
59
|
+
.tac-msg-bubble { min-width: 0; max-width: 100%; padding: 9px 14px; border: 1px solid var(--ta-border-muted); border-radius: 5px 16px 16px 16px; background: var(--ta-side); color: var(--ta-body); line-height: 1.6; overflow-wrap: anywhere; }
|
|
60
|
+
.tac-msg-bubble.tac-failed { border-color: color-mix(in srgb, var(--ta-red) 35%, transparent); }
|
|
61
|
+
.tac-msg-failed { margin-bottom: 4px; color: var(--ta-red); font-size: 12px; }
|
|
62
|
+
.tac-msg-bubble pre { max-width: 100%; overflow-x: auto; }
|
|
63
|
+
.tac-mention { color: var(--ta-link); }
|
|
64
|
+
.tac-notice { align-self: center; margin: 10px 0; padding: 3px 10px; border-radius: 999px; background: var(--ta-hover); color: var(--ta-muted); font-size: 12px; }
|
|
65
|
+
.tac-live { display: flex; align-items: center; gap: 8px; align-self: flex-start; margin: 10px 0 0 38px; padding: 5px 12px 5px 8px; border-radius: 999px; background: var(--ta-hover); color: var(--ta-secondary); font-size: 12.5px; }
|
|
66
|
+
.tac-live-faces { display: inline-flex; }
|
|
67
|
+
.tac-live-faces > * + * { margin-left: -4px; }
|
|
68
|
+
.tac-chat-bottom { width: 100%; max-width: calc(var(--ta-col) + 48px); margin: 0 auto; padding: 8px 24px calc(16px + env(safe-area-inset-bottom)); box-sizing: border-box; flex: none; display: flex; flex-direction: column; gap: 8px; }
|
|
69
|
+
@media (max-width: 720px) {
|
|
70
|
+
.tac-head-topic, .tac-head-face:nth-child(n + 4), .tac-head-more { display: none; }
|
|
71
|
+
.tac-chat-col, .tac-chat-bottom { padding-left: 14px; padding-right: 14px; }
|
|
72
|
+
.tac-msg-col { max-width: calc(100% - 38px); }
|
|
73
|
+
}
|
|
74
|
+
.tac-new-head { position: relative; display: flex; align-items: center; justify-content: center; flex: 1; min-width: 0; height: 100%; }
|
|
75
|
+
.tac-new-title { position: relative; display: flex; justify-content: center; min-width: 0; }
|
|
76
|
+
.tac-new-head > .tac-button { position: absolute; right: 0; }
|
|
77
|
+
.tac-new-trigger { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--ta-text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
|
|
78
|
+
.tac-new-trigger span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
79
|
+
.tac-new-trigger:hover, .tac-new-trigger[aria-expanded="true"] { background: var(--ta-hover); }
|
|
80
|
+
.tac-new-trigger svg { flex: none; color: var(--ta-muted); }
|
|
81
|
+
.tac-identity { position: absolute; top: calc(100% + 8px); left: 50%; z-index: 30; width: 300px; max-width: calc(100vw - 24px); padding: 12px; border: 1px solid var(--ta-border); border-radius: 14px; background: var(--ta-side); box-shadow: var(--ta-shadow-pop); transform: translateX(-50%); animation: tac-pop 140ms ease-out; box-sizing: border-box; }
|
|
82
|
+
.tac-identity-label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; color: var(--ta-muted); font-size: 12px; }
|
|
83
|
+
.tac-identity-label .tac-input { height: 36px; font-size: 13.5px; }
|
|
84
|
+
.tac-faces { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
|
|
85
|
+
.tac-face-pick { display: grid; place-items: center; aspect-ratio: 1; padding: 0; border: 2px solid transparent; border-radius: 12px; background: none; cursor: pointer; transition: background 120ms, border-color 120ms; }
|
|
86
|
+
.tac-face-pick:hover { background: var(--ta-hover); }
|
|
87
|
+
.tac-face-pick.tac-on { border-color: var(--ta-border-focus); background: var(--ta-hover); }
|
|
88
|
+
@keyframes tac-pop { from { opacity: 0; transform: translate(-50%, -4px); } to { opacity: 1; transform: translate(-50%, 0); } }
|
|
89
|
+
.tac-button.tac-quiet { border-color: transparent; background: none; color: var(--ta-secondary); }
|
|
90
|
+
.tac-button.tac-quiet:hover { background: var(--ta-hover); color: var(--ta-text); }
|
|
91
|
+
.tac-new-page { display: flex; flex: 1; min-height: 0; overflow-y: auto; background: var(--ta-main); color: var(--ta-text); }
|
|
92
|
+
.tac-new-col { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: calc(var(--ta-col) + 48px); margin: auto; padding: 24px 24px calc(28px + env(safe-area-inset-bottom)); box-sizing: border-box; }
|
|
93
|
+
.tac-new-name { display: flex; align-items: center; gap: 4px; margin: 16px 0 6px; font-size: 22px; font-weight: 700; }
|
|
94
|
+
.tac-new-name .tac-action { color: var(--ta-muted); }
|
|
95
|
+
.tac-new-hint { margin: 0 0 22px; max-width: 460px; color: var(--ta-muted); font-size: 13px; line-height: 1.6; text-align: center; }
|
|
96
|
+
.tac-new-box { width: 100%; display: flex; flex-direction: column; gap: 8px; }
|
|
97
|
+
.tac-dialog { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
|
|
98
|
+
.tac-dialog-label { display: flex; flex-direction: column; gap: 8px; color: var(--ta-secondary); font-size: 13px; }
|
|
99
|
+
div.tac-dialog-label { flex-direction: row; justify-content: space-between; margin-top: 6px; }
|
|
100
|
+
.tac-dialog-count { color: var(--ta-muted); font-variant-numeric: tabular-nums; }
|
|
101
|
+
.tac-dialog-input { height: 40px; font-size: 14px; }
|
|
102
|
+
.tac-dialog-search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--ta-border-field); border-radius: 10px; background: var(--ta-input); color: var(--ta-muted); box-sizing: border-box; }
|
|
103
|
+
.tac-dialog-search:focus-within { border-color: var(--ta-border-focus); }
|
|
104
|
+
.tac-dialog-search input { flex: 1; min-width: 0; padding: 0; border: 0; background: none; color: var(--ta-text); font: inherit; font-size: 13.5px; outline: none; }
|
|
105
|
+
.tac-pick-list { display: flex; flex-direction: column; max-height: min(320px, 40vh); overflow-y: auto; padding: 4px; border: 1px solid var(--ta-border-muted); border-radius: 12px; }
|
|
106
|
+
.tac-pick-list > .tac-empty { padding: 14px 10px; }
|
|
107
|
+
.tac-pick { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: 9px; background: none; color: var(--ta-text); font: inherit; text-align: left; cursor: pointer; }
|
|
108
|
+
.tac-pick:hover:not(:disabled) { background: var(--ta-hover); }
|
|
109
|
+
.tac-pick:disabled { opacity: 0.45; cursor: default; }
|
|
110
|
+
.tac-check { display: grid; place-items: center; width: 18px; height: 18px; flex: none; border: 1.5px solid var(--ta-border-field); border-radius: 5px; color: var(--ta-main); box-sizing: border-box; }
|
|
111
|
+
.tac-pick.tac-on .tac-check { border-color: var(--ta-text); background: var(--ta-text); }
|
|
112
|
+
.tac-pick-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
|
|
113
|
+
.tac-pick-name { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; }
|
|
114
|
+
.tac-pick-role { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: 12px; }
|
|
115
|
+
.tac-dialog-note { color: var(--ta-muted); font-size: 12px; }
|
|
116
|
+
.tac-dialog-actions { display: flex; justify-content: flex-end; margin-top: 4px; }
|
|
117
|
+
.tac-dialog-actions .tac-button { height: 36px; padding: 0 18px; font-size: 13.5px; }
|
|
118
|
+
@media (max-width: 720px) {
|
|
119
|
+
.tac-new-head > .tac-button { position: static; margin-left: auto; }
|
|
120
|
+
.tac-new-head { justify-content: flex-start; }
|
|
121
|
+
.tac-identity { position: fixed; top: calc(60px + env(safe-area-inset-top) + var(--ta-titlebar, 0px)); left: 12px; right: 12px; width: auto; max-width: none; transform: none; animation: none; }
|
|
122
|
+
}
|
|
123
|
+
.tac-empty { padding: 8px 18px; }
|
|
124
|
+
.tac-item { position: relative; display: flex; align-items: center; gap: 10px; width: calc(100% - 16px); margin: 4px 8px; padding: 8px 10px; border: 0; border-radius: 12px; background: none; color: var(--ta-text); font: inherit; text-align: left; cursor: pointer; transition: background 120ms; }
|
|
125
|
+
.tac-item:hover { background: var(--ta-hover); }
|
|
126
|
+
.tac-item.tac-selected { background: var(--ta-hover-strong); }
|
|
127
|
+
.tac-item.tac-selected::before { content: ''; position: absolute; left: 2px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--ta-green); }
|
|
128
|
+
.tac-item-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
|
|
129
|
+
.tac-item-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
|
|
130
|
+
.tac-item-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 500; line-height: 18px; }
|
|
131
|
+
.tac-item-time { flex: none; margin-left: auto; padding-left: 4px; color: var(--ta-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
|
|
132
|
+
.tac-item-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: 12px; line-height: 17px; }
|
|
133
|
+
.tac-item-preview.tac-live { color: var(--ta-green); }
|
|
134
|
+
.tac-lead { display: inline-flex; align-items: center; gap: 3px; flex: none; max-width: 96px; overflow: hidden; padding: 0 6px; border: 1px solid color-mix(in srgb, var(--ta-green) 35%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--ta-green) 10%, transparent); color: var(--ta-green); font-size: 10.5px; font-weight: 600; line-height: 16px; white-space: nowrap; }
|
|
135
|
+
.tac-lead span { overflow: hidden; text-overflow: ellipsis; }
|
|
136
|
+
.tac-lead svg { flex: none; }
|
|
137
|
+
.tac-folder { display: flex; align-items: center; gap: 5px; margin: 12px 18px 4px; color: var(--ta-muted); font-size: 11.5px; line-height: 16px; }
|
|
138
|
+
.tac-folder span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
139
|
+
.tac-face { display: inline-flex; flex: none; }
|
|
140
|
+
.tac-face svg { display: block; overflow: visible; }
|
|
141
|
+
.tac-face-eyes { transform-box: fill-box; transform-origin: center; animation: tac-blink 5.2s infinite; }
|
|
142
|
+
.tac-face[data-face="1"] .tac-face-eyes, .tac-face[data-face="5"] .tac-face-eyes, .tac-face[data-face="9"] .tac-face-eyes, .tac-face[data-face="13"] .tac-face-eyes { animation-delay: -1.7s; }
|
|
143
|
+
.tac-face[data-face="2"] .tac-face-eyes, .tac-face[data-face="6"] .tac-face-eyes, .tac-face[data-face="10"] .tac-face-eyes, .tac-face[data-face="14"] .tac-face-eyes { animation-delay: -3.1s; }
|
|
144
|
+
.tac-face[data-face="3"] .tac-face-eyes, .tac-face[data-face="7"] .tac-face-eyes, .tac-face[data-face="11"] .tac-face-eyes, .tac-face[data-face="15"] .tac-face-eyes { animation-delay: -4.4s; }
|
|
145
|
+
.tac-face-working .tac-face-look { animation: tac-look 2.4s ease-in-out infinite; }
|
|
146
|
+
.tac-face-working .tac-face-body { transform-box: fill-box; transform-origin: 50% 100%; animation: tac-bob 1.2s ease-in-out infinite; }
|
|
147
|
+
@keyframes tac-blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(0.1); } }
|
|
148
|
+
@keyframes tac-look { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-1.4px); } 70% { transform: translateX(1.4px); } }
|
|
149
|
+
@keyframes tac-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.2px); } }
|
|
150
|
+
@media (prefers-reduced-motion: reduce) { .tac-face * { animation: none !important; } }
|
|
151
|
+
.tac-room { position: relative; display: inline-flex; flex: none; }
|
|
152
|
+
.tac-room-back { position: absolute; right: 0; top: 0; }
|
|
153
|
+
.tac-room-front { position: absolute; left: 0; bottom: 0; z-index: 1; }
|
|
154
|
+
.tac-empty { padding: 8px; color: var(--ta-muted); font-size: 12px; line-height: 1.6; }
|
|
155
|
+
.tac-error { color: var(--ta-red); }
|
|
156
|
+
.tac-form { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; padding: 8px; border: 1px solid var(--ta-border-muted); border-radius: 8px; background: var(--ta-card); }
|
|
157
|
+
.tac-form label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--ta-secondary); }
|
|
158
|
+
.tac-input { width: 100%; box-sizing: border-box; padding: 5px 8px; border: 1px solid var(--ta-border-field); border-radius: 8px; background: var(--ta-input); color: var(--ta-text); font: inherit; font-size: 13px; }
|
|
159
|
+
.tac-input:focus { outline: none; border-color: var(--ta-border-focus); }
|
|
160
|
+
textarea.tac-input { resize: vertical; min-height: 56px; line-height: 1.5; }
|
|
161
|
+
.tac-chips { display: flex; flex-wrap: wrap; gap: 4px; }
|
|
162
|
+
.tac-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid var(--ta-border-muted); border-radius: 12px; background: none; color: var(--ta-body); font: inherit; font-size: 12px; cursor: pointer; }
|
|
163
|
+
.tac-chip.tac-on { border-color: var(--ta-accent); color: var(--ta-text); background: var(--ta-selected); }
|
|
164
|
+
.tac-chip small { color: var(--ta-muted); }
|
|
165
|
+
.tac-buttons { display: flex; justify-content: flex-end; gap: 6px; }
|
|
166
|
+
.tac-button { padding: 4px 12px; border: 1px solid var(--ta-border); border-radius: 8px; background: var(--ta-raised); color: var(--ta-text); font: inherit; font-size: 12.5px; cursor: pointer; }
|
|
167
|
+
.tac-button.tac-primary { border-color: transparent; background: var(--ta-text); color: var(--ta-main); }
|
|
168
|
+
.tac-button:disabled { opacity: 0.5; cursor: default; }
|
|
169
|
+
.tac-button.tac-danger { border-color: transparent; background: var(--ta-red); color: #fff; }
|
|
170
|
+
.tac-link { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px; border: 0; border-radius: 6px; background: none; color: var(--ta-secondary); font: inherit; font-size: 12.5px; cursor: pointer; }
|
|
171
|
+
.tac-link:hover { background: var(--ta-hover); }
|
|
172
|
+
.tac-link.tac-danger { color: var(--ta-red); }
|
|
173
|
+
.tac-members { background: var(--ta-main); }
|
|
174
|
+
.tac-members-none { display: grid; place-items: center; flex: 1; padding: 24px; color: var(--ta-muted); text-align: center; }
|
|
175
|
+
.tac-members-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 8px 12px; }
|
|
176
|
+
.tac-members-top { display: flex; align-items: center; gap: 12px; padding: 14px 10px 12px; }
|
|
177
|
+
.tac-members-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
|
|
178
|
+
.tac-members-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 600; }
|
|
179
|
+
.tac-members-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: 12px; }
|
|
180
|
+
.tac-members-label { padding: 10px 10px 6px; color: var(--ta-muted); font-size: 12px; }
|
|
181
|
+
.tac-members-head { display: flex; align-items: center; gap: 6px; flex: none; padding: 10px 12px 4px 8px; font-size: 13.5px; }
|
|
182
|
+
.tac-members-search { flex: none; margin: 6px 16px 2px; }
|
|
183
|
+
.tac-members-sep { height: 1px; margin: 6px 10px; background: var(--ta-border-muted); }
|
|
184
|
+
.tac-member { position: relative; display: flex; align-items: center; border-radius: 12px; transition: background 120ms; }
|
|
185
|
+
.tac-member:hover, .tac-member:focus-within { background: var(--ta-hover); }
|
|
186
|
+
.tac-member-main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; width: 100%; padding: 8px 10px; border: 0; border-radius: 12px; background: none; color: var(--ta-text); font: inherit; text-align: left; cursor: pointer; }
|
|
187
|
+
.tac-members-scroll > .tac-member-main:hover { background: var(--ta-hover); }
|
|
188
|
+
.tac-member .tac-member-main:focus-visible, .tac-members-scroll > .tac-member-main:focus-visible { outline: 1px solid var(--ta-border-focus); outline-offset: -1px; }
|
|
189
|
+
.tac-member-plus { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--ta-hover); color: var(--ta-secondary); }
|
|
190
|
+
.tac-member-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
|
|
191
|
+
.tac-member-name { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13.5px; font-weight: 500; line-height: 18px; }
|
|
192
|
+
.tac-member-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
193
|
+
.tac-member-detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: 12px; line-height: 17px; }
|
|
194
|
+
.tac-member-detail.tac-live { color: var(--ta-green); }
|
|
195
|
+
.tac-member.tac-muted .tac-member-main > :first-child { opacity: 0.5; }
|
|
196
|
+
.tac-member-actions { display: flex; align-items: center; gap: 2px; flex: none; padding-right: 8px; opacity: 0; transition: opacity 120ms; }
|
|
197
|
+
.tac-member:hover .tac-member-actions, .tac-member:focus-within .tac-member-actions, .tac-member.tac-muted .tac-member-actions { opacity: 1; }
|
|
198
|
+
.tac-member.tac-muted:not(:hover):not(:focus-within) .tac-member-actions > :not(.tac-on) { visibility: hidden; }
|
|
199
|
+
.tac-member-actions .tac-action { width: 28px; height: 28px; border-radius: 8px; }
|
|
200
|
+
.tac-member-actions .tac-action:disabled { opacity: 0.35; cursor: default; background: none; }
|
|
201
|
+
.tac-member:hover .tac-action:not(:disabled):hover { background: var(--ta-hover-strong); }
|
|
202
|
+
.tac-pick.tac-on { background: var(--ta-hover); }
|
|
203
|
+
.tac-members-scroll > .tac-pick { margin: 1px 0; }
|
|
204
|
+
.tac-check { display: grid; place-items: center; width: 18px; height: 18px; flex: none; box-sizing: border-box; border: 1.5px solid var(--ta-border-field); border-radius: 50%; color: var(--ta-main); }
|
|
205
|
+
.tac-pick.tac-on .tac-check { border-color: var(--ta-green); background: var(--ta-green); }
|
|
206
|
+
.tac-members-foot { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex: none; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--ta-border-muted); }
|
|
207
|
+
.tac-members-ask { flex: 1; min-width: 0; color: var(--ta-body); font-size: 12.5px; }
|
|
208
|
+
.tac-button.tac-wide { flex: 1; height: 36px; border-radius: 10px; font-size: 13.5px; }
|
|
209
|
+
@media (hover: none) {
|
|
210
|
+
.tac-member-actions { opacity: 1; }
|
|
211
|
+
.tac-member.tac-muted .tac-member-actions > :not(.tac-on) { visibility: visible; }
|
|
212
|
+
}
|
|
213
|
+
.tac-action:focus-visible, .tac-item:focus-visible, .tac-add:focus-visible, .tac-menu button:focus-visible, .tac-chip:focus-visible, .tac-button:focus-visible { outline: 1px solid var(--ta-border-focus); outline-offset: -1px; }
|
|
214
|
+
.tac-mention { color: var(--ta-link); }
|
|
215
|
+
@media (pointer: coarse) {
|
|
216
|
+
.tac-item { padding: 10px; }
|
|
217
|
+
.tac-action { width: 32px; height: 32px; }
|
|
218
|
+
.tac-input { font-size: 16px; }
|
|
219
|
+
}
|
|
220
|
+
/* The … of an agent: over the time while its row is hovered, focused or its menu open */
|
|
221
|
+
.tac-item-row { position: relative; }
|
|
222
|
+
.tac-item-row > .tac-item { width: calc(100% - 16px); }
|
|
223
|
+
.tac-item-more { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); z-index: 2; }
|
|
224
|
+
.tac-item-more > .tac-action { width: 26px; height: 26px; background: var(--ta-hover-strong); color: var(--ta-secondary); opacity: 0; transition: opacity 120ms; }
|
|
225
|
+
.tac-item-row:hover .tac-item-more > .tac-action, .tac-item-more > .tac-action:focus-visible, .tac-item-more > .tac-action[aria-expanded="true"] { opacity: 1; }
|
|
226
|
+
.tac-item-row:hover .tac-item-time, .tac-item-row:has(.tac-item-more [aria-expanded="true"]) .tac-item-time { visibility: hidden; }
|
|
227
|
+
.tac-agent-menu { top: calc(100% + 4px); width: 210px; padding: 5px; border-color: var(--ta-border); background: var(--ta-side); }
|
|
228
|
+
.tac-agent-menu.tac-up { top: auto; bottom: calc(100% + 4px); }
|
|
229
|
+
.tac-agent-menu button { gap: 10px; height: 32px; padding: 0 9px; border-radius: 7px; }
|
|
230
|
+
.tac-agent-menu button:disabled { opacity: 0.4; cursor: default; background: none; }
|
|
231
|
+
.tac-menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
232
|
+
.tac-menu-line { height: 1px; margin: 4px 2px; border: 0; background: var(--ta-border-muted); }
|
|
233
|
+
.tac-menu button.tac-danger, .tac-menu button.tac-danger svg { color: var(--ta-red); }
|
|
234
|
+
textarea.tac-role-input { min-height: 200px; max-height: 50vh; font-size: 13px; line-height: 1.6; }
|
|
235
|
+
@media (max-width: 720px), (pointer: coarse) {
|
|
236
|
+
.tac-item-more > .tac-action { opacity: 1; background: none; }
|
|
237
|
+
.tac-item-row .tac-item-time { visibility: hidden; }
|
|
238
|
+
}
|
|
239
|
+
`;
|
|
240
|
+
|
|
241
|
+
/** Adds the styles to the page; the function returned takes them away. */
|
|
242
|
+
export function injectStyle(): () => void {
|
|
243
|
+
const element = document.createElement('style');
|
|
244
|
+
element.dataset.taPackage = 'ta-channels';
|
|
245
|
+
element.textContent = STYLE;
|
|
246
|
+
document.head.appendChild(element);
|
|
247
|
+
return () => element.remove();
|
|
248
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { ChannelsUtil, TA } from './channels-util';
|
|
2
|
+
import type { TeamService } from './team';
|
|
3
|
+
|
|
4
|
+
/** A tool of ta to build a team for what the user wants and to talk to it, with the team of ta serve. */
|
|
5
|
+
export interface TeamTool {
|
|
6
|
+
name: string;
|
|
7
|
+
label: string;
|
|
8
|
+
description: string;
|
|
9
|
+
/** JSON Schema of an object. */
|
|
10
|
+
parameters: Record<string, unknown>;
|
|
11
|
+
run(team: TeamService, params: Record<string, unknown>): Promise<string>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export namespace TeamTools {
|
|
15
|
+
export const ALL: TeamTool[] = [
|
|
16
|
+
{
|
|
17
|
+
name: 'create_agent',
|
|
18
|
+
label: 'Create agent',
|
|
19
|
+
description:
|
|
20
|
+
'Creates an agent: another Ta with a role of its own and its own session, which works in channels. Create agents when a goal needs several roles (for example a designer, an engineer and a reviewer), then a channel for them.',
|
|
21
|
+
parameters: {
|
|
22
|
+
type: 'object',
|
|
23
|
+
properties: {
|
|
24
|
+
name: { type: 'string', description: 'Short and unique, without spaces; channels mention it as @name.' },
|
|
25
|
+
role: { type: 'string', description: 'What the agent does and how, in the second person: its instructions.' },
|
|
26
|
+
cwd: { type: 'string', description: "The directory it works in; default: the server's directory." },
|
|
27
|
+
},
|
|
28
|
+
required: ['name', 'role'],
|
|
29
|
+
},
|
|
30
|
+
run: async (team, params) => `Created @${(await team.createAgent(params as { name: unknown; role: unknown; cwd?: unknown })).name}.`,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'create_channel',
|
|
34
|
+
label: 'Create channel',
|
|
35
|
+
description:
|
|
36
|
+
'Creates a channel of agents that exist. The first member leads: it gets the messages that mention nobody. The user sees the channel in the Team view of the web page.',
|
|
37
|
+
parameters: {
|
|
38
|
+
type: 'object',
|
|
39
|
+
properties: {
|
|
40
|
+
name: { type: 'string', description: 'Short, without spaces.' },
|
|
41
|
+
members: { type: 'array', items: { type: 'string' }, description: 'Names of agents; the lead first.' },
|
|
42
|
+
topic: { type: 'string', description: 'What the channel is for, in one sentence.' },
|
|
43
|
+
},
|
|
44
|
+
required: ['name', 'members'],
|
|
45
|
+
},
|
|
46
|
+
run: async (team, params) => {
|
|
47
|
+
const channel = await team.createChannel(params as { name: unknown; members: unknown; topic?: unknown });
|
|
48
|
+
await team.focus(channel.id);
|
|
49
|
+
return `Created #${channel.name}.`;
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'add_to_channel',
|
|
54
|
+
label: 'Add to channel',
|
|
55
|
+
description:
|
|
56
|
+
'Adds agents that exist to a channel, after its members: the lead stays. Add an agent when the work in a channel needs a role it lacks; create the agent first if there is none.',
|
|
57
|
+
parameters: {
|
|
58
|
+
type: 'object',
|
|
59
|
+
properties: {
|
|
60
|
+
channel: { type: 'string', description: 'The name of the channel.' },
|
|
61
|
+
members: { type: 'array', items: { type: 'string' }, description: 'Names of agents to add.' },
|
|
62
|
+
},
|
|
63
|
+
required: ['channel', 'members'],
|
|
64
|
+
},
|
|
65
|
+
run: async (team, params) => {
|
|
66
|
+
const { channel, added } = await team.addMembers(params as { channel: unknown; members: unknown });
|
|
67
|
+
await team.focus(channel.id);
|
|
68
|
+
return added.length > 0
|
|
69
|
+
? `Added ${added.map(agent => `@${agent.name}`).join(', ')} to #${channel.name}.`
|
|
70
|
+
: `They are in #${channel.name} already.`;
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: 'post_to_channel',
|
|
75
|
+
label: 'Post to channel',
|
|
76
|
+
description:
|
|
77
|
+
'Posts a message to a channel and waits for the answers. The agents it mentions as @name answer, or the lead when it mentions nobody; agents may hand on to each other a few times. Returns the answers.',
|
|
78
|
+
parameters: {
|
|
79
|
+
type: 'object',
|
|
80
|
+
properties: {
|
|
81
|
+
channel: { type: 'string', description: 'The name of the channel.' },
|
|
82
|
+
message: { type: 'string', description: 'What to say; mention agents as @name.' },
|
|
83
|
+
},
|
|
84
|
+
required: ['channel', 'message'],
|
|
85
|
+
},
|
|
86
|
+
run: async (team, params) => {
|
|
87
|
+
const { channel, done } = await team.post(String(params.channel ?? ''), TA, String(params.message ?? ''));
|
|
88
|
+
await team.focus(channel.id);
|
|
89
|
+
const replies = await done;
|
|
90
|
+
return replies.length > 0 ? ChannelsUtil.transcript(team.state, replies) : 'Posted; nobody was asked to answer.';
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: 'list_channels',
|
|
95
|
+
label: 'List channels',
|
|
96
|
+
description: 'Lists the agents, their roles, and the channels with their members.',
|
|
97
|
+
parameters: { type: 'object', properties: {} },
|
|
98
|
+
run: async team => ChannelsUtil.summary(team.state),
|
|
99
|
+
},
|
|
100
|
+
];
|
|
101
|
+
|
|
102
|
+
export const NAMES = ALL.map(tool => tool.name);
|
|
103
|
+
}
|