@celljs/ta-glance 4.12.0 → 4.13.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 +1 -0
- package/README.md +1 -0
- package/extension/index.mjs +425 -3
- package/package.json +3 -3
- package/web/index.js +87 -19
package/README.en.md
CHANGED
|
@@ -4,6 +4,7 @@ A pi package that comes with Ta (on by default; Settings → Extensions of the w
|
|
|
4
4
|
|
|
5
5
|
- **The answer first, little of the process**: under the Ta service, every turn's system prompt gets a `<ta-glance>` section: the first line is the conclusion in one sentence, what matters in bold; then only what the user needs to act or decide; a short question gets one to three sentences.
|
|
6
6
|
- **Results as a card**: when a reply reports work done, results, a comparison, choices to make, or several facts or relations, Ta writes a `ta-glance` block (JSON) after the first line, which the web client draws as a card: key numbers, files changed (opened by a click), steps, before and after, bars, a flow, a Mermaid diagram, a table, choices to tap, risks and to-dos, buttons of what to ask next, folded details. The card grows as the reply streams.
|
|
7
|
+
- **Waiting for you**: a turn whose reply ends with a card of choices (`options`) or `status: "blocked"` is marked in the session with a `ta-ask` entry (`TA_ASK_ENTRY`, which the model never reads): the list of chats, its tab, the double's tasks and Quick open show that the conversation waits for you to decide, until you answer, by a tap or in words. Until then the card is framed in blue with a ?; once answered it shows the choice on every device, after a reload too (`WebCodeRendererProps.answer`).
|
|
7
8
|
- **Elsewhere**: the preview of the list of conversations shows the first line; replies to WeChat and WeCom bots draw no card and stay short paragraphs; `ta` in a terminal replies as before. External agents (ta-agents) get the section too.
|
|
8
9
|
|
|
9
10
|
The card's format is in `web-src/glance-protocol.ts`, the prompt in `web-src/glance-prompt.ts`. Other packages draw cards for fenced blocks of their own languages with `registerCodeRenderer`.
|
package/README.md
CHANGED
|
@@ -4,6 +4,7 @@ Ta 自带的 pi 包(默认开启,可在 Web 客户端的 设置 → 扩展
|
|
|
4
4
|
|
|
5
5
|
- **先说结论、少说过程**:在 Ta 服务下,每一轮的系统提示里多一段 `<ta-glance>`:第一行一句话结论、关键词加粗;只写你要行动或决定的东西;小问题一到三句。
|
|
6
6
|
- **结果画成卡片**:汇报完成的工作、结果、对比、要你选的方案、多个事实或关系时,Ta 在第一行之后写一个 `ta-glance` 代码块(JSON),Web 把它画成卡片:关键数字、改了的文件(点开)、步骤、前后对比、横条、流程、Mermaid 关系图、表格、可点选的方案、风险与待办、下一步按钮、折叠的细节。卡片随回复流式长出来。
|
|
7
|
+
- **待你决定**:一轮回复以带选项(`options`)或 `status: "blocked"` 的卡片结束时,pi 扩展在会话里记一条 `ta-ask`(`TA_ASK_ENTRY`,模型读不到),对话列表、标签、分身任务和快捷打开就显示这个对话在等你决定,直到你回答(点选或打字都算)。卡片在你回答前用蓝框和问号标出;回答后各设备都显示已选,刷新也保留(`WebCodeRendererProps.answer`)。
|
|
7
8
|
- **别处**:对话列表的预览显示第一行结论;发到微信、企业微信机器人的回复不画卡片,照常是短段落;终端里的 `ta` 回复照旧。外部 Agent(ta-agents)也会拿到这段写法。
|
|
8
9
|
|
|
9
10
|
卡片的格式见 `web-src/glance-protocol.ts`,提示词见 `web-src/glance-prompt.ts`。别的包也能用 `registerCodeRenderer` 为自己的代码块语言画卡片。
|
package/extension/index.mjs
CHANGED
|
@@ -5,24 +5,440 @@ var TaHostUtil;
|
|
|
5
5
|
TaHostUtil2.WAIT_MS = 1000;
|
|
6
6
|
function reach(events, name, waitMs = TaHostUtil2.WAIT_MS) {
|
|
7
7
|
return new Promise((resolve) => {
|
|
8
|
+
let heard = false;
|
|
9
|
+
let answered = false;
|
|
8
10
|
const timer = setTimeout(() => resolve(undefined), waitMs);
|
|
9
11
|
const request = {
|
|
10
12
|
name,
|
|
13
|
+
heard: () => {
|
|
14
|
+
heard = true;
|
|
15
|
+
},
|
|
11
16
|
resolve: (answer) => {
|
|
17
|
+
answered = true;
|
|
12
18
|
clearTimeout(timer);
|
|
13
19
|
resolve(answer);
|
|
14
20
|
}
|
|
15
21
|
};
|
|
16
22
|
events.emit(TA_HOST_EVENT, request);
|
|
23
|
+
if (!heard && !answered) {
|
|
24
|
+
clearTimeout(timer);
|
|
25
|
+
resolve(undefined);
|
|
26
|
+
}
|
|
17
27
|
});
|
|
18
28
|
}
|
|
19
29
|
TaHostUtil2.reach = reach;
|
|
20
30
|
})(TaHostUtil || (TaHostUtil = {}));
|
|
31
|
+
var TA_ASK_ENTRY = "ta-ask";
|
|
32
|
+
var TaAskUtil;
|
|
33
|
+
(function(TaAskUtil2) {
|
|
34
|
+
const LENGTH = 120;
|
|
35
|
+
function entry(question) {
|
|
36
|
+
const line = question.replace(/\s+/g, " ").trim();
|
|
37
|
+
return { question: line.length > LENGTH ? `${line.slice(0, LENGTH - 1)}…` : line };
|
|
38
|
+
}
|
|
39
|
+
TaAskUtil2.entry = entry;
|
|
40
|
+
function asking(entries) {
|
|
41
|
+
var _a;
|
|
42
|
+
for (let i = entries.length - 1;i >= 0; i--) {
|
|
43
|
+
const entry2 = entries[i];
|
|
44
|
+
if (entry2.type === "message" && ((_a = entry2.message) === null || _a === undefined ? undefined : _a.role) === "user") {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (entry2.type === "custom" && entry2.customType === TA_ASK_ENTRY) {
|
|
48
|
+
return read(entry2);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
TaAskUtil2.asking = asking;
|
|
54
|
+
function next(asked, entry2) {
|
|
55
|
+
var _a;
|
|
56
|
+
if (entry2.type === "message" && ((_a = entry2.message) === null || _a === undefined ? undefined : _a.role) === "user") {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
return entry2.type === "custom" && entry2.customType === TA_ASK_ENTRY ? read(entry2) : asked;
|
|
60
|
+
}
|
|
61
|
+
TaAskUtil2.next = next;
|
|
62
|
+
function read(found) {
|
|
63
|
+
var _a;
|
|
64
|
+
const question = (_a = found.data) === null || _a === undefined ? undefined : _a.question;
|
|
65
|
+
if (typeof question !== "string" || !question.trim()) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const at = found.timestamp ? Date.parse(found.timestamp) : Number.NaN;
|
|
69
|
+
return { question: entry(question).question, at: Number.isNaN(at) ? 0 : at };
|
|
70
|
+
}
|
|
71
|
+
})(TaAskUtil || (TaAskUtil = {}));
|
|
72
|
+
|
|
73
|
+
// web-src/glance-json.ts
|
|
74
|
+
var GlanceJson;
|
|
75
|
+
((GlanceJson) => {
|
|
76
|
+
const TRIES = 40;
|
|
77
|
+
function parse(text, partial) {
|
|
78
|
+
const source = text.trim().replace(/,\s*([}\]])/g, "$1");
|
|
79
|
+
if (!source) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
return JSON.parse(source);
|
|
84
|
+
} catch {
|
|
85
|
+
if (!partial) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
let end = source.length;
|
|
90
|
+
for (let tries = 0;tries < TRIES && end > 0; tries++) {
|
|
91
|
+
const closed = close(source.slice(0, end));
|
|
92
|
+
if (closed !== undefined) {
|
|
93
|
+
try {
|
|
94
|
+
return JSON.parse(closed);
|
|
95
|
+
} catch {}
|
|
96
|
+
}
|
|
97
|
+
end = Math.max(source.lastIndexOf(",", end - 1), source.lastIndexOf("{", end - 1) + 1, source.lastIndexOf("[", end - 1) + 1);
|
|
98
|
+
}
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
GlanceJson.parse = parse;
|
|
102
|
+
function close(text) {
|
|
103
|
+
const open = [];
|
|
104
|
+
let inString = false;
|
|
105
|
+
let escaped = false;
|
|
106
|
+
for (const char of text) {
|
|
107
|
+
if (inString) {
|
|
108
|
+
if (escaped) {
|
|
109
|
+
escaped = false;
|
|
110
|
+
} else if (char === "\\") {
|
|
111
|
+
escaped = true;
|
|
112
|
+
} else if (char === '"') {
|
|
113
|
+
inString = false;
|
|
114
|
+
}
|
|
115
|
+
} else if (char === '"') {
|
|
116
|
+
inString = true;
|
|
117
|
+
} else if (char === "{" || char === "[") {
|
|
118
|
+
open.push(char === "{" ? "}" : "]");
|
|
119
|
+
} else if (char === "}" || char === "]") {
|
|
120
|
+
open.pop();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (!open.length && !inString) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
let body = text;
|
|
127
|
+
if (inString) {
|
|
128
|
+
body = `${escaped ? body.slice(0, -1) : body}"`;
|
|
129
|
+
}
|
|
130
|
+
body = body.replace(/[\s,:]+$/, "");
|
|
131
|
+
if (open[open.length - 1] === "}" && /[{,]\s*"(?:[^"\\]|\\.)*"$/.test(body)) {
|
|
132
|
+
body = body.replace(/,?\s*"(?:[^"\\]|\\.)*"$/, "");
|
|
133
|
+
}
|
|
134
|
+
return body + open.reverse().join("");
|
|
135
|
+
}
|
|
136
|
+
})(GlanceJson ||= {});
|
|
21
137
|
|
|
22
138
|
// web-src/glance-protocol.ts
|
|
23
139
|
var NAME = "@celljs/ta-glance";
|
|
24
140
|
var LANGUAGE = "ta-glance";
|
|
25
141
|
|
|
142
|
+
// web-src/glance-spec.ts
|
|
143
|
+
var ITEMS = 12;
|
|
144
|
+
var BLOCKS = 8;
|
|
145
|
+
var TEXT = 400;
|
|
146
|
+
var MARKDOWN = 8000;
|
|
147
|
+
var STATUSES = ["done", "partial", "failed", "blocked", "info"];
|
|
148
|
+
var TONES = ["good", "bad", "warn", "neutral"];
|
|
149
|
+
var STEPS = ["done", "doing", "todo", "failed", "skipped"];
|
|
150
|
+
var NOTES = ["risk", "info", "todo"];
|
|
151
|
+
function object(value) {
|
|
152
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : undefined;
|
|
153
|
+
}
|
|
154
|
+
function text(value, max = TEXT) {
|
|
155
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
156
|
+
return String(value);
|
|
157
|
+
}
|
|
158
|
+
if (typeof value !== "string") {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
const trimmed = value.trim();
|
|
162
|
+
return trimmed ? trimmed.slice(0, max) : undefined;
|
|
163
|
+
}
|
|
164
|
+
function number(value) {
|
|
165
|
+
const parsed = typeof value === "string" ? Number.parseFloat(value.replace(/[^\d.eE+-]/g, "")) : value;
|
|
166
|
+
return typeof parsed === "number" && Number.isFinite(parsed) ? parsed : undefined;
|
|
167
|
+
}
|
|
168
|
+
function oneOf(value, values) {
|
|
169
|
+
const lower = typeof value === "string" ? value.trim().toLowerCase() : undefined;
|
|
170
|
+
return values.find((candidate) => candidate === lower);
|
|
171
|
+
}
|
|
172
|
+
function items(value, read) {
|
|
173
|
+
if (!Array.isArray(value)) {
|
|
174
|
+
return [];
|
|
175
|
+
}
|
|
176
|
+
const out = [];
|
|
177
|
+
for (const item of value) {
|
|
178
|
+
const made = read(item);
|
|
179
|
+
if (made !== undefined) {
|
|
180
|
+
out.push(made);
|
|
181
|
+
}
|
|
182
|
+
if (out.length === ITEMS) {
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return out;
|
|
187
|
+
}
|
|
188
|
+
function strings(value, max = ITEMS) {
|
|
189
|
+
return items(value, (item) => text(item) ?? text(object(item)?.label) ?? text(object(item)?.text)).slice(0, max);
|
|
190
|
+
}
|
|
191
|
+
function stat(item) {
|
|
192
|
+
const value = object(item);
|
|
193
|
+
const label = text(value?.label);
|
|
194
|
+
const shown = text(value?.value);
|
|
195
|
+
if (!label || shown === undefined) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
const tone = oneOf(value?.tone, TONES);
|
|
199
|
+
const delta = text(value?.delta);
|
|
200
|
+
return { label, value: shown, ...tone ? { tone } : {}, ...delta ? { delta } : {} };
|
|
201
|
+
}
|
|
202
|
+
function change(item) {
|
|
203
|
+
const value = object(item);
|
|
204
|
+
const path = text(value?.path ?? item);
|
|
205
|
+
if (!path) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
const kind = oneOf(value?.kind, ["add", "edit", "delete"]) ?? "edit";
|
|
209
|
+
const add = number(value?.add);
|
|
210
|
+
const del = number(value?.del);
|
|
211
|
+
const note = text(value?.note);
|
|
212
|
+
return {
|
|
213
|
+
path,
|
|
214
|
+
kind,
|
|
215
|
+
...add !== undefined ? { add: Math.max(0, Math.round(add)) } : {},
|
|
216
|
+
...del !== undefined ? { del: Math.max(0, Math.round(del)) } : {},
|
|
217
|
+
...note ? { note } : {}
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
function step(item, partial) {
|
|
221
|
+
const value = object(item);
|
|
222
|
+
const shown = text(value?.text ?? value?.label ?? value?.title ?? item);
|
|
223
|
+
return shown ? { text: shown, status: oneOf(value?.status, STEPS) ?? (partial ? "todo" : "done") } : undefined;
|
|
224
|
+
}
|
|
225
|
+
function option(item) {
|
|
226
|
+
const value = object(item);
|
|
227
|
+
const label = text(value?.label ?? item);
|
|
228
|
+
if (!label) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
const detail = text(value?.detail);
|
|
232
|
+
return {
|
|
233
|
+
label,
|
|
234
|
+
...detail ? { detail } : {},
|
|
235
|
+
pros: strings(value?.pros, 4),
|
|
236
|
+
cons: strings(value?.cons, 4),
|
|
237
|
+
...value?.recommended === true ? { recommended: true } : {}
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
function note(item) {
|
|
241
|
+
const value = object(item);
|
|
242
|
+
const shown = text(value?.text ?? item);
|
|
243
|
+
return shown ? { text: shown, tone: oneOf(value?.tone, NOTES) ?? "info" } : undefined;
|
|
244
|
+
}
|
|
245
|
+
function isPath(value) {
|
|
246
|
+
return !/[,。;!?、]/.test(value) && (!/\s/.test(value) || /[\\/]/.test(value));
|
|
247
|
+
}
|
|
248
|
+
var LABELS = { before: "Before", after: "After" };
|
|
249
|
+
function block(item, partial, labels) {
|
|
250
|
+
const value = object(item);
|
|
251
|
+
const type = typeof value?.type === "string" ? value.type.trim().toLowerCase() : undefined;
|
|
252
|
+
const unit = text(value?.unit, 16);
|
|
253
|
+
switch (type) {
|
|
254
|
+
case "stats": {
|
|
255
|
+
const list = items(value?.items, stat).slice(0, 6);
|
|
256
|
+
return list.length ? { type, items: list } : undefined;
|
|
257
|
+
}
|
|
258
|
+
case "changes": {
|
|
259
|
+
const raw = Array.isArray(value?.items) ? value.items : [];
|
|
260
|
+
if (raw.length && raw.every((entry) => typeof entry === "string" && !isPath(entry))) {
|
|
261
|
+
const list2 = items(raw, note);
|
|
262
|
+
return list2.length ? { type: "notes", items: list2 } : undefined;
|
|
263
|
+
}
|
|
264
|
+
const list = items(value?.items, change);
|
|
265
|
+
return list.length ? { type, items: list } : undefined;
|
|
266
|
+
}
|
|
267
|
+
case "steps": {
|
|
268
|
+
const list = items(value?.items, (entry) => step(entry, partial));
|
|
269
|
+
return list.length ? { type, items: list } : undefined;
|
|
270
|
+
}
|
|
271
|
+
case "compare": {
|
|
272
|
+
const list = items(value?.items, (entry) => {
|
|
273
|
+
const measure = object(entry);
|
|
274
|
+
const label = text(measure?.label);
|
|
275
|
+
const before = number(measure?.before);
|
|
276
|
+
const after = number(measure?.after);
|
|
277
|
+
return label && before !== undefined && after !== undefined ? { label, before, after } : undefined;
|
|
278
|
+
});
|
|
279
|
+
const better = oneOf(value?.better, ["lower", "higher"]) ?? "lower";
|
|
280
|
+
if (list.length) {
|
|
281
|
+
return { type, better, items: list, ...unit ? { unit } : {} };
|
|
282
|
+
}
|
|
283
|
+
const rows = items(value?.items, (entry) => {
|
|
284
|
+
const measure = object(entry);
|
|
285
|
+
const label = text(measure?.label);
|
|
286
|
+
const before = text(measure?.before);
|
|
287
|
+
const after = text(measure?.after);
|
|
288
|
+
return label && (before || after) ? [label, before ?? "", after ?? ""] : undefined;
|
|
289
|
+
});
|
|
290
|
+
return rows.length ? { type: "table", columns: ["", labels.before, labels.after], rows } : undefined;
|
|
291
|
+
}
|
|
292
|
+
case "bars": {
|
|
293
|
+
const list = items(value?.items, (entry) => {
|
|
294
|
+
const amount = object(entry);
|
|
295
|
+
const label = text(amount?.label);
|
|
296
|
+
const shown = number(amount?.value);
|
|
297
|
+
return label && shown !== undefined ? { label, value: shown } : undefined;
|
|
298
|
+
});
|
|
299
|
+
return list.length ? { type, items: list, ...unit ? { unit } : {} } : undefined;
|
|
300
|
+
}
|
|
301
|
+
case "flow": {
|
|
302
|
+
const list = strings(value?.items);
|
|
303
|
+
return list.length ? { type, items: list } : undefined;
|
|
304
|
+
}
|
|
305
|
+
case "diagram": {
|
|
306
|
+
const mermaid = text(value?.mermaid, MARKDOWN);
|
|
307
|
+
return mermaid ? { type, mermaid } : undefined;
|
|
308
|
+
}
|
|
309
|
+
case "table": {
|
|
310
|
+
const columns = strings(value?.columns, 6);
|
|
311
|
+
const rows = items(value?.rows, (row) => Array.isArray(row) ? columns.map((_, index) => text(row[index]) ?? "") : undefined);
|
|
312
|
+
return columns.length && rows.length ? { type, columns, rows } : undefined;
|
|
313
|
+
}
|
|
314
|
+
case "options": {
|
|
315
|
+
const list = items(value?.items, option).slice(0, 5);
|
|
316
|
+
const question = text(value?.question);
|
|
317
|
+
return list.length ? { type, items: list, ...question ? { question } : {} } : undefined;
|
|
318
|
+
}
|
|
319
|
+
case "notes": {
|
|
320
|
+
const list = items(value?.items, note);
|
|
321
|
+
return list.length ? { type, items: list } : undefined;
|
|
322
|
+
}
|
|
323
|
+
case "next": {
|
|
324
|
+
const list = strings(value?.items, 3);
|
|
325
|
+
return list.length ? { type, items: list } : undefined;
|
|
326
|
+
}
|
|
327
|
+
case "details": {
|
|
328
|
+
const markdown = text(value?.markdown, MARKDOWN);
|
|
329
|
+
const title = text(value?.title);
|
|
330
|
+
return markdown ? { type, markdown, ...title ? { title } : {} } : undefined;
|
|
331
|
+
}
|
|
332
|
+
default:
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
function loose(card) {
|
|
337
|
+
const out = [];
|
|
338
|
+
for (const [key, entries] of Object.entries(card)) {
|
|
339
|
+
const type = key === "files" ? "changes" : key;
|
|
340
|
+
if (Array.isArray(entries) && LISTS.includes(type)) {
|
|
341
|
+
out.push({ type, items: entries, ...type === "options" ? { question: card.question } : {} });
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return out;
|
|
345
|
+
}
|
|
346
|
+
var LISTS = ["stats", "changes", "steps", "flow", "options", "notes", "next"];
|
|
347
|
+
var GlanceSpec;
|
|
348
|
+
((GlanceSpec) => {
|
|
349
|
+
function read(value, partial = false, labels = LABELS) {
|
|
350
|
+
const card = object(value);
|
|
351
|
+
if (!card) {
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
const status = oneOf(card.status, STATUSES);
|
|
355
|
+
const title = text(card.title);
|
|
356
|
+
const blocks = items(Array.isArray(card.blocks) ? card.blocks : loose(card), (entry) => block(entry, partial, labels)).slice(0, BLOCKS);
|
|
357
|
+
if (!blocks.length && !title) {
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
return { blocks, ...status ? { status } : {}, ...title ? { title } : {} };
|
|
361
|
+
}
|
|
362
|
+
GlanceSpec.read = read;
|
|
363
|
+
})(GlanceSpec ||= {});
|
|
364
|
+
|
|
365
|
+
// web-src/glance-ask.ts
|
|
366
|
+
var GlanceAsk;
|
|
367
|
+
((GlanceAsk) => {
|
|
368
|
+
function ofRun(messages) {
|
|
369
|
+
for (let i = messages.length - 1;i >= 0; i--) {
|
|
370
|
+
const message = messages[i];
|
|
371
|
+
if (message.role === "assistant") {
|
|
372
|
+
return message.stopReason === "aborted" || message.stopReason === "error" ? undefined : question(text2(message.content));
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
GlanceAsk.ofRun = ofRun;
|
|
378
|
+
function question(reply) {
|
|
379
|
+
let asked;
|
|
380
|
+
let asks = false;
|
|
381
|
+
for (const code of cards(reply)) {
|
|
382
|
+
const card = GlanceSpec.read(GlanceJson.parse(code, false));
|
|
383
|
+
if (!card) {
|
|
384
|
+
continue;
|
|
385
|
+
}
|
|
386
|
+
const options = card.blocks.find((block2) => block2.type === "options");
|
|
387
|
+
if (options || card.status === "blocked") {
|
|
388
|
+
asks = true;
|
|
389
|
+
asked = (options?.type === "options" ? options.question : undefined) ?? card.title ?? asked;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
return asks ? asked ?? firstLine(reply) : undefined;
|
|
393
|
+
}
|
|
394
|
+
GlanceAsk.question = question;
|
|
395
|
+
function text2(content) {
|
|
396
|
+
if (typeof content === "string") {
|
|
397
|
+
return content;
|
|
398
|
+
}
|
|
399
|
+
return Array.isArray(content) ? content.filter((part) => part?.type === "text" && typeof part.text === "string").map((part) => part.text).join(`
|
|
400
|
+
`) : "";
|
|
401
|
+
}
|
|
402
|
+
function cards(reply) {
|
|
403
|
+
const found = [];
|
|
404
|
+
let fence;
|
|
405
|
+
for (const line of reply.split(`
|
|
406
|
+
`)) {
|
|
407
|
+
const opening = /^\s*(`{3,}|~{3,})\s*([\w-]*)/.exec(line);
|
|
408
|
+
if (!fence) {
|
|
409
|
+
if (opening) {
|
|
410
|
+
fence = { mark: opening[1], lines: [], card: opening[2] === LANGUAGE };
|
|
411
|
+
}
|
|
412
|
+
continue;
|
|
413
|
+
}
|
|
414
|
+
const mark = /^\s*(`{3,}|~{3,})\s*$/.exec(line)?.[1];
|
|
415
|
+
if (mark && mark[0] === fence.mark[0] && mark.length >= fence.mark.length) {
|
|
416
|
+
if (fence.card) {
|
|
417
|
+
found.push(fence.lines.join(`
|
|
418
|
+
`));
|
|
419
|
+
}
|
|
420
|
+
fence = undefined;
|
|
421
|
+
} else {
|
|
422
|
+
fence.lines.push(line);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
return found;
|
|
426
|
+
}
|
|
427
|
+
function firstLine(reply) {
|
|
428
|
+
for (const line of reply.split(`
|
|
429
|
+
`)) {
|
|
430
|
+
if (/^\s*(`{3,}|~{3,})/.test(line)) {
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
const said = line.replace(/^\s*(?:#{1,6}\s+|>\s*|[-*+]\s+|\d+\.\s+)/, "").replace(/[*_`]{1,3}/g, "").trim();
|
|
434
|
+
if (said) {
|
|
435
|
+
return said;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
})(GlanceAsk ||= {});
|
|
441
|
+
|
|
26
442
|
// web-src/glance-prompt.ts
|
|
27
443
|
var GLANCE_PROMPT = `The user reads your replies in Ta, often on a phone, and wants to take in the result at a glance, not read long text.
|
|
28
444
|
|
|
@@ -35,11 +451,11 @@ How to reply:
|
|
|
35
451
|
|
|
36
452
|
The card: {"status": "done" | "partial" | "failed" | "blocked" | "info", "title"?: string, "blocks": [...]}
|
|
37
453
|
status: done = finished, partial = done in part, failed, blocked = waiting for the user, info = an answer, no work. Leave out title: the first line already says it.
|
|
38
|
-
Blocks, 1 to 4 of them, the most important first. Every text a few words, in the user's language; inline Markdown works (**bold**, \`path/to/file\` opens the file).
|
|
454
|
+
Blocks, 1 to 4 of them, the most important first, each with only the fields shown. Every text a few words, in the user's language; inline Markdown works (**bold**, \`path/to/file\` opens the file).
|
|
39
455
|
- {"type":"stats","items":[{"label":"Tests","value":"128/128","tone":"good"},{"label":"Startup","value":"210 ms","delta":"-34%","tone":"good"}]}: key numbers, at most 6; tone good | bad | warn.
|
|
40
|
-
- {"type":"changes","items":[{"path":"src/a.ts","kind":"edit","add":12,"del":3,"note":"why, in a few words"}]}: files changed; kind add | edit | delete.
|
|
456
|
+
- {"type":"changes","items":[{"path":"src/a.ts","kind":"edit","add":12,"del":3,"note":"why, in a few words"}]}: files changed, a path each (points go in notes); kind add | edit | delete.
|
|
41
457
|
- {"type":"steps","items":[{"text":"...","status":"done"}]}: progress or a plan; status done | doing | todo | failed | skipped.
|
|
42
|
-
- {"type":"compare","unit":"ms","better":"lower","items":[{"label":"Startup","before":320,"after":210}]}: before and after, numbers only.
|
|
458
|
+
- {"type":"compare","unit":"ms","better":"lower","items":[{"label":"Startup","before":320,"after":210}]}: before and after, numbers only (words go in a table).
|
|
43
459
|
- {"type":"bars","unit":"MB","items":[{"label":"ta","value":66},{"label":"pi","value":129}]}: amounts side by side.
|
|
44
460
|
- {"type":"flow","items":["Request","Gateway","Session","Model"]}: a sequence or a path.
|
|
45
461
|
- {"type":"diagram","mermaid":"graph LR; A-->B"}: relations a flow cannot show, under 12 nodes.
|
|
@@ -61,6 +477,12 @@ function activate(pi) {
|
|
|
61
477
|
event.systemPromptOptions.sections = { ...event.systemPromptOptions.sections, [LANGUAGE]: GLANCE_PROMPT };
|
|
62
478
|
}
|
|
63
479
|
});
|
|
480
|
+
pi.on("agent_end", async (event) => {
|
|
481
|
+
const question = GlanceAsk.ofRun(event.messages ?? []);
|
|
482
|
+
if (question && await underServe()) {
|
|
483
|
+
pi.appendEntry(TA_ASK_ENTRY, TaAskUtil.entry(question));
|
|
484
|
+
}
|
|
485
|
+
});
|
|
64
486
|
}
|
|
65
487
|
export {
|
|
66
488
|
activate as default
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-glance",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.13.0",
|
|
4
4
|
"description": "A pi package for Ta: replies lead with the answer, short, and show results as cards (key numbers, files, steps, comparisons, choices) rather than paragraphs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package"
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@celljs/ta-protocol": "4.
|
|
30
|
-
"@celljs/ta-web": "4.
|
|
29
|
+
"@celljs/ta-protocol": "4.13.0",
|
|
30
|
+
"@celljs/ta-web": "4.13.0",
|
|
31
31
|
"@types/react": "^19.3.0"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
package/web/index.js
CHANGED
|
@@ -143,7 +143,7 @@ function change(item) {
|
|
|
143
143
|
}
|
|
144
144
|
function step(item, partial) {
|
|
145
145
|
const value = object(item);
|
|
146
|
-
const shown = text(value?.text ?? value?.label ?? item);
|
|
146
|
+
const shown = text(value?.text ?? value?.label ?? value?.title ?? item);
|
|
147
147
|
return shown ? { text: shown, status: oneOf(value?.status, STEPS) ?? (partial ? "todo" : "done") } : undefined;
|
|
148
148
|
}
|
|
149
149
|
function option(item) {
|
|
@@ -166,7 +166,11 @@ function note(item) {
|
|
|
166
166
|
const shown = text(value?.text ?? item);
|
|
167
167
|
return shown ? { text: shown, tone: oneOf(value?.tone, NOTES) ?? "info" } : undefined;
|
|
168
168
|
}
|
|
169
|
-
function
|
|
169
|
+
function isPath(value) {
|
|
170
|
+
return !/[,。;!?、]/.test(value) && (!/\s/.test(value) || /[\\/]/.test(value));
|
|
171
|
+
}
|
|
172
|
+
var LABELS = { before: "Before", after: "After" };
|
|
173
|
+
function block(item, partial, labels) {
|
|
170
174
|
const value = object(item);
|
|
171
175
|
const type = typeof value?.type === "string" ? value.type.trim().toLowerCase() : undefined;
|
|
172
176
|
const unit = text(value?.unit, 16);
|
|
@@ -176,6 +180,11 @@ function block(item, partial) {
|
|
|
176
180
|
return list.length ? { type, items: list } : undefined;
|
|
177
181
|
}
|
|
178
182
|
case "changes": {
|
|
183
|
+
const raw = Array.isArray(value?.items) ? value.items : [];
|
|
184
|
+
if (raw.length && raw.every((entry) => typeof entry === "string" && !isPath(entry))) {
|
|
185
|
+
const list2 = items(raw, note);
|
|
186
|
+
return list2.length ? { type: "notes", items: list2 } : undefined;
|
|
187
|
+
}
|
|
179
188
|
const list = items(value?.items, change);
|
|
180
189
|
return list.length ? { type, items: list } : undefined;
|
|
181
190
|
}
|
|
@@ -192,7 +201,17 @@ function block(item, partial) {
|
|
|
192
201
|
return label && before !== undefined && after !== undefined ? { label, before, after } : undefined;
|
|
193
202
|
});
|
|
194
203
|
const better = oneOf(value?.better, ["lower", "higher"]) ?? "lower";
|
|
195
|
-
|
|
204
|
+
if (list.length) {
|
|
205
|
+
return { type, better, items: list, ...unit ? { unit } : {} };
|
|
206
|
+
}
|
|
207
|
+
const rows = items(value?.items, (entry) => {
|
|
208
|
+
const measure = object(entry);
|
|
209
|
+
const label = text(measure?.label);
|
|
210
|
+
const before = text(measure?.before);
|
|
211
|
+
const after = text(measure?.after);
|
|
212
|
+
return label && (before || after) ? [label, before ?? "", after ?? ""] : undefined;
|
|
213
|
+
});
|
|
214
|
+
return rows.length ? { type: "table", columns: ["", labels.before, labels.after], rows } : undefined;
|
|
196
215
|
}
|
|
197
216
|
case "bars": {
|
|
198
217
|
const list = items(value?.items, (entry) => {
|
|
@@ -238,16 +257,27 @@ function block(item, partial) {
|
|
|
238
257
|
return;
|
|
239
258
|
}
|
|
240
259
|
}
|
|
260
|
+
function loose(card) {
|
|
261
|
+
const out = [];
|
|
262
|
+
for (const [key, entries] of Object.entries(card)) {
|
|
263
|
+
const type = key === "files" ? "changes" : key;
|
|
264
|
+
if (Array.isArray(entries) && LISTS.includes(type)) {
|
|
265
|
+
out.push({ type, items: entries, ...type === "options" ? { question: card.question } : {} });
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return out;
|
|
269
|
+
}
|
|
270
|
+
var LISTS = ["stats", "changes", "steps", "flow", "options", "notes", "next"];
|
|
241
271
|
var GlanceSpec;
|
|
242
272
|
((GlanceSpec) => {
|
|
243
|
-
function read(value, partial = false) {
|
|
273
|
+
function read(value, partial = false, labels = LABELS) {
|
|
244
274
|
const card = object(value);
|
|
245
275
|
if (!card) {
|
|
246
276
|
return;
|
|
247
277
|
}
|
|
248
278
|
const status = oneOf(card.status, STATUSES);
|
|
249
279
|
const title = text(card.title);
|
|
250
|
-
const blocks = items(card.blocks, (entry) => block(entry, partial)).slice(0, BLOCKS);
|
|
280
|
+
const blocks = items(Array.isArray(card.blocks) ? card.blocks : loose(card), (entry) => block(entry, partial, labels)).slice(0, BLOCKS);
|
|
251
281
|
if (!blocks.length && !title) {
|
|
252
282
|
return;
|
|
253
283
|
}
|
|
@@ -298,6 +328,11 @@ var GlanceWords;
|
|
|
298
328
|
return language === "zh-CN" ? ZH : EN;
|
|
299
329
|
}
|
|
300
330
|
GlanceWords.of = of;
|
|
331
|
+
function picked(answer, labels) {
|
|
332
|
+
const said = answer.trim();
|
|
333
|
+
return labels.find((label) => said === label || said === format(EN.pick, { label }) || said === format(ZH.pick, { label }));
|
|
334
|
+
}
|
|
335
|
+
GlanceWords.picked = picked;
|
|
301
336
|
function format(text2, values) {
|
|
302
337
|
return text2.replace(/\{(\w+)\}/g, (all, key) => (key in values) ? String(values[key]) : all);
|
|
303
338
|
}
|
|
@@ -327,6 +362,8 @@ function count(value) {
|
|
|
327
362
|
function glanceCard(pi) {
|
|
328
363
|
const icons = pi.ui.icons;
|
|
329
364
|
const Markdown = pi.ui.Markdown;
|
|
365
|
+
const Reply = React.createContext(undefined);
|
|
366
|
+
const Answer = React.createContext({ known: false });
|
|
330
367
|
function Text({ text: text2 }) {
|
|
331
368
|
return MARKS.test(text2) ? /* @__PURE__ */ React.createElement("span", {
|
|
332
369
|
className: "tag-inline"
|
|
@@ -539,16 +576,26 @@ function glanceCard(pi) {
|
|
|
539
576
|
}))))))));
|
|
540
577
|
}
|
|
541
578
|
function Options({ block: block2, words, closed }) {
|
|
542
|
-
const [
|
|
579
|
+
const [tapped, setChosen] = React.useState();
|
|
580
|
+
const send = React.useContext(Reply);
|
|
581
|
+
const answer = React.useContext(Answer);
|
|
582
|
+
const said = answer.text === undefined ? undefined : GlanceWords.picked(answer.text, block2.items.map((item) => item.label));
|
|
583
|
+
const chosen = tapped ?? said;
|
|
584
|
+
const done = chosen !== undefined || answer.text !== undefined;
|
|
585
|
+
const pending = answer.known && closed && !done;
|
|
543
586
|
const choose = (label) => {
|
|
587
|
+
if (!send) {
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
544
590
|
setChosen(label);
|
|
545
|
-
|
|
591
|
+
send(GlanceWords.format(words.pick, { label })).catch((error) => {
|
|
546
592
|
setChosen(undefined);
|
|
547
593
|
pi.ui.notify(error instanceof Error ? error.message : String(error), "error");
|
|
548
594
|
});
|
|
549
595
|
};
|
|
550
596
|
return /* @__PURE__ */ React.createElement("div", {
|
|
551
|
-
className: "tag-options-block"
|
|
597
|
+
className: "tag-options-block",
|
|
598
|
+
"data-pending": pending || undefined
|
|
552
599
|
}, block2.question && /* @__PURE__ */ React.createElement("div", {
|
|
553
600
|
className: "tag-question"
|
|
554
601
|
}, /* @__PURE__ */ React.createElement(Text, {
|
|
@@ -562,7 +609,7 @@ function glanceCard(pi) {
|
|
|
562
609
|
className: "tag-option",
|
|
563
610
|
"data-recommended": item.recommended || undefined,
|
|
564
611
|
"data-chosen": picked || undefined,
|
|
565
|
-
"data-other":
|
|
612
|
+
"data-other": done && !picked || undefined
|
|
566
613
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
567
614
|
className: "tag-option-main"
|
|
568
615
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
@@ -591,8 +638,8 @@ function glanceCard(pi) {
|
|
|
591
638
|
text: point
|
|
592
639
|
}))))), /* @__PURE__ */ React.createElement("button", {
|
|
593
640
|
type: "button",
|
|
594
|
-
className: `ta-button tag-choose${item.recommended && !
|
|
595
|
-
disabled: !closed ||
|
|
641
|
+
className: `ta-button tag-choose${item.recommended && !done ? " ta-primary" : ""}`,
|
|
642
|
+
disabled: !closed || !send || done,
|
|
596
643
|
onClick: () => choose(item.label)
|
|
597
644
|
}, picked && /* @__PURE__ */ React.createElement(Icon, {
|
|
598
645
|
name: "Check",
|
|
@@ -617,14 +664,15 @@ function glanceCard(pi) {
|
|
|
617
664
|
})))));
|
|
618
665
|
}
|
|
619
666
|
function Next({ block: block2, closed }) {
|
|
667
|
+
const send = React.useContext(Reply);
|
|
620
668
|
return /* @__PURE__ */ React.createElement("div", {
|
|
621
669
|
className: "tag-next"
|
|
622
670
|
}, block2.items.map((item, index) => /* @__PURE__ */ React.createElement("button", {
|
|
623
671
|
key: index,
|
|
624
672
|
type: "button",
|
|
625
673
|
className: "tag-chip",
|
|
626
|
-
disabled: !closed,
|
|
627
|
-
onClick: () => void pi.
|
|
674
|
+
disabled: !closed || !send,
|
|
675
|
+
onClick: () => void send?.(item).catch((error) => pi.ui.notify(error instanceof Error ? error.message : String(error), "error"))
|
|
628
676
|
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
629
677
|
name: "CornerDownRight",
|
|
630
678
|
size: 13
|
|
@@ -724,9 +772,13 @@ ${block2.mermaid}
|
|
|
724
772
|
text: card.title
|
|
725
773
|
})));
|
|
726
774
|
}
|
|
727
|
-
return function GlanceCard(
|
|
775
|
+
return function GlanceCard(props) {
|
|
776
|
+
const { code, closed } = props;
|
|
777
|
+
const send = "send" in props ? props.send : pi.sendUserMessage;
|
|
778
|
+
const known = "answer" in props;
|
|
779
|
+
const answer = React.useMemo(() => ({ known, text: props.answer }), [known, props.answer]);
|
|
728
780
|
const words = GlanceWords.of(pi.ui.language);
|
|
729
|
-
const card = React.useMemo(() => GlanceSpec.read(GlanceJson.parse(code, !closed), !closed), [code, closed]);
|
|
781
|
+
const card = React.useMemo(() => GlanceSpec.read(GlanceJson.parse(code, !closed), !closed, words), [code, closed, words]);
|
|
730
782
|
if (!card) {
|
|
731
783
|
return closed ? /* @__PURE__ */ React.createElement(Markdown, {
|
|
732
784
|
text: `\`\`\`json
|
|
@@ -738,7 +790,11 @@ ${code}
|
|
|
738
790
|
className: "ta-spinner"
|
|
739
791
|
}), /* @__PURE__ */ React.createElement("span", null, words.writing));
|
|
740
792
|
}
|
|
741
|
-
return /* @__PURE__ */ React.createElement(
|
|
793
|
+
return /* @__PURE__ */ React.createElement(Reply.Provider, {
|
|
794
|
+
value: send
|
|
795
|
+
}, /* @__PURE__ */ React.createElement(Answer.Provider, {
|
|
796
|
+
value: answer
|
|
797
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
742
798
|
className: "tag-card",
|
|
743
799
|
"data-streaming": !closed || undefined
|
|
744
800
|
}, /* @__PURE__ */ React.createElement(Head, {
|
|
@@ -752,12 +808,13 @@ ${code}
|
|
|
752
808
|
block: block2,
|
|
753
809
|
words,
|
|
754
810
|
closed
|
|
755
|
-
}))));
|
|
811
|
+
}))))));
|
|
756
812
|
};
|
|
757
813
|
}
|
|
758
814
|
|
|
759
815
|
// web-src/glance-protocol.ts
|
|
760
816
|
var LANGUAGE = "ta-glance";
|
|
817
|
+
var ALIASES = ["glance", "glance-choice"];
|
|
761
818
|
|
|
762
819
|
// web-src/style.ts
|
|
763
820
|
var STYLE = `
|
|
@@ -809,11 +866,15 @@ var STYLE = `
|
|
|
809
866
|
/* The head: how it went, as a pill, and a title beside it that wraps under it when long */
|
|
810
867
|
.tag-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: var(--tag-y) var(--tag-x) 0; }
|
|
811
868
|
.tag-card > .tag-head + .tag-part { border-top: 0; padding-top: 8px; }
|
|
869
|
+
/* A table or a diagram reaches the edges: under the head it keeps the hairline, a gap above it */
|
|
870
|
+
.tag-card > .tag-head + .tag-part:is([data-type='table'], [data-type='diagram']) { margin-top: var(--tag-y); padding-top: 0; border-top: 1px solid var(--tag-line); }
|
|
812
871
|
.tag-title { flex: 1 1 14em; min-width: 0; font-weight: 600; font-size: calc(14px * var(--tag-s)); line-height: 1.45; color: var(--ta-text); }
|
|
813
872
|
.tag-status { --tag-tone: var(--ta-muted); flex: none; display: inline-flex; align-items: center; gap: 6px; height: calc(22px * var(--tag-s)); padding: 0 9px; border-radius: 999px; font-size: var(--tag-small); font-weight: 600; line-height: 1; white-space: nowrap; color: var(--tag-tone); background: color-mix(in srgb, var(--tag-tone) 12%, transparent); }
|
|
814
873
|
.tag-status i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
|
|
815
874
|
.tag-status[data-status='done'] { --tag-tone: var(--ta-green); }
|
|
816
|
-
.tag-status[data-status='partial']
|
|
875
|
+
.tag-status[data-status='partial'] { --tag-tone: var(--ta-yellow); }
|
|
876
|
+
/* Needs you: the blue of what waits for the user, as the ? of the list of chats. */
|
|
877
|
+
.tag-status[data-status='blocked'] { --tag-tone: var(--ta-blue); }
|
|
817
878
|
.tag-status[data-status='failed'] { --tag-tone: var(--ta-red); }
|
|
818
879
|
|
|
819
880
|
/* What a part is about, in small muted type above it */
|
|
@@ -941,6 +1002,10 @@ var STYLE = `
|
|
|
941
1002
|
.tag-option[data-recommended] { border-color: color-mix(in srgb, var(--ta-green) 50%, var(--ta-border)); background: color-mix(in srgb, var(--ta-green) 4%, transparent); }
|
|
942
1003
|
.tag-option[data-chosen] { border-color: var(--ta-green); box-shadow: 0 0 0 1px var(--ta-green) inset; }
|
|
943
1004
|
.tag-option[data-other] { opacity: 0.5; }
|
|
1005
|
+
/* Choices that wait for the user: the card is framed in blue and its question marked with the ? of the list, until they answer. */
|
|
1006
|
+
.tag-card:has(.tag-options-block[data-pending]) { border-color: color-mix(in srgb, var(--ta-blue) 55%, var(--ta-border)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ta-blue) 22%, transparent); }
|
|
1007
|
+
.tag-options-block[data-pending] > .tag-question { display: flex; align-items: center; gap: 6px; }
|
|
1008
|
+
.tag-options-block[data-pending] > .tag-question::before { content: '?'; flex: none; width: 16px; height: 16px; border-radius: 50%; background: var(--ta-blue); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }
|
|
944
1009
|
.tag-option-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; }
|
|
945
1010
|
.tag-option-label { font-weight: 600; }
|
|
946
1011
|
.tag-badge { flex: none; padding: 0 6px; border-radius: 999px; font-size: var(--tag-tiny); line-height: calc(18px * var(--tag-s)); font-weight: 600; white-space: nowrap; color: var(--ta-green); background: color-mix(in srgb, var(--ta-green) 13%, transparent); }
|
|
@@ -1005,7 +1070,10 @@ function activate(pi) {
|
|
|
1005
1070
|
};
|
|
1006
1071
|
}
|
|
1007
1072
|
const removeStyle = injectStyle();
|
|
1008
|
-
|
|
1073
|
+
const card = glanceCard(pi);
|
|
1074
|
+
for (const language of [LANGUAGE, ...ALIASES]) {
|
|
1075
|
+
pi.registerCodeRenderer(language, card);
|
|
1076
|
+
}
|
|
1009
1077
|
return removeStyle;
|
|
1010
1078
|
}
|
|
1011
1079
|
export {
|