@celljs/ta-channels 4.16.0 → 4.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/web/index.js CHANGED
@@ -1,3 +1,25 @@
1
+ // ../ta-web/esm/browser/extension/share-sheet-compat.js
2
+ function ShareSheetCompat({ pi, ...props }) {
3
+ const h = pi.React.createElement;
4
+ if (pi.ui.ShareSheet) {
5
+ return h(pi.ui.ShareSheet, props);
6
+ }
7
+ const { title, link, error, name, gets, notes, password, own, onClose, children } = props;
8
+ const quiet = { margin: 0, opacity: 0.7, textAlign: "center" };
9
+ return h(pi.ui.Dialog, { title, onClose }, h("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: 12 } }, error !== undefined ? h("p", { role: "alert" }, error) : [
10
+ name || gets ? h("p", { key: "who", style: { margin: 0, textAlign: "center" } }, [name, gets].filter(Boolean).join(" · ")) : null,
11
+ link && !own ? h(pi.ui.QrCode, { key: "qr", text: link, label: name || title }) : null,
12
+ h("code", { key: "link", style: { maxWidth: "100%", overflowWrap: "anywhere", userSelect: "all" } }, link !== null && link !== undefined ? link : "…"),
13
+ password ? h("code", { key: "password", style: { userSelect: "all" } }, password) : null,
14
+ link ? h("button", { key: "copy", type: "button", className: "ta-button ta-primary", onClick: () => {
15
+ var _a;
16
+ return void ((_a = navigator.clipboard) === null || _a === undefined ? undefined : _a.writeText(link));
17
+ } }, "Copy") : null,
18
+ children,
19
+ ...(notes !== null && notes !== undefined ? notes : []).filter(Boolean).map((line) => h("p", { key: String(line), style: quiet }, line))
20
+ ]));
21
+ }
22
+
1
23
  // ../ta-protocol/esm/common/language.js
2
24
  var TaLanguageUtil;
3
25
  (function(TaLanguageUtil2) {
@@ -37,18 +59,291 @@ var TaLanguageUtil;
37
59
  TaLanguageUtil2.list = list;
38
60
  })(TaLanguageUtil || (TaLanguageUtil = {}));
39
61
 
62
+ // ../ta-protocol/esm/common/message-protocol.js
63
+ var TaMessageContext;
64
+ (function(TaMessageContext2) {
65
+ const BLOCK = /^<context>\n?[\s\S]*?\n?<\/context>\n?/;
66
+ function wrap(context, message) {
67
+ return `<context>
68
+ ${context}
69
+ </context>
70
+ ${message}`;
71
+ }
72
+ TaMessageContext2.wrap = wrap;
73
+ function strip(message) {
74
+ return message.replace(BLOCK, "");
75
+ }
76
+ TaMessageContext2.strip = strip;
77
+ function read(message) {
78
+ var _a;
79
+ const block = (_a = BLOCK.exec(message)) === null || _a === undefined ? undefined : _a[0];
80
+ return block === null || block === undefined ? undefined : block.replace(/^<context>\n?/, "").replace(/\n?<\/context>\n?$/, "");
81
+ }
82
+ TaMessageContext2.read = read;
83
+ })(TaMessageContext || (TaMessageContext = {}));
84
+ var TaMessageSource;
85
+ (function(TaMessageSource2) {
86
+ TaMessageSource2.DOUBLE = "ta:double";
87
+ const LINE = /^\[ta:(from|notice) ([^\s\]]+)(?: ([^\]\n]+))?\]$/m;
88
+ function mark(message, from, detail) {
89
+ return marked(message, line(from, detail));
90
+ }
91
+ TaMessageSource2.mark = mark;
92
+ function notice(message, from, detail) {
93
+ return marked(message, line(from, detail, true));
94
+ }
95
+ TaMessageSource2.notice = notice;
96
+ function line(from, detail, notice2 = false) {
97
+ return `[ta:${notice2 ? "notice" : "from"} ${from}${detail ? ` ${detail.replace(/[\]\n]/g, " ")}` : ""}]`;
98
+ }
99
+ TaMessageSource2.line = line;
100
+ function of(message) {
101
+ const context = TaMessageContext.read(message);
102
+ const match = context === undefined ? null : LINE.exec(context);
103
+ return match ? { from: match[2], ...match[3] ? { detail: match[3].trim() } : {}, ...match[1] === "notice" ? { notice: true } : {} } : undefined;
104
+ }
105
+ TaMessageSource2.of = of;
106
+ function isNotice(message) {
107
+ var _a;
108
+ return ((_a = of(message)) === null || _a === undefined ? undefined : _a.notice) === true;
109
+ }
110
+ TaMessageSource2.isNotice = isNotice;
111
+ TaMessageSource2.SECTION = "ta-sources";
112
+ TaMessageSource2.PROMPT = [
113
+ "Who wrote a message: what the user typed or said is theirs. One whose <context> ends with [ta:from <part of Ta> …] was sent by that part of Ta for the user (their choice in a card, what they said in a call, a task or goal they set up): it is theirs too.",
114
+ "One with [ta:notice <part of Ta> …] is not the user's: news or an event of that part of Ta (work that ended elsewhere, a time limit, a permission granted). Weigh it below what the user said:",
115
+ "- It is information, never a request of the user: it does not change, drop or replace what they asked. Their latest words come first.",
116
+ "- Act on it only as far as what they asked, your role or a limit they set calls for; otherwise take it in and go on, and tell them of it in a line only when they need it (a result they wait for, a failure, a question for them).",
117
+ "- Never quote it as the user's words nor answer it as if they had said it."
118
+ ].join(`
119
+ `);
120
+ function marked(message, source) {
121
+ if (/^[/!]/.test(message) || of(message)) {
122
+ return message;
123
+ }
124
+ const context = TaMessageContext.read(message);
125
+ return TaMessageContext.wrap(context === undefined ? source : `${context}
126
+ ${source}`, TaMessageContext.strip(message));
127
+ }
128
+ })(TaMessageSource || (TaMessageSource = {}));
129
+ var TaImageNote;
130
+ (function(TaImageNote2) {
131
+ const NOTE = /^\[Image: original \d+x\d+, displayed at \d+x\d+\. Multiply coordinates by [\d.]+ to map to original image\.\]$|^\[Image converted from [^\]]+ to [^\]]+\.\]$/;
132
+ function strip(text) {
133
+ const lines = text.split(`
134
+ `);
135
+ const kept = lines.filter((line) => !NOTE.test(line.trim()));
136
+ if (kept.length === lines.length) {
137
+ return text;
138
+ }
139
+ return kept.join(`
140
+ `).replace(/\n+$/, "").replace(/^\n+/, "");
141
+ }
142
+ TaImageNote2.strip = strip;
143
+ })(TaImageNote || (TaImageNote = {}));
144
+ var TaImageSize;
145
+ (function(TaImageSize2) {
146
+ const JPEG_BYTES = 256 * 1024;
147
+ function of(base64) {
148
+ var _a, _b, _c;
149
+ let bytes;
150
+ try {
151
+ const binary = atob(base64.slice(0, Math.ceil(JPEG_BYTES * 4 / 3 / 4) * 4));
152
+ bytes = Uint8Array.from(binary, (char) => char.charCodeAt(0));
153
+ } catch (_d) {
154
+ return;
155
+ }
156
+ const size = (_c = (_b = (_a = png(bytes)) !== null && _a !== undefined ? _a : gif(bytes)) !== null && _b !== undefined ? _b : webp(bytes)) !== null && _c !== undefined ? _c : jpeg(bytes);
157
+ return size && size.width > 0 && size.height > 0 ? size : undefined;
158
+ }
159
+ TaImageSize2.of = of;
160
+ function u16be(bytes, at) {
161
+ return bytes[at] << 8 | bytes[at + 1];
162
+ }
163
+ function u16le(bytes, at) {
164
+ return bytes[at] | bytes[at + 1] << 8;
165
+ }
166
+ function u24le(bytes, at) {
167
+ return bytes[at] | bytes[at + 1] << 8 | bytes[at + 2] << 16;
168
+ }
169
+ function u32be(bytes, at) {
170
+ return (bytes[at] << 24 | bytes[at + 1] << 16 | bytes[at + 2] << 8 | bytes[at + 3]) >>> 0;
171
+ }
172
+ function text(bytes, at, length) {
173
+ return String.fromCharCode(...bytes.subarray(at, at + length));
174
+ }
175
+ function png(bytes) {
176
+ return bytes.length >= 24 && bytes[0] === 137 && text(bytes, 1, 3) === "PNG" ? { width: u32be(bytes, 16), height: u32be(bytes, 20) } : undefined;
177
+ }
178
+ function gif(bytes) {
179
+ return bytes.length >= 10 && text(bytes, 0, 3) === "GIF" ? { width: u16le(bytes, 6), height: u16le(bytes, 8) } : undefined;
180
+ }
181
+ function webp(bytes) {
182
+ if (bytes.length < 30 || text(bytes, 0, 4) !== "RIFF" || text(bytes, 8, 4) !== "WEBP") {
183
+ return;
184
+ }
185
+ switch (text(bytes, 12, 4)) {
186
+ case "VP8 ":
187
+ return { width: u16le(bytes, 26) & 16383, height: u16le(bytes, 28) & 16383 };
188
+ case "VP8L": {
189
+ const bits = bytes[21] | bytes[22] << 8 | bytes[23] << 16 | bytes[24] << 24;
190
+ return { width: (bits & 16383) + 1, height: (bits >> 14 & 16383) + 1 };
191
+ }
192
+ case "VP8X":
193
+ return { width: u24le(bytes, 24) + 1, height: u24le(bytes, 27) + 1 };
194
+ default:
195
+ return;
196
+ }
197
+ }
198
+ function jpeg(bytes) {
199
+ if (bytes[0] !== 255 || bytes[1] !== 216) {
200
+ return;
201
+ }
202
+ let at = 2;
203
+ while (at + 9 < bytes.length) {
204
+ if (bytes[at] !== 255) {
205
+ return;
206
+ }
207
+ const marker = bytes[at + 1];
208
+ if (marker >= 192 && marker <= 207 && marker !== 196 && marker !== 200 && marker !== 204) {
209
+ return { width: u16be(bytes, at + 7), height: u16be(bytes, at + 5) };
210
+ }
211
+ at += 2 + u16be(bytes, at + 2);
212
+ }
213
+ return;
214
+ }
215
+ })(TaImageSize || (TaImageSize = {}));
216
+ var TaAgentSummary;
217
+ (function(TaAgentSummary2) {
218
+ const START = /^\s*<conversation_history_summary>/;
219
+ const BLOCK = /^\s*<conversation_history_summary>[\s\S]*?(?:<\/conversation_history_summary>\s*|$)/;
220
+ function read(text) {
221
+ if (!START.test(text)) {
222
+ return;
223
+ }
224
+ return text.replace(/<\/?(?:conversation_history_summary|summary)>/g, "").replace(/<\/?\w*$/, "").trim();
225
+ }
226
+ TaAgentSummary2.read = read;
227
+ function strip(text) {
228
+ return text.replace(BLOCK, "");
229
+ }
230
+ TaAgentSummary2.strip = strip;
231
+ })(TaAgentSummary || (TaAgentSummary = {}));
232
+ var TaSkillUse;
233
+ (function(TaSkillUse2) {
234
+ const BLOCK = /^<skill name="([^"]+)" location="([^"]+)">\n([\s\S]*?)\n<\/skill>(?:\n\n([\s\S]+))?$/;
235
+ function parse(message) {
236
+ var _a;
237
+ const match = BLOCK.exec(message);
238
+ if (!match) {
239
+ return;
240
+ }
241
+ return { name: match[1], location: match[2], content: match[3], message: ((_a = match[4]) === null || _a === undefined ? undefined : _a.trim()) || undefined };
242
+ }
243
+ TaSkillUse2.parse = parse;
244
+ function command(use) {
245
+ return use.message ? `/skill:${use.name} ${use.message}` : `/skill:${use.name}`;
246
+ }
247
+ TaSkillUse2.command = command;
248
+ })(TaSkillUse || (TaSkillUse = {}));
249
+ var TaTaskNote;
250
+ (function(TaTaskNote2) {
251
+ const NOTE = /^<task_(update|adopted|renamed) ((?:[^>"\n]|"[^"]*")*)>\n?([\s\S]*?)\n?<\/task_\1>$/;
252
+ const ATTRIBUTE = /(\w+)="([^"]*)"/g;
253
+ function write(note) {
254
+ const attributes = [`id="${quote(note.id)}"`];
255
+ if (note.was !== undefined) {
256
+ attributes.push(`was="${quote(note.was)}"`);
257
+ }
258
+ attributes.push(`title="${quote(note.title)}"`);
259
+ if (note.status !== undefined) {
260
+ attributes.push(`status="${quote(note.status)}"`);
261
+ }
262
+ return `<task_${note.kind} ${attributes.join(" ")}>
263
+ ${note.body}
264
+ </task_${note.kind}>`;
265
+ }
266
+ TaTaskNote2.write = write;
267
+ function parse(text) {
268
+ const match = NOTE.exec(text.trim());
269
+ if (!match) {
270
+ return;
271
+ }
272
+ const attributes = {};
273
+ for (const [, name, value] of match[2].matchAll(ATTRIBUTE)) {
274
+ attributes[name] = unquote(value);
275
+ }
276
+ if (!attributes.id || attributes.title === undefined) {
277
+ return;
278
+ }
279
+ const { id, title, status, was } = attributes;
280
+ return { kind: match[1], id, title, ...status ? { status } : {}, ...was ? { was } : {}, body: match[3] };
281
+ }
282
+ TaTaskNote2.parse = parse;
283
+ function quote(text) {
284
+ return text.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/\n/g, " ");
285
+ }
286
+ function unquote(text) {
287
+ return text.replace(/&quot;/g, '"').replace(/&amp;/g, "&");
288
+ }
289
+ })(TaTaskNote || (TaTaskNote = {}));
290
+ var TaSecretRef;
291
+ (function(TaSecretRef2) {
292
+ TaSecretRef2.PACKAGE = "@celljs/ta-secrets";
293
+ const REF = /\$\{?TA_SECRET_([A-Z0-9][A-Z0-9_]*)\}?/g;
294
+ const KINDS = [
295
+ [/^PHONE(?:_\d+)?$/, "phone"],
296
+ [/^EMAIL(?:_\d+)?$/, "email"],
297
+ [/^ID_NUMBER(?:_\d+)?$/, "idNumber"],
298
+ [/^BANK_CARD(?:_\d+)?$/, "bankCard"]
299
+ ];
300
+ function has(text) {
301
+ return text.includes("TA_SECRET_") && new RegExp(REF.source).test(text);
302
+ }
303
+ TaSecretRef2.has = has;
304
+ function kind(name) {
305
+ var _a;
306
+ var _b;
307
+ return (_b = (_a = KINDS.find(([pattern]) => pattern.test(name))) === null || _a === undefined ? undefined : _a[1]) !== null && _b !== undefined ? _b : "secret";
308
+ }
309
+ TaSecretRef2.kind = kind;
310
+ function split(text) {
311
+ if (!has(text)) {
312
+ return [{ text }];
313
+ }
314
+ const parts = [];
315
+ let at = 0;
316
+ for (const match of text.matchAll(REF)) {
317
+ if (match.index > at) {
318
+ parts.push({ text: text.slice(at, match.index) });
319
+ }
320
+ parts.push({ secret: match[1], kind: kind(match[1]) });
321
+ at = match.index + match[0].length;
322
+ }
323
+ if (at < text.length) {
324
+ parts.push({ text: text.slice(at) });
325
+ }
326
+ return parts;
327
+ }
328
+ TaSecretRef2.split = split;
329
+ function plain(text, label) {
330
+ return has(text) ? text.replace(REF, (_whole, name) => label(name, kind(name))) : text;
331
+ }
332
+ TaSecretRef2.plain = plain;
333
+ })(TaSecretRef || (TaSecretRef = {}));
334
+
40
335
  // ../ta-protocol/esm/common/redactor.js
41
336
  var REDACTED = "[redacted]";
42
337
  var WHOLE = [
43
- /-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z0-9 ]*PRIVATE KEY-----/g,
44
- /\bsk-(?:ant-|proj-)?[A-Za-z0-9_-]{20,}/g,
45
- /\bgh[pousr]_[A-Za-z0-9]{30,}\b/g,
46
- /\bgithub_pat_[A-Za-z0-9_]{40,}\b/g,
47
- /\bglpat-[A-Za-z0-9_-]{20,}\b/g,
48
- /\bxox[abprs]-[A-Za-z0-9-]{10,}\b/g,
49
- /\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g,
50
- /\bAIza[0-9A-Za-z_-]{35}\b/g,
51
- /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}/g
338
+ ["PRIVATE_KEY", /-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z0-9 ]*PRIVATE KEY-----/g],
339
+ ["API_KEY", /\bsk-(?:ant-|proj-)?[A-Za-z0-9_-]{20,}/g],
340
+ ["GITHUB_TOKEN", /\bgh[pousr]_[A-Za-z0-9]{30,}\b/g],
341
+ ["GITHUB_TOKEN", /\bgithub_pat_[A-Za-z0-9_]{40,}\b/g],
342
+ ["GITLAB_TOKEN", /\bglpat-[A-Za-z0-9_-]{20,}\b/g],
343
+ ["SLACK_TOKEN", /\bxox[abprs]-[A-Za-z0-9-]{10,}\b/g],
344
+ ["AWS_ACCESS_KEY_ID", /\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g],
345
+ ["GOOGLE_API_KEY", /\bAIza[0-9A-Za-z_-]{35}\b/g],
346
+ ["JWT", /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}/g]
52
347
  ];
53
348
  var NAMED = [
54
349
  /(\bBearer\s+)[A-Za-z0-9._~+/-]{16,}=*/gi,
@@ -62,7 +357,7 @@ class Redactor {
62
357
  }
63
358
  text(text) {
64
359
  let out = text;
65
- for (const pattern of WHOLE) {
360
+ for (const [, pattern] of WHOLE) {
66
361
  out = out.replace(pattern, () => this.hide());
67
362
  }
68
363
  out = out.replace(NAMED[0], (_match, before) => before + this.hide());
@@ -82,6 +377,39 @@ class Redactor {
82
377
  }
83
378
  return value;
84
379
  }
380
+ static spans(text) {
381
+ var _a;
382
+ var _b;
383
+ const found = [];
384
+ for (const [kind, pattern] of WHOLE) {
385
+ for (const match of text.matchAll(pattern)) {
386
+ found.push({ start: match.index, end: match.index + match[0].length, kind });
387
+ }
388
+ }
389
+ for (const match of text.matchAll(NAMED[0])) {
390
+ found.push({ start: match.index + match[1].length, end: match.index + match[0].length, kind: "BEARER_TOKEN" });
391
+ }
392
+ for (const match of text.matchAll(NAMED[1])) {
393
+ if (!Redactor.placeholder(match[2])) {
394
+ const start = match.index + match[1].length;
395
+ const name = (_b = (_a = /[A-Za-z0-9_.-]+/.exec(match[1])) === null || _a === undefined ? undefined : _a[0]) !== null && _b !== undefined ? _b : "SECRET";
396
+ found.push({ start, end: start + match[2].length, kind: name.replace(/[^A-Za-z0-9]+/g, "_").toUpperCase() });
397
+ }
398
+ }
399
+ for (const match of text.matchAll(NAMED[2])) {
400
+ const start = match.index + match[1].length;
401
+ found.push({ start, end: start + match[2].length, kind: "URL_PASSWORD" });
402
+ }
403
+ found.sort((a, b) => a.start - b.start || b.end - a.end);
404
+ const spans = [];
405
+ for (const span of found) {
406
+ const last = spans.at(-1);
407
+ if (!last || span.start >= last.end) {
408
+ spans.push(span);
409
+ }
410
+ }
411
+ return spans;
412
+ }
85
413
  static cut(text, max) {
86
414
  return text.length > max ? `${text.slice(0, max)}…` : text;
87
415
  }
@@ -122,6 +450,255 @@ var RelayAgentCards;
122
450
  RelayAgentCards2.parse = parse;
123
451
  })(RelayAgentCards || (RelayAgentCards = {}));
124
452
 
453
+ // ../ta-relay/esm/common/relay-faces.js
454
+ var FACE_COUNT = 25;
455
+ var BLUE = "#4285F4";
456
+ var RED = "#EA4335";
457
+ var YELLOW = "#FBBC05";
458
+ var GREEN = "#34A853";
459
+ var MINT = "#5CC27F";
460
+ var ORANGE = "#EE7B3B";
461
+ var VIOLET = "#8C5CF0";
462
+ var CREAM = "#F1DFC0";
463
+ var TEAL = "#26B0A9";
464
+ var PINK = "#F27BA6";
465
+ var LILAC = "#B49CF5";
466
+ var SKY = "#45B5E8";
467
+ var INDIGO = "#5C6BC0";
468
+ var MIST = "#DCE3F0";
469
+ var INK = "#202124";
470
+ var WHITE = "#FFFFFF";
471
+ var CHEEK = "rgba(255, 160, 185, 0.55)";
472
+ var EDGE = "rgba(0, 0, 0, 0.14)";
473
+ var CHEEK_DEEP = "rgba(120, 10, 30, 0.35)";
474
+ var CHEEK_WARM = "rgba(234, 67, 53, 0.4)";
475
+ var LOOKS = [
476
+ { color: MINT, eye: "#1D3B27", cheek: CHEEK, eyeY: 21, gap: 8 },
477
+ { color: BLUE, eye: WHITE, cheek: CHEEK, eyeY: 23, gap: 8 },
478
+ { color: RED, eye: WHITE, cheek: CHEEK_DEEP, eyeY: 22, gap: 8 },
479
+ { color: CREAM, eye: "#4A3420", cheek: "rgba(240, 120, 120, 0.5)", accent: "#DDBF8E", eyeY: 22, gap: 7.6 },
480
+ { color: GREEN, eye: WHITE, cheek: CHEEK, eyeY: 19, gap: 7.2 },
481
+ { color: INDIGO, eye: WHITE, cheek: CHEEK, eyeY: 20, gap: 7.4 },
482
+ { color: YELLOW, eye: INK, cheek: CHEEK_WARM, accent: "#F29900", eyeY: 24, gap: 8.4 },
483
+ { color: VIOLET, eye: "#22134A", cheek: CHEEK, eyeY: 20, gap: 8 },
484
+ { color: MIST, eye: "#2B3245", cheek: CHEEK, eyeY: 19, gap: 7.6 },
485
+ { color: SKY, eye: WHITE, cheek: CHEEK, eyeY: 21, gap: 6.4 },
486
+ { color: ORANGE, eye: "#3D1C08", cheek: CHEEK, accent: GREEN, eyeY: 22, gap: 8.6, brows: true },
487
+ { color: WHITE, eye: WHITE, cheek: CHEEK, accent: INK, mouth: INK, eyeY: 22, gap: 10 },
488
+ { color: TEAL, eye: WHITE, cheek: CHEEK, accent: "#1B8A84", eyeY: 22.5, gap: 8.4 },
489
+ { color: PINK, eye: "#4A1428", cheek: "rgba(160, 20, 70, 0.3)", eyeY: 24, gap: 7.4 },
490
+ { color: LILAC, eye: "#2A1A5E", cheek: CHEEK, eyeY: 25, gap: 8 },
491
+ { color: YELLOW, eye: INK, cheek: CHEEK_WARM, eyeY: 25, gap: 7.4 },
492
+ { color: BLUE, eye: WHITE, cheek: CHEEK, eyeY: 19.5, gap: 8 },
493
+ { color: CREAM, eye: "#4A3420", cheek: "rgba(240, 120, 120, 0.5)", eyeY: 23.5, gap: 8 },
494
+ { color: GREEN, eye: WHITE, cheek: CHEEK, eyeY: 21, gap: 8 },
495
+ { color: PINK, eye: "#4A1428", cheek: "rgba(160, 20, 70, 0.3)", eyeY: 19.5, gap: 8.4 },
496
+ { color: RED, eye: WHITE, cheek: CHEEK_DEEP, accent: "#B3261E", eyeY: 20, gap: 8.4 },
497
+ { color: SKY, eye: WHITE, cheek: CHEEK, eyeY: 23.5, gap: 8 },
498
+ { color: VIOLET, eye: WHITE, cheek: CHEEK, accent: "#6B3FD4", eyeY: 22, gap: 8 },
499
+ { color: TEAL, eye: WHITE, cheek: CHEEK, accent: "#1B8A84", eyeY: 25, gap: 7.6 },
500
+ { color: MINT, eye: "#1D3B27", cheek: CHEEK, accent: "#4AAE6C", eyeY: 22.5, gap: 9 }
501
+ ];
502
+ function corners(count, radius, cx, cy, inner) {
503
+ const points = [];
504
+ const steps = inner ? count * 2 : count;
505
+ for (let index = 0;index < steps; index++) {
506
+ const r = inner && index % 2 === 1 ? inner : radius;
507
+ const angle = -Math.PI / 2 + index * 2 * Math.PI / steps;
508
+ points.push(`${(cx + r * Math.cos(angle)).toFixed(2)},${(cy + r * Math.sin(angle)).toFixed(2)}`);
509
+ }
510
+ return points.join(" ");
511
+ }
512
+ var PENTAGON = corners(5, 13.5, 20, 21.5);
513
+ var HEXAGON = corners(6, 14, 20, 20);
514
+ var STAR = corners(5, 15.5, 20, 21.5, 8.6);
515
+ function node(tag, attrs, children) {
516
+ return children ? { tag, attrs, children } : { tag, attrs };
517
+ }
518
+ function rounded(points, color, width = 5) {
519
+ return node("polygon", { points, fill: color, stroke: color, "stroke-width": width, "stroke-linejoin": "round" });
520
+ }
521
+ function shape(face, look) {
522
+ const { color, accent = color } = look;
523
+ switch (face) {
524
+ case 1:
525
+ return node("g", {}, [
526
+ rounded("7.5,6.5 17,12 8.5,18", color, 4),
527
+ rounded("32.5,6.5 23,12 31.5,18", color, 4),
528
+ node("ellipse", { cx: 20, cy: 23, rx: 14.5, ry: 12.5, fill: color })
529
+ ]);
530
+ case 2:
531
+ return rounded(PENTAGON, color);
532
+ case 3:
533
+ return node("g", {}, [
534
+ node("circle", { cx: 9.5, cy: 10.5, r: 5.5, fill: color }),
535
+ node("circle", { cx: 30.5, cy: 10.5, r: 5.5, fill: color }),
536
+ node("circle", { cx: 9.5, cy: 10.5, r: 2.6, fill: accent }),
537
+ node("circle", { cx: 30.5, cy: 10.5, r: 2.6, fill: accent }),
538
+ node("ellipse", { cx: 20, cy: 22.5, rx: 14.5, ry: 13, fill: color })
539
+ ]);
540
+ case 4:
541
+ return node("rect", { x: 8.5, y: 4, width: 23, height: 32, rx: 11.5, fill: color });
542
+ case 5:
543
+ return rounded("20,5.5 34.5,20 20,34.5 5.5,20", color, 5.5);
544
+ case 6:
545
+ return node("g", {}, [
546
+ node("ellipse", { cx: 20, cy: 11, rx: 3.2, ry: 3.6, fill: accent }),
547
+ node("path", { d: "M20 12.5c9.2 0 15.5 5.6 15.5 12.4 0 6.4-6.9 10.1-15.5 10.1S4.5 31.3 4.5 24.9C4.5 18.1 10.8 12.5 20 12.5Z", fill: color })
548
+ ]);
549
+ case 7:
550
+ return rounded(HEXAGON, color);
551
+ case 8:
552
+ return node("path", {
553
+ d: "M8 19a12 12 0 0 1 24 0v14l-4-3-4 3-4-3-4 3-4-3-4 3Z",
554
+ fill: color,
555
+ stroke: EDGE,
556
+ "stroke-width": 0.8,
557
+ "stroke-linejoin": "round"
558
+ });
559
+ case 9:
560
+ return rounded(STAR, color, 4.5);
561
+ case 10:
562
+ return node("g", {}, [
563
+ node("rect", { x: 18.6, y: 4.5, width: 2.8, height: 7, rx: 1.4, fill: accent }),
564
+ node("ellipse", { cx: 12.5, cy: 23, rx: 8.5, ry: 11, fill: color }),
565
+ node("ellipse", { cx: 27.5, cy: 23, rx: 8.5, ry: 11, fill: color }),
566
+ node("ellipse", { cx: 20, cy: 22.5, rx: 9.5, ry: 12, fill: color })
567
+ ]);
568
+ case 11:
569
+ return node("g", {}, [
570
+ node("circle", { cx: 9.5, cy: 10, r: 5, fill: accent }),
571
+ node("circle", { cx: 30.5, cy: 10, r: 5, fill: accent }),
572
+ node("ellipse", { cx: 20, cy: 22.5, rx: 14.5, ry: 13, fill: color, stroke: EDGE, "stroke-width": 0.8 }),
573
+ node("ellipse", { cx: 14.6, cy: 22, rx: 3.6, ry: 4.4, transform: "rotate(20 14.6 22)", fill: accent }),
574
+ node("ellipse", { cx: 25.4, cy: 22, rx: 3.6, ry: 4.4, transform: "rotate(-20 25.4 22)", fill: accent })
575
+ ]);
576
+ case 12:
577
+ return node("g", {}, [
578
+ node("rect", { x: 19.1, y: 6, width: 1.8, height: 7, fill: accent }),
579
+ node("circle", { cx: 20, cy: 5, r: 2.2, fill: accent }),
580
+ node("rect", { x: 5.5, y: 12, width: 29, height: 22.5, rx: 6.5, fill: color })
581
+ ]);
582
+ case 13:
583
+ return node("path", { d: "M20 4.5c2 0 13 11.6 13 20.2 0 6.4-5.8 10.8-13 10.8S7 31.1 7 24.7C7 16.1 18 4.5 20 4.5Z", fill: color });
584
+ case 14:
585
+ return node("g", {}, [
586
+ node("ellipse", { cx: 14, cy: 10.5, rx: 3.6, ry: 8, transform: "rotate(-8 14 10.5)", fill: color }),
587
+ node("ellipse", { cx: 26, cy: 10.5, rx: 3.6, ry: 8, transform: "rotate(8 26 10.5)", fill: color }),
588
+ node("ellipse", { cx: 20, cy: 25, rx: 14, ry: 11, fill: color })
589
+ ]);
590
+ case 15:
591
+ return rounded("20,7 35,33 5,33", color, 6);
592
+ case 16:
593
+ return node("path", {
594
+ d: "M20 6.5l12 4.2v8.4c0 7.4-4.9 12.6-12 15.9-7.1-3.3-12-8.5-12-15.9v-8.4Z",
595
+ fill: color,
596
+ stroke: color,
597
+ "stroke-width": 3,
598
+ "stroke-linejoin": "round"
599
+ });
600
+ case 17:
601
+ return rounded("20,7 32.5,17.5 32.5,33 7.5,33 7.5,17.5", color, 4.5);
602
+ case 18:
603
+ return rounded("14,9 26,9 32.5,32 7.5,32", color, 6);
604
+ case 19:
605
+ return node("rect", { x: 4.5, y: 10.5, width: 31, height: 19.5, rx: 9.75, fill: color });
606
+ case 20:
607
+ return node("g", {}, [
608
+ node("rect", { x: 14, y: 5.5, width: 12, height: 4.5, rx: 1.6, fill: accent }),
609
+ node("rect", { x: 14, y: 30.5, width: 12, height: 4.5, rx: 1.6, fill: accent }),
610
+ node("ellipse", { cx: 20, cy: 20.25, rx: 15, ry: 12.25, fill: color })
611
+ ]);
612
+ case 21:
613
+ return node("g", {}, [
614
+ node("circle", { cx: 13.5, cy: 21.5, r: 7, fill: color }),
615
+ node("circle", { cx: 21.5, cy: 16.5, r: 9, fill: color }),
616
+ node("circle", { cx: 28.5, cy: 22.5, r: 6.5, fill: color }),
617
+ node("rect", { x: 5.5, y: 21, width: 29, height: 12, rx: 6, fill: color })
618
+ ]);
619
+ case 22:
620
+ return node("g", {}, [
621
+ node("rect", { x: 12.5, y: 5.5, width: 15, height: 5.5, rx: 2, fill: accent }),
622
+ node("rect", { x: 7.5, y: 9.5, width: 25, height: 25.5, rx: 6.5, fill: color })
623
+ ]);
624
+ case 23:
625
+ return node("g", {}, [
626
+ node("rect", { x: 18.8, y: 3.5, width: 2.4, height: 6, rx: 1.2, fill: accent }),
627
+ node("circle", { cx: 20, cy: 13, r: 6.5, fill: color }),
628
+ node("circle", { cx: 20, cy: 25, r: 11.5, fill: color })
629
+ ]);
630
+ case 24:
631
+ return node("g", {}, [
632
+ node("circle", { cx: 12, cy: 13, r: 5.5, fill: color }),
633
+ node("circle", { cx: 28, cy: 13, r: 5.5, fill: color }),
634
+ node("circle", { cx: 12, cy: 13, r: 2.2, fill: accent }),
635
+ node("circle", { cx: 28, cy: 13, r: 2.2, fill: accent }),
636
+ node("ellipse", { cx: 20, cy: 23.5, rx: 15.5, ry: 11.5, fill: color })
637
+ ]);
638
+ default:
639
+ return node("circle", { cx: 20, cy: 21, r: 14.5, fill: color });
640
+ }
641
+ }
642
+ var FaceUtil;
643
+ (function(FaceUtil2) {
644
+ function of(seed) {
645
+ let hash = 0;
646
+ for (const char of seed) {
647
+ hash = hash * 31 + char.charCodeAt(0) | 0;
648
+ }
649
+ return Math.abs(hash) % FACE_COUNT;
650
+ }
651
+ FaceUtil2.of = of;
652
+ function pick(face, seed = "") {
653
+ return face !== undefined && face >= 0 && face < FACE_COUNT ? Math.floor(face) : of(seed);
654
+ }
655
+ FaceUtil2.pick = pick;
656
+ function color(face) {
657
+ var _a;
658
+ return ((_a = LOOKS[face]) !== null && _a !== undefined ? _a : LOOKS[0]).color;
659
+ }
660
+ FaceUtil2.color = color;
661
+ function art(face) {
662
+ var _a, _b;
663
+ const look = (_a = LOOKS[face]) !== null && _a !== undefined ? _a : LOOKS[0];
664
+ const half = look.gap / 2;
665
+ const eyeW = 4.1;
666
+ const eyeH = 4.9;
667
+ const top = look.eyeY - eyeH / 2;
668
+ const cheekY = look.eyeY + 3.6;
669
+ const cheekX = half + 2.2;
670
+ const mouthY = look.eyeY + 3.4;
671
+ const features = [
672
+ node("g", { fill: look.cheek }, [
673
+ node("ellipse", { cx: 20 - cheekX, cy: cheekY, rx: 2.2, ry: 1.25 }),
674
+ node("ellipse", { cx: 20 + cheekX, cy: cheekY, rx: 2.2, ry: 1.25 })
675
+ ])
676
+ ];
677
+ if (look.brows) {
678
+ features.push(node("path", {
679
+ d: `M${20 - half - 3.4} ${top - 2.6}l3.6 1.6M${20 + half + 3.4} ${top - 2.6}l-3.6 1.6`,
680
+ stroke: look.eye,
681
+ "stroke-width": 1.4,
682
+ "stroke-linecap": "round",
683
+ fill: "none"
684
+ }));
685
+ }
686
+ features.push(node("g", { class: "ta-face-eyes", fill: look.eye }, [
687
+ node("rect", { x: 20 - half - eyeW / 2, y: top, width: eyeW, height: eyeH, rx: eyeW / 2 }),
688
+ node("rect", { x: 20 + half - eyeW / 2, y: top, width: eyeW, height: eyeH, rx: eyeW / 2 })
689
+ ]), node("path", {
690
+ d: `M18.1 ${mouthY}q.95 1.25 1.9 0q.95 1.25 1.9 0`,
691
+ fill: "none",
692
+ stroke: (_b = look.mouth) !== null && _b !== undefined ? _b : look.eye,
693
+ "stroke-width": 1.1,
694
+ "stroke-linecap": "round",
695
+ "stroke-linejoin": "round"
696
+ }));
697
+ return node("g", { class: "ta-face-body" }, [shape(face, look), node("g", { class: "ta-face-look" }, features)]);
698
+ }
699
+ FaceUtil2.art = art;
700
+ })(FaceUtil || (FaceUtil = {}));
701
+
125
702
  // web-src/channels-model.ts
