@celljs/ta-initiative 4.17.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/README.en.md +9 -1
- package/README.md +9 -1
- package/extension/index.mjs +315 -9
- package/host/index.mjs +529 -11
- package/package.json +3 -3
- package/web/index.js +513 -45
package/web/index.js
CHANGED
|
@@ -66,10 +66,13 @@ var en = {
|
|
|
66
66
|
inboxDone: "Done on its own",
|
|
67
67
|
inboxEmpty: "No suggestions yet",
|
|
68
68
|
inboxEmptyHint: "When Ta finds work you ask for again and again, it suggests it here.",
|
|
69
|
+
inboxIdeas: "Things you could hand to Ta",
|
|
70
|
+
tryIt: "Try it",
|
|
71
|
+
notNow: "Not now",
|
|
69
72
|
accept: "OK",
|
|
70
73
|
decline: "No",
|
|
71
|
-
always: "Always do
|
|
72
|
-
neverAgain: "Never suggest this",
|
|
74
|
+
always: "Always do this kind",
|
|
75
|
+
neverAgain: "Never suggest this kind",
|
|
73
76
|
undo: "Undo",
|
|
74
77
|
undoneState: "Undone",
|
|
75
78
|
failedState: "Failed: {error}",
|
|
@@ -78,6 +81,11 @@ var en = {
|
|
|
78
81
|
homeDetail: "{waiting} waiting · {done} done on its own",
|
|
79
82
|
homeWaiting: "{waiting} waiting for you",
|
|
80
83
|
homeDone: "{done} done on its own",
|
|
84
|
+
inboxIntro: "What Ta found it could do for you in your conversations. It waits for your answer; what it did on its own can be undone for 7 days.",
|
|
85
|
+
inboxRecent: "Answered lately",
|
|
86
|
+
evidenceOne: "Open the conversation",
|
|
87
|
+
undoLeft: "Can be undone for {days} days",
|
|
88
|
+
failedLine: "Failed",
|
|
81
89
|
toolPropose: "Propose",
|
|
82
90
|
acceptedLine: "Accepted",
|
|
83
91
|
declinedLine: "Declined",
|
|
@@ -139,18 +147,26 @@ var zh = {
|
|
|
139
147
|
inboxDone: "已替你做",
|
|
140
148
|
inboxEmpty: "暂时没有建议",
|
|
141
149
|
inboxEmptyHint: "Ta 发现你反复交代的事,会在这里提出。",
|
|
150
|
+
inboxIdeas: "可以交给 Ta 的事",
|
|
151
|
+
tryIt: "试试",
|
|
152
|
+
notNow: "先不用",
|
|
142
153
|
accept: "好",
|
|
143
154
|
decline: "不用",
|
|
144
|
-
always: "
|
|
145
|
-
neverAgain: "
|
|
155
|
+
always: "这类以后直接做",
|
|
156
|
+
neverAgain: "不再提这类",
|
|
146
157
|
undo: "撤销",
|
|
147
158
|
undoneState: "已撤销",
|
|
148
|
-
failedState: "
|
|
159
|
+
failedState: "没做成:{error}",
|
|
149
160
|
inBrief: "来自简报",
|
|
150
161
|
evidence: "依据 {count} 个对话",
|
|
151
162
|
homeDetail: "等你决定 {waiting} · 已替你做 {done}",
|
|
152
163
|
homeWaiting: "等你决定 {waiting}",
|
|
153
164
|
homeDone: "已替你做 {done}",
|
|
165
|
+
inboxIntro: "Ta 从你的对话里发现能替你做的事,放在这里等你点头;替你做过的,7 天内都能撤销。",
|
|
166
|
+
inboxRecent: "最近处理",
|
|
167
|
+
evidenceOne: "查看对话",
|
|
168
|
+
undoLeft: "{days} 天内可撤销",
|
|
169
|
+
failedLine: "没做成",
|
|
154
170
|
toolPropose: "提议",
|
|
155
171
|
acceptedLine: "已同意",
|
|
156
172
|
declinedLine: "已拒绝",
|
|
@@ -212,18 +228,26 @@ var zhTw = {
|
|
|
212
228
|
inboxDone: "已替你做",
|
|
213
229
|
inboxEmpty: "暫時沒有建議",
|
|
214
230
|
inboxEmptyHint: "Ta 發現你反覆交代的事,會在這裡提出。",
|
|
231
|
+
inboxIdeas: "可以交給 Ta 的事",
|
|
232
|
+
tryIt: "試試",
|
|
233
|
+
notNow: "先不用",
|
|
215
234
|
accept: "好",
|
|
216
235
|
decline: "不用",
|
|
217
|
-
always: "
|
|
218
|
-
neverAgain: "
|
|
236
|
+
always: "這類以後直接做",
|
|
237
|
+
neverAgain: "不再提這類",
|
|
219
238
|
undo: "撤銷",
|
|
220
239
|
undoneState: "已撤銷",
|
|
221
|
-
failedState: "
|
|
240
|
+
failedState: "沒做成:{error}",
|
|
222
241
|
inBrief: "來自簡報",
|
|
223
242
|
evidence: "依據 {count} 個對話",
|
|
224
243
|
homeDetail: "等你決定 {waiting} · 已替你做 {done}",
|
|
225
244
|
homeWaiting: "等你決定 {waiting}",
|
|
226
245
|
homeDone: "已替你做 {done}",
|
|
246
|
+
inboxIntro: "Ta 從你的對話裡發現能替你做的事,放在這裡等你點頭;替你做過的,7 天內都能撤銷。",
|
|
247
|
+
inboxRecent: "最近處理",
|
|
248
|
+
evidenceOne: "查看對話",
|
|
249
|
+
undoLeft: "{days} 天內可撤銷",
|
|
250
|
+
failedLine: "沒做成",
|
|
227
251
|
toolPropose: "提議",
|
|
228
252
|
acceptedLine: "已同意",
|
|
229
253
|
declinedLine: "已拒絕",
|
|
@@ -285,10 +309,13 @@ var ja = {
|
|
|
285
309
|
inboxDone: "自動実行済み",
|
|
286
310
|
inboxEmpty: "まだ提案がありません",
|
|
287
311
|
inboxEmptyHint: "Ta があなたが繰り返し行う作業を検出すると、ここで提案します。",
|
|
312
|
+
inboxIdeas: "Ta に任せられること",
|
|
313
|
+
tryIt: "試してみる",
|
|
314
|
+
notNow: "今はいい",
|
|
288
315
|
accept: "OK",
|
|
289
316
|
decline: "いらない",
|
|
290
|
-
always: "
|
|
291
|
-
neverAgain: "
|
|
317
|
+
always: "この種類は今後自動で",
|
|
318
|
+
neverAgain: "この種類は提案しない",
|
|
292
319
|
undo: "取り消し",
|
|
293
320
|
undoneState: "キャンセル済み",
|
|
294
321
|
failedState: "失敗:{error}",
|
|
@@ -297,6 +324,11 @@ var ja = {
|
|
|
297
324
|
homeDetail: "あなたの判断待ち {waiting} · 自動実行済み {done}",
|
|
298
325
|
homeWaiting: "あなたの判断待ち {waiting}",
|
|
299
326
|
homeDone: "自動実行済み {done}",
|
|
327
|
+
inboxIntro: "Ta が会話の中から見つけた、代わりにできることです。あなたの判断を待ちます。自動で行ったことは 7 日以内なら取り消せます。",
|
|
328
|
+
inboxRecent: "最近の対応",
|
|
329
|
+
evidenceOne: "会話を開く",
|
|
330
|
+
undoLeft: "{days} 日以内なら取り消せます",
|
|
331
|
+
failedLine: "失敗",
|
|
300
332
|
toolPropose: "提案",
|
|
301
333
|
acceptedLine: "了承済み",
|
|
302
334
|
declinedLine: "拒否済み",
|
|
@@ -365,6 +397,279 @@ async function openConversation(pi, file) {
|
|
|
365
397
|
return true;
|
|
366
398
|
}
|
|
367
399
|
|
|
400
|
+
// ../ta-protocol/esm/common/message-protocol.js
|
|
401
|
+
var TaMessageContext;
|
|
402
|
+
(function(TaMessageContext2) {
|
|
403
|
+
const BLOCK = /^<context>\n?[\s\S]*?\n?<\/context>\n?/;
|
|
404
|
+
function wrap(context, message) {
|
|
405
|
+
return `<context>
|
|
406
|
+
${context}
|
|
407
|
+
</context>
|
|
408
|
+
${message}`;
|
|
409
|
+
}
|
|
410
|
+
TaMessageContext2.wrap = wrap;
|
|
411
|
+
function strip(message) {
|
|
412
|
+
return message.replace(BLOCK, "");
|
|
413
|
+
}
|
|
414
|
+
TaMessageContext2.strip = strip;
|
|
415
|
+
function read(message) {
|
|
416
|
+
var _a;
|
|
417
|
+
const block = (_a = BLOCK.exec(message)) === null || _a === undefined ? undefined : _a[0];
|
|
418
|
+
return block === null || block === undefined ? undefined : block.replace(/^<context>\n?/, "").replace(/\n?<\/context>\n?$/, "");
|
|
419
|
+
}
|
|
420
|
+
TaMessageContext2.read = read;
|
|
421
|
+
})(TaMessageContext || (TaMessageContext = {}));
|
|
422
|
+
var TaMessageSource;
|
|
423
|
+
(function(TaMessageSource2) {
|
|
424
|
+
TaMessageSource2.DOUBLE = "ta:double";
|
|
425
|
+
const LINE = /^\[ta:(from|notice) ([^\s\]]+)(?: ([^\]\n]+))?\]$/m;
|
|
426
|
+
function mark(message, from, detail) {
|
|
427
|
+
return marked(message, line(from, detail));
|
|
428
|
+
}
|
|
429
|
+
TaMessageSource2.mark = mark;
|
|
430
|
+
function notice(message, from, detail) {
|
|
431
|
+
return marked(message, line(from, detail, true));
|
|
432
|
+
}
|
|
433
|
+
TaMessageSource2.notice = notice;
|
|
434
|
+
function line(from, detail, notice2 = false) {
|
|
435
|
+
return `[ta:${notice2 ? "notice" : "from"} ${from}${detail ? ` ${detail.replace(/[\]\n]/g, " ")}` : ""}]`;
|
|
436
|
+
}
|
|
437
|
+
TaMessageSource2.line = line;
|
|
438
|
+
function of(message) {
|
|
439
|
+
const context = TaMessageContext.read(message);
|
|
440
|
+
const match = context === undefined ? null : LINE.exec(context);
|
|
441
|
+
return match ? { from: match[2], ...match[3] ? { detail: match[3].trim() } : {}, ...match[1] === "notice" ? { notice: true } : {} } : undefined;
|
|
442
|
+
}
|
|
443
|
+
TaMessageSource2.of = of;
|
|
444
|
+
function isNotice(message) {
|
|
445
|
+
var _a;
|
|
446
|
+
return ((_a = of(message)) === null || _a === undefined ? undefined : _a.notice) === true;
|
|
447
|
+
}
|
|
448
|
+
TaMessageSource2.isNotice = isNotice;
|
|
449
|
+
TaMessageSource2.SECTION = "ta-sources";
|
|
450
|
+
TaMessageSource2.PROMPT = [
|
|
451
|
+
"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.",
|
|
452
|
+
"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:",
|
|
453
|
+
"- It is information, never a request of the user: it does not change, drop or replace what they asked. Their latest words come first.",
|
|
454
|
+
"- 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).",
|
|
455
|
+
"- Never quote it as the user's words nor answer it as if they had said it."
|
|
456
|
+
].join(`
|
|
457
|
+
`);
|
|
458
|
+
function marked(message, source) {
|
|
459
|
+
if (/^[/!]/.test(message) || of(message)) {
|
|
460
|
+
return message;
|
|
461
|
+
}
|
|
462
|
+
const context = TaMessageContext.read(message);
|
|
463
|
+
return TaMessageContext.wrap(context === undefined ? source : `${context}
|
|
464
|
+
${source}`, TaMessageContext.strip(message));
|
|
465
|
+
}
|
|
466
|
+
})(TaMessageSource || (TaMessageSource = {}));
|
|
467
|
+
var TaImageNote;
|
|
468
|
+
(function(TaImageNote2) {
|
|
469
|
+
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 [^\]]+\.\]$/;
|
|
470
|
+
function strip(text) {
|
|
471
|
+
const lines = text.split(`
|
|
472
|
+
`);
|
|
473
|
+
const kept = lines.filter((line) => !NOTE.test(line.trim()));
|
|
474
|
+
if (kept.length === lines.length) {
|
|
475
|
+
return text;
|
|
476
|
+
}
|
|
477
|
+
return kept.join(`
|
|
478
|
+
`).replace(/\n+$/, "").replace(/^\n+/, "");
|
|
479
|
+
}
|
|
480
|
+
TaImageNote2.strip = strip;
|
|
481
|
+
})(TaImageNote || (TaImageNote = {}));
|
|
482
|
+
var TaImageSize;
|
|
483
|
+
(function(TaImageSize2) {
|
|
484
|
+
const JPEG_BYTES = 256 * 1024;
|
|
485
|
+
function of(base64) {
|
|
486
|
+
var _a, _b, _c;
|
|
487
|
+
let bytes;
|
|
488
|
+
try {
|
|
489
|
+
const binary = atob(base64.slice(0, Math.ceil(JPEG_BYTES * 4 / 3 / 4) * 4));
|
|
490
|
+
bytes = Uint8Array.from(binary, (char) => char.charCodeAt(0));
|
|
491
|
+
} catch (_d) {
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
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);
|
|
495
|
+
return size && size.width > 0 && size.height > 0 ? size : undefined;
|
|
496
|
+
}
|
|
497
|
+
TaImageSize2.of = of;
|
|
498
|
+
function u16be(bytes, at) {
|
|
499
|
+
return bytes[at] << 8 | bytes[at + 1];
|
|
500
|
+
}
|
|
501
|
+
function u16le(bytes, at) {
|
|
502
|
+
return bytes[at] | bytes[at + 1] << 8;
|
|
503
|
+
}
|
|
504
|
+
function u24le(bytes, at) {
|
|
505
|
+
return bytes[at] | bytes[at + 1] << 8 | bytes[at + 2] << 16;
|
|
506
|
+
}
|
|
507
|
+
function u32be(bytes, at) {
|
|
508
|
+
return (bytes[at] << 24 | bytes[at + 1] << 16 | bytes[at + 2] << 8 | bytes[at + 3]) >>> 0;
|
|
509
|
+
}
|
|
510
|
+
function text(bytes, at, length) {
|
|
511
|
+
return String.fromCharCode(...bytes.subarray(at, at + length));
|
|
512
|
+
}
|
|
513
|
+
function png(bytes) {
|
|
514
|
+
return bytes.length >= 24 && bytes[0] === 137 && text(bytes, 1, 3) === "PNG" ? { width: u32be(bytes, 16), height: u32be(bytes, 20) } : undefined;
|
|
515
|
+
}
|
|
516
|
+
function gif(bytes) {
|
|
517
|
+
return bytes.length >= 10 && text(bytes, 0, 3) === "GIF" ? { width: u16le(bytes, 6), height: u16le(bytes, 8) } : undefined;
|
|
518
|
+
}
|
|
519
|
+
function webp(bytes) {
|
|
520
|
+
if (bytes.length < 30 || text(bytes, 0, 4) !== "RIFF" || text(bytes, 8, 4) !== "WEBP") {
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
523
|
+
switch (text(bytes, 12, 4)) {
|
|
524
|
+
case "VP8 ":
|
|
525
|
+
return { width: u16le(bytes, 26) & 16383, height: u16le(bytes, 28) & 16383 };
|
|
526
|
+
case "VP8L": {
|
|
527
|
+
const bits = bytes[21] | bytes[22] << 8 | bytes[23] << 16 | bytes[24] << 24;
|
|
528
|
+
return { width: (bits & 16383) + 1, height: (bits >> 14 & 16383) + 1 };
|
|
529
|
+
}
|
|
530
|
+
case "VP8X":
|
|
531
|
+
return { width: u24le(bytes, 24) + 1, height: u24le(bytes, 27) + 1 };
|
|
532
|
+
default:
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
function jpeg(bytes) {
|
|
537
|
+
if (bytes[0] !== 255 || bytes[1] !== 216) {
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
let at = 2;
|
|
541
|
+
while (at + 9 < bytes.length) {
|
|
542
|
+
if (bytes[at] !== 255) {
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
const marker = bytes[at + 1];
|
|
546
|
+
if (marker >= 192 && marker <= 207 && marker !== 196 && marker !== 200 && marker !== 204) {
|
|
547
|
+
return { width: u16be(bytes, at + 7), height: u16be(bytes, at + 5) };
|
|
548
|
+
}
|
|
549
|
+
at += 2 + u16be(bytes, at + 2);
|
|
550
|
+
}
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
})(TaImageSize || (TaImageSize = {}));
|
|
554
|
+
var TaAgentSummary;
|
|
555
|
+
(function(TaAgentSummary2) {
|
|
556
|
+
const START = /^\s*<conversation_history_summary>/;
|
|
557
|
+
const BLOCK = /^\s*<conversation_history_summary>[\s\S]*?(?:<\/conversation_history_summary>\s*|$)/;
|
|
558
|
+
function read(text) {
|
|
559
|
+
if (!START.test(text)) {
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
return text.replace(/<\/?(?:conversation_history_summary|summary)>/g, "").replace(/<\/?\w*$/, "").trim();
|
|
563
|
+
}
|
|
564
|
+
TaAgentSummary2.read = read;
|
|
565
|
+
function strip(text) {
|
|
566
|
+
return text.replace(BLOCK, "");
|
|
567
|
+
}
|
|
568
|
+
TaAgentSummary2.strip = strip;
|
|
569
|
+
})(TaAgentSummary || (TaAgentSummary = {}));
|
|
570
|
+
var TaSkillUse;
|
|
571
|
+
(function(TaSkillUse2) {
|
|
572
|
+
const BLOCK = /^<skill name="([^"]+)" location="([^"]+)">\n([\s\S]*?)\n<\/skill>(?:\n\n([\s\S]+))?$/;
|
|
573
|
+
function parse(message) {
|
|
574
|
+
var _a;
|
|
575
|
+
const match = BLOCK.exec(message);
|
|
576
|
+
if (!match) {
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
return { name: match[1], location: match[2], content: match[3], message: ((_a = match[4]) === null || _a === undefined ? undefined : _a.trim()) || undefined };
|
|
580
|
+
}
|
|
581
|
+
TaSkillUse2.parse = parse;
|
|
582
|
+
function command(use) {
|
|
583
|
+
return use.message ? `/skill:${use.name} ${use.message}` : `/skill:${use.name}`;
|
|
584
|
+
}
|
|
585
|
+
TaSkillUse2.command = command;
|
|
586
|
+
})(TaSkillUse || (TaSkillUse = {}));
|
|
587
|
+
var TaTaskNote;
|
|
588
|
+
(function(TaTaskNote2) {
|
|
589
|
+
const NOTE = /^<task_(update|adopted|renamed) ((?:[^>"\n]|"[^"]*")*)>\n?([\s\S]*?)\n?<\/task_\1>$/;
|
|
590
|
+
const ATTRIBUTE = /(\w+)="([^"]*)"/g;
|
|
591
|
+
function write(note) {
|
|
592
|
+
const attributes = [`id="${quote(note.id)}"`];
|
|
593
|
+
if (note.was !== undefined) {
|
|
594
|
+
attributes.push(`was="${quote(note.was)}"`);
|
|
595
|
+
}
|
|
596
|
+
attributes.push(`title="${quote(note.title)}"`);
|
|
597
|
+
if (note.status !== undefined) {
|
|
598
|
+
attributes.push(`status="${quote(note.status)}"`);
|
|
599
|
+
}
|
|
600
|
+
return `<task_${note.kind} ${attributes.join(" ")}>
|
|
601
|
+
${note.body}
|
|
602
|
+
</task_${note.kind}>`;
|
|
603
|
+
}
|
|
604
|
+
TaTaskNote2.write = write;
|
|
605
|
+
function parse(text) {
|
|
606
|
+
const match = NOTE.exec(text.trim());
|
|
607
|
+
if (!match) {
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
const attributes = {};
|
|
611
|
+
for (const [, name, value] of match[2].matchAll(ATTRIBUTE)) {
|
|
612
|
+
attributes[name] = unquote(value);
|
|
613
|
+
}
|
|
614
|
+
if (!attributes.id || attributes.title === undefined) {
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
const { id, title, status, was } = attributes;
|
|
618
|
+
return { kind: match[1], id, title, ...status ? { status } : {}, ...was ? { was } : {}, body: match[3] };
|
|
619
|
+
}
|
|
620
|
+
TaTaskNote2.parse = parse;
|
|
621
|
+
function quote(text) {
|
|
622
|
+
return text.replace(/&/g, "&").replace(/"/g, """).replace(/\n/g, " ");
|
|
623
|
+
}
|
|
624
|
+
function unquote(text) {
|
|
625
|
+
return text.replace(/"/g, '"').replace(/&/g, "&");
|
|
626
|
+
}
|
|
627
|
+
})(TaTaskNote || (TaTaskNote = {}));
|
|
628
|
+
var TaSecretRef;
|
|
629
|
+
(function(TaSecretRef2) {
|
|
630
|
+
TaSecretRef2.PACKAGE = "@celljs/ta-secrets";
|
|
631
|
+
const REF = /\$\{?TA_SECRET_([A-Z0-9][A-Z0-9_]*)\}?/g;
|
|
632
|
+
const KINDS = [
|
|
633
|
+
[/^PHONE(?:_\d+)?$/, "phone"],
|
|
634
|
+
[/^EMAIL(?:_\d+)?$/, "email"],
|
|
635
|
+
[/^ID_NUMBER(?:_\d+)?$/, "idNumber"],
|
|
636
|
+
[/^BANK_CARD(?:_\d+)?$/, "bankCard"]
|
|
637
|
+
];
|
|
638
|
+
function has(text) {
|
|
639
|
+
return text.includes("TA_SECRET_") && new RegExp(REF.source).test(text);
|
|
640
|
+
}
|
|
641
|
+
TaSecretRef2.has = has;
|
|
642
|
+
function kind(name) {
|
|
643
|
+
var _a;
|
|
644
|
+
var _b;
|
|
645
|
+
return (_b = (_a = KINDS.find(([pattern]) => pattern.test(name))) === null || _a === undefined ? undefined : _a[1]) !== null && _b !== undefined ? _b : "secret";
|
|
646
|
+
}
|
|
647
|
+
TaSecretRef2.kind = kind;
|
|
648
|
+
function split(text) {
|
|
649
|
+
if (!has(text)) {
|
|
650
|
+
return [{ text }];
|
|
651
|
+
}
|
|
652
|
+
const parts = [];
|
|
653
|
+
let at = 0;
|
|
654
|
+
for (const match of text.matchAll(REF)) {
|
|
655
|
+
if (match.index > at) {
|
|
656
|
+
parts.push({ text: text.slice(at, match.index) });
|
|
657
|
+
}
|
|
658
|
+
parts.push({ secret: match[1], kind: kind(match[1]) });
|
|
659
|
+
at = match.index + match[0].length;
|
|
660
|
+
}
|
|
661
|
+
if (at < text.length) {
|
|
662
|
+
parts.push({ text: text.slice(at) });
|
|
663
|
+
}
|
|
664
|
+
return parts;
|
|
665
|
+
}
|
|
666
|
+
TaSecretRef2.split = split;
|
|
667
|
+
function plain(text, label) {
|
|
668
|
+
return has(text) ? text.replace(REF, (_whole, name) => label(name, kind(name))) : text;
|
|
669
|
+
}
|
|
670
|
+
TaSecretRef2.plain = plain;
|
|
671
|
+
})(TaSecretRef || (TaSecretRef = {}));
|
|
672
|
+
|
|
368
673
|
// web-src/initiative-protocol.ts
|
|
369
674
|
var NAME = "@celljs/ta-initiative";
|
|
370
675
|
var PACE_TOOL = "evolve_pace";
|
|
@@ -416,6 +721,60 @@ var Limits;
|
|
|
416
721
|
Limits.NOTICE_MS = 2 * 60000;
|
|
417
722
|
})(Limits ||= {});
|
|
418
723
|
|
|
724
|
+
// web-src/idea-proposals.ts
|
|
725
|
+
var IDEA_KIND = "idea.try";
|
|
726
|
+
var IDEAS_WAITING = 2;
|
|
727
|
+
var IdeaProposals;
|
|
728
|
+
((IdeaProposals) => {
|
|
729
|
+
function read(pi) {
|
|
730
|
+
const list = pi?.ideas;
|
|
731
|
+
if (!Array.isArray(list)) {
|
|
732
|
+
return [];
|
|
733
|
+
}
|
|
734
|
+
const text = (value) => value && typeof value === "object" && TaLanguageUtil.ALL.every((language) => typeof value[language] === "string") ? value : undefined;
|
|
735
|
+
return list.flatMap((item) => {
|
|
736
|
+
const one = item ?? {};
|
|
737
|
+
const title = text(one.title);
|
|
738
|
+
const why = text(one.why);
|
|
739
|
+
return typeof one.id === "string" && /^[\w.-]{1,40}$/.test(one.id) && title && typeof one.prompt === "string" && one.prompt.trim() ? [{ id: one.id, title, ...why ? { why } : {}, prompt: one.prompt.trim().slice(0, 2000) }] : [];
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
IdeaProposals.read = read;
|
|
743
|
+
function key(pkg, idea) {
|
|
744
|
+
return `${IDEA_KIND}:${pkg}:${idea.id}`;
|
|
745
|
+
}
|
|
746
|
+
IdeaProposals.key = key;
|
|
747
|
+
function due(packages, proposals, language) {
|
|
748
|
+
const offered = new Set(proposals.filter((one) => one.kind === IDEA_KIND).map((one) => one.key));
|
|
749
|
+
const waiting = proposals.filter((one) => one.kind === IDEA_KIND && (one.state === "pending" || one.state === "digest")).length;
|
|
750
|
+
const room = Math.max(0, IDEAS_WAITING - waiting);
|
|
751
|
+
return packages.flatMap((pkg) => pkg.ideas.map((idea) => ({ pkg: pkg.name, idea }))).filter(({ pkg, idea }) => !offered.has(key(pkg, idea))).slice(0, room).map(({ pkg, idea }) => offer(pkg, idea, language));
|
|
752
|
+
}
|
|
753
|
+
IdeaProposals.due = due;
|
|
754
|
+
function offer(pkg, idea, language) {
|
|
755
|
+
const title = TaLanguageUtil.pick(language, idea.title);
|
|
756
|
+
return {
|
|
757
|
+
kind: IDEA_KIND,
|
|
758
|
+
title,
|
|
759
|
+
why: idea.why ? TaLanguageUtil.pick(language, idea.why) : "",
|
|
760
|
+
key: key(pkg, idea),
|
|
761
|
+
source: "host",
|
|
762
|
+
urgency: "whenever",
|
|
763
|
+
action: { type: "prompt", prompt: message(title, idea.prompt) }
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
IdeaProposals.offer = offer;
|
|
767
|
+
function message(title, prompt) {
|
|
768
|
+
return TaMessageContext.wrap([
|
|
769
|
+
`The user tapped Try on an idea Ta offered them: ${prompt}`,
|
|
770
|
+
"You know little of their situation yet: first ask at most 3 questions you truly need, in one short message, with choices where you can (a ta-glance card of options), then do it. Never buy, send, publish or delete anything without asking.",
|
|
771
|
+
TaMessageSource.line(NAME)
|
|
772
|
+
].join(`
|
|
773
|
+
`), title);
|
|
774
|
+
}
|
|
775
|
+
IdeaProposals.message = message;
|
|
776
|
+
})(IdeaProposals ||= {});
|
|
777
|
+
|
|
419
778
|
// web-src/inbox-util.ts
|
|
420
779
|
var DAY_MS = 24 * 60 * 60000;
|
|
421
780
|
function waits(proposal) {
|
|
@@ -431,10 +790,23 @@ var InboxUtil;
|
|
|
431
790
|
return proposals.filter((proposal) => proposal.auto && ["done", "undone", "failed"].includes(proposal.state) && now - (proposal.decidedAt ?? proposal.at) <= Limits.UNDO_DAYS * DAY_MS).sort((a, b) => (b.decidedAt ?? b.at) - (a.decidedAt ?? a.at));
|
|
432
791
|
}
|
|
433
792
|
InboxUtil.done = done;
|
|
793
|
+
function recent(proposals, now, limit = 20) {
|
|
794
|
+
return proposals.filter((proposal) => !proposal.auto && ["done", "declined", "expired", "failed"].includes(proposal.state) && now - (proposal.decidedAt ?? proposal.at) <= Limits.UNDO_DAYS * DAY_MS).sort((a, b) => (b.decidedAt ?? b.at) - (a.decidedAt ?? a.at)).slice(0, limit);
|
|
795
|
+
}
|
|
796
|
+
InboxUtil.recent = recent;
|
|
434
797
|
function canUndo(proposal, now) {
|
|
435
798
|
return proposal.state === "done" && !!proposal.undo && now - (proposal.decidedAt ?? proposal.at) <= Limits.UNDO_DAYS * DAY_MS;
|
|
436
799
|
}
|
|
437
800
|
InboxUtil.canUndo = canUndo;
|
|
801
|
+
function undoDaysLeft(proposal, now) {
|
|
802
|
+
return Math.max(1, Math.ceil(((proposal.decidedAt ?? proposal.at) + Limits.UNDO_DAYS * DAY_MS - now) / DAY_MS));
|
|
803
|
+
}
|
|
804
|
+
InboxUtil.undoDaysLeft = undoDaysLeft;
|
|
805
|
+
function conversation(proposal) {
|
|
806
|
+
const action = proposal.action;
|
|
807
|
+
return proposal.sessionFile ?? (action?.type === "session" ? action.sessionFile : undefined) ?? proposal.evidence?.[0];
|
|
808
|
+
}
|
|
809
|
+
InboxUtil.conversation = conversation;
|
|
438
810
|
function home(proposals, seen, now) {
|
|
439
811
|
const open = waiting(proposals);
|
|
440
812
|
const did = done(proposals, now).filter((proposal) => proposal.state === "done");
|
|
@@ -580,8 +952,9 @@ class InitiativeStore {
|
|
|
580
952
|
this.set({ ...this.current, review: { ...this.current.review, profile: kept || undefined } });
|
|
581
953
|
}
|
|
582
954
|
async decide(id, decision) {
|
|
583
|
-
await this.pi.callHost("decide", id, decision);
|
|
955
|
+
const decided = await this.pi.callHost("decide", id, decision);
|
|
584
956
|
this.read();
|
|
957
|
+
return decided;
|
|
585
958
|
}
|
|
586
959
|
async undo(id) {
|
|
587
960
|
await this.pi.callHost("undo", id);
|
|
@@ -711,15 +1084,17 @@ function useBusy(ui) {
|
|
|
711
1084
|
function message(error) {
|
|
712
1085
|
return error instanceof Error ? error.message : String(error);
|
|
713
1086
|
}
|
|
714
|
-
function clock(at, now = Date.now()) {
|
|
1087
|
+
function clock(at, short = false, now = Date.now()) {
|
|
715
1088
|
const date = new Date(at);
|
|
716
1089
|
const pad = (value) => String(value).padStart(2, "0");
|
|
717
1090
|
const time = `${pad(date.getHours())}:${pad(date.getMinutes())}`;
|
|
718
|
-
|
|
1091
|
+
const day = `${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
|
|
1092
|
+
return date.toDateString() === new Date(now).toDateString() ? time : short ? day : `${day} ${time}`;
|
|
719
1093
|
}
|
|
720
1094
|
function kindTitle(kinds, id, language) {
|
|
721
1095
|
const kind = kinds.find((one) => one.kind.id === id)?.kind;
|
|
722
|
-
|
|
1096
|
+
const title = kind ? KindTitleUtil.pick(kind.title, language) : "";
|
|
1097
|
+
return title === id ? "" : title;
|
|
723
1098
|
}
|
|
724
1099
|
function Act({ pi, label, primary, icon: Icon, onClick }) {
|
|
725
1100
|
const [busy, run] = useBusy(pi.ui);
|
|
@@ -752,22 +1127,26 @@ function Head({ pi, proposal, kinds, at, words }) {
|
|
|
752
1127
|
size: 12
|
|
753
1128
|
})), /* @__PURE__ */ React.createElement("span", {
|
|
754
1129
|
className: "tin-kind-title"
|
|
755
|
-
}, kindTitle(kinds, proposal.kind, pi.ui.language)), proposal.state === "digest" && /* @__PURE__ */ React.createElement("span", {
|
|
1130
|
+
}, proposal.kind === IDEA_KIND ? "" : kindTitle(kinds, proposal.kind, pi.ui.language)), proposal.state === "digest" && /* @__PURE__ */ React.createElement("span", {
|
|
756
1131
|
className: "tin-tag"
|
|
757
1132
|
}, words.inBrief), /* @__PURE__ */ React.createElement("span", {
|
|
758
1133
|
className: "tin-time"
|
|
759
1134
|
}, clock(at)));
|
|
760
1135
|
}
|
|
761
1136
|
function Evidence({ pi, proposal, words }) {
|
|
762
|
-
const
|
|
763
|
-
if (
|
|
1137
|
+
const file = InboxUtil.conversation(proposal);
|
|
1138
|
+
if (!file) {
|
|
764
1139
|
return null;
|
|
765
1140
|
}
|
|
1141
|
+
const count = proposal.evidence?.length ?? 0;
|
|
1142
|
+
const Chevron = pi.ui.icons.ChevronRight;
|
|
766
1143
|
return /* @__PURE__ */ React.createElement("button", {
|
|
767
1144
|
type: "button",
|
|
768
|
-
className: "tin-link",
|
|
769
|
-
onClick: () => void openConversation(pi,
|
|
770
|
-
}, InitiativeWords.format(words.evidence, { count: String(
|
|
1145
|
+
className: "tin-link tin-evidence",
|
|
1146
|
+
onClick: () => void openConversation(pi, file)
|
|
1147
|
+
}, /* @__PURE__ */ React.createElement("span", null, count > 1 ? InitiativeWords.format(words.evidence, { count: String(count) }) : words.evidenceOne), Chevron && /* @__PURE__ */ React.createElement(Chevron, {
|
|
1148
|
+
size: 12
|
|
1149
|
+
}));
|
|
771
1150
|
}
|
|
772
1151
|
function Waiting({
|
|
773
1152
|
pi,
|
|
@@ -777,11 +1156,15 @@ function Waiting({
|
|
|
777
1156
|
away
|
|
778
1157
|
}) {
|
|
779
1158
|
const words = InitiativeWords.of(pi.ui.language);
|
|
1159
|
+
const idea = proposal.kind === IDEA_KIND;
|
|
780
1160
|
const decide = (decision) => async () => {
|
|
781
|
-
await store.decide(proposal.id, decision);
|
|
1161
|
+
const decided = await store.decide(proposal.id, decision);
|
|
782
1162
|
const action = proposal.action;
|
|
783
|
-
if (
|
|
784
|
-
|
|
1163
|
+
if (decision === "accept" || decision === "always") {
|
|
1164
|
+
const file = action?.type === "session" ? away ? action.sessionFile : undefined : idea ? decided?.sessionFile : undefined;
|
|
1165
|
+
if (file) {
|
|
1166
|
+
await openConversation(pi, file);
|
|
1167
|
+
}
|
|
785
1168
|
}
|
|
786
1169
|
};
|
|
787
1170
|
const reversible = kinds.find((one) => one.kind.id === proposal.kind)?.kind.reversible ?? false;
|
|
@@ -812,7 +1195,7 @@ function Waiting({
|
|
|
812
1195
|
onClick: () => void decide("always")().catch(() => {
|
|
813
1196
|
return;
|
|
814
1197
|
})
|
|
815
|
-
}, words.always), /* @__PURE__ */ React.createElement("button", {
|
|
1198
|
+
}, words.always), !idea && /* @__PURE__ */ React.createElement("button", {
|
|
816
1199
|
type: "button",
|
|
817
1200
|
className: "tin-link",
|
|
818
1201
|
onClick: () => void decide("never")().catch(() => {
|
|
@@ -822,11 +1205,11 @@ function Waiting({
|
|
|
822
1205
|
className: "tin-actions"
|
|
823
1206
|
}, /* @__PURE__ */ React.createElement(Act, {
|
|
824
1207
|
pi,
|
|
825
|
-
label: words.decline,
|
|
1208
|
+
label: idea ? words.notNow : words.decline,
|
|
826
1209
|
onClick: decide("decline")
|
|
827
1210
|
}), /* @__PURE__ */ React.createElement(Act, {
|
|
828
1211
|
pi,
|
|
829
|
-
label: words.accept,
|
|
1212
|
+
label: idea ? words.tryIt : words.accept,
|
|
830
1213
|
primary: true,
|
|
831
1214
|
onClick: decide("accept")
|
|
832
1215
|
}))));
|
|
@@ -836,11 +1219,13 @@ function Done({
|
|
|
836
1219
|
store,
|
|
837
1220
|
proposal,
|
|
838
1221
|
kinds,
|
|
839
|
-
now
|
|
1222
|
+
now,
|
|
1223
|
+
away
|
|
840
1224
|
}) {
|
|
841
1225
|
const words = InitiativeWords.of(pi.ui.language);
|
|
842
1226
|
const tone = proposal.state === "undone" ? "undone" : proposal.state === "failed" ? "failed" : "done";
|
|
843
|
-
const
|
|
1227
|
+
const undo = InboxUtil.canUndo(proposal, now);
|
|
1228
|
+
const state = tone === "undone" ? words.undoneState : tone === "failed" ? InitiativeWords.format(words.failedState, { error: proposal.error ?? "" }) : away ? undefined : words.inboxDone;
|
|
844
1229
|
return /* @__PURE__ */ React.createElement("li", {
|
|
845
1230
|
className: "tin-card tin-done",
|
|
846
1231
|
"data-tone": tone
|
|
@@ -854,11 +1239,17 @@ function Done({
|
|
|
854
1239
|
className: "tin-title"
|
|
855
1240
|
}, proposal.title), proposal.why && /* @__PURE__ */ React.createElement("div", {
|
|
856
1241
|
className: "tin-why"
|
|
857
|
-
}, proposal.why), /* @__PURE__ */ React.createElement(
|
|
1242
|
+
}, proposal.why), away && /* @__PURE__ */ React.createElement(Evidence, {
|
|
1243
|
+
pi,
|
|
1244
|
+
proposal,
|
|
1245
|
+
words
|
|
1246
|
+
}), (state || undo) && /* @__PURE__ */ React.createElement("div", {
|
|
858
1247
|
className: "tin-foot"
|
|
859
|
-
}, /* @__PURE__ */ React.createElement("span", {
|
|
1248
|
+
}, state ? /* @__PURE__ */ React.createElement("span", {
|
|
860
1249
|
className: "tin-state"
|
|
861
|
-
}, /* @__PURE__ */ React.createElement("i", null), /* @__PURE__ */ React.createElement("span", null, state))
|
|
1250
|
+
}, /* @__PURE__ */ React.createElement("i", null), /* @__PURE__ */ React.createElement("span", null, state)) : /* @__PURE__ */ React.createElement("span", {
|
|
1251
|
+
className: "tin-hint"
|
|
1252
|
+
}, InitiativeWords.format(words.undoLeft, { days: String(InboxUtil.undoDaysLeft(proposal, now)) })), undo && /* @__PURE__ */ React.createElement("div", {
|
|
862
1253
|
className: "tin-actions"
|
|
863
1254
|
}, /* @__PURE__ */ React.createElement(Act, {
|
|
864
1255
|
pi,
|
|
@@ -867,12 +1258,45 @@ function Done({
|
|
|
867
1258
|
onClick: () => store.undo(proposal.id)
|
|
868
1259
|
}))));
|
|
869
1260
|
}
|
|
1261
|
+
function SectionHead({ title, count }) {
|
|
1262
|
+
return /* @__PURE__ */ React.createElement("h3", {
|
|
1263
|
+
className: "tin-head"
|
|
1264
|
+
}, /* @__PURE__ */ React.createElement("span", null, title), /* @__PURE__ */ React.createElement("span", {
|
|
1265
|
+
className: "tin-count"
|
|
1266
|
+
}, count));
|
|
1267
|
+
}
|
|
1268
|
+
function Answered({ pi, proposal, words }) {
|
|
1269
|
+
const file = InboxUtil.conversation(proposal);
|
|
1270
|
+
const state = proposal.state === "done" ? words.acceptedLine : proposal.state === "declined" ? words.declinedLine : proposal.state === "failed" ? words.failedLine : words.expiredLine;
|
|
1271
|
+
const Chevron = pi.ui.icons.ChevronRight;
|
|
1272
|
+
return /* @__PURE__ */ React.createElement("li", null, /* @__PURE__ */ React.createElement("button", {
|
|
1273
|
+
type: "button",
|
|
1274
|
+
className: "tin-answered",
|
|
1275
|
+
"data-state": proposal.state,
|
|
1276
|
+
disabled: !file,
|
|
1277
|
+
onClick: () => file && void openConversation(pi, file)
|
|
1278
|
+
}, /* @__PURE__ */ React.createElement("i", null), /* @__PURE__ */ React.createElement("span", {
|
|
1279
|
+
className: "tin-answered-title"
|
|
1280
|
+
}, proposal.title), /* @__PURE__ */ React.createElement("span", {
|
|
1281
|
+
className: "tin-answered-state"
|
|
1282
|
+
}, state), /* @__PURE__ */ React.createElement("span", {
|
|
1283
|
+
className: "tin-time"
|
|
1284
|
+
}, clock(proposal.decidedAt ?? proposal.at, true)), file && Chevron && /* @__PURE__ */ React.createElement("span", {
|
|
1285
|
+
className: "tin-answered-go"
|
|
1286
|
+
}, /* @__PURE__ */ React.createElement(Chevron, {
|
|
1287
|
+
size: 14
|
|
1288
|
+
}))));
|
|
1289
|
+
}
|
|
870
1290
|
function Inbox({ pi, store }) {
|
|
871
1291
|
const state = useInitiative(React, store);
|
|
872
1292
|
const words = InitiativeWords.of(pi.ui.language);
|
|
873
1293
|
const now = Date.now();
|
|
874
|
-
const
|
|
1294
|
+
const all = InboxUtil.waiting(state.proposals);
|
|
1295
|
+
const waiting = all.filter((proposal) => proposal.kind !== IDEA_KIND);
|
|
1296
|
+
const ideas = all.filter((proposal) => proposal.kind === IDEA_KIND);
|
|
875
1297
|
const done = InboxUtil.done(state.proposals, now);
|
|
1298
|
+
const answered = InboxUtil.recent(state.proposals, now);
|
|
1299
|
+
const empty = all.length === 0 && done.length === 0 && answered.length === 0;
|
|
876
1300
|
React.useEffect(() => {
|
|
877
1301
|
if (state.loaded) {
|
|
878
1302
|
store.see();
|
|
@@ -880,12 +1304,15 @@ function Inbox({ pi, store }) {
|
|
|
880
1304
|
}, [store, state.loaded, state.proposals]);
|
|
881
1305
|
return /* @__PURE__ */ React.createElement("div", {
|
|
882
1306
|
className: "tin-inbox"
|
|
883
|
-
},
|
|
1307
|
+
}, empty && state.loaded && /* @__PURE__ */ React.createElement(pi.ui.Empty, {
|
|
884
1308
|
title: words.inboxEmpty,
|
|
885
1309
|
hint: words.inboxEmptyHint
|
|
886
|
-
}),
|
|
887
|
-
className: "tin-
|
|
888
|
-
}, words.
|
|
1310
|
+
}), !empty && /* @__PURE__ */ React.createElement("p", {
|
|
1311
|
+
className: "tin-intro"
|
|
1312
|
+
}, words.inboxIntro), waiting.length > 0 && /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement(SectionHead, {
|
|
1313
|
+
title: words.inboxWaiting,
|
|
1314
|
+
count: waiting.length
|
|
1315
|
+
}), /* @__PURE__ */ React.createElement("ul", {
|
|
889
1316
|
className: "tin-list"
|
|
890
1317
|
}, waiting.map((proposal) => /* @__PURE__ */ React.createElement(Waiting, {
|
|
891
1318
|
key: proposal.id,
|
|
@@ -894,9 +1321,22 @@ function Inbox({ pi, store }) {
|
|
|
894
1321
|
proposal,
|
|
895
1322
|
kinds: state.kinds,
|
|
896
1323
|
away: true
|
|
897
|
-
})))),
|
|
898
|
-
|
|
899
|
-
|
|
1324
|
+
})))), ideas.length > 0 && /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement(SectionHead, {
|
|
1325
|
+
title: words.inboxIdeas,
|
|
1326
|
+
count: ideas.length
|
|
1327
|
+
}), /* @__PURE__ */ React.createElement("ul", {
|
|
1328
|
+
className: "tin-list"
|
|
1329
|
+
}, ideas.map((proposal) => /* @__PURE__ */ React.createElement(Waiting, {
|
|
1330
|
+
key: proposal.id,
|
|
1331
|
+
pi,
|
|
1332
|
+
store,
|
|
1333
|
+
proposal,
|
|
1334
|
+
kinds: state.kinds,
|
|
1335
|
+
away: true
|
|
1336
|
+
})))), done.length > 0 && /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement(SectionHead, {
|
|
1337
|
+
title: words.inboxDone,
|
|
1338
|
+
count: done.length
|
|
1339
|
+
}), /* @__PURE__ */ React.createElement("ul", {
|
|
900
1340
|
className: "tin-list"
|
|
901
1341
|
}, done.map((proposal) => /* @__PURE__ */ React.createElement(Done, {
|
|
902
1342
|
key: proposal.id,
|
|
@@ -904,7 +1344,18 @@ function Inbox({ pi, store }) {
|
|
|
904
1344
|
store,
|
|
905
1345
|
proposal,
|
|
906
1346
|
kinds: state.kinds,
|
|
907
|
-
now
|
|
1347
|
+
now,
|
|
1348
|
+
away: true
|
|
1349
|
+
})))), answered.length > 0 && /* @__PURE__ */ React.createElement("section", null, /* @__PURE__ */ React.createElement(SectionHead, {
|
|
1350
|
+
title: words.inboxRecent,
|
|
1351
|
+
count: answered.length
|
|
1352
|
+
}), /* @__PURE__ */ React.createElement("ul", {
|
|
1353
|
+
className: "tin-answered-list"
|
|
1354
|
+
}, answered.map((proposal) => /* @__PURE__ */ React.createElement(Answered, {
|
|
1355
|
+
key: proposal.id,
|
|
1356
|
+
pi,
|
|
1357
|
+
proposal,
|
|
1358
|
+
words
|
|
908
1359
|
})))));
|
|
909
1360
|
}
|
|
910
1361
|
function AboveComposer({ pi, store, sessionFile }) {
|
|
@@ -1314,8 +1765,10 @@ var STYLE = `
|
|
|
1314
1765
|
.tev-profile-text { width: 100%; height: auto; min-height: 160px; padding: 8px; box-sizing: border-box; line-height: 1.55; resize: vertical; font-size: calc(13px * var(--ta-font-scale)); }
|
|
1315
1766
|
[data-touch] .tev-profile-text { font-size: 16px; }
|
|
1316
1767
|
/* The suggestions: a card each, its kind, what and why, the answers */
|
|
1317
|
-
.tin-inbox { display: flex; flex-direction: column;
|
|
1318
|
-
.tin-
|
|
1768
|
+
.tin-inbox { display: flex; flex-direction: column; flex: 1 0 auto; width: 100%; max-width: var(--ta-page-width); margin: 0 auto; padding: 4px 16px calc(32px + env(safe-area-inset-bottom)); box-sizing: border-box; }
|
|
1769
|
+
.tin-intro { margin: 4px 2px 4px; color: var(--ta-muted); font-size: calc(12.5px * var(--ta-font-scale)); line-height: 1.6; }
|
|
1770
|
+
.tin-head { display: flex; align-items: center; gap: 6px; margin: 20px 2px 8px; color: var(--ta-secondary); font-size: calc(13px * var(--ta-font-scale)); font-weight: 600; }
|
|
1771
|
+
.tin-count { min-width: calc(18px * var(--ta-font-scale)); padding: 0 5px; box-sizing: border-box; border-radius: 9px; background: var(--ta-hover); color: var(--ta-muted); font-size: calc(11.5px * var(--ta-font-scale)); font-weight: 500; line-height: calc(18px * var(--ta-font-scale)); text-align: center; font-variant-numeric: tabular-nums; }
|
|
1319
1772
|
.tin-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
|
|
1320
1773
|
/*
|
|
1321
1774
|
* A card: its head (a mark in the tone of where it stands, the kind, the time), what and why, and a foot under a
|
|
@@ -1331,7 +1784,7 @@ var STYLE = `
|
|
|
1331
1784
|
.tin-tag { flex: none; padding: 0 6px; border-radius: 6px; background: var(--ta-hover); line-height: 1.6; }
|
|
1332
1785
|
.tin-time { flex: none; font-variant-numeric: tabular-nums; }
|
|
1333
1786
|
.tin-title { margin-top: 8px; color: var(--ta-text); font-size: calc(14.5px * var(--ta-font-scale)); font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
|
|
1334
|
-
.tin-why { margin-top: 3px; color: var(--ta-secondary); font-size: calc(13px * var(--ta-font-scale)); line-height: 1.55; overflow-wrap: anywhere; }
|
|
1787
|
+
.tin-why { margin-top: 3px; color: var(--ta-secondary); font-size: calc(13px * var(--ta-font-scale)); line-height: 1.55; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
|
|
1335
1788
|
.tin-card[data-tone='undone'] .tin-title { color: var(--ta-muted); font-weight: 500; }
|
|
1336
1789
|
.tin-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--ta-border-muted); }
|
|
1337
1790
|
.tin-state { flex: 1; min-width: 0; display: inline-flex; align-items: baseline; gap: 7px; color: var(--tin-tone); font-size: calc(12.5px * var(--ta-font-scale)); font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; }
|
|
@@ -1344,7 +1797,23 @@ var STYLE = `
|
|
|
1344
1797
|
.tin-more { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
|
|
1345
1798
|
.tin-link { padding: 0; border: 0; background: none; color: var(--ta-muted); font: inherit; font-size: calc(12.5px * var(--ta-font-scale)); cursor: pointer; text-align: left; }
|
|
1346
1799
|
.tin-link:hover { color: var(--ta-text); }
|
|
1347
|
-
.tin-card > .tin-link { margin-top: 6px; display:
|
|
1800
|
+
.tin-card > .tin-link { margin-top: 6px; display: flex; align-items: center; gap: 2px; width: fit-content; }
|
|
1801
|
+
.tin-hint { flex: 1; min-width: 0; color: var(--ta-muted); font-size: calc(12.5px * var(--ta-font-scale)); line-height: 1.5; }
|
|
1802
|
+
/* Answered lately: a line each in one card, what became of it in its tone, a tap to its conversation */
|
|
1803
|
+
.tin-answered-list { margin: 0; padding: 4px 0; list-style: none; border: 1px solid var(--ta-border-muted); border-radius: 12px; background: var(--ta-card); }
|
|
1804
|
+
.tin-answered-list > li + li .tin-answered { border-top: 1px solid var(--ta-border-muted); }
|
|
1805
|
+
.tin-answered { --tin-tone: var(--ta-muted); display: flex; align-items: center; gap: 8px; width: 100%; min-height: calc(40px * var(--ta-font-scale)); padding: 0 12px 0 14px; box-sizing: border-box; border: 0; background: none; color: var(--ta-text); font: inherit; font-size: calc(13px * var(--ta-font-scale)); text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; }
|
|
1806
|
+
.tin-answered[data-state='done'] { --tin-tone: var(--ta-green); }
|
|
1807
|
+
.tin-answered[data-state='failed'] { --tin-tone: var(--ta-red); }
|
|
1808
|
+
.tin-answered:disabled { cursor: default; }
|
|
1809
|
+
.tin-answered:not(:disabled):hover { background: var(--ta-hover); }
|
|
1810
|
+
.tin-answered > i { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--tin-tone); }
|
|
1811
|
+
.tin-answered-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1812
|
+
.tin-answered[data-state='declined'] .tin-answered-title, .tin-answered[data-state='expired'] .tin-answered-title { color: var(--ta-secondary); }
|
|
1813
|
+
.tin-answered-state { flex: none; color: var(--tin-tone); font-size: calc(12px * var(--ta-font-scale)); }
|
|
1814
|
+
.tin-answered .tin-time { color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
|
|
1815
|
+
.tin-answered-go { flex: none; display: inline-flex; margin-right: -4px; color: var(--ta-muted); }
|
|
1816
|
+
[data-touch] .tin-answered { min-height: 46px; }
|
|
1348
1817
|
.tin-above { margin: 0 0 8px; }
|
|
1349
1818
|
.tin-above .tin-card { padding: 10px 12px; }
|
|
1350
1819
|
.tin-above .tin-foot { margin-top: 10px; padding-top: 8px; }
|
|
@@ -1420,7 +1889,6 @@ function activate(pi) {
|
|
|
1420
1889
|
store
|
|
1421
1890
|
}),
|
|
1422
1891
|
order: 75,
|
|
1423
|
-
discover: true,
|
|
1424
1892
|
group: "work"
|
|
1425
1893
|
});
|
|
1426
1894
|
pi.registerMessageRenderer(CARD_TYPE, ({ message: message3 }) => {
|