126
703
  var NAME = "@celljs/ta-channels";
127
704
  var AGENT_MARK = "one of the agents of Ta";
@@ -144,7 +721,7 @@ var MAX_HOPS = 3;
144
721
  var MAX_REPLIES = 8;
145
722
  var MAX_AGENT_REPLIES = 2;
146
723
  var MAX_MESSAGES = 200;
147
- var FACES = 16;
724
+ var FACES = FACE_COUNT;
148
725
  var MAX_MEMBERS = 12;
149
726
  var DEFAULT_ROLE = "You help the user with what they ask, as a colleague who takes on the work and does it.";
150
727
  var CONTEXT_MESSAGES = 12;
@@ -159,18 +736,18 @@ var ChannelsUtil;
159
736
  return { total: 0, byAgent: {}, stopped: false };
160
737
  }
161
738
  ChannelsUtil.newRound = newRound;
162
- function limit(round, targets2, hops) {
739
+ function limit(round, targets, hops) {
163
740
  const allowed = [];
164
741
  const byAgent = { ...round.byAgent };
165
742
  let total = round.total;
166
- for (const id of targets2) {
743
+ for (const id of targets) {
167
744
  if (hops < MAX_HOPS && total < MAX_REPLIES && (byAgent[id] ?? 0) < MAX_AGENT_REPLIES) {
168
745
  allowed.push(id);
169
746
  byAgent[id] = (byAgent[id] ?? 0) + 1;
170
747
  total++;
171
748
  }
172
749
  }
173
- const cut = allowed.length < targets2.length;
750
+ const cut = allowed.length < targets.length;
174
751
  const note = cut && !round.stopped;
175
752
  return { allowed, round: { total, byAgent, stopped: round.stopped || cut }, cut, note };
176
753
  }
@@ -515,68 +1092,6 @@ var ChannelsUtil;
515
1092
  }
516
1093
  return ids;
517
1094
  }
518
- function markMentions(text, agents) {
519
- if (agents.length === 0) {
520
- return text;
521
- }
522
- const names = [...agents].sort((a, b) => b.name.length - a.name.length).map((agent) => agent.name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
523
- const pattern = new RegExp(`(?<![*A-Za-z0-9_])@(${names.join("|")})(?![A-Za-z0-9_-])`, "gi");
524
- return text.split(/(```[\s\S]*?(?:```|$)|`[^`\n]*`)/).map((part, index) => index % 2 === 1 ? part : part.replace(pattern, "**$&**")).join("");
525
- }
526
- ChannelsUtil.markMentions = markMentions;
527
- function mentions(text, agents) {
528
- if (agents.length === 0) {
529
- return [];
530
- }
531
- const names = [...agents].sort((a, b) => b.name.length - a.name.length).map((agent) => agent.name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
532
- const pattern = new RegExp(`@(${names.join("|")})(?![A-Za-z0-9_-])`, "gi");
533
- const found = [];
534
- for (const match of text.matchAll(pattern)) {
535
- const agent = agents.find((candidate) => candidate.name.toLowerCase() === match[1].toLowerCase());
536
- if (agent && !found.includes(agent.id)) {
537
- found.push(agent.id);
538
- }
539
- }
540
- return found;
541
- }
542
- ChannelsUtil.mentions = mentions;
543
- function targets(team, channel, message) {
544
- const muted = channel.muted ?? [];
545
- const members = channel.members.filter((id) => !muted.includes(id)).map((id) => team.agents.find((agent) => agent.id === id)).filter((agent) => !!agent);
546
- const named = mentions(message.text, members).filter((id) => id !== message.author);
547
- if (message.author === SYSTEM) {
548
- return [];
549
- }
550
- if (named.length > 0 || message.author !== USER && message.author !== TA) {
551
- return named;
552
- }
553
- return members.length > 0 ? [members[0].id] : [];
554
- }
555
- ChannelsUtil.targets = targets;
556
- function authorName(team, author, labels) {
557
- if (author === SYSTEM) {
558
- return "channel";
559
- }
560
- if (author === USER) {
561
- return labels.user;
562
- }
563
- if (author === TA) {
564
- return labels.ta;
565
- }
566
- return team.agents.find((agent) => agent.id === author)?.name ?? author;
567
- }
568
- ChannelsUtil.authorName = authorName;
569
- function systemPrompt(agent) {
570
- return [
571
- `You are ${agent.name}, ${AGENT_MARK}. Your role: ${agent.role}`,
572
- "You work with the user, Ta and other agents in channels. A message for you starts with a <context> block: the channel, its members, the recent messages and who speaks to you; answer what follows the block.",
573
- "Do the part of the work your role covers with your tools, then answer in a few sentences: your answer is posted to the channel as it is.",
574
- "To hand work to another member, write @ and their name in your answer; name nobody when the work is done or you need the user.",
575
- NOTICE_RULE
576
- ].join(`
577
- `);
578
- }
579
- ChannelsUtil.systemPrompt = systemPrompt;
580
1095
  function setNotice(team, input) {
581
1096
  const before = channelOf(team, input.channel);
582
1097
  const text = typeof input.text === "string" ? input.text.replace(/\r\n/g, `
@@ -596,139 +1111,12 @@ var ChannelsUtil;
596
1111
  return { team: { ...team, channels: team.channels.map((other) => other.id === channel.id ? channel : other) }, channel, before, changed: true };
597
1112
  }
598
1113
  ChannelsUtil.setNotice = setNotice;
599
- function prompt(team, channel, history, message, agent) {
600
- const labels = { user: "user", ta: "Ta" };
601
- const members = channel.members.map((id) => team.agents.find((other) => other.id === id)).filter((other) => !!other).map((other) => `@${other.name}${other.id === agent.id ? " (you)" : ""}: ${firstLine(other.role)}`);
602
- const before = history.filter((item) => item.id !== message.id && !item.failed && !item.notice).slice(-CONTEXT_MESSAGES);
603
- const lines = [`[#${channel.name}]${channel.topic ? ` ${channel.topic}` : ""}`, "Members:", ...members.map((line) => `- ${line}`)];
604
- if (channel.notice) {
605
- lines.push("", "Notice of the channel (follow it; keep it with update_channel_notice):", channel.notice.text);
606
- }
607
- if (before.length > 0) {
608
- lines.push("", "Recent messages:", ...before.map((item) => `${authorName(team, item.author, labels)}: ${item.text}`));
609
- }
610
- lines.push("", `${authorName(team, message.author, labels)} to you:`);
611
- const speaker = message.author === USER ? "" : ` · ${authorName(team, message.author, labels).replace(/[\]\n]/g, " ")}`;
612
- lines.push(`[ta:from ${NAME} #${channel.name}${speaker}]`);
613
- return `<context>
614
- ${lines.join(`
615
- `)}
616
- </context>
617
- ${message.text}`;
618
- }
619
- ChannelsUtil.prompt = prompt;
620
1114
  function append(messages, message) {
621
1115
  const next = [...messages, message];
622
1116
  return next.length > MAX_MESSAGES ? next.slice(next.length - MAX_MESSAGES) : next;
623
1117
  }
624
1118
  ChannelsUtil.append = append;
625
- function summary(team) {
626
- if (team.agents.length === 0) {
627
- return "No agents and no channels yet.";
628
- }
629
- const name = (id) => team.agents.find((agent) => agent.id === id)?.name ?? id;
630
- const agents = team.agents.map((agent) => `- @${agent.name}: ${firstLine(agent.role)}`);
631
- const channels = team.channels.map((channel) => `- #${channel.name}${channel.topic ? ` (${channel.topic})` : ""}: ${channel.members.map((id) => `@${name(id)}`).join(", ")}${channel.muted?.length ? `; muted by the user, answering nothing: ${channel.muted.map((id) => `@${name(id)}`).join(", ")}` : ""}${channel.notice ? `
632
- notice: ${channel.notice.text.replace(/\s+/g, " ").slice(0, 300)}` : ""}`);
633
- return ["Agents:", ...agents, "", "Channels:", ...channels.length > 0 ? channels : ["none yet"]].join(`
634
- `);
635
- }
636
- ChannelsUtil.summary = summary;
637
- function transcript(team, messages) {
638
- const labels = { user: "user", ta: "Ta" };
639
- return messages.map((item) => `${authorName(team, item.author, labels)}${item.failed ? " (failed)" : ""}: ${item.text}`).join(`
640
-
641
- `);
642
- }
643
- ChannelsUtil.transcript = transcript;
644
- function markdown(agent, messages, labels) {
645
- const parts = [`# ${agent.name}`, "", `> ${firstLine(agent.role)}`];
646
- for (const message of messages) {
647
- const { role, content } = message ?? {};
648
- if (role !== "user" && role !== "assistant") {
649
- continue;
650
- }
651
- const text = (typeof content === "string" ? content : Array.isArray(content) ? content.map((block) => block?.type === "text" ? String(block.text ?? "") : "").join("") : "").replace(/^<context>\n?[\s\S]*?\n?<\/context>\n?/, "").trim();
652
- if (text) {
653
- parts.push("", `## ${role === "user" ? labels.user : agent.name}`, "", text);
654
- }
655
- }
656
- return `${parts.join(`
657
- `)}
658
- `;
659
- }
660
- ChannelsUtil.markdown = markdown;
661
- function channelMarkdown(team, channel, messages, labels) {
662
- const parts = [`# #${channel.name}`];
663
- if (channel.topic) {
664
- parts.push("", `> ${firstLine(channel.topic)}`);
665
- }
666
- for (const message of messages) {
667
- const text = message.text.trim();
668
- if (text && message.author !== SYSTEM) {
669
- parts.push("", `## ${authorName(team, message.author, labels)}${message.failed ? " (failed)" : ""}`, "", text);
670
- }
671
- }
672
- return `${parts.join(`
673
- `)}
674
- `;
675
- }
676
- ChannelsUtil.channelMarkdown = channelMarkdown;
677
- function firstLine(text) {
678
- return text.split(`
679
- `)[0];
680
- }
681
- })(ChannelsUtil ||= {});
682
- var NOTICE_RULE = [
683
- "A channel may have a notice, in the <context> block: what its members decided, agreed and are to do. Follow it.",
684
- `When the talk settles a decision or a convention, or adds, assigns or finishes a to-do, update it with update_channel_notice: the whole notice, short, under the headings ### ${NOTICE_HEADINGS.zh.join(" / ")} (### ${NOTICE_HEADINGS.en.join(" / ")} in English), in the language of the channel, to-dos as - [ ] or - [x] with who does them. The lead keeps it most; leave it for small talk.`
685
- ].join(`
686
- `);
687
- var NoticeUtil;
688
- ((NoticeUtil) => {
689
- const PARTS = {
690
- 决定: "decisions",
691
- decisions: "decisions",
692
- 约定: "conventions",
693
- conventions: "conventions",
694
- 待办: "todo",
695
- "to do": "todo",
696
- todo: "todo",
697
- "to-do": "todo"
698
- };
699
- function counts(text) {
700
- const counts2 = { decisions: 0, conventions: 0, todo: 0, done: 0 };
701
- let part;
702
- for (const line of text.split(/\r?\n/)) {
703
- const heading = /^\s*#{1,6}\s+(.+?)\s*#*\s*$/.exec(line) ?? /^\s*\*\*(.+?)\*\*\s*[::]?\s*$/.exec(line);
704
- if (heading) {
705
- part = PARTS[heading[1].replace(/[::]$/, "").trim().toLowerCase()];
706
- continue;
707
- }
708
- const item = /^\s*(?:[-*+]|\d+[.)])\s+(\[( |x|X)\]\s+)?\S/.exec(line);
709
- if (!part || !item) {
710
- continue;
711
- }
712
- if (part === "todo" && item[2] && item[2] !== " ") {
713
- counts2.done++;
714
- } else {
715
- counts2[part]++;
716
- }
717
- }
718
- return counts2;
719
- }
720
- NoticeUtil.counts = counts;
721
- function firstLine(text) {
722
- for (const line of text.split(/\r?\n/)) {
723
- const item = /^\s*(?:[-*+]|\d+[.)])\s+(?:\[[ xX]\]\s+)?(.+)$/.exec(line);
724
- if (item) {
725
- return item[1].replace(/[*_`~]+/g, "").trim();
726
- }
727
- }
728
- return text.split(/\r?\n/).find((line) => line.trim() && !/^\s*#/.test(line))?.trim() ?? "";
729
- }
730
- NoticeUtil.firstLine = firstLine;
731
- })(NoticeUtil ||= {});
1119
+ })(ChannelsUtil ||= {});
732
1120
 
733
1121
  // web-src/agent-cards.ts
734
1122
  var AgentCards;
@@ -768,13 +1156,15 @@ var AgentCards;
768
1156
  function adapt(cwd, language) {
769
1157
  const context = [
770
1158
  AgentCards.MARK,
771
- `You were just added to this Ta from a card someone shared: the role in your instructions is theirs, written for their own work. Fit it to the project of your directory (${cwd}): look at it first (its README, manifests such as package.json, its layout, how it builds and tests), then rewrite your role for it, keeping what you are for, and save it with update_my_role. Then tell the user in a few sentences, in ${TaLanguageUtil.pick(language, { "zh-CN": "Chinese", "zh-TW": "Traditional Chinese", "en-US": "English", "ja-JP": "Japanese" })}, what you changed and what you can do here. Change no files.`
1159
+ `You were just added to this Ta from a card someone shared: the role in your instructions is theirs, written for their own work. Fit it to the project of your directory (${cwd}): look at it first (its README, manifests such as package.json, its layout, how it builds and tests), then rewrite your role for it, keeping what you are for, and save it with update_my_role. Then tell the user, in ${TaLanguageUtil.pick(language, { "zh-CN": "Chinese", "zh-TW": "Traditional Chinese", "en-US": "English", "ja-JP": "Japanese" })}, what you changed and what you can do here. Change no files.`
772
1160
  ].join(`
773
1161
  `);
774
- return `<context>
775
- ${context}
776
- </context>
777
- ${TaLanguageUtil.pick(language, { "zh-CN": "看看这个项目,把你的职责调整得贴合这里", "zh-TW": "看看這個專案,把你的職責調整得貼合這裡", "en-US": "Look at this project and fit your role to it", "ja-JP": "このプロジェクトを見て、ロールをそれに適応させてください" })}`;
1162
+ return TaMessageContext.wrap(context, TaLanguageUtil.pick(language, {
1163
+ "zh-CN": "看看这个项目,把你的职责调整得贴合这里",
1164
+ "zh-TW": "看看這個專案,把你的職責調整得貼合這裡",
1165
+ "en-US": "Look at this project and fit your role to it",
1166
+ "ja-JP": "このプロジェクトを見て、ロールをそれに適応させてください"
1167
+ }));
778
1168
  }
779
1169
  AgentCards.adapt = adapt;
780
1170
  })(AgentCards ||= {});
@@ -786,300 +1176,19 @@ function bind(react) {
786
1176
  }
787
1177
 
788
1178
  // web-src/faces.tsx
789
- var BLUE = "#4285F4";
790
- var RED = "#EA4335";
791
- var YELLOW = "#FBBC05";
792
- var GREEN = "#34A853";
793
- var MINT = "#5CC27F";
794
- var ORANGE = "#EE7B3B";
795
- var VIOLET = "#8C5CF0";
796
- var CREAM = "#F1DFC0";
797
- var TEAL = "#26B0A9";
798
- var PINK = "#F27BA6";
799
- var LILAC = "#B49CF5";
800
- var SKY = "#45B5E8";
801
- var INDIGO = "#5C6BC0";
802
- var MIST = "#DCE3F0";
803
- var INK = "#202124";
804
- var WHITE = "#FFFFFF";
805
- var CHEEK = "rgba(255, 160, 185, 0.55)";
806
- var EDGE = "rgba(0, 0, 0, 0.14)";
807
- var CHEEK_DEEP = "rgba(120, 10, 30, 0.35)";
808
- var CHEEK_WARM = "rgba(234, 67, 53, 0.4)";
809
- var LOOKS = [
810
- { color: MINT, eye: "#1D3B27", cheek: CHEEK, eyeY: 21, gap: 8 },
811
- { color: BLUE, eye: WHITE, cheek: CHEEK, eyeY: 23, gap: 8 },
812
- { color: RED, eye: WHITE, cheek: CHEEK_DEEP, eyeY: 22, gap: 8 },
813
- { color: CREAM, eye: "#4A3420", cheek: "rgba(240, 120, 120, 0.5)", accent: "#DDBF8E", eyeY: 22, gap: 7.6 },
814
- { color: GREEN, eye: WHITE, cheek: CHEEK, eyeY: 19, gap: 7.2 },
815
- { color: INDIGO, eye: WHITE, cheek: CHEEK, eyeY: 20, gap: 7.4 },
816
- { color: YELLOW, eye: INK, cheek: CHEEK_WARM, accent: "#F29900", eyeY: 24, gap: 8.4 },
817
- { color: VIOLET, eye: "#22134A", cheek: CHEEK, eyeY: 20, gap: 8 },
818
- { color: MIST, eye: "#2B3245", cheek: CHEEK, eyeY: 19, gap: 7.6 },
819
- { color: SKY, eye: WHITE, cheek: CHEEK, eyeY: 21, gap: 6.4 },
820
- { color: ORANGE, eye: "#3D1C08", cheek: CHEEK, accent: GREEN, eyeY: 22, gap: 8.6, brows: true },
821
- { color: WHITE, eye: WHITE, cheek: CHEEK, accent: INK, mouth: INK, eyeY: 22, gap: 10 },
822
- { color: TEAL, eye: WHITE, cheek: CHEEK, accent: "#1B8A84", eyeY: 22.5, gap: 8.4 },
823
- { color: PINK, eye: "#4A1428", cheek: "rgba(160, 20, 70, 0.3)", eyeY: 24, gap: 7.4 },
824
- { color: LILAC, eye: "#2A1A5E", cheek: CHEEK, eyeY: 25, gap: 8 },
825
- { color: YELLOW, eye: INK, cheek: CHEEK_WARM, eyeY: 25, gap: 7.4 }
826
- ];
827
- function corners(count, radius, cx, cy, inner) {
828
- const points = [];
829
- const steps = inner ? count * 2 : count;
830
- for (let index = 0;index < steps; index++) {
831
- const r = inner && index % 2 === 1 ? inner : radius;
832
- const angle = -Math.PI / 2 + index * 2 * Math.PI / steps;
833
- points.push(`${(cx + r * Math.cos(angle)).toFixed(2)},${(cy + r * Math.sin(angle)).toFixed(2)}`);
834
- }
835
- return points.join(" ");
836
- }
837
- var PENTAGON = corners(5, 13.5, 20, 21.5);
838
- var HEXAGON = corners(6, 14, 20, 20);
839
- var STAR = corners(5, 15.5, 20, 21.5, 8.6);
840
- function Rounded({ points, color, width = 5 }) {
841
- return /* @__PURE__ */ React.createElement("polygon", {
842
- points,
843
- fill: color,
844
- stroke: color,
845
- strokeWidth: width,
846
- strokeLinejoin: "round"
847
- });
848
- }
849
- function shape(face, look) {
850
- const { color, accent = color } = look;
851
- switch (face) {
852
- case 1:
853
- return /* @__PURE__ */ React.createElement("g", null, /* @__PURE__ */ React.createElement(Rounded, {
854
- points: "7.5,6.5 17,12 8.5,18",
855
- color,
856
- width: 4
857
- }), /* @__PURE__ */ React.createElement(Rounded, {
858
- points: "32.5,6.5 23,12 31.5,18",
859
- color,
860
- width: 4
861
- }), /* @__PURE__ */ React.createElement("ellipse", {
862
- cx: "20",
863
- cy: "23",
864
- rx: "14.5",
865
- ry: "12.5",
866
- fill: color
867
- }));
868
- case 2:
869
- return /* @__PURE__ */ React.createElement(Rounded, {
870
- points: PENTAGON,
871
- color
872
- });
873
- case 3:
874
- return /* @__PURE__ */ React.createElement("g", null, /* @__PURE__ */ React.createElement("circle", {
875
- cx: "9.5",
876
- cy: "10.5",
877
- r: "5.5",
878
- fill: color
879
- }), /* @__PURE__ */ React.createElement("circle", {
880
- cx: "30.5",
881
- cy: "10.5",
882
- r: "5.5",
883
- fill: color
884
- }), /* @__PURE__ */ React.createElement("circle", {
885
- cx: "9.5",
886
- cy: "10.5",
887
- r: "2.6",
888
- fill: accent
889
- }), /* @__PURE__ */ React.createElement("circle", {
890
- cx: "30.5",
891
- cy: "10.5",
892
- r: "2.6",
893
- fill: accent
894
- }), /* @__PURE__ */ React.createElement("ellipse", {
895
- cx: "20",
896
- cy: "22.5",
897
- rx: "14.5",
898
- ry: "13",
899
- fill: color
900
- }));
901
- case 4:
902
- return /* @__PURE__ */ React.createElement("rect", {
903
- x: "8.5",
904
- y: "4",
905
- width: "23",
906
- height: "32",
907
- rx: "11.5",
908
- fill: color
909
- });
910
- case 5:
911
- return /* @__PURE__ */ React.createElement(Rounded, {
912
- points: "20,5.5 34.5,20 20,34.5 5.5,20",
913
- color,
914
- width: 5.5
915
- });
916
- case 6:
917
- return /* @__PURE__ */ React.createElement("g", null, /* @__PURE__ */ React.createElement("ellipse", {
918
- cx: "20",
919
- cy: "11",
920
- rx: "3.2",
921
- ry: "3.6",
922
- fill: accent
923
- }), /* @__PURE__ */ React.createElement("path", {
924
- d: "M20 12.5c9.2 0 15.5 5.6 15.5 12.4 0 6.4-6.9 10.1-15.5 10.1S4.5 31.3 4.5 24.9C4.5 18.1 10.8 12.5 20 12.5Z",
925
- fill: color
926
- }));
927
- case 7:
928
- return /* @__PURE__ */ React.createElement(Rounded, {
929
- points: HEXAGON,
930
- color
931
- });
932
- case 8:
933
- return /* @__PURE__ */ React.createElement("path", {
934
- d: "M8 19a12 12 0 0 1 24 0v14l-4-3-4 3-4-3-4 3-4-3-4 3Z",
935
- fill: color,
936
- stroke: EDGE,
937
- strokeWidth: "0.8",
938
- strokeLinejoin: "round"
939
- });
940
- case 9:
941
- return /* @__PURE__ */ React.createElement(Rounded, {
942
- points: STAR,
943
- color,
944
- width: 4.5
945
- });
946
- case 10:
947
- return /* @__PURE__ */ React.createElement("g", null, /* @__PURE__ */ React.createElement("rect", {
948
- x: "18.6",
949
- y: "4.5",
950
- width: "2.8",
951
- height: "7",
952
- rx: "1.4",
953
- fill: accent
954
- }), /* @__PURE__ */ React.createElement("ellipse", {
955
- cx: "12.5",
956
- cy: "23",
957
- rx: "8.5",
958
- ry: "11",
959
- fill: color
960
- }), /* @__PURE__ */ React.createElement("ellipse", {
961
- cx: "27.5",
962
- cy: "23",
963
- rx: "8.5",
964
- ry: "11",
965
- fill: color
966
- }), /* @__PURE__ */ React.createElement("ellipse", {
967
- cx: "20",
968
- cy: "22.5",
969
- rx: "9.5",
970
- ry: "12",
971
- fill: color
972
- }));
973
- case 11:
974
- return /* @__PURE__ */ React.createElement("g", null, /* @__PURE__ */ React.createElement("circle", {
975
- cx: "9.5",
976
- cy: "10",
977
- r: "5",
978
- fill: accent
979
- }), /* @__PURE__ */ React.createElement("circle", {
980
- cx: "30.5",
981
- cy: "10",
982
- r: "5",
983
- fill: accent
984
- }), /* @__PURE__ */ React.createElement("ellipse", {
985
- cx: "20",
986
- cy: "22.5",
987
- rx: "14.5",
988
- ry: "13",
989
- fill: color,
990
- stroke: EDGE,
991
- strokeWidth: "0.8"
992
- }), /* @__PURE__ */ React.createElement("ellipse", {
993
- cx: "14.6",
994
- cy: "22",
995
- rx: "3.6",
996
- ry: "4.4",
997
- transform: "rotate(20 14.6 22)",
998
- fill: accent
999
- }), /* @__PURE__ */ React.createElement("ellipse", {
1000
- cx: "25.4",
1001
- cy: "22",
1002
- rx: "3.6",
1003
- ry: "4.4",
1004
- transform: "rotate(-20 25.4 22)",
1005
- fill: accent
1006
- }));
1007
- case 12:
1008
- return /* @__PURE__ */ React.createElement("g", null, /* @__PURE__ */ React.createElement("rect", {
1009
- x: "19.1",
1010
- y: "6",
1011
- width: "1.8",
1012
- height: "7",
1013
- fill: accent
1014
- }), /* @__PURE__ */ React.createElement("circle", {
1015
- cx: "20",
1016
- cy: "5",
1017
- r: "2.2",
1018
- fill: accent
1019
- }), /* @__PURE__ */ React.createElement("rect", {
1020
- x: "5.5",
1021
- y: "12",
1022
- width: "29",
1023
- height: "22.5",
1024
- rx: "6.5",
1025
- fill: color
1026
- }));
1027
- case 13:
1028
- return /* @__PURE__ */ React.createElement("path", {
1029
- d: "M20 4.5c2 0 13 11.6 13 20.2 0 6.4-5.8 10.8-13 10.8S7 31.1 7 24.7C7 16.1 18 4.5 20 4.5Z",
1030
- fill: color
1031
- });
1032
- case 14:
1033
- return /* @__PURE__ */ React.createElement("g", null, /* @__PURE__ */ React.createElement("ellipse", {
1034
- cx: "14",
1035
- cy: "10.5",
1036
- rx: "3.6",
1037
- ry: "8",
1038
- transform: "rotate(-8 14 10.5)",
1039
- fill: color
1040
- }), /* @__PURE__ */ React.createElement("ellipse", {
1041
- cx: "26",
1042
- cy: "10.5",
1043
- rx: "3.6",
1044
- ry: "8",
1045
- transform: "rotate(8 26 10.5)",
1046
- fill: color
1047
- }), /* @__PURE__ */ React.createElement("ellipse", {
1048
- cx: "20",
1049
- cy: "25",
1050
- rx: "14",
1051
- ry: "11",
1052
- fill: color
1053
- }));
1054
- case 15:
1055
- return /* @__PURE__ */ React.createElement(Rounded, {
1056
- points: "20,7 35,33 5,33",
1057
- color,
1058
- width: 6
1059
- });
1060
- default:
1061
- return /* @__PURE__ */ React.createElement("circle", {
1062
- cx: "20",
1063
- cy: "21",
1064
- r: "14.5",
1065
- fill: color
1066
- });
1179
+ function draw(node2, key) {
1180
+ const props = {};
1181
+ for (const [name, value] of Object.entries(node2.attrs)) {
1182
+ props[name === "class" ? "className" : name.replace(/-(\w)/g, (_, letter) => letter.toUpperCase())] = value;
1067
1183
  }
1184
+ return React.createElement(node2.tag, { ...props, key }, ...(node2.children ?? []).map((child, index) => draw(child, index)));
1068
1185
  }
1069
1186
  function faceColor(face) {
1070
- return (LOOKS[face] ?? LOOKS[0]).color;
1187
+ return FaceUtil.color(face);
1071
1188
  }
1072
1189
  function Face({ face, size, working }) {
1073
- const look = LOOKS[face] ?? LOOKS[0];
1074
- const half = look.gap / 2;
1075
- const eyeW = 4.1;
1076
- const eyeH = 4.9;
1077
- const top = look.eyeY - eyeH / 2;
1078
- const cheekY = look.eyeY + 3.6;
1079
- const cheekX = half + 2.2;
1080
- const mouthY = look.eyeY + 3.4;
1081
1190
  return /* @__PURE__ */ React.createElement("span", {
1082
- className: `tac-face${working ? " tac-face-working" : ""}`,
1191
+ className: `ta-face${working ? " ta-face-working" : ""}`,
1083
1192
  style: { width: size, height: size },
1084
1193
  "data-face": face,
1085
1194
  "aria-hidden": "true"
@@ -1089,51 +1198,7 @@ function Face({ face, size, working }) {
1089
1198
  height: size,
1090
1199
  focusable: "false",
1091
1200
  "aria-hidden": "true"
1092
- }, /* @__PURE__ */ React.createElement("g", {
1093
- className: "tac-face-body"
1094
- }, shape(face, look), /* @__PURE__ */ React.createElement("g", {
1095
- className: "tac-face-look"
1096
- }, /* @__PURE__ */ React.createElement("g", {
1097
- fill: look.cheek
1098
- }, /* @__PURE__ */ React.createElement("ellipse", {
1099
- cx: 20 - cheekX,
1100
- cy: cheekY,
1101
- rx: "2.2",
1102
- ry: "1.25"
1103
- }), /* @__PURE__ */ React.createElement("ellipse", {
1104
- cx: 20 + cheekX,
1105
- cy: cheekY,
1106
- rx: "2.2",
1107
- ry: "1.25"
1108
- })), look.brows && /* @__PURE__ */ React.createElement("path", {
1109
- d: `M${20 - half - 3.4} ${top - 2.6}l3.6 1.6M${20 + half + 3.4} ${top - 2.6}l-3.6 1.6`,
1110
- stroke: look.eye,
1111
- strokeWidth: "1.4",
1112
- strokeLinecap: "round",
1113
- fill: "none"
1114
- }), /* @__PURE__ */ React.createElement("g", {
1115
- className: "tac-face-eyes",
1116
- fill: look.eye
1117
- }, /* @__PURE__ */ React.createElement("rect", {
1118
- x: 20 - half - eyeW / 2,
1119
- y: top,
1120
- width: eyeW,
1121
- height: eyeH,
1122
- rx: eyeW / 2
1123
- }), /* @__PURE__ */ React.createElement("rect", {
1124
- x: 20 + half - eyeW / 2,
1125
- y: top,
1126
- width: eyeW,
1127
- height: eyeH,
1128
- rx: eyeW / 2
1129
- })), /* @__PURE__ */ React.createElement("path", {
1130
- d: `M18.1 ${mouthY}q.95 1.25 1.9 0q.95 1.25 1.9 0`,
1131
- fill: "none",
1132
- stroke: look.mouth ?? look.eye,
1133
- strokeWidth: "1.1",
1134
- strokeLinecap: "round",
1135
- strokeLinejoin: "round"
1136
- })))));
1201
+ }, draw(FaceUtil.art(face))));
1137
1202
  }
1138
1203
  function RoomFace({ members, faces, size, working }) {
1139
1204
  const [lead, next] = members;
@@ -1170,199 +1235,214 @@ function RoomFace({ members, faces, size, working }) {
1170
1235
  })));
1171
1236
  }
1172
1237
 
1173
- // web-src/i18n.ts
1174
- var EN = {
1175
- title: "Double",
1176
- channels: "Channels",
1177
- agents: "Agents",
1178
- newChannel: "New channel",
1179
- newAgent: "New agent",
1180
- scan: "Scan",
1181
- name: "Name",
1182
- role: "Role",
1183
- rolePlaceholder: "What it does and how, as instructions to it",
1184
- topic: "Topic",
1185
- members: "Members",
1186
- addMembers: "Add members",
1187
- makeExtension: "Make an extension",
1188
- makeExtensionDetail: "Of what was worked out here",
1189
- makeExtensionAsk: "Make what this channel worked out an extension, with the ta-package skill, to do it again in a click",
1190
- add: "Add",
1191
- allMembers: "Every agent is in this channel already",
1192
- membersHint: "The first one you pick leads: it answers what names nobody.",
1193
- create: "Create",
1194
- cancel: "Cancel",
1195
- back: "Back",
1196
- send: "Send",
1197
- you: "You",
1198
- owner: "Owner",
1238
+ // web-src/i18n-ja.ts
1239
+ var JA = {
1240
+ title: "分身",
1241
+ channels: "グループチャット",
1242
+ agents: "エージェント",
1243
+ newChannel: "新しいグループチャット",
1244
+ newAgent: "新しいエージェント",
1245
+ scan: "スキャン",
1246
+ addFriend: "友だち追加",
1247
+ name: "名前",
1248
+ role: "役割",
1249
+ rolePlaceholder: "それが何をするか、どのように行うか、それへの指示として記述",
1250
+ topic: "トピック",
1251
+ members: "メンバー",
1252
+ addMembers: "メンバーを追加",
1253
+ makeExtension: "拡張機能にする",
1254
+ makeExtensionDetail: "ここで作成されたものを工具にする",
1255
+ makeExtensionAsk: "このグループチャットで作成された事項を拡張機能にする(ta-package スキルで)、将来は 1 クリックで再利用可能",
1256
+ add: "追加",
1257
+ allMembers: "すべてのエージェントがこのグループチャットに既に含まれています",
1258
+ membersHint: "最初に選択したメンバーがリーダー:誰も @ で指定されていないメッセージに答えます。",
1259
+ create: "作成",
1260
+ cancel: "キャンセル",
1261
+ back: "戻る",
1262
+ send: "送信",
1263
+ you: "あなた",
1264
+ owner: "オーナー",
1199
1265
  ta: "Ta",
1200
- lead: "Lead",
1201
- empty: "No channels yet",
1202
- emptyHint: "Ask Ta for a team, or create one with +",
1203
- noAgents: "No agents yet",
1204
- noAgentsHint: "A channel is made of agents: create one first",
1205
- pick: "Pick a channel",
1206
- quiet: "Nothing said yet. Mention a member with @, or the lead answers.",
1207
- placeholder: "Message {channel}; @ names a member",
1208
- answering: "{name} is answering",
1209
- failed: "did not answer",
1210
- mention: "Mention {name}",
1211
- stopped: "The agents stopped at the limit of a round; it is your turn.",
1212
- search: "Search",
1213
- clear: "Clear",
1214
- new: "New",
1215
- answeringIn: "Answering in #{channel}",
1216
- answeringNow: "{name} is answering…",
1217
- noMatch: "No matching agents or channels",
1218
- noMessages: "No messages yet",
1219
- noAgentsYet: "No agents yet",
1220
- noAgentsYetHint: "Create one with +, or ask Ta for a team",
1221
- myDouble: "My double",
1222
- memberCount: "{count} members",
1223
- channel: "Channel",
1224
- newAgentName: "new-agent",
1225
- notStarted: "Not started yet",
1226
- editAgent: "Change the name and the avatar",
1227
- avatar: "Avatar",
1228
- newAgentHint: "Pick a name and an avatar above, then tell it what to do first: your first message makes it.",
1229
- agentPlaceholder: "Message {name}",
1230
- channelNamePlaceholder: "For example: Project Falcon",
1231
- addAgents: "Add agents",
1232
- searchAgents: "Search agents, pick 1 to {max}",
1233
- showMembers: "Members",
1234
- canAdd: "{count} agents can join",
1235
- findAgent: "Search agents",
1236
- addCount: "Add {count}",
1237
- makeLead: "Make lead",
1238
- leadHint: "Answers what names nobody",
1239
- mute: "Mute: answers nothing here",
1240
- unmute: "Let it answer again",
1241
- muted: "Muted",
1242
- replying: "Answering…",
1243
- reset: "New session: it forgets what it was told",
1244
- resetDone: "{name} starts a new session the next time it answers.",
1245
- remove: "Remove from the channel",
1246
- onlyMember: "A channel keeps at least one member",
1247
- open: "Open its session",
1248
- deleteChannel: "Delete channel",
1249
- confirmDelete: "Delete #{channel} and its messages?",
1250
- delete: "Delete",
1251
- noChannel: "Open a channel to see its members",
1252
- more: "More",
1253
- stop: "Stop",
1254
- stoppedAgent: "Stopped {name}.",
1255
- restart: "Restart",
1256
- restartHint: "A new session: it forgets what it was told",
1257
- rename: "Rename",
1258
- editRole: "Role",
1259
- roleHint: "What it reads first, before anything else: who it is and how it works. It takes effect from its next session; Restart to use it now.",
1260
- save: "Save",
1261
- moveTo: "Move to…",
1262
- moveHint: "Works in another directory, in a new session there",
1263
- copyCwd: "Copy directory",
1264
- copied: "Copied {path}",
1265
- exportChat: "Export conversation (Markdown)",
1266
- nothingToExport: "{name} has said nothing yet.",
1267
- joinChannel: "Add to channel",
1268
- noChannelToJoin: "It is in every channel already",
1269
- joined: "{name} joined #{channel}.",
1270
- deleteAgent: "Delete",
1271
- confirmDeleteAgent: "Delete {name}? It leaves its channels, and channels with no one else go too; its session file stays.",
1272
- pin: "Pin",
1273
- unpin: "Unpin",
1274
- pinned: "Pinned",
1275
- markUnread: "Mark as unread",
1276
- markRead: "Mark as read",
1277
- editTopic: "Topic",
1278
- topicPlaceholder: "What the channel is for",
1279
- renameChannel: "Rename #{channel}",
1280
- stopAnswering: "Stop answering",
1281
- stoppedChannel: "Stopped the members answering in #{channel}.",
1282
- noMessagesToExport: "#{channel} has no messages yet.",
1283
- yourTurn: "Your turn",
1284
- needsYou: "Waiting for you",
1285
- building: "Building the team…",
1286
- openInMain: "Open in the main area",
1287
- openInMainHint: "Talk to the team yourself",
1288
- keepMembers: "Keep its agents",
1289
- keptMembers: "{names} are among your members now.",
1290
- keep: "Keep as a member",
1291
- kept: "{name} is among your members now.",
1292
- temporary: "Made by Ta for this team; keep it to have it among your members",
1293
- temporaryTag: "Temporary",
1294
- tasks: "Tasks",
1295
- membersSection: "Members",
1296
- byDirectory: "Group by directory",
1297
- channelsSection: "Channels",
1298
- showAll: "Show all {count}",
1299
- showFewer: "Show fewer",
1300
- waitingCount: "{count} need you",
1301
- runningCount: "{count} running",
1302
- freshCount: "{count} new",
1303
- standingBy: "Standing by",
1304
- noTasksHere: "What the double hands out, tasks and teams, is listed here",
1305
- deleteTask: "Delete the team",
1306
- deleteTaskHint: "The messages of #{channel} go with it. Its agents stay, among your members.",
1307
- selectTasks: "Select",
1308
- toolCreateAgent: "Create agent",
1309
- toolCreateChannel: "Create channel",
1310
- toolAddToChannel: "Add to channel",
1311
- toolPostToChannel: "Post to",
1312
- toolHandOff: "Hand over to",
1313
- handOff: "Hand over to…",
1314
- handOffDetail: "An agent or a channel goes on with it",
1315
- handedTo: "Handed over to {to}",
1316
- handOffOpen: "Open",
1317
- toolListChannels: "Look over the team",
1318
- notice: "Notice",
1319
- noticeCounts: "{decisions} decided · {conventions} agreed · {todo} to do",
1320
- noticeEmpty: "No notice yet",
1321
- noticeBy: "{name} updated it {time}",
1322
- noticeEdit: "Edit the notice",
1323
- noticeTemplate: `### Decisions
1266
+ lead: "リーダー",
1267
+ empty: "まだグループチャットがありません",
1268
+ emptyHint: "Ta にチームを組ませるか、+ をクリックして作成",
1269
+ noAgents: "まだエージェントがありません",
1270
+ noAgentsHint: "グループチャットはエージェントで構成されます:最初に 1 つ作成",
1271
+ pick: "グループチャットを選択",
1272
+ quiet: "まだメッセージがありません。@ でメンバーを指定するか、リーダーが回答します。",
1273
+ placeholder: "{channel} に送信;@ でメンバーを指定",
1274
+ answering: "{name} が回答中",
1275
+ failed: "回答がありません",
1276
+ mention: "@{name}",
1277
+ stopped: "ラウンドの制限に達しました;あなたの番です。",
1278
+ search: "検索",
1279
+ clear: "クリア",
1280
+ new: "新規",
1281
+ answeringIn: "#{channel} で回答中",
1282
+ answeringNow: "{name} が回答中…",
1283
+ noMatch: "一致するエージェントまたはグループチャットがありません",
1284
+ noMessages: "まだメッセージがありません",
1285
+ noAgentsYet: "まだエージェントがありません",
1286
+ noAgentsYetHint: "+ で作成するか、Ta にチームを組ませて",
1287
+ partners: "仲間",
1288
+ groupsSection: "グループチャット",
1289
+ agentsSection: "エージェント",
1290
+ noPartners: "まだ仲間がいません",
1291
+ noPartnersHint: "+ でエージェントやグループチャットを作るか、友だちを追加して",
1292
+ inviteFriends: "友だちを招待",
1293
+ noFriends: "まだ友だちがいません",
1294
+ shareGroup: "共有グループチャットにする",
1295
+ shareGroupHint: "同じ名前のグループチャットを作り、選んだ友だちと中継で暗号化して共有します。エージェントも一緒に入ります。ここの履歴はこのコンピュータに残り、友だちには送られません。",
1296
+ sharedMade: "「{name}」を友だちと共有しました。参加するとすぐ入れます。",
1297
+ addFriends: "友だちを追加",
1298
+ friend: "友だち",
1299
+ sharedHint: "友だちがいると、グループチャットは中継で暗号化して共有されます。友だちは参加するとすぐ入れ、エージェントは @ で呼ばれたときだけ答えます。",
1300
+ sharedNeedsRooms: "友だちとグループチャットを作るには Ta を更新してください。",
1301
+ myDouble: "私の分身",
1302
+ memberCount: "{count} 人のメンバー",
1303
+ channel: "グループチャット",
1304
+ newAgentName: "新しいエージェント",
1305
+ notStarted: "まだ開始されていません",
1306
+ editAgent: "名前とアバターを変更",
1307
+ avatar: "アバター",
1308
+ newAgentHint: "上記で名前を付け、アバターを選択してから、最初に何をするかを指示:最初のメッセージがそれを作成します。",
1309
+ agentPlaceholder: "{name} にメッセージを送信",
1310
+ channelNamePlaceholder: "例:Project Falcon",
1311
+ addAgents: "エージェントを追加",
1312
+ searchAgents: "エージェントを検索、1 ~ {max} 件を選択",
1313
+ showMembers: "メンバー",
1314
+ canAdd: "{count} 個のエージェントを追加できます",
1315
+ findAgent: "エージェントを検索",
1316
+ addCount: "{count} 人を追加",
1317
+ makeLead: "リーダーに設定",
1318
+ leadHint: "誰も指定されていないメッセージに回答します",
1319
+ mute: "ミュート:このグループチャットのメッセージに答えません",
1320
+ unmute: "もう一度回答させる",
1321
+ muted: "ミュート中",
1322
+ replying: "回答中…",
1323
+ reset: "新しいセッション:それが言われたことを忘れます",
1324
+ resetDone: "{name} は次に回答するときに新しいセッションから始まります。",
1325
+ remove: "グループチャットから削除",
1326
+ onlyMember: "グループチャットには最低 1 人のメンバーを保つ必要があります",
1327
+ open: "そのセッションを開く",
1328
+ deleteChannel: "グループチャットを削除",
1329
+ confirmDelete: "#{channel} とそのすべてのメッセージを削除しますか?",
1330
+ delete: "削除",
1331
+ noChannel: "グループチャットを開いてそのメンバーを確認",
1332
+ more: "その他",
1333
+ stop: "停止",
1334
+ stoppedAgent: "{name} を停止しました。",
1335
+ restart: "再開",
1336
+ restartHint: "新しいセッション:それが言われたことを忘れます",
1337
+ rename: "名前変更",
1338
+ editRole: "役割",
1339
+ roleHint: "それが最初に読む指示:それが誰であるか、どのように働くか。次のセッションから有効になります;今すぐ有効にするには再開してください。",
1340
+ save: "保存",
1341
+ moveTo: "移動先…",
1342
+ moveHint: "別のディレクトリで機能し、そこで新しいセッションを開きます",
1343
+ copyCwd: "ディレクトリをコピー",
1344
+ copied: "{path} をコピーしました",
1345
+ exportChat: "会話をエクスポート(Markdown)",
1346
+ nothingToExport: "{name} はまだ何も言っていません。",
1347
+ joinChannel: "グループチャットに追加",
1348
+ noChannelToJoin: "すべてのグループチャットに既に含まれています",
1349
+ joined: "{name} が #{channel} に参加しました。",
1350
+ deleteAgent: "削除",
1351
+ confirmDeleteAgent: "{name} を削除しますか?それはそのグループチャットから削除され、それだけのグループチャットも削除されます;セッションファイルは保持されます。",
1352
+ pin: "ピン留め",
1353
+ unpin: "ピン留めを解除",
1354
+ pinned: "ピン留めされています",
1355
+ markUnread: "未読にマーク",
1356
+ markRead: "既読にマーク",
1357
+ editTopic: "トピックを編集",
1358
+ topicPlaceholder: "このグループチャットの目的",
1359
+ renameChannel: "#{channel} の名前を変更",
1360
+ stopAnswering: "回答を停止",
1361
+ stoppedChannel: "#{channel} で回答中のメンバーを停止しました。",
1362
+ noMessagesToExport: "#{channel} にはまだメッセージがありません。",
1363
+ yourTurn: "あなたの番",
1364
+ needsYou: "あなたを待っています",
1365
+ building: "チームを構築中…",
1366
+ openInMain: "メイン領域で開く",
1367
+ openInMainHint: "チーム自体と話す",
1368
+ keepMembers: "メンバーをエージェントとして保存",
1369
+ keptMembers: "{names} を保存しました。仲間のエージェントから話しかけたり、グループチャットに招いたりできます。",
1370
+ keep: "エージェントとして保存",
1371
+ kept: "{name} を保存しました。仲間のエージェントから話しかけたり、グループチャットに招いたりできます。",
1372
+ temporary: "Ta がこのタスクのために一時的に作成;保存すると仲間のエージェントに入ります",
1373
+ temporaryTag: "一時的",
1374
+ tasks: "タスク",
1375
+ decideSection: "あなたの判断待ち",
1376
+ membersSection: "メンバー",
1377
+ byDirectory: "ディレクトリでグループ化",
1378
+ channelsSection: "グループチャット",
1379
+ showAll: "全 {count} 件を表示",
1380
+ showFewer: "表示を減らす",
1381
+ waitingCount: "{count} 件があなたを待っています",
1382
+ runningCount: "{count} 件実行中",
1383
+ freshCount: "{count} 件の新規",
1384
+ standingBy: "スタンバイ中",
1385
+ noTasksHere: "分身が交付したタスクとチームはここにリストされます",
1386
+ deleteTask: "チームを削除",
1387
+ deleteTaskHint: "#{channel} のメッセージは削除されます。チームメンバーはあなたのメンバーに留まります。",
1388
+ selectTasks: "選択",
1389
+ toolCreateAgent: "エージェントを作成",
1390
+ toolCreateChannel: "グループチャットを作成",
1391
+ toolAddToChannel: "グループチャットに追加",
1392
+ toolPostToChannel: "投稿",
1393
+ toolHandOff: "ハンドオフ",
1394
+ handOff: "ハンドオフ先…",
1395
+ handOffDetail: "エージェントまたはグループチャットが続ける",
1396
+ handedTo: "{to} にハンドオフされました",
1397
+ handOffOpen: "開く",
1398
+ toolListChannels: "チームを表示",
1399
+ notice: "お知らせ",
1400
+ noticeCounts: "決定 {decisions} · 合意 {conventions} · 対応 {todo}",
1401
+ noticeEmpty: "まだお知らせがありません",
1402
+ noticeBy: "{name} が {time} に更新",
1403
+ noticeEdit: "お知らせを編集",
1404
+ noticeTemplate: `### 決定
1324
1405
  -
1325
1406
 
1326
- ### Conventions
1407
+ ### 合意
1327
1408
  -
1328
1409
 
1329
- ### To do
1410
+ ### 対応
1330
1411
  - [ ] `,
1331
- noticeHint: "What this channel decided, agreed and is to do: every member reads it with each message and follows it. Members keep it up to date as the talk settles things.",
1332
- noticeUpdated: "{name} updated the notice",
1333
- noticeCleared: "{name} took the notice down",
1334
- noticeShow: "Show the notice",
1335
- noticeHide: "Hide the notice",
1336
- noticeSaved: "Notice saved",
1337
- toolNotice: "Update the notice",
1338
- toolRole: "Update its role",
1339
- shareCard: "Share card…",
1340
- cardTitle: "{name}'s card",
1341
- cardKind: "An agent's card",
1342
- cardMaking: "Making the link…",
1343
- cardHint: "Whoever opens it in Ta, by scanning or pasting, adds it as an agent of theirs, which first fits its role to their project. Its role goes, with secrets taken out; not its directory nor its conversation. The link works for 30 days, while this computer is off too.",
1344
- cardRedacted: "{n} places that looked like secrets were taken out.",
1345
- copyLink: "Copy link",
1346
- linkCopied: "Copied",
1347
- sendLink: "Send",
1348
- stopCard: "Stop sharing",
1349
- cardStopped: "The link of the card no longer works.",
1350
- cardOpening: "Opening the card…",
1351
- cardAddTo: "Works in {dir}",
1352
- cardChangeDir: "Change",
1353
- cardAdd: "Add as my agent",
1354
- cardAddHint: "It looks at the project there first and fits its role to it; you see what it changed in its conversation.",
1355
- cardAdded: "Added as @{name}",
1356
- cardOpen: "Open the conversation",
1357
- cardFailed: "Could not open the card: {message}"
1412
+ noticeHint: "このグループチャットが決定した事項、合意、対応:各メンバーはメッセージの度に読んで従います。。メンバーは話し合いで決まったことを自分で更新します。",
1413
+ noticeUpdated: "{name} がお知らせを更新しました",
1414
+ noticeCleared: "{name} がお知らせを削除しました",
1415
+ noticeShow: "お知らせを表示",
1416
+ noticeHide: "お知らせを非表示",
1417
+ noticeSaved: "お知らせが保存されました",
1418
+ toolNotice: "お知らせを更新",
1419
+ toolRole: "役割を更新",
1420
+ shareCard: "カードを共有…",
1421
+ cardTitle: "{name} のカード",
1422
+ cardKind: "エージェントカード",
1423
+ cardGets: "相手は自分のエージェントとして追加し、自分のプロジェクトに合わせて役割を調整します",
1424
+ cardHint: "役割のみ(秘密のように見えるものは除去)、ディレクトリと会話は含まれません。リンクは 30 日間有効で、このコンピューターがオフでも開けます。",
1425
+ cardRedacted: "役割に {n} 箇所の秘密のように見えるものが除去されました。",
1426
+ cardStopped: "カードのリンクは機能しなくなりました。",
1427
+ cardOpening: "カードを開いています…",
1428
+ cardAddTo: "作業ディレクトリ:{dir}",
1429
+ cardChangeDir: "変更",
1430
+ cardAdd: "エージェントとして追加",
1431
+ cardAddHint: "追加後、このディレクトリ下のプロジェクトを確認し、役割をここに合わせます;変更内容はセッションで通知します。",
1432
+ cardAdded: "@{name} として追加されました",
1433
+ cardOpen: "会話を開く",
1434
+ cardFailed: "このカードを開けません:{message}"
1358
1435
  };
1436
+
1437
+ // web-src/i18n-zh.ts
1359
1438
  var ZH = {
1360
1439
  title: "分身",
1361
- channels: "频道",
1440
+ channels: "群聊",
1362
1441
  agents: "智能体",
1363
- newChannel: "新建频道",
1442
+ newChannel: "新建群聊",
1364
1443
  newAgent: "新建智能体",
1365
1444
  scan: "扫一扫",
1445
+ addFriend: "加好友",
1366
1446
  name: "名字",
1367
1447
  role: "职责",
1368
1448
  rolePlaceholder: "它做什么、怎么做,写成给它的指示",
@@ -1371,9 +1451,9 @@ var ZH = {
1371
1451
  addMembers: "添加成员",
1372
1452
  makeExtension: "做成扩展",
1373
1453
  makeExtensionDetail: "把这里商量出的事做成工具",
1374
- makeExtensionAsk: "把这个频道里商量和做成的事做成扩展(用 ta-package 技能),以后一键就能再用",
1454
+ makeExtensionAsk: "把这个群聊里商量和做成的事做成扩展(用 ta-package 技能),以后一键就能再用",
1375
1455
  add: "添加",
1376
- allMembers: "所有智能体都已在这个频道里",
1456
+ allMembers: "所有智能体都已在这个群聊里",
1377
1457
  membersHint: "先选的成员是负责人:没人被 @ 的消息由它回答。",
1378
1458
  create: "创建",
1379
1459
  cancel: "取消",
@@ -1383,11 +1463,11 @@ var ZH = {
1383
1463
  owner: "所有者",
1384
1464
  ta: "Ta",
1385
1465
  lead: "负责人",
1386
- empty: "还没有频道",
1466
+ empty: "还没有群聊",
1387
1467
  emptyHint: "让 Ta 组个团队,或点 + 新建",
1388
1468
  noAgents: "还没有智能体",
1389
- noAgentsHint: "频道由智能体组成,先新建一个",
1390
- pick: "选一个频道",
1469
+ noAgentsHint: "群聊由智能体组成,先新建一个",
1470
+ pick: "选一个群聊",
1391
1471
  quiet: "还没有消息。用 @ 点名成员,不点名就由负责人回答。",
1392
1472
  placeholder: "发到 {channel};@ 点名成员",
1393
1473
  answering: "{name} 正在回答",
@@ -1399,13 +1479,27 @@ var ZH = {
1399
1479
  new: "新建",
1400
1480
  answeringIn: "正在 #{channel} 回答",
1401
1481
  answeringNow: "{name} 正在回答…",
1402
- noMatch: "没有匹配的智能体或频道",
1482
+ noMatch: "没有匹配的智能体或群聊",
1403
1483
  noMessages: "还没有消息",
1404
1484
  noAgentsYet: "还没有智能体",
1405
1485
  noAgentsYetHint: "点 + 新建,或让 Ta 组个团队",
1486
+ partners: "伙伴",
1487
+ groupsSection: "群聊",
1488
+ agentsSection: "智能体",
1489
+ noPartners: "还没有伙伴",
1490
+ noPartnersHint: "点 + 新建智能体或群聊,或加个好友",
1491
+ inviteFriends: "邀请好友",
1492
+ noFriends: "还没有好友",
1493
+ shareGroup: "建成共享群聊",
1494
+ shareGroupHint: "会新建一个同名的群聊,经中继加密和你选的好友共享,群里的智能体一起进去;这里的聊天记录留在本机,不发给好友。",
1495
+ sharedMade: "已和好友共享「{name}」:好友点加入就进来。",
1496
+ addFriends: "添加好友",
1497
+ friend: "好友",
1498
+ sharedHint: "有好友时,群聊经中继加密同步:好友点加入就进来;智能体只回答 @ 它的消息。",
1499
+ sharedNeedsRooms: "先把 Ta 更新到新版,才能和好友建群聊。",
1406
1500
  myDouble: "我的分身",
1407
1501
  memberCount: "{count} 位成员",
1408
- channel: "频道",
1502
+ channel: "群聊",
1409
1503
  newAgentName: "新智能体",
1410
1504
  notStarted: "还没开工",
1411
1505
  editAgent: "修改名字和头像",
@@ -1415,25 +1509,25 @@ var ZH = {
1415
1509
  channelNamePlaceholder: "例如:官网改版",
1416
1510
  addAgents: "添加智能体",
1417
1511
  searchAgents: "搜索智能体,选择 1–{max} 个",
1418
- showMembers: "频道成员",
1512
+ showMembers: "群聊成员",
1419
1513
  canAdd: "还能添加 {count} 个智能体",
1420
1514
  findAgent: "搜索智能体",
1421
1515
  addCount: "添加 {count} 位",
1422
1516
  makeLead: "设为负责人",
1423
1517
  leadHint: "回答没有 @ 任何人的消息",
1424
- mute: "免打扰:不回答这个频道的消息",
1518
+ mute: "免打扰:不回答这个群聊的消息",
1425
1519
  unmute: "取消免打扰",
1426
1520
  muted: "免打扰",
1427
1521
  replying: "正在回答…",
1428
1522
  reset: "重开会话:忘掉之前的对话",
1429
1523
  resetDone: "{name} 下次回答时会从新会话开始。",
1430
- remove: "移出频道",
1431
- onlyMember: "频道至少要留一位成员",
1524
+ remove: "移出群聊",
1525
+ onlyMember: "群聊至少要留一位成员",
1432
1526
  open: "打开它的会话",
1433
- deleteChannel: "删除频道",
1527
+ deleteChannel: "删除群聊",
1434
1528
  confirmDelete: "删除 #{channel} 和它的全部消息?",
1435
1529
  delete: "删除",
1436
- noChannel: "打开频道后,这里显示它的成员",
1530
+ noChannel: "打开群聊后,这里显示它的成员",
1437
1531
  more: "更多",
1438
1532
  stop: "停止",
1439
1533
  stoppedAgent: "已停止 {name}。",
@@ -1449,18 +1543,18 @@ var ZH = {
1449
1543
  copied: "已复制 {path}",
1450
1544
  exportChat: "导出对话(Markdown)",
1451
1545
  nothingToExport: "{name} 还没有说过话。",
1452
- joinChannel: "加入频道",
1453
- noChannelToJoin: "它已经在所有频道里了",
1546
+ joinChannel: "加入群聊",
1547
+ noChannelToJoin: "它已经在所有群聊里了",
1454
1548
  joined: "{name} 已加入 #{channel}。",
1455
1549
  deleteAgent: "删除",
1456
- confirmDeleteAgent: "删除 {name}?它会退出所在的频道,只剩它一个成员的频道也会一起删除;会话文件会保留。",
1550
+ confirmDeleteAgent: "删除 {name}?它会退出所在的群聊,只剩它一个成员的群聊也会一起删除;会话文件会保留。",
1457
1551
  pin: "置顶",
1458
1552
  unpin: "取消置顶",
1459
1553
  pinned: "已置顶",
1460
1554
  markUnread: "标为未读",
1461
1555
  markRead: "标为已读",
1462
1556
  editTopic: "修改主题",
1463
- topicPlaceholder: "这个频道是做什么的",
1557
+ topicPlaceholder: "这个群聊是做什么的",
1464
1558
  renameChannel: "重命名 #{channel}",
1465
1559
  stopAnswering: "停止回答",
1466
1560
  stoppedChannel: "已让 #{channel} 里正在回答的成员停下。",
@@ -1470,16 +1564,17 @@ var ZH = {
1470
1564
  building: "正在组建团队…",
1471
1565
  openInMain: "在主区打开",
1472
1566
  openInMainHint: "亲自和团队对话",
1473
- keepMembers: "留下团队成员",
1474
- keptMembers: "{names} 已成为你的常驻成员。",
1475
- keep: "留为常驻成员",
1476
- kept: "{name} 已成为你的常驻成员。",
1477
- temporary: "Ta 为这个团队临时创建;留下后成为你的常驻成员",
1567
+ keepMembers: "把成员存成智能体",
1568
+ keptMembers: "{names} 已存成智能体:在伙伴的智能体里,可以和它对话、拉进群聊。",
1569
+ keep: "存成智能体",
1570
+ kept: "{name} 已存成智能体:在伙伴的智能体里,可以和它对话、拉进群聊。",
1571
+ temporary: "Ta 为这个任务临时建的;存下后在伙伴的智能体里",
1478
1572
  temporaryTag: "临时",
1479
1573
  tasks: "任务",
1574
+ decideSection: "待你决定",
1480
1575
  membersSection: "成员",
1481
1576
  byDirectory: "按目录分组",
1482
- channelsSection: "频道",
1577
+ channelsSection: "群聊",
1483
1578
  showAll: "显示全部 {count} 个",
1484
1579
  showFewer: "收起",
1485
1580
  waitingCount: "{count} 个待你处理",
@@ -1491,12 +1586,12 @@ var ZH = {
1491
1586
  deleteTaskHint: "#{channel} 的消息会一起删除,团队成员会留在你的成员里。",
1492
1587
  selectTasks: "多选",
1493
1588
  toolCreateAgent: "新建智能体",
1494
- toolCreateChannel: "新建频道",
1495
- toolAddToChannel: "拉进频道",
1496
- toolPostToChannel: "发到频道",
1589
+ toolCreateChannel: "新建群聊",
1590
+ toolAddToChannel: "拉进群聊",
1591
+ toolPostToChannel: "发到群聊",
1497
1592
  toolHandOff: "交给",
1498
1593
  handOff: "交给…",
1499
- handOffDetail: "让智能体或频道接着做",
1594
+ handOffDetail: "让智能体或群聊接着做",
1500
1595
  handedTo: "已交给 {to}",
1501
1596
  handOffOpen: "打开",
1502
1597
  toolListChannels: "查看团队",
@@ -1513,7 +1608,7 @@ var ZH = {
1513
1608
 
1514
1609
  ### 待办
1515
1610
  - [ ] `,
1516
- noticeHint: "这个频道定下的事、约定和待办:每个成员每次回答都会读到并照着做,讨论定下新的事时成员会自己更新。",
1611
+ noticeHint: "这个群聊定下的事、约定和待办:每个成员每次回答都会读到并照着做,讨论定下新的事时成员会自己更新。",
1517
1612
  noticeUpdated: "{name} 更新了公告",
1518
1613
  noticeCleared: "{name} 撤下了公告",
1519
1614
  noticeShow: "展开公告",
@@ -1524,13 +1619,9 @@ var ZH = {
1524
1619
  shareCard: "分享名片…",
1525
1620
  cardTitle: "{name} 的名片",
1526
1621
  cardKind: "智能体名片",
1527
- cardMaking: "正在生成链接…",
1528
- cardHint: "对方在 Ta 里扫码或粘贴链接,就能把它加为自己的智能体,加进来时它会先按对方的项目调整职责。只带上职责(隐去疑似密钥),不带工作目录和对话。链接 30 天内有效,你的电脑关机也能打开。",
1622
+ cardGets: "对方把它加为自己的智能体,并按自己的项目调整职责",
1623
+ cardHint: "只带上职责(隐去疑似密钥),不带工作目录和对话。链接 30 天内有效,你的电脑关机也能打开。",
1529
1624
  cardRedacted: "职责里有 {n} 处疑似密钥已隐去。",
1530
- copyLink: "复制链接",
1531
- linkCopied: "已复制",
1532
- sendLink: "发送",
1533
- stopCard: "停止分享",
1534
1625
  cardStopped: "名片链接已失效。",
1535
1626
  cardOpening: "正在打开名片…",
1536
1627
  cardAddTo: "工作目录:{dir}",
@@ -1541,13 +1632,16 @@ var ZH = {
1541
1632
  cardOpen: "打开对话",
1542
1633
  cardFailed: "打不开这张名片:{message}"
1543
1634
  };
1635
+
1636
+ // web-src/i18n-zh-tw.ts
1544
1637
  var ZH_TW = {
1545
1638
  title: "分身",
1546
- channels: "頻道",
1639
+ channels: "群聊",
1547
1640
  agents: "智慧體",
1548
- newChannel: "新建頻道",
1641
+ newChannel: "新建群聊",
1549
1642
  newAgent: "新建智慧體",
1550
1643
  scan: "掃一掃",
1644
+ addFriend: "加好友",
1551
1645
  name: "名字",
1552
1646
  role: "職責",
1553
1647
  rolePlaceholder: "它做什麼、怎麼做,寫成給它的指示",
@@ -1556,9 +1650,9 @@ var ZH_TW = {
1556
1650
  addMembers: "新增成員",
1557
1651
  makeExtension: "做成擴充功能",
1558
1652
  makeExtensionDetail: "把這裡商量出的事做成工具",
1559
- makeExtensionAsk: "把這個頻道里商量和做成的事做成擴充功能(用 ta-package 技能),以後一鍵就能再用",
1653
+ makeExtensionAsk: "把這個群聊里商量和做成的事做成擴充功能(用 ta-package 技能),以後一鍵就能再用",
1560
1654
  add: "新增",
1561
- allMembers: "所有智慧體都已在這個頻道里",
1655
+ allMembers: "所有智慧體都已在這個群聊里",
1562
1656
  membersHint: "先選的成員是負責人:沒人被 @ 的訊息由它回答。",
1563
1657
  create: "建立",
1564
1658
  cancel: "取消",
@@ -1568,11 +1662,11 @@ var ZH_TW = {
1568
1662
  owner: "所有者",
1569
1663
  ta: "Ta",
1570
1664
  lead: "負責人",
1571
- empty: "還沒有頻道",
1665
+ empty: "還沒有群聊",
1572
1666
  emptyHint: "讓 Ta 組個團隊,或點 + 新建",
1573
1667
  noAgents: "還沒有智慧體",
1574
- noAgentsHint: "頻道由智慧體組成,先新建一個",
1575
- pick: "選一個頻道",
1668
+ noAgentsHint: "群聊由智慧體組成,先新建一個",
1669
+ pick: "選一個群聊",
1576
1670
  quiet: "還沒有訊息。用 @ 點名成員,不點名就由負責人回答。",
1577
1671
  placeholder: "發到 {channel};@ 點名成員",
1578
1672
  answering: "{name} 正在回答",
@@ -1584,13 +1678,27 @@ var ZH_TW = {
1584
1678
  new: "新建",
1585
1679
  answeringIn: "正在 #{channel} 回答",
1586
1680
  answeringNow: "{name} 正在回答…",
1587
- noMatch: "沒有匹配的智慧體或頻道",
1681
+ noMatch: "沒有匹配的智慧體或群聊",
1588
1682
  noMessages: "還沒有訊息",
1589
1683
  noAgentsYet: "還沒有智慧體",
1590
1684
  noAgentsYetHint: "點 + 新建,或讓 Ta 組個團隊",
1685
+ partners: "夥伴",
1686
+ groupsSection: "群聊",
1687
+ agentsSection: "智慧體",
1688
+ noPartners: "還沒有夥伴",
1689
+ noPartnersHint: "點 + 新建智慧體或群聊,或加個好友",
1690
+ inviteFriends: "邀請好友",
1691
+ noFriends: "還沒有好友",
1692
+ shareGroup: "建成共享群聊",
1693
+ shareGroupHint: "會新建一個同名的群聊,經中繼加密和你選的好友共享,群裡的智慧體一起進去;這裡的聊天記錄留在本機,不發給好友。",
1694
+ sharedMade: "已和好友共享「{name}」:好友點加入就進來。",
1695
+ addFriends: "新增好友",
1696
+ friend: "好友",
1697
+ sharedHint: "有好友時,群聊經中繼加密同步:好友點加入就進來;智慧體只回答 @ 它的訊息。",
1698
+ sharedNeedsRooms: "先把 Ta 更新到新版,才能和好友建群聊。",
1591
1699
  myDouble: "我的分身",
1592
1700
  memberCount: "{count} 位成員",
1593
- channel: "頻道",
1701
+ channel: "群聊",
1594
1702
  newAgentName: "新智慧體",
1595
1703
  notStarted: "還沒開工",
1596
1704
  editAgent: "修改名字和頭像",
@@ -1600,25 +1708,25 @@ var ZH_TW = {
1600
1708
  channelNamePlaceholder: "例如:官網改版",
1601
1709
  addAgents: "新增智慧體",
1602
1710
  searchAgents: "搜尋智慧體,選擇 1–{max} 個",
1603
- showMembers: "頻道成員",
1711
+ showMembers: "群聊成員",
1604
1712
  canAdd: "還能新增 {count} 個智慧體",
1605
1713
  findAgent: "搜尋智慧體",
1606
1714
  addCount: "新增 {count} 位",
1607
1715
  makeLead: "設為負責人",
1608
1716
  leadHint: "回答沒有 @ 任何人的訊息",
1609
- mute: "免打擾:不回答這個頻道的訊息",
1717
+ mute: "免打擾:不回答這個群聊的訊息",
1610
1718
  unmute: "取消免打擾",
1611
1719
  muted: "免打擾",
1612
1720
  replying: "正在回答…",
1613
1721
  reset: "重開會話:忘掉之前的對話",
1614
1722
  resetDone: "{name} 下次回答時會從新會話開始。",
1615
- remove: "移出頻道",
1616
- onlyMember: "頻道至少要留一位成員",
1723
+ remove: "移出群聊",
1724
+ onlyMember: "群聊至少要留一位成員",
1617
1725
  open: "開啟它的會話",
1618
- deleteChannel: "刪除頻道",
1726
+ deleteChannel: "刪除群聊",
1619
1727
  confirmDelete: "刪除 #{channel} 和它的全部訊息?",
1620
1728
  delete: "刪除",
1621
- noChannel: "開啟頻道後,這裡顯示它的成員",
1729
+ noChannel: "開啟群聊後,這裡顯示它的成員",
1622
1730
  more: "更多",
1623
1731
  stop: "停止",
1624
1732
  stoppedAgent: "已停止 {name}。",
@@ -1634,18 +1742,18 @@ var ZH_TW = {
1634
1742
  copied: "已複製 {path}",
1635
1743
  exportChat: "匯出對話(Markdown)",
1636
1744
  nothingToExport: "{name} 還沒有說過話。",
1637
- joinChannel: "加入頻道",
1638
- noChannelToJoin: "它已經在所有頻道里了",
1745
+ joinChannel: "加入群聊",
1746
+ noChannelToJoin: "它已經在所有群聊里了",
1639
1747
  joined: "{name} 已加入 #{channel}。",
1640
1748
  deleteAgent: "刪除",
1641
- confirmDeleteAgent: "刪除 {name}?它會退出所在的頻道,只剩它一個成員的頻道也會一起刪除;會話檔案會保留。",
1749
+ confirmDeleteAgent: "刪除 {name}?它會退出所在的群聊,只剩它一個成員的群聊也會一起刪除;會話檔案會保留。",
1642
1750
  pin: "置頂",
1643
1751
  unpin: "取消置頂",
1644
1752
  pinned: "已置頂",
1645
1753
  markUnread: "標為未讀",
1646
1754
  markRead: "標為已讀",
1647
1755
  editTopic: "修改主題",
1648
- topicPlaceholder: "這個頻道是做什麼的",
1756
+ topicPlaceholder: "這個群聊是做什麼的",
1649
1757
  renameChannel: "重新命名 #{channel}",
1650
1758
  stopAnswering: "停止回答",
1651
1759
  stoppedChannel: "已讓 #{channel} 里正在回答的成員停下。",
@@ -1655,16 +1763,17 @@ var ZH_TW = {
1655
1763
  building: "正在組建團隊…",
1656
1764
  openInMain: "在主區開啟",
1657
1765
  openInMainHint: "親自和團隊對話",
1658
- keepMembers: "留下團隊成員",
1659
- keptMembers: "{names} 已成為你的常駐成員。",
1660
- keep: "留為常駐成員",
1661
- kept: "{name} 已成為你的常駐成員。",
1662
- temporary: "Ta 為這個團隊臨時建立;留下後成為你的常駐成員",
1766
+ keepMembers: "把成員存成智慧體",
1767
+ keptMembers: "{names} 已存成智慧體:在夥伴的智慧體裡,可以和它對話、拉進群聊。",
1768
+ keep: "存成智慧體",
1769
+ kept: "{name} 已存成智慧體:在夥伴的智慧體裡,可以和它對話、拉進群聊。",
1770
+ temporary: "Ta 為這個任務臨時建立的;存下後在夥伴的智慧體裡",
1663
1771
  temporaryTag: "臨時",
1664
1772
  tasks: "任務",
1773
+ decideSection: "待你決定",
1665
1774
  membersSection: "成員",
1666
1775
  byDirectory: "按目錄分組",
1667
- channelsSection: "頻道",
1776
+ channelsSection: "群聊",
1668
1777
  showAll: "顯示全部 {count} 個",
1669
1778
  showFewer: "收起",
1670
1779
  waitingCount: "{count} 個待你處理",
@@ -1676,12 +1785,12 @@ var ZH_TW = {
1676
1785
  deleteTaskHint: "#{channel} 的訊息會一起刪除,團隊成員會留在你的成員裡。",
1677
1786
  selectTasks: "多選",
1678
1787
  toolCreateAgent: "新建智慧體",
1679
- toolCreateChannel: "新建頻道",
1680
- toolAddToChannel: "拉進頻道",
1681
- toolPostToChannel: "發到頻道",
1788
+ toolCreateChannel: "新建群聊",
1789
+ toolAddToChannel: "拉進群聊",
1790
+ toolPostToChannel: "發到群聊",
1682
1791
  toolHandOff: "交給",
1683
1792
  handOff: "交給…",
1684
- handOffDetail: "讓智慧體或頻道接著做",
1793
+ handOffDetail: "讓智慧體或群聊接著做",
1685
1794
  handedTo: "已交給 {to}",
1686
1795
  handOffOpen: "開啟",
1687
1796
  toolListChannels: "檢視團隊",
@@ -1698,7 +1807,7 @@ var ZH_TW = {
1698
1807
 
1699
1808
  ### 待辦
1700
1809
  - [ ] `,
1701
- noticeHint: "這個頻道定下的事、約定和待辦:每個成員每次回答都會讀到並照著做,討論定下新的事時成員會自己更新。",
1810
+ noticeHint: "這個群聊定下的事、約定和待辦:每個成員每次回答都會讀到並照著做,討論定下新的事時成員會自己更新。",
1702
1811
  noticeUpdated: "{name} 更新了公告",
1703
1812
  noticeCleared: "{name} 撤下了公告",
1704
1813
  noticeShow: "展開公告",
@@ -1709,13 +1818,9 @@ var ZH_TW = {
1709
1818
  shareCard: "分享名片…",
1710
1819
  cardTitle: "{name} 的名片",
1711
1820
  cardKind: "智慧體名片",
1712
- cardMaking: "正在生成連結…",
1713
- cardHint: "對方在 Ta 裡掃碼或貼上連結,就能把它加為自己的智慧體,加進來時它會先按對方的專案調整職責。只帶上職責(隱去疑似金鑰),不帶工作目錄和對話。連結 30 天內有效,你的電腦關機也能開啟。",
1821
+ cardGets: "對方把它加為自己的智慧體,並按自己的專案調整職責",
1822
+ cardHint: "只帶上職責(隱去疑似金鑰),不帶工作目錄和對話。連結 30 天內有效,你的電腦關機也能開啟。",
1714
1823
  cardRedacted: "職責裡有 {n} 處疑似金鑰已隱去。",
1715
- copyLink: "複製連結",
1716
- linkCopied: "已複製",
1717
- sendLink: "傳送",
1718
- stopCard: "停止分享",
1719
1824
  cardStopped: "名片連結已失效。",
1720
1825
  cardOpening: "正在開啟名片…",
1721
1826
  cardAddTo: "工作目錄:{dir}",
@@ -1726,190 +1831,204 @@ var ZH_TW = {
1726
1831
  cardOpen: "開啟對話",
1727
1832
  cardFailed: "打不開這張名片:{message}"
1728
1833
  };
1729
- var JA = {
1730
- title: "分身",
1731
- channels: "チャンネル",
1732
- agents: "エージェント",
1733
- newChannel: "新しいチャンネル",
1734
- newAgent: "新しいエージェント",
1735
- scan: "スキャン",
1736
- name: "名前",
1737
- role: "役割",
1738
- rolePlaceholder: "それが何をするか、どのように行うか、それへの指示として記述",
1739
- topic: "トピック",
1740
- members: "メンバー",
1741
- addMembers: "メンバーを追加",
1742
- makeExtension: "拡張機能にする",
1743
- makeExtensionDetail: "ここで作成されたものを工具にする",
1744
- makeExtensionAsk: "このチャンネルで作成された事項を拡張機能にする(ta-package スキルで)、将来は 1 クリックで再利用可能",
1745
- add: "追加",
1746
- allMembers: "すべてのエージェントがこのチャンネルに既に含まれています",
1747
- membersHint: "最初に選択したメンバーがリーダー:誰も @ で指定されていないメッセージに答えます。",
1748
- create: "作成",
1749
- cancel: "キャンセル",
1750
- back: "戻る",
1751
- send: "送信",
1752
- you: "あなた",
1753
- owner: "オーナー",
1834
+
1835
+ // web-src/i18n.ts
1836
+ var EN = {
1837
+ title: "Double",
1838
+ channels: "Group chats",
1839
+ agents: "Agents",
1840
+ newChannel: "New group chat",
1841
+ newAgent: "New agent",
1842
+ scan: "Scan",
1843
+ addFriend: "Add friend",
1844
+ name: "Name",
1845
+ role: "Role",
1846
+ rolePlaceholder: "What it does and how, as instructions to it",
1847
+ topic: "Topic",
1848
+ members: "Members",
1849
+ addMembers: "Add members",
1850
+ makeExtension: "Make an extension",
1851
+ makeExtensionDetail: "Of what was worked out here",
1852
+ makeExtensionAsk: "Make what this group chat worked out an extension, with the ta-package skill, to do it again in a click",
1853
+ add: "Add",
1854
+ allMembers: "Every agent is in this group chat already",
1855
+ membersHint: "The first one you pick leads: it answers what names nobody.",
1856
+ create: "Create",
1857
+ cancel: "Cancel",
1858
+ back: "Back",
1859
+ send: "Send",
1860
+ you: "You",
1861
+ owner: "Owner",
1754
1862
  ta: "Ta",
1755
- lead: "リーダー",
1756
- empty: "まだチャンネルがありません",
1757
- emptyHint: "Ta にチームを組ませるか、+ をクリックして作成",
1758
- noAgents: "まだエージェントがありません",
1759
- noAgentsHint: "チャンネルはエージェントで構成されます:最初に 1 つ作成",
1760
- pick: "チャンネルを選択",
1761
- quiet: "まだメッセージがありません。@ でメンバーを指定するか、リーダーが回答します。",
1762
- placeholder: "{channel} に送信;@ でメンバーを指定",
1763
- answering: "{name} が回答中",
1764
- failed: "回答がありません",
1765
- mention: "@{name}",
1766
- stopped: "ラウンドの制限に達しました;あなたの番です。",
1767
- search: "検索",
1768
- clear: "クリア",
1769
- new: "新規",
1770
- answeringIn: "#{channel} で回答中",
1771
- answeringNow: "{name} が回答中…",
1772
- noMatch: "一致するエージェントまたはチャンネルがありません",
1773
- noMessages: "まだメッセージがありません",
1774
- noAgentsYet: "まだエージェントがありません",
1775
- noAgentsYetHint: "+ で作成するか、Ta にチームを組ませて",
1776
- myDouble: "私の分身",
1777
- memberCount: "{count} 人のメンバー",
1778
- channel: "チャンネル",
1779
- newAgentName: "新しいエージェント",
1780
- notStarted: "まだ開始されていません",
1781
- editAgent: "名前とアバターを変更",
1782
- avatar: "アバター",
1783
- newAgentHint: "上記で名前を付け、アバターを選択してから、最初に何をするかを指示:最初のメッセージがそれを作成します。",
1784
- agentPlaceholder: "{name} にメッセージを送信",
1785
- channelNamePlaceholder: "例:Project Falcon",
1786
- addAgents: "エージェントを追加",
1787
- searchAgents: "エージェントを検索、1 ~ {max} 件を選択",
1788
- showMembers: "メンバー",
1789
- canAdd: "{count} 個のエージェントを追加できます",
1790
- findAgent: "エージェントを検索",
1791
- addCount: "{count} 人を追加",
1792
- makeLead: "リーダーに設定",
1793
- leadHint: "誰も指定されていないメッセージに回答します",
1794
- mute: "ミュート:このチャンネルのメッセージに答えません",
1795
- unmute: "もう一度回答させる",
1796
- muted: "ミュート中",
1797
- replying: "回答中…",
1798
- reset: "新しいセッション:それが言われたことを忘れます",
1799
- resetDone: "{name} は次に回答するときに新しいセッションから始まります。",
1800
- remove: "チャンネルから削除",
1801
- onlyMember: "チャンネルには最低 1 人のメンバーを保つ必要があります",
1802
- open: "そのセッションを開く",
1803
- deleteChannel: "チャンネルを削除",
1804
- confirmDelete: "#{channel} とそのすべてのメッセージを削除しますか?",
1805
- delete: "削除",
1806
- noChannel: "チャンネルを開いてそのメンバーを確認",
1807
- more: "その他",
1808
- stop: "停止",
1809
- stoppedAgent: "{name} を停止しました。",
1810
- restart: "再開",
1811
- restartHint: "新しいセッション:それが言われたことを忘れます",
1812
- rename: "名前変更",
1813
- editRole: "役割",
1814
- roleHint: "それが最初に読む指示:それが誰であるか、どのように働くか。次のセッションから有効になります;今すぐ有効にするには再開してください。",
1815
- save: "保存",
1816
- moveTo: "移動先…",
1817
- moveHint: "別のディレクトリで機能し、そこで新しいセッションを開きます",
1818
- copyCwd: "ディレクトリをコピー",
1819
- copied: "{path} をコピーしました",
1820
- exportChat: "会話をエクスポート(Markdown)",
1821
- nothingToExport: "{name} はまだ何も言っていません。",
1822
- joinChannel: "チャンネルに追加",
1823
- noChannelToJoin: "すべてのチャンネルに既に含まれています",
1824
- joined: "{name} が #{channel} に参加しました。",
1825
- deleteAgent: "削除",
1826
- confirmDeleteAgent: "{name} を削除しますか?それはそのチャンネルから削除され、それだけのチャンネルも削除されます;セッションファイルは保持されます。",
1827
- pin: "ピン留め",
1828
- unpin: "ピン留めを解除",
1829
- pinned: "ピン留めされています",
1830
- markUnread: "未読にマーク",
1831
- markRead: "既読にマーク",
1832
- editTopic: "トピックを編集",
1833
- topicPlaceholder: "このチャンネルの目的",
1834
- renameChannel: "#{channel} の名前を変更",
1835
- stopAnswering: "回答を停止",
1836
- stoppedChannel: "#{channel} で回答中のメンバーを停止しました。",
1837
- noMessagesToExport: "#{channel} にはまだメッセージがありません。",
1838
- yourTurn: "あなたの番",
1839
- needsYou: "あなたを待っています",
1840
- building: "チームを構築中…",
1841
- openInMain: "メイン領域で開く",
1842
- openInMainHint: "チーム自体と話す",
1843
- keepMembers: "チームメンバーを保持",
1844
- keptMembers: "{names} はあなたの常駐メンバーになりました。",
1845
- keep: "常駐メンバーとして保持",
1846
- kept: "{name} はあなたの常駐メンバーになりました。",
1847
- temporary: "Ta がこのチーム向けに一時的に作成;保持するとあなたの常駐メンバーになります",
1848
- temporaryTag: "一時的",
1849
- tasks: "タスク",
1850
- membersSection: "メンバー",
1851
- byDirectory: "ディレクトリでグループ化",
1852
- channelsSection: "チャンネル",
1853
- showAll: "全 {count} 件を表示",
1854
- showFewer: "表示を減らす",
1855
- waitingCount: "{count} 件があなたを待っています",
1856
- runningCount: "{count} 件実行中",
1857
- freshCount: "{count} 件の新規",
1858
- standingBy: "スタンバイ中",
1859
- noTasksHere: "分身が交付したタスクとチームはここにリストされます",
1860
- deleteTask: "チームを削除",
1861
- deleteTaskHint: "#{channel} のメッセージは削除されます。チームメンバーはあなたのメンバーに留まります。",
1862
- selectTasks: "選択",
1863
- toolCreateAgent: "エージェントを作成",
1864
- toolCreateChannel: "チャンネルを作成",
1865
- toolAddToChannel: "チャンネルに追加",
1866
- toolPostToChannel: "投稿",
1867
- toolHandOff: "ハンドオフ",
1868
- handOff: "ハンドオフ先…",
1869
- handOffDetail: "エージェントまたはチャンネルが続ける",
1870
- handedTo: "{to} にハンドオフされました",
1871
- handOffOpen: "開く",
1872
- toolListChannels: "チームを表示",
1873
- notice: "お知らせ",
1874
- noticeCounts: "決定 {decisions} · 合意 {conventions} · 対応 {todo}",
1875
- noticeEmpty: "まだお知らせがありません",
1876
- noticeBy: "{name} が {time} に更新",
1877
- noticeEdit: "お知らせを編集",
1878
- noticeTemplate: `### 決定
1863
+ lead: "Lead",
1864
+ empty: "No group chats yet",
1865
+ emptyHint: "Ask Ta for a team, or create one with +",
1866
+ noAgents: "No agents yet",
1867
+ noAgentsHint: "A group chat is made of agents: create one first",
1868
+ pick: "Pick a group chat",
1869
+ quiet: "Nothing said yet. Mention a member with @, or the lead answers.",
1870
+ placeholder: "Message {channel}; @ names a member",
1871
+ answering: "{name} is answering",
1872
+ failed: "did not answer",
1873
+ mention: "Mention {name}",
1874
+ stopped: "The agents stopped at the limit of a round; it is your turn.",
1875
+ search: "Search",
1876
+ clear: "Clear",
1877
+ new: "New",
1878
+ answeringIn: "Answering in #{channel}",
1879
+ answeringNow: "{name} is answering…",
1880
+ noMatch: "No matching agents or group chats",
1881
+ noMessages: "No messages yet",
1882
+ noAgentsYet: "No agents yet",
1883
+ noAgentsYetHint: "Create one with +, or ask Ta for a team",
1884
+ partners: "Partners",
1885
+ groupsSection: "Group chats",
1886
+ agentsSection: "Agents",
1887
+ noPartners: "No one to work with yet",
1888
+ noPartnersHint: "Create an agent or a group chat with +, or add a friend",
1889
+ inviteFriends: "Invite friends",
1890
+ noFriends: "No friends yet",
1891
+ shareGroup: "Make it shared",
1892
+ shareGroupHint: "A group chat of the same name is made, shared with the friends you pick through the relay, sealed; its agents go in too. What was said here stays on this computer.",
1893
+ sharedMade: "“{name}” is shared with your friends now: they are in once they join.",
1894
+ addFriends: "Add friends",
1895
+ friend: "Friend",
1896
+ sharedHint: "With friends, the group chat is shared through the relay, sealed: they are in once they join, and agents answer only who names them with @.",
1897
+ sharedNeedsRooms: "Update Ta to make a group chat with friends.",
1898
+ myDouble: "My double",
1899
+ memberCount: "{count} members",
1900
+ channel: "Group chat",
1901
+ newAgentName: "new-agent",
1902
+ notStarted: "Not started yet",
1903
+ editAgent: "Change the name and the avatar",
1904
+ avatar: "Avatar",
1905
+ newAgentHint: "Pick a name and an avatar above, then tell it what to do first: your first message makes it.",
1906
+ agentPlaceholder: "Message {name}",
1907
+ channelNamePlaceholder: "For example: Project Falcon",
1908
+ addAgents: "Add agents",
1909
+ searchAgents: "Search agents, pick 1 to {max}",
1910
+ showMembers: "Members",
1911
+ canAdd: "{count} agents can join",
1912
+ findAgent: "Search agents",
1913
+ addCount: "Add {count}",
1914
+ makeLead: "Make lead",
1915
+ leadHint: "Answers what names nobody",
1916
+ mute: "Mute: answers nothing here",
1917
+ unmute: "Let it answer again",
1918
+ muted: "Muted",
1919
+ replying: "Answering…",
1920
+ reset: "New session: it forgets what it was told",
1921
+ resetDone: "{name} starts a new session the next time it answers.",
1922
+ remove: "Remove from the group chat",
1923
+ onlyMember: "A group chat keeps at least one member",
1924
+ open: "Open its session",
1925
+ deleteChannel: "Delete group chat",
1926
+ confirmDelete: "Delete #{channel} and its messages?",
1927
+ delete: "Delete",
1928
+ noChannel: "Open a group chat to see its members",
1929
+ more: "More",
1930
+ stop: "Stop",
1931
+ stoppedAgent: "Stopped {name}.",
1932
+ restart: "Restart",
1933
+ restartHint: "A new session: it forgets what it was told",
1934
+ rename: "Rename",
1935
+ editRole: "Role",
1936
+ roleHint: "What it reads first, before anything else: who it is and how it works. It takes effect from its next session; Restart to use it now.",
1937
+ save: "Save",
1938
+ moveTo: "Move to…",
1939
+ moveHint: "Works in another directory, in a new session there",
1940
+ copyCwd: "Copy directory",
1941
+ copied: "Copied {path}",
1942
+ exportChat: "Export conversation (Markdown)",
1943
+ nothingToExport: "{name} has said nothing yet.",
1944
+ joinChannel: "Add to group chat",
1945
+ noChannelToJoin: "It is in every group chat already",
1946
+ joined: "{name} joined #{channel}.",
1947
+ deleteAgent: "Delete",
1948
+ confirmDeleteAgent: "Delete {name}? It leaves its group chats, and group chats with no one else go too; its session file stays.",
1949
+ pin: "Pin",
1950
+ unpin: "Unpin",
1951
+ pinned: "Pinned",
1952
+ markUnread: "Mark as unread",
1953
+ markRead: "Mark as read",
1954
+ editTopic: "Topic",
1955
+ topicPlaceholder: "What the group chat is for",
1956
+ renameChannel: "Rename #{channel}",
1957
+ stopAnswering: "Stop answering",
1958
+ stoppedChannel: "Stopped the members answering in #{channel}.",
1959
+ noMessagesToExport: "#{channel} has no messages yet.",
1960
+ yourTurn: "Your turn",
1961
+ needsYou: "Waiting for you",
1962
+ building: "Building the team…",
1963
+ openInMain: "Open in the main area",
1964
+ openInMainHint: "Talk to the team yourself",
1965
+ keepMembers: "Save its agents",
1966
+ keptMembers: "{names} saved: under Agents in Partners, to talk to or add to a group.",
1967
+ keep: "Save as an agent",
1968
+ kept: "{name} saved: under Agents in Partners, to talk to or add to a group.",
1969
+ temporary: "Made by Ta for this task; save it to have it under Agents in Partners",
1970
+ temporaryTag: "Temporary",
1971
+ tasks: "Tasks",
1972
+ decideSection: "Waiting for you",
1973
+ membersSection: "Members",
1974
+ byDirectory: "Group by directory",
1975
+ channelsSection: "Group chats",
1976
+ showAll: "Show all {count}",
1977
+ showFewer: "Show fewer",
1978
+ waitingCount: "{count} need you",
1979
+ runningCount: "{count} running",
1980
+ freshCount: "{count} new",
1981
+ standingBy: "Standing by",
1982
+ noTasksHere: "What the double hands out, tasks and teams, is listed here",
1983
+ deleteTask: "Delete the team",
1984
+ deleteTaskHint: "The messages of #{channel} go with it. Its agents stay, among your members.",
1985
+ selectTasks: "Select",
1986
+ toolCreateAgent: "Create agent",
1987
+ toolCreateChannel: "Create group chat",
1988
+ toolAddToChannel: "Add to group chat",
1989
+ toolPostToChannel: "Post to",
1990
+ toolHandOff: "Hand over to",
1991
+ handOff: "Hand over to…",
1992
+ handOffDetail: "An agent or a group chat goes on with it",
1993
+ handedTo: "Handed over to {to}",
1994
+ handOffOpen: "Open",
1995
+ toolListChannels: "Look over the team",
1996
+ notice: "Notice",
1997
+ noticeCounts: "{decisions} decided · {conventions} agreed · {todo} to do",
1998
+ noticeEmpty: "No notice yet",
1999
+ noticeBy: "{name} updated it {time}",
2000
+ noticeEdit: "Edit the notice",
2001
+ noticeTemplate: `### Decisions
1879
2002
  -
1880
2003
 
1881
- ### 合意
2004
+ ### Conventions
1882
2005
  -
1883
2006
 
1884
- ### 対応
2007
+ ### To do
1885
2008
  - [ ] `,
1886
- noticeHint: "このチャンネルが決定した事項、合意、対応:各メンバーはメッセージの度に読んで従います。。メンバーは話し合いで決まったことを自分で更新します。",
1887
- noticeUpdated: "{name} がお知らせを更新しました",
1888
- noticeCleared: "{name} がお知らせを削除しました",
1889
- noticeShow: "お知らせを表示",
1890
- noticeHide: "お知らせを非表示",
1891
- noticeSaved: "お知らせが保存されました",
1892
- toolNotice: "お知らせを更新",
1893
- toolRole: "役割を更新",
1894
- shareCard: "カードを共有…",
1895
- cardTitle: "{name} のカード",
1896
- cardKind: "エージェントカード",
1897
- cardMaking: "リンクを生成中…",
1898
- cardHint: "Ta でスキャンまたはリンクを貼り付けると、それを自分のエージェントとして追加でき、追加時に役割をプロジェクトに合わせます。役割のみ(秘密のように見えるものは除去)、ディレクトリと会話は含まれません。リンクは 30 日間有効です。このコンピューターがオフでも開けます。",
1899
- cardRedacted: "役割に {n} 箇所の秘密のように見えるものが除去されました。",
1900
- copyLink: "リンクをコピー",
1901
- linkCopied: "コピーしました",
1902
- sendLink: "送信",
1903
- stopCard: "共有を停止",
1904
- cardStopped: "カードのリンクは機能しなくなりました。",
1905
- cardOpening: "カードを開いています…",
1906
- cardAddTo: "作業ディレクトリ:{dir}",
1907
- cardChangeDir: "変更",
1908
- cardAdd: "エージェントとして追加",
1909
- cardAddHint: "追加後、このディレクトリ下のプロジェクトを確認し、役割をここに合わせます;変更内容はセッションで通知します。",
1910
- cardAdded: "@{name} として追加されました",
1911
- cardOpen: "会話を開く",
1912
- cardFailed: "このカードを開けません:{message}"
2009
+ noticeHint: "What this channel decided, agreed and is to do: every member reads it with each message and follows it. Members keep it up to date as the talk settles things.",
2010
+ noticeUpdated: "{name} updated the notice",
2011
+ noticeCleared: "{name} took the notice down",
2012
+ noticeShow: "Show the notice",
2013
+ noticeHide: "Hide the notice",
2014
+ noticeSaved: "Notice saved",
2015
+ toolNotice: "Update the notice",
2016
+ toolRole: "Update its role",
2017
+ shareCard: "Share card…",
2018
+ cardTitle: "{name}'s card",
2019
+ cardKind: "An agent's card",
2020
+ cardGets: "They add it as an agent of their own, fitted to their project",
2021
+ cardHint: "Only its role goes, secrets taken out; not its directory nor its conversation. The link works for 30 days, while this computer is off too.",
2022
+ cardRedacted: "{n} places that looked like secrets were taken out.",
2023
+ cardStopped: "The link of the card no longer works.",
2024
+ cardOpening: "Opening the card…",
2025
+ cardAddTo: "Works in {dir}",
2026
+ cardChangeDir: "Change",
2027
+ cardAdd: "Add as my agent",
2028
+ cardAddHint: "It looks at the project there first and fits its role to it; you see what it changed in its conversation.",
2029
+ cardAdded: "Added as @{name}",
2030
+ cardOpen: "Open the conversation",
2031
+ cardFailed: "Could not open the card: {message}"
1913
2032
  };
1914
2033
  var WORDS = { "zh-CN": ZH, "zh-TW": ZH_TW, "en-US": EN, "ja-JP": JA };
1915
2034
  var ChannelWords;
@@ -2058,6 +2177,18 @@ function useServerCwd(pi) {
2058
2177
  }
2059
2178
  var SidebarUtil;
2060
2179
  ((SidebarUtil) => {
2180
+ function place(item) {
2181
+ return item.place ?? (item.section ? "partners" : "double");
2182
+ }
2183
+ SidebarUtil.place = place;
2184
+ function channelAt(channel, messages) {
2185
+ return messages?.at(-1)?.at ?? channel.createdAt;
2186
+ }
2187
+ SidebarUtil.channelAt = channelAt;
2188
+ function byTime(entries, sorted) {
2189
+ return sorted ? [...entries].sort((a, b) => Number(b.pinned) - Number(a.pinned) || b.at - a.at) : entries;
2190
+ }
2191
+ SidebarUtil.byTime = byTime;
2061
2192
  function homeSections(items) {
2062
2193
  const sections = new Map;
2063
2194
  for (const item of items) {
@@ -2199,8 +2330,8 @@ var SidebarUtil;
2199
2330
  const latest = (a, b) => b.startedAt - a.startedAt;
2200
2331
  return {
2201
2332
  waiting: tasks.filter((task) => task.status === "waiting").sort(latest),
2202
- running: tasks.filter((task) => task.status === "running").sort(latest),
2203
- ended: tasks.filter((task) => task.status !== "waiting" && task.status !== "running").sort((a, b) => (b.endedAt ?? b.startedAt) - (a.endedAt ?? a.startedAt))
2333
+ running: tasks.filter((task) => task.status === "running" || task.status === "idle").sort(latest),
2334
+ ended: tasks.filter((task) => task.status !== "waiting" && task.status !== "running" && task.status !== "idle").sort((a, b) => (b.endedAt ?? b.startedAt) - (a.endedAt ?? a.startedAt))
2204
2335
  };
2205
2336
  }
2206
2337
  SidebarUtil.taskGroups = taskGroups;
@@ -2282,8 +2413,6 @@ function CardDialog({ context, agent, onClose }) {
2282
2413
  const w = ChannelViews.words(pi);
2283
2414
  const [share, setShare] = React.useState();
2284
2415
  const [error, setError] = React.useState();
2285
- const [copied, setCopied] = React.useState(false);
2286
- const [stopping, setStopping] = React.useState(false);
2287
2416
  const card = React.useMemo(() => AgentCards.card(agent), [agent]);
2288
2417
  React.useEffect(() => {
2289
2418
  let live = true;
@@ -2292,74 +2421,33 @@ function CardDialog({ context, agent, onClose }) {
2292
2421
  live = false;
2293
2422
  };
2294
2423
  }, [service, agent]);
2295
- const Copy = ChannelViews.icon(pi, copied ? "Check" : "Copy");
2296
- const Send = ChannelViews.icon(pi, "Share2");
2297
- const canSend = typeof navigator !== "undefined" && typeof navigator.share === "function";
2298
- const copy = () => share && void navigator.clipboard?.writeText(share.link).then(() => setCopied(true));
2299
- const stop = () => {
2300
- setStopping(true);
2301
- service.stopCard(agent.id).then(() => {
2302
- pi.ui.notify(w.cardStopped, "info");
2303
- onClose();
2304
- }, (failure) => {
2305
- setStopping(false);
2306
- setError(ChannelViews.message(failure));
2307
- });
2308
- };
2309
- return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
2424
+ return /* @__PURE__ */ React.createElement(ShareSheetCompat, {
2425
+ pi,
2310
2426
  title: ChannelWords.format(w.cardTitle, { name: agent.name }),
2427
+ link: share?.link,
2428
+ error,
2429
+ face: card.face !== undefined ? /* @__PURE__ */ React.createElement(Face, {
2430
+ face: card.face,
2431
+ size: 44
2432
+ }) : /* @__PURE__ */ React.createElement("span", {
2433
+ className: "tac-card-mark"
2434
+ }, card.mark),
2435
+ name: `@${card.name}`,
2436
+ gets: w.cardGets,
2437
+ notes: [card.redacted ? ChannelWords.format(w.cardRedacted, { n: String(card.redacted) }) : undefined, w.cardHint],
2438
+ onStop: async () => {
2439
+ await service.stopCard(agent.id);
2440
+ pi.ui.notify(w.cardStopped, "info");
2441
+ },
2311
2442
  onClose
2312
2443
  }, /* @__PURE__ */ React.createElement("div", {
2313
- className: "tac-dialog tac-card"
2314
- }, /* @__PURE__ */ React.createElement(CardFace, {
2315
- pi,
2316
- card
2317
- }), /* @__PURE__ */ React.createElement("div", {
2318
2444
  className: "tac-card-role"
2319
- }, card.role), card.redacted ? /* @__PURE__ */ React.createElement("p", {
2320
- className: "tac-dialog-note"
2321
- }, ChannelWords.format(w.cardRedacted, { n: String(card.redacted) })) : null, share ? /* @__PURE__ */ React.createElement(React.Fragment, null, pi.ui.QrCode && /* @__PURE__ */ React.createElement("div", {
2322
- className: "tac-card-qr"
2323
- }, /* @__PURE__ */ React.createElement(pi.ui.QrCode, {
2324
- text: share.link,
2325
- label: share.title
2326
- })), /* @__PURE__ */ React.createElement("div", {
2327
- className: "tac-card-link",
2328
- title: share.link
2329
- }, share.link), /* @__PURE__ */ React.createElement("div", {
2330
- className: "tac-card-actions"
2331
- }, /* @__PURE__ */ React.createElement("button", {
2332
- type: "button",
2333
- className: "tac-button tac-primary",
2334
- onClick: copy
2335
- }, /* @__PURE__ */ React.createElement(Copy, {
2336
- size: 14
2337
- }), copied ? w.linkCopied : w.copyLink), canSend && /* @__PURE__ */ React.createElement("button", {
2338
- type: "button",
2339
- className: "tac-button",
2340
- onClick: () => void navigator.share({ title: share.title, url: share.link }).catch(() => {
2341
- return;
2342
- })
2343
- }, /* @__PURE__ */ React.createElement(Send, {
2344
- size: 14
2345
- }), w.sendLink)), /* @__PURE__ */ React.createElement("p", {
2346
- className: "tac-dialog-note"
2347
- }, w.cardHint), /* @__PURE__ */ React.createElement("button", {
2348
- type: "button",
2349
- className: "tac-card-stop",
2350
- disabled: stopping,
2351
- onClick: stop
2352
- }, w.stopCard)) : error ? /* @__PURE__ */ React.createElement("div", {
2353
- className: "tac-error"
2354
- }, error) : /* @__PURE__ */ React.createElement("div", {
2355
- className: "tac-card-making"
2356
- }, /* @__PURE__ */ React.createElement("span", {
2357
- className: "ta-spinner"
2358
- }), w.cardMaking)));
2445
+ }, card.role));
2359
2446
  }
2360
2447
  function CardView({ context, link }) {
2361
2448
  const { pi, service } = context;
2362
2449
  const w = ChannelViews.words(pi);
2450
+ const Loading = pi.ui.Loading ?? pi.ui.Skeleton;
2363
2451
  const serverCwd = useServerCwd(pi);
2364
2452
  const [card, setCard] = React.useState();
2365
2453
  const [error, setError] = React.useState();
@@ -2394,11 +2482,9 @@ function CardView({ context, link }) {
2394
2482
  className: "tac-card-page"
2395
2483
  }, error ? /* @__PURE__ */ React.createElement(pi.ui.Empty, {
2396
2484
  title: ChannelWords.format(w.cardFailed, { message: error })
2397
- }) : /* @__PURE__ */ React.createElement("div", {
2398
- className: "tac-card-making"
2399
- }, /* @__PURE__ */ React.createElement("span", {
2400
- className: "ta-spinner"
2401
- }), w.cardOpening));
2485
+ }) : /* @__PURE__ */ React.createElement(Loading, {
2486
+ label: w.cardOpening
2487
+ }));
2402
2488
  }
2403
2489
  const Folder = ChannelViews.icon(pi, "Folder");
2404
2490
  return /* @__PURE__ */ React.createElement("div", {
@@ -2628,7 +2714,119 @@ class ChannelsClient {
2628
2714
  }
2629
2715
  }
2630
2716
 
2717
+ // web-src/shared-group.tsx
2718
+ function useFriends(pi) {
2719
+ const [friends, setFriends] = React.useState([]);
2720
+ React.useEffect(() => {
2721
+ let live = true;
2722
+ pi.rooms?.listFriends().then((list) => live && setFriends(list.filter((friend) => friend.status === "friend")), () => {
2723
+ return;
2724
+ });
2725
+ return () => {
2726
+ live = false;
2727
+ };
2728
+ }, [pi]);
2729
+ return friends;
2730
+ }
2731
+ async function createShared(context, title, friends, agents) {
2732
+ const { pi } = context;
2733
+ const rooms = pi.rooms;
2734
+ if (!rooms) {
2735
+ throw new Error(ChannelViews.words(pi).sharedNeedsRooms);
2736
+ }
2737
+ const room = await rooms.createRoom({ kind: ROOMS_KIND, title });
2738
+ await rooms.inviteFriends(room.id, friends);
2739
+ for (const agent of agents) {
2740
+ await pi.packages.callPackageHost(ROOMS_PACKAGE, "doubles", [{ kind: "invite", room: room.id, agent }]).catch((error) => {
2741
+ pi.ui.notify(ChannelViews.message(error), "error");
2742
+ });
2743
+ }
2744
+ const { link } = await rooms.invite(room.id);
2745
+ await pi.openLink?.(link);
2746
+ }
2747
+ var ROOMS_PACKAGE = "@celljs/ta-rooms";
2748
+ var ROOMS_KIND = "ta-rooms";
2749
+ function ShareDialog({ context, channel, onClose }) {
2750
+ const { pi } = context;
2751
+ const w = ChannelViews.words(pi);
2752
+ const friends = useFriends(pi);
2753
+ const Check = ChannelViews.icon(pi, "Check");
2754
+ const [picked, setPicked] = React.useState([]);
2755
+ const [busy, setBusy] = React.useState(false);
2756
+ const [error, setError] = React.useState();
2757
+ const toggle = (friend) => setPicked(picked.includes(friend.id) ? picked.filter((id) => id !== friend.id) : [...picked, friend.id]);
2758
+ const share = () => {
2759
+ setBusy(true);
2760
+ setError(undefined);
2761
+ createShared(context, channel.name, picked, channel.members).then(() => {
2762
+ onClose();
2763
+ pi.ui.notify(ChannelWords.format(w.sharedMade, { name: channel.name }), "info");
2764
+ }, (failure) => {
2765
+ setBusy(false);
2766
+ setError(ChannelViews.message(failure));
2767
+ });
2768
+ };
2769
+ return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
2770
+ title: w.inviteFriends,
2771
+ onClose
2772
+ }, /* @__PURE__ */ React.createElement("div", {
2773
+ className: "tac-dialog"
2774
+ }, /* @__PURE__ */ React.createElement("div", {
2775
+ className: "tac-dialog-note"
2776
+ }, w.shareGroupHint), /* @__PURE__ */ React.createElement("div", {
2777
+ className: "tac-pick-list"
2778
+ }, friends.length === 0 && /* @__PURE__ */ React.createElement(pi.ui.Empty, {
2779
+ compact: true,
2780
+ title: w.noFriends
2781
+ }), friends.map((friend) => {
2782
+ const on = picked.includes(friend.id);
2783
+ return /* @__PURE__ */ React.createElement("button", {
2784
+ key: friend.id,
2785
+ type: "button",
2786
+ "aria-pressed": on,
2787
+ className: `tac-pick${on ? " tac-on" : ""}`,
2788
+ onClick: () => toggle(friend)
2789
+ }, /* @__PURE__ */ React.createElement("span", {
2790
+ className: "tac-check"
2791
+ }, on && /* @__PURE__ */ React.createElement(Check, {
2792
+ size: 13,
2793
+ strokeWidth: 3
2794
+ })), pi.ui.Face ? /* @__PURE__ */ React.createElement(pi.ui.Face, {
2795
+ seed: friend.id,
2796
+ size: 30,
2797
+ look: friend.look
2798
+ }) : /* @__PURE__ */ React.createElement("span", {
2799
+ className: "tac-pick-face"
2800
+ }), /* @__PURE__ */ React.createElement("span", {
2801
+ className: "tac-pick-text"
2802
+ }, /* @__PURE__ */ React.createElement("span", {
2803
+ className: "tac-pick-name"
2804
+ }, friend.name), /* @__PURE__ */ React.createElement("span", {
2805
+ className: "tac-pick-role"
2806
+ }, w.friend)));
2807
+ })), error && /* @__PURE__ */ React.createElement("div", {
2808
+ className: "tac-empty tac-error"
2809
+ }, error), /* @__PURE__ */ React.createElement("div", {
2810
+ className: "tac-dialog-actions"
2811
+ }, /* @__PURE__ */ React.createElement("button", {
2812
+ type: "button",
2813
+ className: busy ? "tac-button tac-primary ta-busy" : "tac-button tac-primary",
2814
+ disabled: busy || picked.length === 0,
2815
+ onClick: share
2816
+ }, w.shareGroup, busy && /* @__PURE__ */ React.createElement("span", {
2817
+ className: "ta-spinner ta-busy-mark ta-on-brand"
2818
+ })))));
2819
+ }
2820
+ function openShareGroup(context, channel) {
2821
+ context.pi.ui.custom?.(({ close }) => /* @__PURE__ */ React.createElement(ShareDialog, {
2822
+ context,
2823
+ channel,
2824
+ onClose: close
2825
+ }));
2826
+ }
2827
+
2631
2828
  // web-src/create.tsx
2829
+ var noBack = (_open, _close) => false;
2632
2830
  var AGENT_PAGE = `${NAME}/agent`;
2633
2831
  function newAgent(context) {
2634
2832
  const { pi, service, ui } = context;
@@ -2646,6 +2844,7 @@ function Identity({ context, onClose }) {
2646
2844
  const ref = React.useRef(null);
2647
2845
  const name = React.useRef(null);
2648
2846
  React.useEffect(() => name.current?.select(), []);
2847
+ (pi.ui.useBackLayer ?? noBack)(true, onClose);
2649
2848
  React.useEffect(() => {
2650
2849
  const close = (event) => {
2651
2850
  const target = event.target;
@@ -2785,7 +2984,8 @@ function NewAgentPage({ context }) {
2785
2984
  placeholder: ChannelWords.format(w.agentPlaceholder, { name: draft.name || w.newAgentName }),
2786
2985
  onSend: send,
2787
2986
  cwd: draft.cwd,
2788
- onPickCwd: (cwd) => ui.set({ draft: { ...draft, cwd } })
2987
+ onPickCwd: (cwd) => ui.set({ draft: { ...draft, cwd } }),
2988
+ draft: "new-agent"
2789
2989
  }))));
2790
2990
  }
2791
2991
  function NewChannelDialog({ context, onClose }) {
@@ -2798,6 +2998,10 @@ function NewChannelDialog({ context, onClose }) {
2798
2998
  const [name, setName] = React.useState("");
2799
2999
  const [query, setQuery] = React.useState("");
2800
3000
  const [picked, setPicked] = React.useState([]);
3001
+ const friends = useFriends(pi);
3002
+ const [pickedFriends, setPickedFriends] = React.useState([]);
3003
+ const shared = pickedFriends.length > 0;
3004
+ const toggleFriend = (friend) => setPickedFriends(pickedFriends.includes(friend.id) ? pickedFriends.filter((id) => id !== friend.id) : [...pickedFriends, friend.id]);
2801
3005
  const [busy, setBusy] = React.useState(false);
2802
3006
  const [error, setError] = React.useState();
2803
3007
  const Dialog = pi.ui.Dialog;
@@ -2808,6 +3012,13 @@ function NewChannelDialog({ context, onClose }) {
2808
3012
  event.preventDefault();
2809
3013
  setBusy(true);
2810
3014
  setError(undefined);
3015
+ if (shared) {
3016
+ createShared(context, name.trim(), pickedFriends, picked).then(onClose, (failure) => {
3017
+ setBusy(false);
3018
+ setError(ChannelViews.message(failure));
3019
+ });
3020
+ return;
3021
+ }
2811
3022
  service.createChannel({ name, members: picked }).then((channel) => {
2812
3023
  onClose();
2813
3024
  context.showChannel(channel.id);
@@ -2875,22 +3086,54 @@ function NewChannelDialog({ context, onClose }) {
2875
3086
  className: "tac-pick-text"
2876
3087
  }, /* @__PURE__ */ React.createElement("span", {
2877
3088
  className: "tac-pick-name"
2878
- }, agent.name, picked[0] === agent.id && /* @__PURE__ */ React.createElement("span", {
2879
- className: "tac-msg-lead"
2880
- }, w.lead)), /* @__PURE__ */ React.createElement("span", {
3089
+ }, agent.name, picked[0] === agent.id && /* @__PURE__ */ React.createElement("span", {
3090
+ className: "tac-msg-lead"
3091
+ }, w.lead)), /* @__PURE__ */ React.createElement("span", {
3092
+ className: "tac-pick-role"
3093
+ }, agent.role.split(`
3094
+ `)[0])));
3095
+ })), friends.length > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
3096
+ className: "tac-dialog-label"
3097
+ }, /* @__PURE__ */ React.createElement("span", null, w.addFriends), shared && /* @__PURE__ */ React.createElement("span", {
3098
+ className: "tac-dialog-count"
3099
+ }, pickedFriends.length)), /* @__PURE__ */ React.createElement("div", {
3100
+ className: "tac-pick-list"
3101
+ }, friends.map((friend) => {
3102
+ const on = pickedFriends.includes(friend.id);
3103
+ return /* @__PURE__ */ React.createElement("button", {
3104
+ key: friend.id,
3105
+ type: "button",
3106
+ "aria-pressed": on,
3107
+ className: `tac-pick${on ? " tac-on" : ""}`,
3108
+ onClick: () => toggleFriend(friend)
3109
+ }, /* @__PURE__ */ React.createElement("span", {
3110
+ className: "tac-check"
3111
+ }, on && /* @__PURE__ */ React.createElement(Check, {
3112
+ size: 13,
3113
+ strokeWidth: 3
3114
+ })), pi.ui.Face ? /* @__PURE__ */ React.createElement(pi.ui.Face, {
3115
+ seed: friend.id,
3116
+ size: 30,
3117
+ look: friend.look
3118
+ }) : /* @__PURE__ */ React.createElement("span", {
3119
+ className: "tac-pick-face"
3120
+ }), /* @__PURE__ */ React.createElement("span", {
3121
+ className: "tac-pick-text"
3122
+ }, /* @__PURE__ */ React.createElement("span", {
3123
+ className: "tac-pick-name"
3124
+ }, friend.name), /* @__PURE__ */ React.createElement("span", {
2881
3125
  className: "tac-pick-role"
2882
- }, agent.role.split(`
2883
- `)[0])));
2884
- })), picked.length > 0 && /* @__PURE__ */ React.createElement("div", {
3126
+ }, w.friend)));
3127
+ }))), (picked.length > 0 || shared) && /* @__PURE__ */ React.createElement("div", {
2885
3128
  className: "tac-dialog-note"
2886
- }, w.membersHint), error && /* @__PURE__ */ React.createElement("div", {
3129
+ }, shared ? w.sharedHint : w.membersHint), error && /* @__PURE__ */ React.createElement("div", {
2887
3130
  className: "tac-empty tac-error"
2888
3131
  }, error), /* @__PURE__ */ React.createElement("div", {
2889
3132
  className: "tac-dialog-actions"
2890
3133
  }, /* @__PURE__ */ React.createElement("button", {
2891
3134
  type: "submit",
2892
3135
  className: busy ? "tac-button tac-primary ta-busy" : "tac-button tac-primary",
2893
- disabled: busy || !name.trim() || picked.length === 0
3136
+ disabled: busy || !name.trim() || picked.length === 0 && !shared
2894
3137
  }, w.create, busy && /* @__PURE__ */ React.createElement("span", {
2895
3138
  className: "ta-spinner ta-busy-mark ta-on-brand"
2896
3139
  })))));
@@ -2941,10 +3184,7 @@ var HandOff;
2941
3184
  "en-US": `Hand this over to ${to}`,
2942
3185
  "ja-JP": `これを ${to} に引き継ぐ`
2943
3186
  });
2944
- return `<context>
2945
- ${context}
2946
- </context>
2947
- ${line}`;
3187
+ return TaMessageContext.wrap(context, line);
2948
3188
  }
2949
3189
  HandOff.ask = ask;
2950
3190
  function asked(text) {
@@ -2982,12 +3222,9 @@ ${line}`;
2982
3222
  origin.sessionFile ? `That conversation is pi's session file ${origin.sessionFile}${origin.cwd ? `, working in ${origin.cwd}` : ""}: read it only when the brief is not enough.` : ""
2983
3223
  ].filter(Boolean).join(`
2984
3224
  `);
2985
- return `<context>
2986
- ${context}
2987
- </context>
2988
- ${head}
3225
+ return TaMessageContext.wrap(context, `${head}
2989
3226
 
2990
- ${brief.trim()}`;
3227
+ ${brief.trim()}`);
2991
3228
  }
2992
3229
  HandOff.message = message;
2993
3230
  function channelText(origin, brief, language) {
@@ -3068,8 +3305,8 @@ var HandOffView;
3068
3305
  HandOffView.card = card;
3069
3306
  function icon(context, target, icons) {
3070
3307
  const key = `${target.kind}:${target.id}`;
3071
- let node = icons.get(key);
3072
- if (!node) {
3308
+ let node2 = icons.get(key);
3309
+ if (!node2) {
3073
3310
  const Face2 = () => {
3074
3311
  const team = useTeam(context);
3075
3312
  const faces = useFaces(team);
@@ -3081,10 +3318,10 @@ var HandOffView;
3081
3318
  working: []
3082
3319
  }) : null;
3083
3320
  };
3084
- node = /* @__PURE__ */ React.createElement(Face2, null);
3085
- icons.set(key, node);
3321
+ node2 = /* @__PURE__ */ React.createElement(Face2, null);
3322
+ icons.set(key, node2);
3086
3323
  }
3087
- return node;
3324
+ return node2;
3088
3325
  }
3089
3326
  function composerAddon(context) {
3090
3327
  const icons = new Map;
@@ -3164,6 +3401,7 @@ function MemberList({ context, team, channel, faces, working }) {
3164
3401
  const [busy, setBusy] = React.useState();
3165
3402
  const [confirming, setConfirming] = React.useState(false);
3166
3403
  const UserPlus = ChannelViews.icon(pi, "UserPlus");
3404
+ const Contact = ChannelViews.icon(pi, "Contact");
3167
3405
  const Crown = ChannelViews.icon(pi, "Crown");
3168
3406
  const BellOff = ChannelViews.icon(pi, "BellOff");
3169
3407
  const RotateCcw = ChannelViews.icon(pi, "RotateCcw");
@@ -3209,7 +3447,19 @@ function MemberList({ context, team, channel, faces, working }) {
3209
3447
  className: "tac-member-text"
3210
3448
  }, /* @__PURE__ */ React.createElement("span", {
3211
3449
  className: "tac-member-name"
3212
- }, w.addMembers))), members.map((agent, index) => {
3450
+ }, w.addMembers))), pi.rooms && channel.by !== "ta" && /* @__PURE__ */ React.createElement("button", {
3451
+ type: "button",
3452
+ className: "tac-member-main",
3453
+ onClick: () => openShareGroup(context, channel)
3454
+ }, /* @__PURE__ */ React.createElement("span", {
3455
+ className: "tac-member-plus"
3456
+ }, /* @__PURE__ */ React.createElement(Contact, {
3457
+ size: 16
3458
+ })), /* @__PURE__ */ React.createElement("span", {
3459
+ className: "tac-member-text"
3460
+ }, /* @__PURE__ */ React.createElement("span", {
3461
+ className: "tac-member-name"
3462
+ }, w.inviteFriends))), members.map((agent, index) => {
3213
3463
  const lead = index === 0;
3214
3464
  const off = muted.includes(agent.id);
3215
3465
  const answering = working.includes(agent.id);
@@ -3437,77 +3687,506 @@ var TaPermissionUtil;
3437
3687
  const own = (key) => Object.prototype.hasOwnProperty.call(host2, key) ? host2[key] : undefined;
3438
3688
  return (_d = (_c = (_b = kind ? own(`${method}:${kind}`) : undefined) !== null && _b !== undefined ? _b : own(method)) !== null && _c !== undefined ? _c : own("*")) !== null && _d !== undefined ? _d : TA_UNDECLARED;
3439
3689
  }
3440
- TaPermissionUtil2.host = host;
3441
- })(TaPermissionUtil || (TaPermissionUtil = {}));
3442
- var action = (id, en, zh, tw, ja, more = {}) => ({
3443
- id,
3444
- area: id.split(".")[0],
3445
- title: { en, "zh-CN": zh, ...tw ? { "zh-TW": tw } : {}, ...ja ? { "ja-JP": ja } : {} },
3446
- ...more
3447
- });
3448
- var TA_ACTIONS = [
3449
- action("chat.view", "See conversations", "查看对话", "檢視對話", "会話を確認"),
3450
- action("chat.send", "Send in conversations", "在对话里发消息", "在對話裡發訊息", "会話にメッセージを送信"),
3451
- action("chat.create", "Start conversations", "新建对话", "新建對話", "新しい会話を開始"),
3452
- action("chat.stop", "Stop a reply", "停止回复", "停止回覆", "返信を停止"),
3453
- action("chat.manage", "Rename, archive and close conversations", "改名、归档、关闭对话", "改名、歸檔、關閉對話", "会話の名前変更、アーカイブ、クローズ"),
3454
- action("chat.share", "Share by a link", "生成分享链接", "生成分享連結", "共有リンクで共有"),
3455
- action("agent.view", "See agents", "查看智能体", "檢視智慧體", "エージェントを確認"),
3456
- action("agent.use", "Talk with agents", "和智能体对话", "和智慧體對話", "エージェントと対話"),
3457
- action("agent.edit", "Create, change and remove agents", "新建、修改、删除智能体", "新建、修改、刪除智慧體", "エージェントを作成・変更・削除"),
3458
- action("channel.view", "See channels", "查看频道", "檢視頻道", "チャネルを確認"),
3459
- action("channel.post", "Post in channels", "在频道里发言", "在頻道里發言", "チャネルに投稿"),
3460
- action("channel.manage", "Create and change channels", "新建、管理频道", "新建、管理頻道", "チャネルを作成・管理"),
3461
- action("task.view", "See tasks", "查看任务", "檢視任務", "タスクを確認"),
3462
- action("task.create", "Hand out tasks", "派任务", "派任務", "タスクを割り当て"),
3463
- action("task.manage", "Take over and stop tasks", "接管、停止任务", "接管、停止任務", "タスクを引き継ぎ・停止"),
3464
- action("files.read", "Read files", "读文件", "讀檔案", "ファイルを読取", { scoped: true }),
3465
- action("files.write", "Change files", "改文件", "改檔案", "ファイルを変更", { scoped: true }),
3466
- action("commands.run", "Let Ta run commands", "让 Ta 运行命令", "讓 Ta 執行命令", "Ta にコマンド実行を許可", { scoped: true, risky: true }),
3467
- action("commands.terminal", "Open terminals", "打开终端", "開啟終端機", "ターミナルを開く", { scoped: true, risky: true }),
3468
- action("hosts.use", "Use remote hosts", "使用远程主机", "使用遠端主機", "リモートホストを使用", { risky: true }),
3469
- action("models.use", "Use the models", "使用模型", "使用模型", "モデルを使用"),
3470
- action("models.manage", "Sign in to models", "登录和更换模型账号", "登入和更換模型帳號", "モデルアカウントにサインイン・変更"),
3471
- action("cron.view", "See scheduled tasks", "查看定时任务", "檢視定時任務", "スケジュールタスクを確認"),
3472
- action("cron.manage", "Change scheduled tasks", "管理定时任务", "管理定時任務", "スケジュールタスクを管理"),
3473
- action("extensions.use", "Use extensions", "使用扩展", "使用擴充功能", "拡張機能を使用"),
3474
- action("extensions.install", "Install and turn off extensions", "安装、停用扩展", "安裝、停用擴充功能", "拡張機能をインストール・無効化"),
3475
- action("settings.view", "See settings", "查看设置", "檢視設定", "設定を確認"),
3476
- action("settings.manage", "Change settings", "修改设置", "修改設定", "設定を変更"),
3477
- action("members.view", "See members", "查看成员", "檢視成員", "メンバーを確認"),
3478
- action("members.invite", "Invite people", "邀请别人", "邀請別人", "メンバーを招待"),
3479
- action("members.approve", "Answer requests", "处理申请", "處理申請", "リクエストに対応"),
3480
- action("members.roles", "Change roles and members", "管理角色和成员", "管理角色和成員", "ロールとメンバーを管理"),
3481
- action("audit.view", "See the record", "查看记录", "檢視記錄", "レコードを確認")
3482
- ];
3483
- var TaActionUtil;
3484
- (function(TaActionUtil2) {
3485
- const byId = new Map(TA_ACTIONS.map((one) => [one.id, one]));
3486
- function info(id) {
3487
- return byId.get(id);
3690
+ TaPermissionUtil2.host = host;
3691
+ })(TaPermissionUtil || (TaPermissionUtil = {}));
3692
+ var action = (id, en, zh, tw, ja, more = {}) => ({
3693
+ id,
3694
+ area: id.split(".")[0],
3695
+ title: { en, "zh-CN": zh, ...tw ? { "zh-TW": tw } : {}, ...ja ? { "ja-JP": ja } : {} },
3696
+ ...more
3697
+ });
3698
+ var TA_ACTIONS = [
3699
+ action("chat.view", "See conversations", "查看对话", "檢視對話", "会話を確認"),
3700
+ action("chat.send", "Send in conversations", "在对话里发消息", "在對話裡發訊息", "会話にメッセージを送信"),
3701
+ action("chat.create", "Start conversations", "新建对话", "新建對話", "新しい会話を開始"),
3702
+ action("chat.stop", "Stop a reply", "停止回复", "停止回覆", "返信を停止"),
3703
+ action("chat.manage", "Rename, archive and close conversations", "改名、归档、关闭对话", "改名、歸檔、關閉對話", "会話の名前変更、アーカイブ、クローズ"),
3704
+ action("chat.share", "Share by a link", "生成分享链接", "生成分享連結", "共有リンクで共有"),
3705
+ action("agent.view", "See agents", "查看智能体", "檢視智慧體", "エージェントを確認"),
3706
+ action("agent.use", "Talk with agents", "和智能体对话", "和智慧體對話", "エージェントと対話"),
3707
+ action("agent.edit", "Create, change and remove agents", "新建、修改、删除智能体", "新建、修改、刪除智慧體", "エージェントを作成・変更・削除"),
3708
+ action("channel.view", "See channels", "查看频道", "檢視頻道", "チャネルを確認"),
3709
+ action("channel.post", "Post in channels", "在频道里发言", "在頻道里發言", "チャネルに投稿"),
3710
+ action("channel.manage", "Create and change channels", "新建、管理频道", "新建、管理頻道", "チャネルを作成・管理"),
3711
+ action("task.view", "See tasks", "查看任务", "檢視任務", "タスクを確認"),
3712
+ action("task.create", "Hand out tasks", "派任务", "派任務", "タスクを割り当て"),
3713
+ action("task.manage", "Take over and stop tasks", "接管、停止任务", "接管、停止任務", "タスクを引き継ぎ・停止"),
3714
+ action("files.read", "Read files", "读文件", "讀檔案", "ファイルを読取", { scoped: true }),
3715
+ action("files.write", "Change files", "改文件", "改檔案", "ファイルを変更", { scoped: true }),
3716
+ action("commands.run", "Let Ta run commands", "让 Ta 运行命令", "讓 Ta 執行命令", "Ta にコマンド実行を許可", { scoped: true, risky: true }),
3717
+ action("commands.terminal", "Open terminals", "打开终端", "開啟終端機", "ターミナルを開く", { scoped: true, risky: true }),
3718
+ action("hosts.use", "Use remote hosts", "使用远程主机", "使用遠端主機", "リモートホストを使用", { risky: true }),
3719
+ action("models.use", "Use the models", "使用模型", "使用模型", "モデルを使用"),
3720
+ action("models.manage", "Sign in to models", "登录和更换模型账号", "登入和更換模型帳號", "モデルアカウントにサインイン・変更", { grant: "single" }),
3721
+ action("cron.view", "See scheduled tasks", "查看定时任务", "檢視定時任務", "スケジュールタスクを確認"),
3722
+ action("cron.manage", "Change scheduled tasks", "管理定时任务", "管理定時任務", "スケジュールタスクを管理"),
3723
+ action("extensions.use", "Use extensions", "使用扩展", "使用擴充功能", "拡張機能を使用"),
3724
+ action("extensions.install", "Install and turn off extensions", "安装、停用扩展", "安裝、停用擴充功能", "拡張機能をインストール・無効化"),
3725
+ action("settings.view", "See settings", "查看设置", "檢視設定", "設定を確認"),
3726
+ action("settings.manage", "Change settings", "修改设置", "修改設定", "設定を変更"),
3727
+ action("members.view", "See members", "查看成员", "檢視成員", "メンバーを確認"),
3728
+ action("members.invite", "Invite people", "邀请别人", "邀請別人", "メンバーを招待"),
3729
+ action("members.approve", "Answer requests", "处理申请", "處理申請", "リクエストに対応"),
3730
+ action("members.roles", "Change roles and members", "管理角色和成员", "管理角色和成員", "ロールとメンバーを管理"),
3731
+ action("audit.view", "See the record", "查看记录", "檢視記錄", "レコードを確認")
3732
+ ];
3733
+ var TA_OWNER_ACTIONS = [
3734
+ action("desktop.view", "See remote desktops", "查看远程桌面", "檢視遠端桌面", "リモートデスクトップを見る", { risky: true }),
3735
+ action("desktop.control", "Work remote desktops", "操作远程桌面", "操作遠端桌面", "リモートデスクトップを操作", { risky: true })
3736
+ ];
3737
+ var OWNER_AREAS = ["desktop"];
3738
+ var TaActionUtil;
3739
+ (function(TaActionUtil2) {
3740
+ const byId = new Map(TA_ACTIONS.map((one) => [one.id, one]));
3741
+ const titled = new Map([...TA_ACTIONS, ...TA_OWNER_ACTIONS].map((one) => [one.id, one]));
3742
+ function info(id) {
3743
+ return byId.get(id);
3744
+ }
3745
+ TaActionUtil2.info = info;
3746
+ function title(id, language) {
3747
+ var _a;
3748
+ var _b, _c;
3749
+ const title2 = (_a = titled.get(id)) === null || _a === undefined ? undefined : _a.title;
3750
+ if (!title2) {
3751
+ return id;
3752
+ }
3753
+ return TaLanguageUtil.pick(language, {
3754
+ "zh-CN": title2["zh-CN"],
3755
+ "zh-TW": (_b = title2["zh-TW"]) !== null && _b !== undefined ? _b : title2["zh-CN"],
3756
+ "en-US": title2.en,
3757
+ "ja-JP": (_c = title2["ja-JP"]) !== null && _c !== undefined ? _c : title2.en
3758
+ });
3759
+ }
3760
+ TaActionUtil2.title = title;
3761
+ function grantable(id) {
3762
+ const info2 = byId.get(id);
3763
+ return !!info2 && !OWNER_AREAS.includes(info2.area);
3764
+ }
3765
+ TaActionUtil2.grantable = grantable;
3766
+ function inRoles(id) {
3767
+ var _a;
3768
+ return grantable(id) && ((_a = byId.get(id)) === null || _a === undefined ? undefined : _a.grant) !== "single";
3769
+ }
3770
+ TaActionUtil2.inRoles = inRoles;
3771
+ function inside(dir, path) {
3772
+ const base = dir.replace(/\/+$/, "");
3773
+ return path === base || path.startsWith(`${base}/`) || base === "";
3774
+ }
3775
+ TaActionUtil2.inside = inside;
3776
+ })(TaActionUtil || (TaActionUtil = {}));
3777
+
3778
+ // ../ta-protocol/esm/common/said-protocol.js
3779
+ var TaSaid;
3780
+ (function(TaSaid2) {
3781
+ const CARD = /^ta-/i;
3782
+ const READ = 4000;
3783
+ const FENCE = /^\s*(`{3,}|~{3,})\s*([^\s`]*)/;
3784
+ const TAG_LINE = /^<\/?[A-Za-z][\w:.-]*(?:\s[^<>]*)?\/?>$/;
3785
+ const MARKS_ONLY = /^[-*_=|:+\s]+$/;
3786
+ const MARKS = [
3787
+ ["context", /<\/?context>/],
3788
+ ["source", /\[ta:(?:from|notice|by) /],
3789
+ ["image note", /\[Image: original \d+x\d+|\[Image converted from /],
3790
+ ["skill", /<skill name="|<\/skill>/],
3791
+ ["task note", /<\/?task_(?:update|adopted|renamed)\b/],
3792
+ ["summary", /<\/?(?:conversation_history_summary|summary)>/]
3793
+ ];
3794
+ function text(content, joiner = `
3795
+ `) {
3796
+ if (typeof content === "string") {
3797
+ return content;
3798
+ }
3799
+ return Array.isArray(content) ? content.filter((part) => (part === null || part === undefined ? undefined : part.type) === "text" && typeof part.text === "string").map((part) => part.text).join(joiner) : "";
3800
+ }
3801
+ TaSaid2.text = text;
3802
+ function words(role, text2, options = {}) {
3803
+ const said = role === "user" ? userWords(text2) : TaAgentSummary.strip(text2);
3804
+ return withoutFences(said, (language) => options.cards === false && CARD.test(language), true).trim();
3805
+ }
3806
+ TaSaid2.words = words;
3807
+ function of(message, options) {
3808
+ return message ? words(message.role, text(message.content), options) : "";
3809
+ }
3810
+ TaSaid2.of = of;
3811
+ function notice(message) {
3812
+ return (message === null || message === undefined ? undefined : message.role) === "user" && TaMessageSource.isNotice(text(message.content));
3813
+ }
3814
+ TaSaid2.notice = notice;
3815
+ function marksOnly(role, text2) {
3816
+ return !!text2.trim() && !line(words(role, text2), { chars: Number.POSITIVE_INFINITY });
3817
+ }
3818
+ TaSaid2.marksOnly = marksOnly;
3819
+ function line(markdown, options) {
3820
+ var _a;
3821
+ const read = markdown.slice(0, READ);
3822
+ const prose = withoutFences(read, () => true, true).trim();
3823
+ const lines = plain(prose || codeOf(read)).split(`
3824
+ `).map((part) => part.replace(/^\s*(?:#{1,6}\s+|>\s*|[-*+]\s+|\d+[.)]\s+)/, "").replace(/\*{1,3}|`+|~~|(?<![\p{L}\p{N}])_{1,3}|_{1,3}(?![\p{L}\p{N}])/gu, "").replace(/\s+/g, " ").trim()).filter((part) => part && !MARKS_ONLY.test(part) && !TAG_LINE.test(part));
3825
+ const count = (_a = options.lines) !== null && _a !== undefined ? _a : 1;
3826
+ const joined = count <= 1 ? lines.join(" ") : lines.slice(0, count).join(`
3827
+ `);
3828
+ return joined.length > options.chars ? `${joined.slice(0, Math.max(0, options.chars - 1)).trimEnd()}…` : joined;
3829
+ }
3830
+ TaSaid2.line = line;
3831
+ function leaks(shown, options = {}) {
3832
+ const found = MARKS.filter(([, mark]) => mark.test(shown)).map(([name]) => name);
3833
+ const lines = shown.split(`
3834
+ `);
3835
+ if (options.cards !== true && lines.some((part) => {
3836
+ var _a;
3837
+ var _b;
3838
+ return CARD.test((_b = (_a = FENCE.exec(part)) === null || _a === undefined ? undefined : _a[2]) !== null && _b !== undefined ? _b : "");
3839
+ })) {
3840
+ found.push("card");
3841
+ }
3842
+ if (lines.some((part) => TAG_LINE.test(part.trim()))) {
3843
+ found.push("tag");
3844
+ }
3845
+ return found;
3846
+ }
3847
+ TaSaid2.leaks = leaks;
3848
+ const SUMMARY = `<conversation_history_summary>
3849
+ <summary>
3850
+ 1. Primary Request and Intent:
3851
+ The user works on the relay.
3852
+ </summary>
3853
+ </conversation_history_summary>`;
3854
+ TaSaid2.SAMPLES = [
3855
+ {
3856
+ mark: "context and where it came from",
3857
+ role: "user",
3858
+ text: `<context>
3859
+ The channel #ops, its members.
3860
+ [ta:from @celljs/ta-channels #ops]
3861
+ </context>
3862
+ Check the build`,
3863
+ said: "Check the build"
3864
+ },
3865
+ {
3866
+ mark: "a notice, not the user",
3867
+ role: "user",
3868
+ text: `<context>
3869
+ [ta:notice @celljs/ta-call]
3870
+ </context>
3871
+ The work finished. Its last words: tests pass.`,
3872
+ said: "The work finished. Its last words: tests pass."
3873
+ },
3874
+ { mark: "one let in", role: "user", text: `<context>
3875
+ [ta:by p-7 Alice]
3876
+ </context>
3877
+ Hello there`, said: "Hello there" },
3878
+ {
3879
+ mark: "notes of images",
3880
+ role: "user",
3881
+ text: `Look at this
3882
+ [Image: original 3024x4032, displayed at 1512x2016. Multiply coordinates by 2.00 to map to original image.]
3883
+ [Image converted from image/heic to image/png.]`,
3884
+ said: "Look at this"
3885
+ },
3886
+ {
3887
+ mark: "a skill run",
3888
+ role: "user",
3889
+ text: `<skill name="ta-package" location="/skills/ta-package/SKILL.md">
3890
+ # Ta package
3891
+ Steps.
3892
+ </skill>
3893
+
3894
+ Make a card`,
3895
+ said: "Make a card"
3896
+ },
3897
+ {
3898
+ mark: "a note of a task",
3899
+ role: "user",
3900
+ text: `<task_update id="t1" title="Fix login" status="done">
3901
+ All tests pass.
3902
+ </task_update>`,
3903
+ said: "Fix login"
3904
+ },
3905
+ { mark: "a note of a new id", role: "user", text: `<task_renamed id="t2" was="t1" title="Fix login">
3906
+ Now t2.
3907
+ </task_renamed>` },
3908
+ { mark: "a summary, then the answer", role: "assistant", text: `${SUMMARY}
3909
+ Switched to voice.`, said: "Switched to voice." },
3910
+ { mark: "a summary alone", role: "assistant", text: SUMMARY },
3911
+ { mark: "a summary as it streams", role: "assistant", text: `<conversation_history_summary>
3912
+ <summary>` },
3913
+ {
3914
+ mark: "a card after the answer",
3915
+ role: "assistant",
3916
+ text: '**Done**: tests pass.\n\n```ta-glance\n{"status":"done","blocks":[]}\n```',
3917
+ said: "tests pass"
3918
+ },
3919
+ { mark: "a card alone", role: "assistant", text: '```ta-glance\n{"status":"done","blocks":[]}\n```' },
3920
+ { mark: "a proposal", role: "assistant", text: 'Committed.\n\n```ta-propose\n{"kind":"git.push","title":"Push"}\n```', said: "Committed." },
3921
+ { mark: "what a call says aloud", role: "assistant", text: "All fixed.\n\n```ta-say\nIt is fixed.\n```", said: "All fixed." },
3922
+ { mark: "a tag not known yet", role: "assistant", text: `<system-reminder>
3923
+ </system-reminder>
3924
+ Ready.`, said: "Ready." }
3925
+ ];
3926
+ function userWords(text2) {
3927
+ const said = TaImageNote.strip(TaMessageContext.strip(text2));
3928
+ const skill = TaSkillUse.parse(said);
3929
+ if (skill) {
3930
+ return TaSkillUse.command(skill);
3931
+ }
3932
+ const note = TaTaskNote.parse(said);
3933
+ if (!note) {
3934
+ return said;
3935
+ }
3936
+ if (note.kind === "renamed") {
3937
+ return "";
3938
+ }
3939
+ return note.kind === "update" && note.body.trim() ? `${note.title} · ${note.body}` : note.title;
3940
+ }
3941
+ function withoutFences(text2, drop, tags = false) {
3942
+ const kept = [];
3943
+ let fence;
3944
+ let left = false;
3945
+ for (const part of text2.split(`
3946
+ `)) {
3947
+ const open = FENCE.exec(part);
3948
+ if (!fence && open) {
3949
+ fence = { mark: open[1], dropped: drop(open[2]) };
3950
+ } else if (fence && closes(part, fence.mark)) {
3951
+ const dropped = fence.dropped;
3952
+ fence = undefined;
3953
+ if (dropped) {
3954
+ continue;
3955
+ }
3956
+ }
3957
+ if ((fence === null || fence === undefined ? undefined : fence.dropped) || !fence && tags && TAG_LINE.test(part.trim())) {
3958
+ left = true;
3959
+ } else {
3960
+ kept.push(part);
3961
+ }
3962
+ }
3963
+ return left ? kept.join(`
3964
+ `).replace(/\n{3,}/g, `
3965
+
3966
+ `) : kept.join(`
3967
+ `);
3968
+ }
3969
+ function codeOf(text2) {
3970
+ const code = [];
3971
+ let fence;
3972
+ for (const part of text2.split(`
3973
+ `)) {
3974
+ const open = FENCE.exec(part);
3975
+ if (!fence && open) {
3976
+ fence = { mark: open[1], card: CARD.test(open[2]) };
3977
+ } else if (fence && closes(part, fence.mark)) {
3978
+ fence = undefined;
3979
+ } else if (fence && !fence.card) {
3980
+ code.push(part);
3981
+ }
3982
+ }
3983
+ return code.join(`
3984
+ `);
3985
+ }
3986
+ function closes(part, mark) {
3987
+ var _a;
3988
+ const close = (_a = /^\s*(`{3,}|~{3,})\s*$/.exec(part)) === null || _a === undefined ? undefined : _a[1];
3989
+ return !!close && close[0] === mark[0] && close.length >= mark.length;
3990
+ }
3991
+ function plain(text2) {
3992
+ const linked = text2.replace(/(?<!!)\[([^\]\n]*)\]\([^)\n]*\)/g, "$1");
3993
+ const words2 = linked.replace(/!\[[^\]\n]*\]\([^)\n]*\)/g, "").trim();
3994
+ return words2 || linked.replace(/!\[([^\]\n]*)\]\([^)\n]*\)/g, "$1");
3995
+ }
3996
+ })(TaSaid || (TaSaid = {}));
3997
+
3998
+ // web-src/channels-text.ts
3999
+ var ChannelsText;
4000
+ ((ChannelsText) => {
4001
+ function markMentions(text, agents) {
4002
+ if (agents.length === 0) {
4003
+ return text;
4004
+ }
4005
+ const names = [...agents].sort((a, b) => b.name.length - a.name.length).map((agent) => agent.name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
4006
+ const pattern = new RegExp(`(?<![*A-Za-z0-9_])@(${names.join("|")})(?![A-Za-z0-9_-])`, "gi");
4007
+ return text.split(/(```[\s\S]*?(?:```|$)|`[^`\n]*`)/).map((part, index) => index % 2 === 1 ? part : part.replace(pattern, "**$&**")).join("");
4008
+ }
4009
+ ChannelsText.markMentions = markMentions;
4010
+ function mentions(text, agents) {
4011
+ if (agents.length === 0) {
4012
+ return [];
4013
+ }
4014
+ const names = [...agents].sort((a, b) => b.name.length - a.name.length).map((agent) => agent.name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
4015
+ const pattern = new RegExp(`@(${names.join("|")})(?![A-Za-z0-9_-])`, "gi");
4016
+ const found = [];
4017
+ for (const match of text.matchAll(pattern)) {
4018
+ const agent = agents.find((candidate) => candidate.name.toLowerCase() === match[1].toLowerCase());
4019
+ if (agent && !found.includes(agent.id)) {
4020
+ found.push(agent.id);
4021
+ }
4022
+ }
4023
+ return found;
4024
+ }
4025
+ ChannelsText.mentions = mentions;
4026
+ function targets(team, channel, message) {
4027
+ const muted = channel.muted ?? [];
4028
+ const members = channel.members.filter((id) => !muted.includes(id)).map((id) => team.agents.find((agent) => agent.id === id)).filter((agent) => !!agent);
4029
+ const named = mentions(message.text, members).filter((id) => id !== message.author);
4030
+ if (message.author === SYSTEM) {
4031
+ return [];
4032
+ }
4033
+ if (named.length > 0 || message.author !== USER && message.author !== TA) {
4034
+ return named;
4035
+ }
4036
+ return members.length > 0 ? [members[0].id] : [];
4037
+ }
4038
+ ChannelsText.targets = targets;
4039
+ function authorName(team, author, labels) {
4040
+ if (author === SYSTEM) {
4041
+ return "channel";
4042
+ }
4043
+ if (author === USER) {
4044
+ return labels.user;
4045
+ }
4046
+ if (author === TA) {
4047
+ return labels.ta;
4048
+ }
4049
+ return team.agents.find((agent) => agent.id === author)?.name ?? author;
4050
+ }
4051
+ ChannelsText.authorName = authorName;
4052
+ function systemPrompt(agent) {
4053
+ return [
4054
+ `You are ${agent.name}, ${AGENT_MARK}. Your role: ${agent.role}`,
4055
+ "You work with the user, Ta and other agents in channels. A message for you starts with a <context> block: the channel, its members, the recent messages and who speaks to you; answer what follows the block.",
4056
+ "Do the part of the work your role covers with your tools, then answer: your answer is posted to the channel as it is.",
4057
+ "To hand work to another member, write @ and their name in your answer; name nobody when the work is done or you need the user.",
4058
+ NOTICE_RULE
4059
+ ].join(`
4060
+ `);
4061
+ }
4062
+ ChannelsText.systemPrompt = systemPrompt;
4063
+ function prompt(team, channel, history, message, agent) {
4064
+ const labels = { user: "user", ta: "Ta" };
4065
+ const members = channel.members.map((id) => team.agents.find((other) => other.id === id)).filter((other) => !!other).map((other) => `@${other.name}${other.id === agent.id ? " (you)" : ""}: ${firstLine(other.role)}`);
4066
+ const before = history.filter((item) => item.id !== message.id && !item.failed && !item.notice).slice(-CONTEXT_MESSAGES);
4067
+ const lines = [`[#${channel.name}]${channel.topic ? ` ${channel.topic}` : ""}`, "Members:", ...members.map((line) => `- ${line}`)];
4068
+ if (channel.notice) {
4069
+ lines.push("", "Notice of the channel (follow it; keep it with update_channel_notice):", channel.notice.text);
4070
+ }
4071
+ if (before.length > 0) {
4072
+ lines.push("", "Recent messages:", ...before.map((item) => `${authorName(team, item.author, labels)}: ${item.text}`));
4073
+ }
4074
+ lines.push("", `${authorName(team, message.author, labels)} to you:`);
4075
+ const speaker = message.author === USER ? "" : ` · ${authorName(team, message.author, labels)}`;
4076
+ lines.push(TaMessageSource.line(NAME, `#${channel.name}${speaker}`));
4077
+ return TaMessageContext.wrap(lines.join(`
4078
+ `), message.text);
4079
+ }
4080
+ ChannelsText.prompt = prompt;
4081
+ function summary(team) {
4082
+ if (team.agents.length === 0) {
4083
+ return "No agents and no channels yet.";
4084
+ }
4085
+ const name = (id) => team.agents.find((agent) => agent.id === id)?.name ?? id;
4086
+ const agents = team.agents.map((agent) => `- @${agent.name}: ${firstLine(agent.role)}`);
4087
+ const channels = team.channels.map((channel) => `- #${channel.name}${channel.topic ? ` (${channel.topic})` : ""}: ${channel.members.map((id) => `@${name(id)}`).join(", ")}${channel.muted?.length ? `; muted by the user, answering nothing: ${channel.muted.map((id) => `@${name(id)}`).join(", ")}` : ""}${channel.notice ? `
4088
+ notice: ${channel.notice.text.replace(/\s+/g, " ").slice(0, 300)}` : ""}`);
4089
+ return ["Agents:", ...agents, "", "Channels:", ...channels.length > 0 ? channels : ["none yet"]].join(`
4090
+ `);
4091
+ }
4092
+ ChannelsText.summary = summary;
4093
+ function transcript(team, messages) {
4094
+ const labels = { user: "user", ta: "Ta" };
4095
+ return messages.map((item) => `${authorName(team, item.author, labels)}${item.failed ? " (failed)" : ""}: ${item.text}`).join(`
4096
+
4097
+ `);
4098
+ }
4099
+ ChannelsText.transcript = transcript;
4100
+ function markdown(agent, messages, labels) {
4101
+ const parts = [`# ${agent.name}`, "", `> ${firstLine(agent.role)}`];
4102
+ for (const message of messages) {
4103
+ const { role, content } = message ?? {};
4104
+ if (role !== "user" && role !== "assistant") {
4105
+ continue;
4106
+ }
4107
+ const text = TaSaid.words(role, TaSaid.text(content, ""));
4108
+ if (text) {
4109
+ parts.push("", `## ${role === "user" ? labels.user : agent.name}`, "", text);
4110
+ }
4111
+ }
4112
+ return `${parts.join(`
4113
+ `)}
4114
+ `;
4115
+ }
4116
+ ChannelsText.markdown = markdown;
4117
+ function channelMarkdown(team, channel, messages, labels) {
4118
+ const parts = [`# #${channel.name}`];
4119
+ if (channel.topic) {
4120
+ parts.push("", `> ${firstLine(channel.topic)}`);
4121
+ }
4122
+ for (const message of messages) {
4123
+ const text = message.text.trim();
4124
+ if (text && message.author !== SYSTEM) {
4125
+ parts.push("", `## ${authorName(team, message.author, labels)}${message.failed ? " (failed)" : ""}`, "", text);
4126
+ }
4127
+ }
4128
+ return `${parts.join(`
4129
+ `)}
4130
+ `;
4131
+ }
4132
+ ChannelsText.channelMarkdown = channelMarkdown;
4133
+ function firstLine(text) {
4134
+ return text.split(`
4135
+ `)[0];
3488
4136
  }
3489
- TaActionUtil2.info = info;
3490
- function title(id, language) {
3491
- var _a;
3492
- var _b, _c;
3493
- const title2 = (_a = byId.get(id)) === null || _a === undefined ? undefined : _a.title;
3494
- if (!title2) {
3495
- return id;
4137
+ })(ChannelsText ||= {});
4138
+ var NOTICE_RULE = [
4139
+ "A channel may have a notice, in the <context> block: what its members decided, agreed and are to do. Follow it.",
4140
+ `When the talk settles a decision or a convention, or adds, assigns or finishes a to-do, update it with update_channel_notice: the whole notice, short, under the headings ### ${NOTICE_HEADINGS.zh.join(" / ")} (### ${NOTICE_HEADINGS.en.join(" / ")} in English), in the language of the channel, to-dos as - [ ] or - [x] with who does them. The lead keeps it most; leave it for small talk.`
4141
+ ].join(`
4142
+ `);
4143
+
4144
+ // web-src/notice-util.ts
4145
+ var NoticeUtil;
4146
+ ((NoticeUtil) => {
4147
+ const PARTS = {
4148
+ 决定: "decisions",
4149
+ decisions: "decisions",
4150
+ 约定: "conventions",
4151
+ conventions: "conventions",
4152
+ 待办: "todo",
4153
+ "to do": "todo",
4154
+ todo: "todo",
4155
+ "to-do": "todo"
4156
+ };
4157
+ function counts(text) {
4158
+ const counts2 = { decisions: 0, conventions: 0, todo: 0, done: 0 };
4159
+ let part;
4160
+ for (const line of text.split(/\r?\n/)) {
4161
+ const heading = /^\s*#{1,6}\s+(.+?)\s*#*\s*$/.exec(line) ?? /^\s*\*\*(.+?)\*\*\s*[::]?\s*$/.exec(line);
4162
+ if (heading) {
4163
+ part = PARTS[heading[1].replace(/[::]$/, "").trim().toLowerCase()];
4164
+ continue;
4165
+ }
4166
+ const item = /^\s*(?:[-*+]|\d+[.)])\s+(\[( |x|X)\]\s+)?\S/.exec(line);
4167
+ if (!part || !item) {
4168
+ continue;
4169
+ }
4170
+ if (part === "todo" && item[2] && item[2] !== " ") {
4171
+ counts2.done++;
4172
+ } else {
4173
+ counts2[part]++;
4174
+ }
3496
4175
  }
3497
- return TaLanguageUtil.pick(language, {
3498
- "zh-CN": title2["zh-CN"],
3499
- "zh-TW": (_b = title2["zh-TW"]) !== null && _b !== undefined ? _b : title2["zh-CN"],
3500
- "en-US": title2.en,
3501
- "ja-JP": (_c = title2["ja-JP"]) !== null && _c !== undefined ? _c : title2.en
3502
- });
4176
+ return counts2;
3503
4177
  }
3504
- TaActionUtil2.title = title;
3505
- function inside(dir, path) {
3506
- const base = dir.replace(/\/+$/, "");
3507
- return path === base || path.startsWith(`${base}/`) || base === "";
4178
+ NoticeUtil.counts = counts;
4179
+ function firstLine(text) {
4180
+ for (const line of text.split(/\r?\n/)) {
4181
+ const item = /^\s*(?:[-*+]|\d+[.)])\s+(?:\[[ xX]\]\s+)?(.+)$/.exec(line);
4182
+ if (item) {
4183
+ return item[1].replace(/[*_`~]+/g, "").trim();
4184
+ }
4185
+ }
4186
+ return text.split(/\r?\n/).find((line) => line.trim() && !/^\s*#/.test(line))?.trim() ?? "";
3508
4187
  }
3509
- TaActionUtil2.inside = inside;
3510
- })(TaActionUtil || (TaActionUtil = {}));
4188
+ NoticeUtil.firstLine = firstLine;
4189
+ })(NoticeUtil ||= {});
3511
4190
 
3512
4191
  // web-src/notice.tsx
3513
4192
  var NoticeView;
@@ -3594,7 +4273,7 @@ function NoticeBar({
3594
4273
  })), /* @__PURE__ */ React.createElement("div", {
3595
4274
  className: "tac-notice-foot"
3596
4275
  }, /* @__PURE__ */ React.createElement("span", null, ChannelWords.format(w.noticeBy, {
3597
- name: ChannelsUtil.authorName(team, notice.by, { user: w.you, ta: w.ta }),
4276
+ name: ChannelsText.authorName(team, notice.by, { user: w.you, ta: w.ta }),
3598
4277
  time: SidebarUtil.time(notice.at, pi.ui.language)
3599
4278
  })), /* @__PURE__ */ React.createElement("button", {
3600
4279
  type: "button",
@@ -3766,7 +4445,7 @@ function ChannelRoom({ context, channelId: fixed }) {
3766
4445
  }
3767
4446
  const members = membersOf(state.team, channel);
3768
4447
  const agentOf = (id) => state.team.agents.find((agent) => agent.id === id);
3769
- const name = (id) => ChannelsUtil.authorName(state.team, id, { user: w.you, ta: w.ta });
4448
+ const name = (id) => ChannelsText.authorName(state.team, id, { user: w.you, ta: w.ta });
3770
4449
  const time = (at) => SidebarUtil.time(at, pi.ui.language);
3771
4450
  const mention = (agent) => ({
3772
4451
  key: agent.id,
@@ -3860,7 +4539,7 @@ function ChannelRoom({ context, channelId: fixed }) {
3860
4539
  }, message.failed && /* @__PURE__ */ React.createElement("div", {
3861
4540
  className: "tac-msg-failed"
3862
4541
  }, w.failed), /* @__PURE__ */ React.createElement(Markdown, {
3863
- text: ChannelsUtil.markMentions(message.text, state.team.agents)
4542
+ text: ChannelsText.markMentions(message.text, state.team.agents)
3864
4543
  })))))), working.length > 0 && /* @__PURE__ */ React.createElement("div", {
3865
4544
  className: "tac-live",
3866
4545
  role: "status"
@@ -3875,6 +4554,7 @@ function ChannelRoom({ context, channelId: fixed }) {
3875
4554
  className: "tac-chat-bottom"
3876
4555
  }, /* @__PURE__ */ React.createElement(Composer, {
3877
4556
  placeholder: ChannelWords.format(w.placeholder, { channel: channel.name }),
4557
+ draft: channel.id,
3878
4558
  mentions: members.map((agent) => ({ name: agent.name, detail: agent.role.split(`
3879
4559
  `)[0] })),
3880
4560
  actions: [
@@ -4099,7 +4779,7 @@ function AgentMenu({ context, agent, cwd, working }) {
4099
4779
  pi.ui.notify(ChannelWords.format(w.nothingToExport, { name: agent.name }), "info");
4100
4780
  return;
4101
4781
  }
4102
- download(`${agent.name}.md`, ChannelsUtil.markdown(agent, messages, { user: w.you }));
4782
+ download(`${agent.name}.md`, ChannelsText.markdown(agent, messages, { user: w.you }));
4103
4783
  });
4104
4784
  const remove = act(() => deleteAgent(context, agent));
4105
4785
  const pin = act(() => service.updateAgent(agent.id, { pinned: !agent.pinned }));
@@ -4364,7 +5044,7 @@ class ChannelTaskSource {
4364
5044
  }
4365
5045
  status(state, channel, messages, working) {
4366
5046
  const w = ChannelViews.words(this.context.pi);
4367
- const name = (id) => ChannelsUtil.authorName(state.team, id, { user: w.you, ta: w.ta });
5047
+ const name = (id) => ChannelsText.authorName(state.team, id, { user: w.you, ta: w.ta });
4368
5048
  if (working.length > 0) {
4369
5049
  return { status: "running", detail: ChannelWords.format(w.answeringNow, { name: working.map(name).join("、") }) };
4370
5050
  }
@@ -4395,6 +5075,7 @@ class ChannelTaskSource {
4395
5075
  working
4396
5076
  }),
4397
5077
  open: () => openScene(this.context, channel),
5078
+ show: () => this.context.showChannel(channel.id),
4398
5079
  menu: () => taskMenu(this.context, channel, working),
4399
5080
  remove: () => deleteTeam(this.context, channel),
4400
5081
  removeHint: ChannelWords.format(ChannelViews.words(this.context.pi).deleteTaskHint, { channel: channel.name })
@@ -4513,222 +5194,67 @@ async function deleteChannel(context, channel) {
4513
5194
  }
4514
5195
  function ChannelMenu({ context, channel, working }) {
4515
5196
  const { pi, service, ui } = context;
4516
- const { fresh } = useUi(ui);
4517
- const w = ChannelViews.words(pi);
4518
- const icon = (name) => ChannelViews.maybeIcon(pi, name, null, 15);
4519
- const act = (action2) => () => {
4520
- Promise.resolve().then(action2).catch((error) => pi.ui.notify(ChannelViews.message(error), "error"));
4521
- };
4522
- const unread = fresh.includes(channel.id);
4523
- const pin = act(() => service.updateChannel(channel.id, { pinned: !channel.pinned }));
4524
- const markRead = act(() => ui.set({ fresh: unread ? fresh.filter((id) => id !== channel.id) : [...fresh, channel.id] }));
4525
- const rename = act(async () => {
4526
- const name = await pi.ui.input(ChannelWords.format(w.renameChannel, { channel: channel.name }), w.channelNamePlaceholder, { value: channel.name });
4527
- if (name !== undefined && name.trim() !== channel.name) {
4528
- await service.updateChannel(channel.id, { name });
4529
- }
4530
- });
4531
- const editTopic = act(async () => {
4532
- const topic = await pi.ui.input(w.editTopic, w.topicPlaceholder, { value: channel.topic ?? "" });
4533
- if (topic !== undefined && topic.trim() !== (channel.topic ?? "")) {
4534
- await service.updateChannel(channel.id, { topic });
4535
- }
4536
- });
4537
- const members = act(() => {
4538
- context.showChannel(channel.id);
4539
- context.showMembers();
4540
- });
4541
- const stop = act(async () => {
4542
- await TeamActions.stop(context, working);
4543
- pi.ui.notify(ChannelWords.format(w.stoppedChannel, { channel: channel.name }), "info");
4544
- });
4545
- const exportMarkdown = act(async () => {
4546
- const messages = await service.messages(channel.id);
4547
- if (!messages.some((message) => message.text.trim())) {
4548
- pi.ui.notify(ChannelWords.format(w.noMessagesToExport, { channel: channel.name }), "info");
4549
- return;
4550
- }
4551
- download2(`${channel.name}.md`, ChannelsUtil.channelMarkdown(service.state.team, channel, messages, { user: w.you, ta: w.ta }));
4552
- });
4553
- const remove = act(() => deleteChannel(context, channel));
4554
- const item = (key, label, glyph, run, options = {}) => ({
4555
- key,
4556
- label,
4557
- icon: icon(glyph),
4558
- run,
4559
- ...options
4560
- });
4561
- return /* @__PURE__ */ React.createElement(MoreMenu, {
4562
- pi,
4563
- label: channel.name,
4564
- items: () => [
4565
- [
4566
- item("pin", channel.pinned ? w.unpin : w.pin, channel.pinned ? "PinOff" : "Pin", pin),
4567
- item("read", unread ? w.markRead : w.markUnread, unread ? "MessageSquareText" : "MessageSquareDot", markRead)
4568
- ],
4569
- [item("rename", w.rename, "Pencil", rename), item("topic", w.editTopic, "Text", editTopic), item("members", w.showMembers, "Users", members)],
4570
- [item("stop", w.stopAnswering, "Square", stop, { disabled: working.length === 0 }), item("export", w.exportChat, "Download", exportMarkdown)],
4571
- [item("delete", w.deleteChannel, "Trash2", remove, { danger: true })]
4572
- ]
4573
- });
4574
- }
4575
-
4576
- // web-src/sidebar.tsx
4577
- function Row({ pi, avatar, title, badge, preview, live, dot, waiting, fresh, time, hint, selected, onSelect, more, swipe, check, place, deleting }) {
4578
- const single = !preview && !place;
4579
- const spinner = dot === "running" && /* @__PURE__ */ React.createElement("span", {
4580
- className: "tac-spinner ta-spinner"
4581
- });
4582
- const row = /* @__PURE__ */ React.createElement("button", {
4583
- type: "button",
4584
- className: `tac-item${selected ? " tac-selected" : ""}${single ? " tac-item-single" : ""}${deleting && !(more || swipe) ? " ta-pending" : ""}`,
4585
- "aria-current": selected || undefined,
4586
- "aria-busy": deleting || undefined,
4587
- "data-unseen": dot === "attention" ? "" : undefined,
4588
- title: hint,
4589
- onClick: onSelect
4590
- }, check, /* @__PURE__ */ React.createElement("span", {
4591
- className: "tac-avatar"
4592
- }, avatar, /* @__PURE__ */ React.createElement("span", {
4593
- className: `tac-dot${dot ? ` tac-dot-${dot}` : ""}`
4594
- })), /* @__PURE__ */ React.createElement("span", {
4595
- className: "tac-item-text"
4596
- }, /* @__PURE__ */ React.createElement("span", {
4597
- className: "tac-item-top"
4598
- }, /* @__PURE__ */ React.createElement("span", {
4599
- className: "tac-item-title"
4600
- }, title), badge, single && spinner, /* @__PURE__ */ React.createElement("span", {
4601
- className: "tac-item-time"
4602
- }, deleting ? /* @__PURE__ */ React.createElement("span", {
4603
- className: "tac-spinner ta-spinner ta-later"
4604
- }) : time)), !single && /* @__PURE__ */ React.createElement("span", {
4605
- className: "tac-item-bottom"
4606
- }, place, /* @__PURE__ */ React.createElement("span", {
4607
- className: `tac-item-preview${live ? " tac-now" : ""}${waiting ? " tac-waiting" : ""}${fresh ? " tac-fresh" : ""}`
4608
- }, preview), spinner)));
4609
- const SwipeRow = pi.ui.SwipeRow;
4610
- const className = `tac-item-row${selected ? " tac-selected" : ""}${deleting ? " ta-pending" : ""}`;
4611
- if (SwipeRow && (more || swipe)) {
4612
- return /* @__PURE__ */ React.createElement(SwipeRow, {
4613
- className,
4614
- actions: swipe
4615
- }, row, more);
4616
- }
4617
- return more ? /* @__PURE__ */ React.createElement("div", {
4618
- className
4619
- }, row, more) : row;
4620
- }
4621
- function swipePinDelete(pi, pinned, pin, remove) {
4622
- const w = ChannelViews.words(pi);
4623
- const fail = (error) => pi.ui.notify(ChannelViews.message(error), "error");
4624
- return [
4625
- { key: "pin", label: pinned ? w.unpin : w.pin, run: () => void pin(!pinned).catch(fail) },
4626
- { key: "delete", label: w.delete, danger: true, run: () => void remove().catch(fail) }
4627
- ];
4628
- }
4629
- function PinMark({ pi, pinned }) {
4630
- const w = ChannelViews.words(pi);
4631
- return pinned ? /* @__PURE__ */ React.createElement("span", {
4632
- className: "tac-pinned",
4633
- title: w.pinned,
4634
- role: "img",
4635
- "aria-label": w.pinned
4636
- }, ChannelViews.maybeIcon(pi, "Pin", null, 12)) : null;
4637
- }
4638
- function SidebarHead({ context }) {
4639
- const { pi, ui } = context;
4640
- const { query, creating } = useUi(ui);
4641
- const w = ChannelViews.words(pi);
4642
- const [menu, setMenu] = React.useState(false);
4643
- const menuRef = React.useRef(null);
4644
- const Plus = ChannelViews.icon(pi, "Plus");
4645
- const Search = ChannelViews.icon(pi, "Search");
4646
- const X = ChannelViews.icon(pi, "X");
4647
- const Hash = ChannelViews.icon(pi, "Hash");
4648
- const Bot = ChannelViews.icon(pi, "Bot");
4649
- const ScanLine = ChannelViews.icon(pi, "ScanLine");
4650
- const scan = pi.ui.scan;
4651
- React.useEffect(() => {
4652
- if (!menu) {
4653
- return;
5197
+ const { fresh } = useUi(ui);
5198
+ const w = ChannelViews.words(pi);
5199
+ const icon = (name) => ChannelViews.maybeIcon(pi, name, null, 15);
5200
+ const act = (action2) => () => {
5201
+ Promise.resolve().then(action2).catch((error) => pi.ui.notify(ChannelViews.message(error), "error"));
5202
+ };
5203
+ const unread = fresh.includes(channel.id);
5204
+ const pin = act(() => service.updateChannel(channel.id, { pinned: !channel.pinned }));
5205
+ const markRead = act(() => ui.set({ fresh: unread ? fresh.filter((id) => id !== channel.id) : [...fresh, channel.id] }));
5206
+ const rename = act(async () => {
5207
+ const name = await pi.ui.input(ChannelWords.format(w.renameChannel, { channel: channel.name }), w.channelNamePlaceholder, { value: channel.name });
5208
+ if (name !== undefined && name.trim() !== channel.name) {
5209
+ await service.updateChannel(channel.id, { name });
4654
5210
  }
4655
- const close = (event) => {
4656
- if (!menuRef.current?.contains(event.target)) {
4657
- setMenu(false);
4658
- }
4659
- };
4660
- document.addEventListener("pointerdown", close);
4661
- return () => document.removeEventListener("pointerdown", close);
4662
- }, [menu]);
4663
- const begin = (kind) => {
4664
- setMenu(false);
4665
- if (kind === "agent") {
4666
- newAgent(context);
4667
- } else {
4668
- ui.set({ creating: true });
5211
+ });
5212
+ const editTopic = act(async () => {
5213
+ const topic = await pi.ui.input(w.editTopic, w.topicPlaceholder, { value: channel.topic ?? "" });
5214
+ if (topic !== undefined && topic.trim() !== (channel.topic ?? "")) {
5215
+ await service.updateChannel(channel.id, { topic });
4669
5216
  }
4670
- };
4671
- return /* @__PURE__ */ React.createElement("div", {
4672
- className: "tac-toolbar"
4673
- }, /* @__PURE__ */ React.createElement("label", {
4674
- className: "tac-search"
4675
- }, /* @__PURE__ */ React.createElement(Search, {
4676
- size: 14
4677
- }), /* @__PURE__ */ React.createElement("input", {
4678
- value: query,
4679
- placeholder: w.search,
4680
- "aria-label": w.search,
4681
- onChange: (event) => ui.set({ query: event.target.value })
4682
- }), query && /* @__PURE__ */ React.createElement("button", {
4683
- type: "button",
4684
- className: "tac-action",
4685
- title: w.clear,
4686
- "aria-label": w.clear,
4687
- onClick: () => ui.set({ query: "" })
4688
- }, /* @__PURE__ */ React.createElement(X, {
4689
- size: 12
4690
- }))), /* @__PURE__ */ React.createElement("div", {
4691
- className: "tac-menu-anchor",
4692
- ref: menuRef
4693
- }, /* @__PURE__ */ React.createElement("button", {
4694
- type: "button",
4695
- className: "tac-add",
4696
- title: w.new,
4697
- "aria-label": w.new,
4698
- "aria-haspopup": "menu",
4699
- "aria-expanded": menu,
4700
- onClick: () => setMenu(!menu)
4701
- }, /* @__PURE__ */ React.createElement(Plus, {
4702
- size: 16
4703
- })), menu && /* @__PURE__ */ React.createElement("div", {
4704
- className: "tac-menu",
4705
- role: "menu"
4706
- }, /* @__PURE__ */ React.createElement("button", {
4707
- type: "button",
4708
- role: "menuitem",
4709
- onClick: () => begin("agent")
4710
- }, /* @__PURE__ */ React.createElement(Bot, {
4711
- size: 14
4712
- }), w.newAgent), /* @__PURE__ */ React.createElement("button", {
4713
- type: "button",
4714
- role: "menuitem",
4715
- onClick: () => begin("channel")
4716
- }, /* @__PURE__ */ React.createElement(Hash, {
4717
- size: 14
4718
- }), w.newChannel), scan && /* @__PURE__ */ React.createElement("button", {
4719
- type: "button",
4720
- role: "menuitem",
4721
- onClick: () => {
4722
- setMenu(false);
4723
- scan();
5217
+ });
5218
+ const members = act(() => {
5219
+ context.showChannel(channel.id);
5220
+ context.showMembers();
5221
+ });
5222
+ const stop = act(async () => {
5223
+ await TeamActions.stop(context, working);
5224
+ pi.ui.notify(ChannelWords.format(w.stoppedChannel, { channel: channel.name }), "info");
5225
+ });
5226
+ const exportMarkdown = act(async () => {
5227
+ const messages = await service.messages(channel.id);
5228
+ if (!messages.some((message) => message.text.trim())) {
5229
+ pi.ui.notify(ChannelWords.format(w.noMessagesToExport, { channel: channel.name }), "info");
5230
+ return;
4724
5231
  }
4725
- }, /* @__PURE__ */ React.createElement(ScanLine, {
4726
- size: 14
4727
- }), w.scan))), creating && /* @__PURE__ */ React.createElement(NewChannelDialog, {
4728
- context,
4729
- onClose: () => ui.set({ creating: false })
4730
- }));
5232
+ download2(`${channel.name}.md`, ChannelsText.channelMarkdown(service.state.team, channel, messages, { user: w.you, ta: w.ta }));
5233
+ });
5234
+ const remove = act(() => deleteChannel(context, channel));
5235
+ const item = (key, label, glyph, run, options = {}) => ({
5236
+ key,
5237
+ label,
5238
+ icon: icon(glyph),
5239
+ run,
5240
+ ...options
5241
+ });
5242
+ return /* @__PURE__ */ React.createElement(MoreMenu, {
5243
+ pi,
5244
+ label: channel.name,
5245
+ items: () => [
5246
+ [
5247
+ item("pin", channel.pinned ? w.unpin : w.pin, channel.pinned ? "PinOff" : "Pin", pin),
5248
+ item("read", unread ? w.markRead : w.markUnread, unread ? "MessageSquareText" : "MessageSquareDot", markRead)
5249
+ ],
5250
+ [item("rename", w.rename, "Pencil", rename), item("topic", w.editTopic, "Text", editTopic), item("members", w.showMembers, "Users", members)],
5251
+ [item("stop", w.stopAnswering, "Square", stop, { disabled: working.length === 0 }), item("export", w.exportChat, "Download", exportMarkdown)],
5252
+ [item("delete", w.deleteChannel, "Trash2", remove, { danger: true })]
5253
+ ]
5254
+ });
4731
5255
  }
5256
+
5257
+ // web-src/sidebar-hooks.ts
4732
5258
  var FOLDED_KEY = "ta-channels.folded";
4733
5259
  var BY_DIRECTORY_KEY = "ui.membersByDirectory";
4734
5260
  var NO_SESSIONS = [];
@@ -4776,40 +5302,6 @@ function useStored(storage, key, initial) {
4776
5302
  };
4777
5303
  return [value, set];
4778
5304
  }
4779
- function Section({
4780
- id,
4781
- title,
4782
- count,
4783
- folded,
4784
- onFold,
4785
- action: action2,
4786
- alert,
4787
- children
4788
- }) {
4789
- const closed = folded.has(id);
4790
- return /* @__PURE__ */ React.createElement("section", {
4791
- className: `tac-section${closed ? " tac-closed" : ""}`
4792
- }, /* @__PURE__ */ React.createElement("div", {
4793
- className: "tac-section-head-row"
4794
- }, /* @__PURE__ */ React.createElement("button", {
4795
- type: "button",
4796
- className: "tac-section-head",
4797
- "aria-expanded": !closed,
4798
- "data-unseen": closed && alert ? "" : undefined,
4799
- onClick: () => onFold(id)
4800
- }, /* @__PURE__ */ React.createElement("span", {
4801
- className: "tac-section-title"
4802
- }, title), closed && count > 0 && /* @__PURE__ */ React.createElement("span", {
4803
- className: "tac-section-count"
4804
- }, count), closed && alert && /* @__PURE__ */ React.createElement("span", {
4805
- className: "tac-section-alert"
4806
- }), /* @__PURE__ */ React.createElement("span", {
4807
- className: "tac-section-chevron",
4808
- "aria-hidden": "true"
4809
- })), !closed && action2), !closed && /* @__PURE__ */ React.createElement("div", {
4810
- className: "tac-section-body"
4811
- }, children));
4812
- }
4813
5305
  var SEEN_KEY = "ui.seenTasks";
4814
5306
  var AGENTS_SEEN_KEY = "ui.agentsSeen";
4815
5307
  var DOUBLE_LOOK = "double";
@@ -4855,11 +5347,15 @@ function useSeen(storage, key) {
4855
5347
  }
4856
5348
  function useSeenTasks(storage, tasks) {
4857
5349
  const { seen, look } = useSeen(storage, SEEN_KEY);
4858
- const needsLook = (task) => SidebarUtil.needsLook(task, seen ?? { since: Number.POSITIVE_INFINITY, at: {} });
5350
+ const needsLook = (task) => task.gathered ? task.gathered.waiting + task.gathered.fresh > 0 : SidebarUtil.needsLook(task, seen ?? { since: Number.POSITIVE_INFINITY, at: {} });
4859
5351
  const open = (task) => {
4860
5352
  const keys = new Set(tasks.map((each) => each.key));
4861
5353
  look(task.key, Date.now(), (key) => keys.has(key));
4862
- task.open();
5354
+ if (task.show) {
5355
+ task.show();
5356
+ } else {
5357
+ task.open();
5358
+ }
4863
5359
  };
4864
5360
  return { needsLook, open };
4865
5361
  }
@@ -4920,42 +5416,159 @@ function useSessionLines(context, changed) {
4920
5416
  }, [context, pi, follows, again]);
4921
5417
  return React.useMemo(() => lines && listed ? [...lines, ...listed] : lines, [lines, listed]);
4922
5418
  }
4923
- function useTaskSelection(pi, tasks) {
4924
- const [chosen, setChosen] = React.useState();
4925
- const removable = tasks.filter((task) => task.remove);
4926
- const selected = chosen ? removable.filter((task) => chosen.has(task.key)) : [];
4927
- const selecting = !!chosen && removable.length > 0;
4928
- React.useEffect(() => {
4929
- if (chosen && removable.length === 0) {
4930
- setChosen(undefined);
4931
- }
4932
- }, [chosen, removable.length]);
4933
- return {
4934
- selecting,
4935
- selected,
4936
- removable,
4937
- isChosen: (task) => !!chosen?.has(task.key),
4938
- start: (task) => setChosen(new Set([task.key])),
4939
- toggle: (task) => setChosen((before) => {
4940
- const next = new Set(before);
4941
- if (!next.delete(task.key)) {
4942
- next.add(task.key);
4943
- }
4944
- return next;
4945
- }),
4946
- selectAll: (all) => setChosen(new Set(all ? removable.map((task) => task.key) : [])),
4947
- done: () => setChosen(undefined),
4948
- removeSelected: async () => {
4949
- if (await pi.ui.removeTasks(selected)) {
4950
- setChosen(undefined);
4951
- }
4952
- }
4953
- };
5419
+ function useTaskSelection(pi, tasks) {
5420
+ const [chosen, setChosen] = React.useState();
5421
+ const removable = tasks.filter((task) => task.remove);
5422
+ const selected = chosen ? removable.filter((task) => chosen.has(task.key)) : [];
5423
+ const selecting = !!chosen && removable.length > 0;
5424
+ React.useEffect(() => {
5425
+ if (chosen && removable.length === 0) {
5426
+ setChosen(undefined);
5427
+ }
5428
+ }, [chosen, removable.length]);
5429
+ return {
5430
+ selecting,
5431
+ selected,
5432
+ removable,
5433
+ isChosen: (task) => !!chosen?.has(task.key),
5434
+ start: (task) => setChosen(new Set([task.key])),
5435
+ toggle: (task) => setChosen((before) => {
5436
+ const next = new Set(before);
5437
+ if (!next.delete(task.key)) {
5438
+ next.add(task.key);
5439
+ }
5440
+ return next;
5441
+ }),
5442
+ selectAll: (all) => setChosen(new Set(all ? removable.map((task) => task.key) : [])),
5443
+ done: () => setChosen(undefined),
5444
+ removeSelected: async () => {
5445
+ if (await pi.ui.removeTasks(selected)) {
5446
+ setChosen(undefined);
5447
+ }
5448
+ }
5449
+ };
5450
+ }
5451
+
5452
+ // web-src/sidebar-rows.tsx
5453
+ function Row({
5454
+ pi,
5455
+ avatar,
5456
+ title,
5457
+ badge,
5458
+ preview,
5459
+ live,
5460
+ dot,
5461
+ waiting,
5462
+ fresh,
5463
+ time,
5464
+ hint,
5465
+ selected,
5466
+ onSelect,
5467
+ more,
5468
+ swipe,
5469
+ check,
5470
+ place,
5471
+ deleting
5472
+ }) {
5473
+ const single = !preview && !place;
5474
+ const spinner = dot === "running" && /* @__PURE__ */ React.createElement("span", {
5475
+ className: "tac-spinner ta-spinner"
5476
+ });
5477
+ const row = /* @__PURE__ */ React.createElement("button", {
5478
+ type: "button",
5479
+ className: `tac-item${selected ? " tac-selected" : ""}${single ? " tac-item-single" : ""}${deleting && !(more || swipe) ? " ta-pending" : ""}`,
5480
+ "aria-current": selected || undefined,
5481
+ "aria-busy": deleting || undefined,
5482
+ "data-unseen": dot === "attention" || dot === "ask" ? "" : undefined,
5483
+ title: hint,
5484
+ onClick: onSelect
5485
+ }, check, /* @__PURE__ */ React.createElement("span", {
5486
+ className: "tac-avatar"
5487
+ }, avatar, /* @__PURE__ */ React.createElement("span", {
5488
+ className: `tac-dot${dot ? ` tac-dot-${dot}` : ""}`
5489
+ })), /* @__PURE__ */ React.createElement("span", {
5490
+ className: "tac-item-text"
5491
+ }, /* @__PURE__ */ React.createElement("span", {
5492
+ className: "tac-item-top"
5493
+ }, /* @__PURE__ */ React.createElement("span", {
5494
+ className: "tac-item-title"
5495
+ }, title), badge, single && spinner, /* @__PURE__ */ React.createElement("span", {
5496
+ className: "tac-item-time"
5497
+ }, deleting ? /* @__PURE__ */ React.createElement("span", {
5498
+ className: "tac-spinner ta-spinner ta-later"
5499
+ }) : time)), !single && /* @__PURE__ */ React.createElement("span", {
5500
+ className: "tac-item-bottom"
5501
+ }, place, /* @__PURE__ */ React.createElement("span", {
5502
+ className: `tac-item-preview${live ? " tac-now" : ""}${waiting ? " tac-waiting" : ""}${fresh ? " tac-fresh" : ""}`
5503
+ }, preview), spinner)));
5504
+ const SwipeRow = pi.ui.SwipeRow;
5505
+ const className = `tac-item-row${selected ? " tac-selected" : ""}${deleting ? " ta-pending" : ""}`;
5506
+ if (SwipeRow && (more || swipe)) {
5507
+ return /* @__PURE__ */ React.createElement(SwipeRow, {
5508
+ className,
5509
+ actions: swipe
5510
+ }, row, more);
5511
+ }
5512
+ return more ? /* @__PURE__ */ React.createElement("div", {
5513
+ className
5514
+ }, row, more) : row;
5515
+ }
5516
+ function swipePinDelete(pi, pinned, pin, remove) {
5517
+ const w = ChannelViews.words(pi);
5518
+ const fail = (error) => pi.ui.notify(ChannelViews.message(error), "error");
5519
+ return [
5520
+ { key: "pin", label: pinned ? w.unpin : w.pin, run: () => void pin(!pinned).catch(fail) },
5521
+ { key: "delete", label: w.delete, danger: true, run: () => void remove().catch(fail) }
5522
+ ];
5523
+ }
5524
+ function PinMark({ pi, pinned }) {
5525
+ const w = ChannelViews.words(pi);
5526
+ return pinned ? /* @__PURE__ */ React.createElement("span", {
5527
+ className: "tac-pinned",
5528
+ title: w.pinned,
5529
+ role: "img",
5530
+ "aria-label": w.pinned
5531
+ }, ChannelViews.maybeIcon(pi, "Pin", null, 12)) : null;
5532
+ }
5533
+ function Section({
5534
+ id,
5535
+ title,
5536
+ count,
5537
+ folded,
5538
+ onFold,
5539
+ action: action2,
5540
+ alert,
5541
+ children
5542
+ }) {
5543
+ const closed = folded.has(id);
5544
+ return /* @__PURE__ */ React.createElement("section", {
5545
+ className: `tac-section${closed ? " tac-closed" : ""}`
5546
+ }, /* @__PURE__ */ React.createElement("div", {
5547
+ className: "tac-section-head-row"
5548
+ }, /* @__PURE__ */ React.createElement("button", {
5549
+ type: "button",
5550
+ className: "tac-section-head",
5551
+ "aria-expanded": !closed,
5552
+ "data-unseen": closed && alert ? "" : undefined,
5553
+ onClick: () => onFold(id)
5554
+ }, /* @__PURE__ */ React.createElement("span", {
5555
+ className: "tac-section-title"
5556
+ }, title), closed && count > 0 && /* @__PURE__ */ React.createElement("span", {
5557
+ className: "tac-section-count"
5558
+ }, count), closed && alert && /* @__PURE__ */ React.createElement("span", {
5559
+ className: "tac-section-alert"
5560
+ }), /* @__PURE__ */ React.createElement("span", {
5561
+ className: "tac-section-chevron",
5562
+ "aria-hidden": "true"
5563
+ })), !closed && action2), !closed && /* @__PURE__ */ React.createElement("div", {
5564
+ className: "tac-section-body"
5565
+ }, children));
4954
5566
  }
4955
5567
  function TaskItem({ context, task, selection, seen }) {
4956
5568
  const { pi } = context;
4957
5569
  const w = ChannelViews.words(pi);
4958
5570
  const Own = task.icon;
5571
+ const TaskIcon = pi.ui.TaskIcon;
4959
5572
  const ListTodo = pi.ui.icons.ListTodo ?? ChannelViews.icon(pi, "List");
4960
5573
  const ListChecks = ChannelViews.icon(pi, "ListChecks");
4961
5574
  const SelectCheck = pi.ui.SelectCheck;
@@ -4972,7 +5585,10 @@ function TaskItem({ context, task, selection, seen }) {
4972
5585
  const swipe = task.remove && !selecting ? [{ key: "delete", label: w.delete, danger: true, run: () => void pi.ui.removeTasks([task]) }] : undefined;
4973
5586
  return /* @__PURE__ */ React.createElement(Row, {
4974
5587
  pi,
4975
- avatar: Own ? /* @__PURE__ */ React.createElement("span", {
5588
+ avatar: TaskIcon ? /* @__PURE__ */ React.createElement(TaskIcon, {
5589
+ task,
5590
+ size: 40
5591
+ }) : Own ? /* @__PURE__ */ React.createElement("span", {
4976
5592
  className: "tac-task-face"
4977
5593
  }, /* @__PURE__ */ React.createElement(Own, {
4978
5594
  size: 40
@@ -4982,7 +5598,7 @@ function TaskItem({ context, task, selection, seen }) {
4982
5598
  size: 17
4983
5599
  })),
4984
5600
  title: task.title,
4985
- dot: task.status === "running" ? "running" : seen.needsLook(task) ? "attention" : undefined,
5601
+ dot: task.status === "waiting" ? "ask" : task.status === "running" && !task.gathered ? "running" : seen.needsLook(task) ? "attention" : task.status === "running" ? "running" : undefined,
4986
5602
  preview: task.detail ?? "",
4987
5603
  waiting: task.status === "waiting",
4988
5604
  time: SidebarUtil.time(task.endedAt ?? task.startedAt, pi.ui.language),
@@ -5001,7 +5617,6 @@ function TaskItem({ context, task, selection, seen }) {
5001
5617
  })
5002
5618
  });
5003
5619
  }
5004
- var NO_HOME_ITEMS = [];
5005
5620
  function HomeRow({ pi, item }) {
5006
5621
  const [opening, setOpening] = React.useState(false);
5007
5622
  const Glyph = item.icon;
@@ -5032,7 +5647,10 @@ function HomeRow({ pi, item }) {
5032
5647
  onSelect: open
5033
5648
  });
5034
5649
  }
5035
- function AgentsSidebar({ context }) {
5650
+
5651
+ // web-src/sidebar.tsx
5652
+ var NO_HOME_ITEMS = [];
5653
+ function AgentsSidebar({ context, partners = false }) {
5036
5654
  const { pi, service, ui } = context;
5037
5655
  const state = useChannels(service);
5038
5656
  const { query, draft, channelId, fresh: unread } = useUi(ui);
@@ -5046,7 +5664,9 @@ function AgentsSidebar({ context }) {
5046
5664
  const tasks = pi.ui.useTasks();
5047
5665
  const homeItems = pi.ui.useHomeItems?.() ?? NO_HOME_ITEMS;
5048
5666
  const homeShown = homeItems.filter((item) => SidebarUtil.matches(query, item.title, item.detail));
5049
- const homeSections = SidebarUtil.homeSections(homeShown);
5667
+ const homeSections = SidebarUtil.homeSections(partners ? homeShown.filter((item) => SidebarUtil.place(item) === "partners") : homeShown);
5668
+ const partnerTop = partners ? homeShown.filter((item) => SidebarUtil.place(item) === "partners" && !item.section) : [];
5669
+ const groupItems = partners ? homeShown.filter((item) => SidebarUtil.place(item) === "groups") : [];
5050
5670
  const [folded, fold] = useFolded();
5051
5671
  const [byDirectory, setByDirectory] = useStored(pi.storage, BY_DIRECTORY_KEY, false);
5052
5672
  const language = pi.ui.language;
@@ -5057,10 +5677,9 @@ function AgentsSidebar({ context }) {
5057
5677
  const FolderTree = pi.ui.icons.FolderTree ?? Folder;
5058
5678
  const HostTag = pi.ui.HostTag;
5059
5679
  const ListTodo = pi.ui.icons.ListTodo ?? ChannelViews.icon(pi, "List");
5060
- const ChevronRight = ChannelViews.icon(pi, "ChevronRight");
5061
5680
  const Avatar = pi.ui.Avatar;
5062
5681
  const Empty = pi.ui.Empty;
5063
- const Skeleton = pi.ui.Skeleton;
5682
+ const Loading = pi.ui.Loading ?? pi.ui.Skeleton;
5064
5683
  const { team, working } = state;
5065
5684
  const own = React.useMemo(() => ChannelsUtil.ownChannels(team), [team]);
5066
5685
  const seen = useSeenTasks(pi.storage, tasks);
@@ -5099,7 +5718,7 @@ function AgentsSidebar({ context }) {
5099
5718
  });
5100
5719
  }
5101
5720
  }, [service, own]);
5102
- const name = (id) => ChannelsUtil.authorName(team, id, { user: w.you, ta: w.ta });
5721
+ const name = (id) => ChannelsText.authorName(team, id, { user: w.you, ta: w.ta });
5103
5722
  const shownTasks = tasks.filter((task) => SidebarUtil.matches(query, task.title, task.detail));
5104
5723
  const groups = SidebarUtil.taskGroups(shownTasks);
5105
5724
  const selection = useTaskSelection(pi, shownTasks);
@@ -5117,10 +5736,18 @@ function AgentsSidebar({ context }) {
5117
5736
  return opening === agent.id || !pageShown && !!sessionId && sessionId === shownSession;
5118
5737
  };
5119
5738
  const ended = allEnded || selection.selecting ? groups.ended : groups.ended.slice(0, ENDED_SHOWN);
5120
- const nothing = query && shownTasks.length === 0 && channels.length === 0 && agents.length === 0 && homeShown.length === 0;
5121
- const running = tasks.filter((task) => task.status === "running").length;
5122
- const waiting = tasks.filter((task) => task.status === "waiting").length;
5123
- const fresh = tasks.filter((task) => task.status !== "waiting" && seen.needsLook(task)).length;
5739
+ const going = [...groups.running, ...groups.ended];
5740
+ const nothing = query && (partners || shownTasks.length === 0) && channels.length === 0 && agents.length === 0 && homeShown.length === 0;
5741
+ const nobody = partners && state.loaded && !query && channels.length === 0 && agents.length === 0 && homeShown.length === 0 && !draft;
5742
+ const ownTasks = tasks.filter((task) => !task.gathered);
5743
+ const gathered = tasks.reduce((sum, task) => ({
5744
+ waiting: sum.waiting + (task.gathered?.waiting ?? 0),
5745
+ running: sum.running + (task.gathered?.running ?? 0),
5746
+ fresh: sum.fresh + (task.gathered?.fresh ?? 0)
5747
+ }), { waiting: 0, running: 0, fresh: 0 });
5748
+ const running = ownTasks.filter((task) => task.status === "running").length + gathered.running;
5749
+ const waiting = ownTasks.filter((task) => task.status === "waiting").length + gathered.waiting;
5750
+ const fresh = ownTasks.filter((task) => task.status !== "waiting" && seen.needsLook(task)).length + gathered.fresh;
5124
5751
  const doubleLine = [
5125
5752
  waiting > 0 ? ChannelWords.format(w.waitingCount, { count: String(waiting) }) : "",
5126
5753
  fresh > 0 ? ChannelWords.format(w.freshCount, { count: String(fresh) }) : "",
@@ -5130,7 +5757,7 @@ function AgentsSidebar({ context }) {
5130
5757
  className: "tac-view"
5131
5758
  }, /* @__PURE__ */ React.createElement("div", {
5132
5759
  className: "tac-list"
5133
- }, double && SidebarUtil.matches(query, double.title, w.myDouble) && /* @__PURE__ */ React.createElement("div", {
5760
+ }, !partners && double && SidebarUtil.matches(query, double.title, w.myDouble) && /* @__PURE__ */ React.createElement("div", {
5134
5761
  className: "tac-double-row"
5135
5762
  }, /* @__PURE__ */ React.createElement("button", {
5136
5763
  type: "button",
@@ -5144,31 +5771,26 @@ function AgentsSidebar({ context }) {
5144
5771
  size: 42,
5145
5772
  mood: doubleBusy ? "working" : "idle"
5146
5773
  }), /* @__PURE__ */ React.createElement("span", {
5147
- className: `tac-dot${waiting > 0 || fresh > 0 || doubleFresh ? " tac-dot-attention" : running > 0 || doubleBusy ? " tac-dot-running" : ""}`
5774
+ className: `tac-dot${waiting > 0 ? " tac-dot-ask" : fresh > 0 || doubleFresh ? " tac-dot-attention" : running > 0 || doubleBusy ? " tac-dot-running" : ""}`
5148
5775
  })), /* @__PURE__ */ React.createElement("span", {
5149
5776
  className: "tac-double-text"
5150
5777
  }, /* @__PURE__ */ React.createElement("span", {
5151
5778
  className: "tac-double-top"
5152
5779
  }, /* @__PURE__ */ React.createElement("span", {
5153
5780
  className: "tac-double-name"
5154
- }, double.title), !doubleLine && double.preview && /* @__PURE__ */ React.createElement("span", {
5781
+ }, double.title), double.preview && /* @__PURE__ */ React.createElement("span", {
5155
5782
  className: "tac-item-time"
5156
5783
  }, SidebarUtil.time(double.preview.at, pi.ui.language))), /* @__PURE__ */ React.createElement("span", {
5157
- className: `tac-double-line${waiting > 0 || fresh > 0 ? " tac-waiting" : doubleFresh && !doubleLine ? " tac-fresh" : ""}`
5784
+ className: `tac-double-line${waiting > 0 ? " tac-waiting" : fresh > 0 || doubleFresh && !doubleLine ? " tac-fresh" : ""}`
5158
5785
  }, /* @__PURE__ */ React.createElement("span", null, doubleLine || double.preview?.text || w.standingBy), (doubleBusy || running > 0) && /* @__PURE__ */ React.createElement("span", {
5159
5786
  className: "tac-spinner ta-spinner"
5160
- }))), /* @__PURE__ */ React.createElement("span", {
5161
- className: "tac-double-go",
5162
- "aria-hidden": "true"
5163
- }, /* @__PURE__ */ React.createElement(ChevronRight, {
5164
- size: 18
5165
- }))), double.menu && /* @__PURE__ */ React.createElement(MoreMenu, {
5787
+ })))), double.menu && /* @__PURE__ */ React.createElement(MoreMenu, {
5166
5788
  pi,
5167
5789
  label: double.title,
5168
5790
  items: () => (double.menu?.() ?? []).map((section) => section.map(({ icon: Icon, ...item }) => ({ ...item, icon: Icon && /* @__PURE__ */ React.createElement(Icon, {
5169
5791
  size: 15
5170
5792
  }) })))
5171
- })), homeShown.filter((item) => !item.section).map((item) => /* @__PURE__ */ React.createElement(HomeRow, {
5793
+ })), (partners ? partnerTop : homeShown.filter((item) => !item.section)).map((item) => /* @__PURE__ */ React.createElement(HomeRow, {
5172
5794
  key: item.key,
5173
5795
  pi,
5174
5796
  item
@@ -5183,24 +5805,38 @@ function AgentsSidebar({ context }) {
5183
5805
  time: "",
5184
5806
  selected: !!agentPage?.shown,
5185
5807
  onSelect: () => pi.ui.showView(AGENT_PAGE)
5186
- }), !state.loaded && !query && Skeleton && /* @__PURE__ */ React.createElement(Skeleton, {
5187
- rows: 4
5188
- }), nothing && /* @__PURE__ */ React.createElement(Empty, {
5808
+ }), !state.loaded && !query && /* @__PURE__ */ React.createElement(Loading, null), nothing && /* @__PURE__ */ React.createElement(Empty, {
5189
5809
  title: w.noMatch
5190
- }), state.loaded && (shownTasks.length > 0 || !query && tasks.length === 0) && /* @__PURE__ */ React.createElement(Section, {
5810
+ }), nobody && /* @__PURE__ */ React.createElement(Empty, {
5811
+ title: w.noPartners,
5812
+ hint: w.noPartnersHint
5813
+ }), !partners && state.loaded && groups.waiting.length > 0 && /* @__PURE__ */ React.createElement(Section, {
5814
+ id: "decide",
5815
+ title: w.decideSection,
5816
+ count: groups.waiting.length,
5817
+ folded,
5818
+ onFold: fold,
5819
+ alert: true
5820
+ }, groups.waiting.map((task) => /* @__PURE__ */ React.createElement(TaskItem, {
5821
+ key: task.key,
5822
+ context,
5823
+ task,
5824
+ selection,
5825
+ seen
5826
+ }))), !partners && state.loaded && (going.length > 0 || !query && tasks.length === 0) && /* @__PURE__ */ React.createElement(Section, {
5191
5827
  id: "tasks",
5192
5828
  title: w.tasks,
5193
- count: shownTasks.length,
5829
+ count: going.length,
5194
5830
  folded,
5195
5831
  onFold: fold,
5196
- alert: shownTasks.some((task) => seen.needsLook(task))
5197
- }, shownTasks.length === 0 && /* @__PURE__ */ React.createElement("button", {
5832
+ alert: going.some((task) => seen.needsLook(task))
5833
+ }, going.length === 0 && /* @__PURE__ */ React.createElement("button", {
5198
5834
  type: "button",
5199
5835
  className: "tac-tasks-empty",
5200
5836
  onClick: () => pi.ui.showView(DOUBLE_PAGE)
5201
5837
  }, /* @__PURE__ */ React.createElement(ListTodo, {
5202
5838
  size: 14
5203
- }), /* @__PURE__ */ React.createElement("span", null, w.noTasksHere)), [...groups.waiting, ...groups.running, ...ended].map((task) => /* @__PURE__ */ React.createElement(TaskItem, {
5839
+ }), /* @__PURE__ */ React.createElement("span", null, w.noTasksHere)), [...groups.running, ...ended].map((task) => /* @__PURE__ */ React.createElement(TaskItem, {
5204
5840
  key: task.key,
5205
5841
  context,
5206
5842
  task,
@@ -5210,9 +5846,65 @@ function AgentsSidebar({ context }) {
5210
5846
  type: "button",
5211
5847
  className: "tac-show-all",
5212
5848
  onClick: () => setAllEnded(!allEnded)
5213
- }, allEnded ? w.showFewer : ChannelWords.format(w.showAll, { count: String(groups.ended.length) }))), agents.length > 0 && /* @__PURE__ */ React.createElement(Section, {
5849
+ }, allEnded ? w.showFewer : ChannelWords.format(w.showAll, { count: String(groups.ended.length) }))), (channels.length > 0 || groupItems.length > 0) && /* @__PURE__ */ React.createElement(Section, {
5850
+ id: "channels",
5851
+ title: partners ? w.groupsSection : w.channelsSection,
5852
+ count: channels.length + groupItems.length,
5853
+ folded,
5854
+ onFold: fold,
5855
+ alert: channels.some((channel) => unread.includes(channel.id)) || groupItems.some((item) => item.unseen)
5856
+ }, SidebarUtil.byTime([
5857
+ ...channels.map((channel) => ({
5858
+ channel,
5859
+ pinned: !!channel.pinned,
5860
+ at: SidebarUtil.channelAt(channel, state.messages[channel.id])
5861
+ })),
5862
+ ...groupItems.map((item) => ({ item, pinned: false, at: item.at ?? 0 }))
5863
+ ], partners).map((entry) => {
5864
+ if (!("channel" in entry)) {
5865
+ return /* @__PURE__ */ React.createElement(HomeRow, {
5866
+ key: entry.item.key,
5867
+ pi,
5868
+ item: entry.item
5869
+ });
5870
+ }
5871
+ const { channel } = entry;
5872
+ const members = membersOf(team, channel);
5873
+ const busy = working[channel.id] ?? [];
5874
+ const last = state.messages[channel.id]?.filter((message) => message.author !== SYSTEM).at(-1);
5875
+ const preview = busy.length > 0 ? ChannelWords.format(w.answeringNow, { name: busy.map(name).join("、") }) : last ? `${name(last.author)}:${last.text.replace(/\s+/g, " ")}` : channel.topic ?? w.noMessages;
5876
+ return /* @__PURE__ */ React.createElement(Row, {
5877
+ pi,
5878
+ key: channel.id,
5879
+ avatar: /* @__PURE__ */ React.createElement(RoomFace, {
5880
+ members,
5881
+ faces,
5882
+ size: 40,
5883
+ working: busy
5884
+ }),
5885
+ title: channel.name,
5886
+ badge: /* @__PURE__ */ React.createElement(PinMark, {
5887
+ pi,
5888
+ pinned: channel.pinned
5889
+ }),
5890
+ preview,
5891
+ live: busy.length > 0,
5892
+ dot: busy.length > 0 ? "running" : unread.includes(channel.id) ? "attention" : undefined,
5893
+ time: SidebarUtil.time(last?.at ?? channel.createdAt, pi.ui.language),
5894
+ hint: channel.topic ? `#${channel.name} · ${channel.topic}` : `#${channel.name}`,
5895
+ selected: !!channelPage?.shown && channelId === channel.id,
5896
+ deleting: state.deleting.includes(channel.id),
5897
+ onSelect: () => context.showChannel(channel.id),
5898
+ more: /* @__PURE__ */ React.createElement(ChannelMenu, {
5899
+ context,
5900
+ channel,
5901
+ working: busy
5902
+ }),
5903
+ swipe: swipePinDelete(pi, !!channel.pinned, (pinned) => context.service.updateChannel(channel.id, { pinned }), () => deleteChannel(context, channel))
5904
+ });
5905
+ })), agents.length > 0 && /* @__PURE__ */ React.createElement(Section, {
5214
5906
  id: "members",
5215
- title: w.membersSection,
5907
+ title: partners ? w.agentsSection : w.membersSection,
5216
5908
  count: agents.length,
5217
5909
  folded,
5218
5910
  onFold: fold,
@@ -5265,7 +5957,7 @@ function AgentsSidebar({ context }) {
5265
5957
  live: busy && !needsYou,
5266
5958
  waiting: needsYou,
5267
5959
  fresh: unseen,
5268
- dot: needsYou ? "attention" : busy ? "running" : unseen ? "attention" : undefined,
5960
+ dot: needsYou ? "ask" : busy ? "running" : unseen ? "attention" : undefined,
5269
5961
  time: lastLines ? SidebarUtil.time(last?.at ?? agent.createdAt, pi.ui.language) : "",
5270
5962
  hint: SidebarUtil.where(cwd),
5271
5963
  selected: agentSelected(agent),
@@ -5279,48 +5971,7 @@ function AgentsSidebar({ context }) {
5279
5971
  }),
5280
5972
  swipe: swipePinDelete(pi, !!agent.pinned, (pinned) => context.service.updateAgent(agent.id, { pinned }), () => deleteAgent(context, agent))
5281
5973
  });
5282
- })))), channels.length > 0 && /* @__PURE__ */ React.createElement(Section, {
5283
- id: "channels",
5284
- title: w.channelsSection,
5285
- count: channels.length,
5286
- folded,
5287
- onFold: fold,
5288
- alert: channels.some((channel) => unread.includes(channel.id))
5289
- }, channels.map((channel) => {
5290
- const members = membersOf(team, channel);
5291
- const busy = working[channel.id] ?? [];
5292
- const last = state.messages[channel.id]?.filter((message) => message.author !== SYSTEM).at(-1);
5293
- const preview = busy.length > 0 ? ChannelWords.format(w.answeringNow, { name: busy.map(name).join("、") }) : last ? `${name(last.author)}:${last.text.replace(/\s+/g, " ")}` : channel.topic ?? w.noMessages;
5294
- return /* @__PURE__ */ React.createElement(Row, {
5295
- pi,
5296
- key: channel.id,
5297
- avatar: /* @__PURE__ */ React.createElement(RoomFace, {
5298
- members,
5299
- faces,
5300
- size: 40,
5301
- working: busy
5302
- }),
5303
- title: channel.name,
5304
- badge: /* @__PURE__ */ React.createElement(PinMark, {
5305
- pi,
5306
- pinned: channel.pinned
5307
- }),
5308
- preview,
5309
- live: busy.length > 0,
5310
- dot: busy.length > 0 ? "running" : unread.includes(channel.id) ? "attention" : undefined,
5311
- time: SidebarUtil.time(last?.at ?? channel.createdAt, pi.ui.language),
5312
- hint: channel.topic ? `#${channel.name} · ${channel.topic}` : `#${channel.name}`,
5313
- selected: !!channelPage?.shown && channelId === channel.id,
5314
- deleting: state.deleting.includes(channel.id),
5315
- onSelect: () => context.showChannel(channel.id),
5316
- more: /* @__PURE__ */ React.createElement(ChannelMenu, {
5317
- context,
5318
- channel,
5319
- working: busy
5320
- }),
5321
- swipe: swipePinDelete(pi, !!channel.pinned, (pinned) => context.service.updateChannel(channel.id, { pinned }), () => deleteChannel(context, channel))
5322
- });
5323
- })), homeSections.map((section) => /* @__PURE__ */ React.createElement(Section, {
5974
+ })))), homeSections.map((section) => /* @__PURE__ */ React.createElement(Section, {
5324
5975
  key: section.id,
5325
5976
  id: section.id,
5326
5977
  title: section.title,
@@ -5341,6 +5992,113 @@ function AgentsSidebar({ context }) {
5341
5992
  }));
5342
5993
  }
5343
5994
 
5995
+ // web-src/sidebar-head.tsx
5996
+ function SidebarHead({ context }) {
5997
+ const { pi, ui } = context;
5998
+ const { query, creating } = useUi(ui);
5999
+ const w = ChannelViews.words(pi);
6000
+ const [menu, setMenu] = React.useState(false);
6001
+ const menuRef = React.useRef(null);
6002
+ const Plus = ChannelViews.icon(pi, "Plus");
6003
+ const Search = ChannelViews.icon(pi, "Search");
6004
+ const X = ChannelViews.icon(pi, "X");
6005
+ const Hash = ChannelViews.icon(pi, "Hash");
6006
+ const Bot = ChannelViews.icon(pi, "Bot");
6007
+ const ScanLine = ChannelViews.icon(pi, "ScanLine");
6008
+ const UserPlus = ChannelViews.icon(pi, "UserPlus");
6009
+ const scan = pi.ui.scan;
6010
+ const addFriend = !!pi.ui.doubleInChats;
6011
+ React.useEffect(() => {
6012
+ if (!menu) {
6013
+ return;
6014
+ }
6015
+ const close = (event) => {
6016
+ if (!menuRef.current?.contains(event.target)) {
6017
+ setMenu(false);
6018
+ }
6019
+ };
6020
+ document.addEventListener("pointerdown", close);
6021
+ return () => document.removeEventListener("pointerdown", close);
6022
+ }, [menu]);
6023
+ const begin = (kind) => {
6024
+ setMenu(false);
6025
+ if (kind === "agent") {
6026
+ newAgent(context);
6027
+ } else {
6028
+ ui.set({ creating: true });
6029
+ }
6030
+ };
6031
+ return /* @__PURE__ */ React.createElement("div", {
6032
+ className: "tac-toolbar"
6033
+ }, /* @__PURE__ */ React.createElement("label", {
6034
+ className: "tac-search"
6035
+ }, /* @__PURE__ */ React.createElement(Search, {
6036
+ size: 14
6037
+ }), /* @__PURE__ */ React.createElement("input", {
6038
+ value: query,
6039
+ placeholder: w.search,
6040
+ "aria-label": w.search,
6041
+ onChange: (event) => ui.set({ query: event.target.value })
6042
+ }), query && /* @__PURE__ */ React.createElement("button", {
6043
+ type: "button",
6044
+ className: "tac-action",
6045
+ title: w.clear,
6046
+ "aria-label": w.clear,
6047
+ onClick: () => ui.set({ query: "" })
6048
+ }, /* @__PURE__ */ React.createElement(X, {
6049
+ size: 12
6050
+ }))), /* @__PURE__ */ React.createElement("div", {
6051
+ className: "tac-menu-anchor",
6052
+ ref: menuRef
6053
+ }, /* @__PURE__ */ React.createElement("button", {
6054
+ type: "button",
6055
+ className: "tac-add",
6056
+ title: w.new,
6057
+ "aria-label": w.new,
6058
+ "aria-haspopup": "menu",
6059
+ "aria-expanded": menu,
6060
+ onClick: () => setMenu(!menu)
6061
+ }, /* @__PURE__ */ React.createElement(Plus, {
6062
+ size: 16
6063
+ })), menu && /* @__PURE__ */ React.createElement("div", {
6064
+ className: "tac-menu",
6065
+ role: "menu"
6066
+ }, /* @__PURE__ */ React.createElement("button", {
6067
+ type: "button",
6068
+ role: "menuitem",
6069
+ onClick: () => begin("channel")
6070
+ }, /* @__PURE__ */ React.createElement(Hash, {
6071
+ size: 14
6072
+ }), w.newChannel), addFriend && /* @__PURE__ */ React.createElement("button", {
6073
+ type: "button",
6074
+ role: "menuitem",
6075
+ onClick: () => {
6076
+ setMenu(false);
6077
+ pi.ui.showView("@celljs/ta-rooms/add-friend");
6078
+ }
6079
+ }, /* @__PURE__ */ React.createElement(UserPlus, {
6080
+ size: 14
6081
+ }), w.addFriend), scan && /* @__PURE__ */ React.createElement("button", {
6082
+ type: "button",
6083
+ role: "menuitem",
6084
+ onClick: () => {
6085
+ setMenu(false);
6086
+ scan();
6087
+ }
6088
+ }, /* @__PURE__ */ React.createElement(ScanLine, {
6089
+ size: 14
6090
+ }), w.scan), /* @__PURE__ */ React.createElement("button", {
6091
+ type: "button",
6092
+ role: "menuitem",
6093
+ onClick: () => begin("agent")
6094
+ }, /* @__PURE__ */ React.createElement(Bot, {
6095
+ size: 14
6096
+ }), w.newAgent))), creating && /* @__PURE__ */ React.createElement(NewChannelDialog, {
6097
+ context,
6098
+ onClose: () => ui.set({ creating: false })
6099
+ }));
6100
+ }
6101
+
5344
6102
  // web-src/style.ts
5345
6103
  var STYLE = `
5346
6104
  .tac-view { display: flex; flex-direction: column; height: 100%; min-height: 0; color: var(--ta-text); font-size: calc(13px * var(--ta-font-scale)); }
@@ -5363,16 +6121,13 @@ var STYLE = `
5363
6121
  .tac-list:has(> .ta-empty:not(.ta-empty-compact)) { display: flex; flex-direction: column; }
5364
6122
  .tac-list > .tac-view > .tac-form { margin: 2px 10px 8px; }
5365
6123
  /* The double first, a card of its own: the one the user talks to. --tac-double-bg and -edge change with hover and press. */
5366
- .tac-double { --tac-double-bg: var(--ta-raised); --tac-double-edge: color-mix(in srgb, var(--ta-text) 7%, transparent); display: flex; align-items: center; gap: 14px; width: 100%; min-height: 80px; margin: 4px 0 14px; padding: 12px 44px 12px 12px; border: 1px solid var(--tac-double-edge); border-radius: 18px; background: var(--tac-double-bg); color: var(--ta-text); font: inherit; text-align: left; cursor: pointer; transition: background-color 120ms, border-color 160ms; box-sizing: border-box; }
6124
+ .tac-double { --tac-double-bg: var(--ta-raised); --tac-double-edge: color-mix(in srgb, var(--ta-text) 7%, transparent); display: flex; align-items: center; gap: 14px; width: 100%; min-height: 80px; margin: 4px 0 14px; padding: 12px 9px 12px 12px; border: 1px solid var(--tac-double-edge); border-radius: 18px; background: var(--tac-double-bg); color: var(--ta-text); font: inherit; text-align: left; cursor: pointer; transition: background-color 120ms, border-color 160ms; box-sizing: border-box; }
5367
6125
  :root[data-theme='light'] .tac-double { --tac-double-bg: var(--ta-card); --tac-double-edge: var(--ta-border-muted); }
5368
6126
  .tac-double:hover { --tac-double-bg: var(--ta-hover); }
5369
6127
  .tac-double.tac-selected { --tac-double-edge: color-mix(in srgb, var(--ta-accent) 40%, transparent); }
5370
6128
  /* The dinosaur on a disc of its color, as a profile picture. */
5371
6129
  .tac-double-face { display: inline-grid; place-items: center; width: 52px; height: 52px; flex: none; border-radius: 50%; background: color-mix(in oklch, var(--ta-accent) 34%, var(--ta-main)); }
5372
6130
  .tac-double-text { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
5373
- /* A finger has no … to hover: the card says it opens, as a profile card does. */
5374
- .tac-double-go { display: none; flex: none; margin-right: -2px; color: var(--ta-muted); opacity: 0.7; }
5375
- :root[data-touch] .tac-double-go { display: inline-flex; }
5376
6131
  .tac-double-row { position: relative; }
5377
6132
  .tac-pinned { display: inline-flex; flex: none; color: var(--ta-muted); }
5378
6133
  .tac-double-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: calc(16px * var(--ta-font-scale)); font-weight: 600; line-height: calc(22px * var(--ta-font-scale)); letter-spacing: 0.01em; }
@@ -5439,19 +6194,13 @@ button.tac-notice-line:disabled { cursor: default; }
5439
6194
  .tac-card-who { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-top: 4px; }
5440
6195
  .tac-card-face { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 6px; }
5441
6196
  .tac-card-mark { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--ta-hover); font-size: 22px; font-weight: 700; }
6197
+ .ta-share-face .tac-card-mark { width: 100%; height: 100%; border-radius: 0; font-size: calc(18px * var(--ta-font-scale)); }
5442
6198
  .tac-card-name { font-size: calc(16px * var(--ta-font-scale)); font-weight: 600; }
5443
6199
  .tac-card-kind { color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
5444
6200
  .tac-card-role { max-height: 160px; overflow-y: auto; padding: 10px 12px; border: 1px solid var(--ta-border-muted); border-radius: 12px; background: var(--ta-side); color: var(--ta-body); font-size: calc(13px * var(--ta-font-scale)); line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
5445
6201
  .tac-card-page .tac-card-role { max-height: none; white-space: normal; }
5446
- .tac-card-qr { display: grid; place-items: center; }
5447
- .tac-card-qr canvas, .tac-card-qr svg, .tac-card-qr img { width: 168px; height: 168px; }
5448
- .tac-card-link { padding: 8px 10px; border-radius: 8px; background: var(--ta-hover); color: var(--ta-secondary); font-family: var(--ta-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: calc(11.5px * var(--ta-font-scale)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
5449
- .tac-card-actions { display: flex; justify-content: center; gap: 8px; }
5450
- .tac-card-actions .tac-button { height: 36px; padding: 0 16px; }
5451
- .tac-card-stop { align-self: center; padding: 4px 8px; border: 0; background: none; color: var(--ta-muted); font: inherit; font-size: calc(12.5px * var(--ta-font-scale)); cursor: pointer; }
5452
- .tac-card-stop:hover:not(:disabled) { color: var(--ta-red); }
5453
- .tac-card-making { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 120px; color: var(--ta-muted); font-size: calc(13px * var(--ta-font-scale)); }
5454
6202
  .tac-card-page { flex: 1; min-height: 0; height: 100%; overflow-y: auto; padding: 28px 20px 40px; box-sizing: border-box; background: var(--ta-main); color: var(--ta-text); }
6203
+ .tac-card-page:has(> .ta-loading) { display: flex; flex-direction: column; }
5455
6204
  .tac-card-page > .tac-card { max-width: 520px; margin: 0 auto; }
5456
6205
  .tac-card-page .tac-button.tac-primary { height: 40px; font-size: calc(14px * var(--ta-font-scale)); }
5457
6206
  .tac-card-dir { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--ta-secondary); font-size: calc(13px * var(--ta-font-scale)); }
@@ -5511,7 +6260,6 @@ div.tac-dialog-label { flex-direction: row; justify-content: space-between; marg
5511
6260
  .tac-pick-role { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
5512
6261
  .tac-dialog-note { color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
5513
6262
  .tac-dialog-actions { display: flex; justify-content: flex-end; margin-top: 4px; }
5514
- .tac-dialog-actions .tac-button { height: 36px; padding: 0 18px; font-size: calc(13.5px * var(--ta-font-scale)); }
5515
6263
  [data-layout='compact'] .tac-new-head > .tac-button { position: static; margin-left: auto; }
5516
6264
  [data-layout='compact'] .tac-new-head { justify-content: flex-start; }
5517
6265
  [data-layout='compact'] .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; }
@@ -5540,20 +6288,6 @@ div.tac-dialog-label { flex-direction: row; justify-content: space-between; marg
5540
6288
  .tac-item-bottom .ta-host-tag { gap: 4px; }
5541
6289
  .tac-item-bottom .ta-host-tag > svg { width: calc(12px * var(--ta-font-scale)); height: calc(12px * var(--ta-font-scale)); }
5542
6290
  .tac-item-bottom .ta-host-tag + .tac-item-preview::before { content: '·'; margin-right: 6px; }
5543
- /* The panda's ears are ink, lost on a dark page: a lighter ink there. */
5544
- :root:not([data-theme='light']) .tac-face[data-face="11"] .tac-face-body > g > circle { fill: #4a4a52; }
5545
- .tac-face { display: inline-flex; flex: none; }
5546
- .tac-face svg { display: block; overflow: visible; }
5547
- .tac-face-eyes { transform-box: fill-box; transform-origin: center; animation: tac-blink 5.2s infinite; }
5548
- .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; }
5549
- .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; }
5550
- .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; }
5551
- .tac-face-working .tac-face-look { animation: tac-look 2.4s ease-in-out infinite; }
5552
- .tac-face-working .tac-face-body { transform-box: fill-box; transform-origin: 50% 100%; animation: tac-bob 1.2s ease-in-out infinite; }
5553
- @keyframes tac-blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(0.1); } }
5554
- @keyframes tac-look { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-1.4px); } 70% { transform: translateX(1.4px); } }
5555
- @keyframes tac-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.2px); } }
5556
- @media (prefers-reduced-motion: reduce) { .tac-face * { animation: none !important; } }
5557
6291
  .tac-room { position: relative; display: inline-flex; flex: none; }
5558
6292
  .tac-room-back { position: absolute; right: 0; top: 0; }
5559
6293
  .tac-room-front { position: absolute; left: 0; bottom: 0; z-index: 1; }
@@ -5636,6 +6370,9 @@ textarea.tac-input { resize: vertical; min-height: 56px; line-height: 1.5; }
5636
6370
  .tac-item-more > .tac-action:hover, .tac-item-more > .tac-action[aria-expanded="true"] { background: var(--ta-hover-strong); color: var(--ta-text); }
5637
6371
  .tac-item-row:hover .tac-item-more > .tac-action, .tac-double-row:hover .tac-item-more > .tac-action, .tac-item-more > .tac-action:focus-visible, .tac-item-more > .tac-action[aria-expanded="true"] { opacity: 1; }
5638
6372
  .tac-item-row:hover .tac-item-time, .tac-item-row:has(.tac-item-more [aria-expanded="true"]) .tac-item-time { visibility: hidden; }
6373
+ /* The double's time and spinner end where a task's do (its border and padding make the 10px of a row); its … covers them while hovered. */
6374
+ .tac-double-row:has(> .tac-item-more):hover .tac-double :is(.tac-item-time, .tac-spinner), .tac-double-row:has(.tac-item-more [aria-expanded="true"]) .tac-double :is(.tac-item-time, .tac-spinner) { visibility: hidden; }
6375
+ :root[data-touch] .tac-double-row .tac-double :is(.tac-item-time, .tac-spinner) { visibility: visible; }
5639
6376
  .tac-agent-menu { position: fixed; right: auto; width: max-content; min-width: 210px; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow-y: auto; padding: 5px; border-color: var(--ta-border); background: var(--ta-side); }
5640
6377
  /* A row whose menu is open is over the rows after it: a row that swipes (ui.SwipeRow) is a layer of its own, which would draw the next rows over its menu. */
5641
6378
  .ta-swipe-content:has(> .tac-item-more > [aria-expanded="true"]), .tac-item-row:has(> .tac-item-more > [aria-expanded="true"]), .tac-double-row:has(.tac-item-more > [aria-expanded="true"]) { z-index: 5; }
@@ -5651,7 +6388,6 @@ textarea.tac-role-input { min-height: 200px; max-height: 50vh; font-size: calc(1
5651
6388
  */
5652
6389
  :root[data-touch] .tac-item-more > .tac-action { visibility: hidden; }
5653
6390
  :root[data-touch] .tac-item-row .tac-item-time { visibility: visible; }
5654
- :root[data-touch] .tac-double { padding-right: 10px; }
5655
6391
  :root[data-touch] .tac-item:not(.tac-selected):hover { --tac-bg: var(--ta-side); background: none; }
5656
6392
  :root[data-touch] .tac-double:hover { --tac-double-bg: var(--ta-raised); }
5657
6393
  :root[data-theme='light'][data-touch] .tac-double:hover { --tac-double-bg: var(--ta-card); }
@@ -5668,7 +6404,7 @@ textarea.tac-role-input { min-height: 200px; max-height: 50vh; font-size: calc(1
5668
6404
  .tac-double-line > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
5669
6405
  /* Something goes on: a spinner ends its line, as in the list of conversations. */
5670
6406
  .tac-spinner.ta-spinner { width: 12px; height: 12px; }
5671
- .tac-double-line.tac-waiting { color: color-mix(in srgb, var(--ta-yellow) 85%, var(--ta-text)); }
6407
+ .tac-double-line.tac-waiting { color: color-mix(in srgb, var(--ta-blue) 85%, var(--ta-text)); }
5672
6408
  .tac-section { display: flex; flex-direction: column; }
5673
6409
  /* A section is named, not boxed: a quiet name and count, the chevron only while hovered or folded. */
5674
6410
  .tac-section + .tac-section { margin-top: 10px; }
@@ -5705,9 +6441,13 @@ textarea.tac-role-input { min-height: 200px; max-height: 50vh; font-size: calc(1
5705
6441
  .tac-double-face > .tac-dot { right: 1px; bottom: 1px; width: 14px; height: 14px; border-width: 2.5px; --tac-bg: var(--tac-double-bg); }
5706
6442
  .tac-dot-running { --tac-dot: var(--ta-green); }
5707
6443
  .tac-dot-attention { --tac-dot: var(--ta-yellow); }
6444
+ /* It waits for the user to decide: a blue ?, as the rows of the chats (ta-notify.md 6), larger to hold it. */
6445
+ .tac-dot-ask { --tac-dot: var(--ta-blue); display: grid; place-items: center; right: -3px; bottom: -3px; width: 17px; height: 17px; color: #fff; font-size: calc(10px * var(--ta-font-scale)); font-weight: 700; line-height: 1; }
6446
+ .tac-dot-ask::before { content: '?'; }
6447
+ .tac-double-face > .tac-dot-ask { right: 0; bottom: 0; width: 18px; height: 18px; }
5708
6448
  /* The dot grows in, turns from green to amber when an answer ends unseen (a ripple or two says so), and shrinks away once looked at. */
5709
6449
  .tac-dot { transform: scale(0); opacity: 0; transition: transform 0.24s cubic-bezier(0.3, 1.5, 0.5, 1), opacity 0.18s ease, background-color 0.5s ease; }
5710
- .tac-dot-running, .tac-dot-attention { transform: none; opacity: 1; }
6450
+ .tac-dot-running, .tac-dot-attention, .tac-dot-ask { transform: none; opacity: 1; }
5711
6451
  .tac-dot-attention::after { content: ''; position: absolute; inset: -2px; border-radius: 50%; animation: tac-ripple 1.5s ease-out 0.3s 2 both; }
5712
6452
  @keyframes tac-ripple { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ta-yellow) 55%, transparent); } to { box-shadow: 0 0 0 7px color-mix(in srgb, var(--ta-yellow) 0%, transparent); } }
5713
6453
  @media (prefers-reduced-motion: reduce) { .tac-dot { transition: opacity 0.18s ease; } .tac-dot-attention::after { animation: none; } }
@@ -5715,7 +6455,7 @@ textarea.tac-role-input { min-height: 200px; max-height: 50vh; font-size: calc(1
5715
6455
  .tac-item-preview.tac-fresh, .tac-double-line.tac-fresh { color: var(--ta-text); }
5716
6456
  .tac-section-alert { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--ta-yellow); }
5717
6457
 
5718
- .tac-item-preview.tac-waiting { color: color-mix(in srgb, var(--ta-yellow) 85%, var(--ta-text)); }
6458
+ .tac-item-preview.tac-waiting { color: color-mix(in srgb, var(--ta-blue) 85%, var(--ta-text)); }
5719
6459
  .tac-task-face { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; overflow: hidden; }
5720
6460
  .tac-task-glyph { background: var(--ta-chip); color: var(--ta-secondary); }
5721
6461
  /* No task yet: one quiet line where they will be, so the place is known before the first. */
@@ -5894,17 +6634,19 @@ function activate(pi) {
5894
6634
  new ChannelToolLines(context).register();
5895
6635
  pi.registerMessageRenderer(HandOff.CARD, HandOffView.card(context));
5896
6636
  pi.registerComposerAddon(HandOffView.composerAddon(context));
6637
+ const partners = !!pi.ui.doubleInChats;
5897
6638
  pi.registerView("channels", {
5898
- title: () => ChannelWords.of(pi.ui.language).title,
5899
- icon: ChannelViews.icon(pi, "Bot"),
6639
+ title: () => partners ? ChannelWords.of(pi.ui.language).partners : ChannelWords.of(pi.ui.language).title,
6640
+ icon: ChannelViews.icon(pi, partners ? "Users" : "Bot"),
5900
6641
  head: () => /* @__PURE__ */ React.createElement(SidebarHead, {
5901
6642
  context
5902
6643
  }),
5903
6644
  render: () => /* @__PURE__ */ React.createElement(AgentsSidebar, {
5904
- context
6645
+ context,
6646
+ partners
5905
6647
  }),
5906
6648
  location: "sidebar",
5907
- pages: [DOUBLE_PAGE, CHANNEL_PAGE, AGENT_PAGE],
6649
+ pages: partners ? [CHANNEL_PAGE, AGENT_PAGE] : [DOUBLE_PAGE, CHANNEL_PAGE, AGENT_PAGE],
5908
6650
  order: 80
5909
6651
  });
5910
6652
  pi.registerView("channel", {