@celljs/ta-goals 0.0.0-stage → 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 ADDED
@@ -0,0 +1,1027 @@
1
+ // web-src/goal-protocol.ts
2
+ var CARD = "ta-goal";
3
+ var RESULT = "ta-goal-result";
4
+ var Keys;
5
+ ((Keys) => {
6
+ Keys.GOALS = "goals";
7
+ Keys.SETTINGS = "settings";
8
+ })(Keys ||= {});
9
+ var Limits;
10
+ ((Limits) => {
11
+ Limits.ACTIVE = 3;
12
+ Limits.ACTIVE_MAX = 8;
13
+ Limits.FAILURES = 3;
14
+ Limits.EVENTS = 10;
15
+ Limits.EVENT_CHARS = 2000;
16
+ Limits.SETTLE_MS = 5000;
17
+ Limits.WATCH = 10;
18
+ Limits.BRIEF_LINES = 6;
19
+ Limits.PACE_MS = 4 * 60 * 60000;
20
+ Limits.PACE_MIN_MS = 15 * 60000;
21
+ Limits.PACE_MAX_MS = 7 * 24 * 60 * 60000;
22
+ Limits.BUDGET_MS = 2 * 60 * 60000;
23
+ Limits.BUDGET_MAX_MS = 12 * 60 * 60000;
24
+ Limits.BUSY_MS = 10 * 60000;
25
+ Limits.LOG = 60;
26
+ Limits.ITEMS = 20;
27
+ Limits.TEXT = 400;
28
+ Limits.SLEEP_MS = 60000;
29
+ })(Limits ||= {});
30
+
31
+ // web-src/goal-util.ts
32
+ var GoalUtil;
33
+ ((GoalUtil) => {
34
+ const STATUSES = ["working", "review", "done", "paused"];
35
+ function duration(value) {
36
+ if (typeof value === "number" && Number.isFinite(value) && value > 0) {
37
+ return Math.round(value * 60000);
38
+ }
39
+ if (typeof value !== "string") {
40
+ return;
41
+ }
42
+ const text2 = value.trim().toLowerCase().replace(/^every\s+/, "");
43
+ const parts = /^(?:(\d+(?:\.\d+)?)d)?\s*(?:(\d+(?:\.\d+)?)h)?\s*(?:(\d+(?:\.\d+)?)m(?:in)?)?$/.exec(text2);
44
+ if (!text2 || !parts || !(parts[1] || parts[2] || parts[3])) {
45
+ return;
46
+ }
47
+ const ms = (Number(parts[1] ?? 0) * 24 * 60 + Number(parts[2] ?? 0) * 60 + Number(parts[3] ?? 0)) * 60000;
48
+ return ms > 0 ? Math.round(ms) : undefined;
49
+ }
50
+ GoalUtil.duration = duration;
51
+ function line(value) {
52
+ if (typeof value !== "string") {
53
+ return "";
54
+ }
55
+ const text2 = value.replace(/\s+/g, " ").trim();
56
+ return text2.length > Limits.TEXT ? `${text2.slice(0, Limits.TEXT - 1)}…` : text2;
57
+ }
58
+ GoalUtil.line = line;
59
+ function lines(value) {
60
+ const list = Array.isArray(value) ? value : typeof value === "string" ? [value] : [];
61
+ return [...new Set(list.map(line).filter(Boolean))].slice(0, Limits.ITEMS);
62
+ }
63
+ GoalUtil.lines = lines;
64
+ function clamp(value, min, max) {
65
+ return Math.min(max, Math.max(min, value));
66
+ }
67
+ function draft(input, defaults = settings(undefined)) {
68
+ const given = input && typeof input === "object" ? input : {};
69
+ const title = line(given.title);
70
+ if (!title) {
71
+ throw new Error("A goal needs a title: what to achieve, in a line.");
72
+ }
73
+ const doneWhen = lines(given.doneWhen);
74
+ if (doneWhen.length === 0) {
75
+ throw new Error("A goal needs doneWhen: how it is judged done, each a check the user can see.");
76
+ }
77
+ const pace = duration(given.every);
78
+ const budget = duration(given.budget);
79
+ return {
80
+ title,
81
+ doneWhen,
82
+ constraints: lines(given.constraints),
83
+ askFirst: lines(given.askFirst),
84
+ paceMs: clamp(pace ?? defaults.paceMs, Limits.PACE_MIN_MS, Limits.PACE_MAX_MS),
85
+ budgetMs: clamp(budget ?? defaults.budgetMs, Limits.PACE_MIN_MS, Limits.BUDGET_MAX_MS)
86
+ };
87
+ }
88
+ GoalUtil.draft = draft;
89
+ function settings(value) {
90
+ const given = value && typeof value === "object" ? value : {};
91
+ const number = (key, fallback, min, max) => typeof given[key] === "number" && Number.isFinite(given[key]) ? clamp(Math.round(given[key]), min, max) : fallback;
92
+ return {
93
+ paceMs: number("paceMs", Limits.PACE_MS, Limits.PACE_MIN_MS, Limits.PACE_MAX_MS),
94
+ budgetMs: number("budgetMs", Limits.BUDGET_MS, Limits.PACE_MIN_MS, Limits.BUDGET_MAX_MS),
95
+ active: number("active", Limits.ACTIVE, 1, Limits.ACTIVE_MAX)
96
+ };
97
+ }
98
+ GoalUtil.settings = settings;
99
+ function brief(goals) {
100
+ const items = goals.flatMap((goal) => [
101
+ ...goal.log.slice(-Limits.BRIEF_LINES).map((entry) => ({
102
+ at: entry.at,
103
+ text: `${goal.title}: ${entry.did}${entry.next ? ` (next: ${entry.next})` : ""}`
104
+ })),
105
+ ...goal.status === "review" ? [{ at: goal.updatedAt, text: `${goal.title}: its result waits for the user to accept` }] : [],
106
+ ...goal.status === "paused" && (goal.failures ?? 0) >= Limits.FAILURES ? [{ at: goal.updatedAt, text: `${goal.title}: paused after ${Limits.FAILURES} failed turns in a row` }] : []
107
+ ]);
108
+ return {
109
+ section: "Progress of the user's goals, each worked on by Ta in a conversation of its own",
110
+ instruction: "One line per goal that moved since the last brief: where it is now, in the words of the user. First a result that waits for the user to accept, or a goal that stopped; leave out goals that did not move.",
111
+ items: items.sort((a, b) => a.at - b.at).slice(-30)
112
+ };
113
+ }
114
+ GoalUtil.brief = brief;
115
+ function card(code) {
116
+ const given = json(code);
117
+ const title = line(given?.title);
118
+ if (!given || !title) {
119
+ return;
120
+ }
121
+ const pace = duration(given.every);
122
+ const budget = duration(given.budget);
123
+ return {
124
+ title,
125
+ doneWhen: lines(given.doneWhen),
126
+ constraints: lines(given.constraints),
127
+ askFirst: lines(given.askFirst),
128
+ ...pace ? { paceMs: clamp(pace, Limits.PACE_MIN_MS, Limits.PACE_MAX_MS) } : {},
129
+ ...budget ? { budgetMs: clamp(budget, Limits.PACE_MIN_MS, Limits.BUDGET_MAX_MS) } : {}
130
+ };
131
+ }
132
+ GoalUtil.card = card;
133
+ function result(input) {
134
+ const given = input && typeof input === "object" ? input : undefined;
135
+ const summary = line(given?.summary);
136
+ if (!given || !summary) {
137
+ return;
138
+ }
139
+ const criteria = (Array.isArray(given.criteria) ? given.criteria : []).map((item) => {
140
+ const one = item && typeof item === "object" ? item : { text: item };
141
+ const evidence = line(one.evidence);
142
+ return { text: line(one.text), met: one.met !== false, ...evidence ? { evidence } : {} };
143
+ }).filter((item) => item.text).slice(0, Limits.ITEMS);
144
+ return { summary, criteria, outputs: lines(given.outputs) };
145
+ }
146
+ GoalUtil.result = result;
147
+ function resultCard(code) {
148
+ return result(json(code));
149
+ }
150
+ GoalUtil.resultCard = resultCard;
151
+ function change(input) {
152
+ const given = input && typeof input === "object" ? input : {};
153
+ const change2 = {};
154
+ if (Array.isArray(given.plan)) {
155
+ change2.plan = given.plan.map((item) => {
156
+ const one = item && typeof item === "object" ? item : { text: item };
157
+ return { text: line(one.text), done: one.done === true };
158
+ }).filter((step) => step.text).slice(0, Limits.ITEMS);
159
+ }
160
+ const did = line(given.did);
161
+ const next = line(given.next);
162
+ if (did) {
163
+ change2.did = did;
164
+ }
165
+ if (next) {
166
+ change2.next = next;
167
+ }
168
+ const wake = duration(given.wakeIn);
169
+ if (wake) {
170
+ change2.wakeMs = clamp(wake, Limits.PACE_MIN_MS, Limits.PACE_MAX_MS);
171
+ }
172
+ if (given.status !== undefined) {
173
+ if (!STATUSES.includes(given.status)) {
174
+ throw new Error(`status is one of ${STATUSES.join(", ")}.`);
175
+ }
176
+ change2.status = given.status;
177
+ }
178
+ const result2 = GoalUtil.result(given.result);
179
+ if (result2) {
180
+ change2.result = result2;
181
+ }
182
+ if (given.watch !== undefined) {
183
+ change2.watch = lines(given.watch).slice(0, Limits.WATCH);
184
+ }
185
+ return change2;
186
+ }
187
+ GoalUtil.change = change;
188
+ function short(ms) {
189
+ const minutes = Math.round(ms / 60000);
190
+ if (minutes % 1440 === 0) {
191
+ return `${minutes / 1440}d`;
192
+ }
193
+ const hours = Math.floor(minutes / 60);
194
+ const rest = minutes % 60;
195
+ return hours ? `${hours}h${rest ? `${rest}m` : ""}` : `${rest}m`;
196
+ }
197
+ GoalUtil.short = short;
198
+ function day(at) {
199
+ const date = new Date(at);
200
+ return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
201
+ }
202
+ GoalUtil.day = day;
203
+ function left(goal, now) {
204
+ const used = goal.used.day === day(now) ? goal.used.ms : 0;
205
+ return Math.max(0, goal.budgetMs - used);
206
+ }
207
+ GoalUtil.left = left;
208
+ function tomorrow(now) {
209
+ const date = new Date(now);
210
+ date.setHours(24, 5, 0, 0);
211
+ return date.getTime();
212
+ }
213
+ GoalUtil.tomorrow = tomorrow;
214
+ function find(goals, ref) {
215
+ const key = String(ref ?? "").trim();
216
+ return goals.find((goal) => goal.id === key || !!goal.sessionFile && goal.sessionFile === key) ?? [...goals].sort((a, b) => b.createdAt - a.createdAt).find((goal) => goal.title === key);
217
+ }
218
+ GoalUtil.find = find;
219
+ function progress(goal) {
220
+ return { done: goal.plan.filter((step) => step.done).length, total: goal.plan.length };
221
+ }
222
+ GoalUtil.progress = progress;
223
+ function ignored(name) {
224
+ return /(^|[\\/])(\.git|node_modules|dist|lib|esm|build|out|\.turbo|\.next|coverage)([\\/]|$)/.test(name);
225
+ }
226
+ GoalUtil.ignored = ignored;
227
+ function event(events, text2) {
228
+ const said = text2.length > Limits.EVENT_CHARS ? `${text2.slice(0, Limits.EVENT_CHARS - 1)}…` : text2;
229
+ return [...events ?? [], said].slice(-Limits.EVENTS);
230
+ }
231
+ GoalUtil.event = event;
232
+ function context(goal, now, hookUrl) {
233
+ const list = (items) => items.length ? items.map((item) => `- ${item}`).join(`
234
+ `) : "- (none)";
235
+ const plan = goal.plan.length ? goal.plan.map((step) => `- [${step.done ? "x" : " "}] ${step.text}`).join(`
236
+ `) : "- (no plan yet: make one)";
237
+ const log = goal.log.slice(-8).map((entry) => `- ${new Date(entry.at).toISOString().slice(0, 16)} ${entry.did}${entry.next ? ` / next: ${entry.next}` : ""}`);
238
+ const minutes = (ms) => `${Math.round(ms / 60000)} min`;
239
+ return [
240
+ `Goal: ${goal.title}`,
241
+ `Turn: ${goal.turns + 1}`,
242
+ "Done when:",
243
+ list(goal.doneWhen),
244
+ "Constraints:",
245
+ list(goal.constraints),
246
+ "Ask the user first before:",
247
+ list(goal.askFirst),
248
+ "Plan:",
249
+ plan,
250
+ "Log (latest last):",
251
+ log.length ? log.join(`
252
+ `) : "- (nothing yet)",
253
+ `Pace: a turn every ${minutes(goal.paceMs)}; work left today: ${minutes(left(goal, now))} of ${minutes(goal.budgetMs)}.`,
254
+ `Wakes also on: ${[goal.watch?.length ? `changes to ${goal.watch.join(", ")}` : "", hookUrl ? `a POST to ${hookUrl} (what is posted is told)` : ""].filter(Boolean).join("; ") || "nothing else"}.`,
255
+ ...goal.events?.length ? ["Since the last turn:", ...goal.events.map((event2) => `- ${event2}`)] : []
256
+ ].join(`
257
+ `);
258
+ }
259
+ GoalUtil.context = context;
260
+ function json(code) {
261
+ try {
262
+ const value = JSON.parse(code);
263
+ return value && typeof value === "object" && !Array.isArray(value) ? value : undefined;
264
+ } catch {
265
+ return;
266
+ }
267
+ }
268
+ function blocks(reply, language) {
269
+ const found = [];
270
+ let fence;
271
+ for (const text2 of reply.split(`
272
+ `)) {
273
+ if (!fence) {
274
+ const opening = /^\s*(`{3,}|~{3,})\s*([\w-]*)/.exec(text2);
275
+ if (opening) {
276
+ fence = { mark: opening[1], lines: [], ours: opening[2] === language };
277
+ }
278
+ continue;
279
+ }
280
+ const mark = /^\s*(`{3,}|~{3,})\s*$/.exec(text2)?.[1];
281
+ if (mark && mark[0] === fence.mark[0] && mark.length >= fence.mark.length) {
282
+ if (fence.ours) {
283
+ found.push(fence.lines.join(`
284
+ `));
285
+ }
286
+ fence = undefined;
287
+ } else {
288
+ fence.lines.push(text2);
289
+ }
290
+ }
291
+ return found;
292
+ }
293
+ GoalUtil.blocks = blocks;
294
+ function text(content) {
295
+ if (typeof content === "string") {
296
+ return content;
297
+ }
298
+ return Array.isArray(content) ? content.filter((part) => part?.type === "text" && typeof part.text === "string").map((part) => part.text).join(`
299
+ `) : "";
300
+ }
301
+ GoalUtil.text = text;
302
+ })(GoalUtil ||= {});
303
+
304
+ // ../ta-protocol/esm/common/language.js
305
+ var TaLanguageUtil;
306
+ (function(TaLanguageUtil2) {
307
+ TaLanguageUtil2.ALL = ["zh-CN", "zh-TW", "en-US", "ja-JP"];
308
+ TaLanguageUtil2.NAMES = { "zh-CN": "简体中文", "zh-TW": "繁體中文", "en-US": "English", "ja-JP": "日本語" };
309
+ function of(tag) {
310
+ const said = (tag !== null && tag !== undefined ? tag : "").toLowerCase().replace(/_/g, "-");
311
+ if (/^zh(\b|-)/.test(said)) {
312
+ return /-hant\b/.test(said) || !/-hans\b/.test(said) && /-(tw|hk|mo)\b/.test(said) ? "zh-TW" : "zh-CN";
313
+ }
314
+ return /^ja(\b|-)/.test(said) ? "ja-JP" : "en-US";
315
+ }
316
+ TaLanguageUtil2.of = of;
317
+ function server(env = typeof process === "undefined" ? {} : process.env) {
318
+ return of(env.TA_LANGUAGE || env.LC_ALL || env.LC_MESSAGES || env.LANG);
319
+ }
320
+ TaLanguageUtil2.server = server;
321
+ function pick(language, words) {
322
+ return words[of(language)];
323
+ }
324
+ TaLanguageUtil2.pick = pick;
325
+ function say(words) {
326
+ return words[server()];
327
+ }
328
+ TaLanguageUtil2.say = say;
329
+ function chinese(language) {
330
+ return of(language).startsWith("zh");
331
+ }
332
+ TaLanguageUtil2.chinese = chinese;
333
+ function cjk(language) {
334
+ return of(language) !== "en-US";
335
+ }
336
+ TaLanguageUtil2.cjk = cjk;
337
+ function list(language, items) {
338
+ return items.join(cjk(language) ? "、" : ", ");
339
+ }
340
+ TaLanguageUtil2.list = list;
341
+ })(TaLanguageUtil || (TaLanguageUtil = {}));
342
+
343
+ // web-src/i18n.ts
344
+ var EN = {
345
+ goal: "Goal",
346
+ toStart: "To start",
347
+ drafting: "Drafting the goal…",
348
+ doneWhen: "Done when",
349
+ constraints: "Keep to",
350
+ askFirst: "Asks you before",
351
+ pace: "A step every {pace} · at most {budget} a day",
352
+ start: "Start",
353
+ started: "Started: Ta works on it in a conversation of its own",
354
+ change: "To change it, just tell Ta",
355
+ open: "Open",
356
+ result: "Result",
357
+ toAccept: "To accept",
358
+ accept: "Accept",
359
+ missing: "Something is missing",
360
+ accepted: "Accepted",
361
+ answered: "Answered",
362
+ outputs: "Where it is",
363
+ review: "The result waits for you to accept",
364
+ paused: "Paused",
365
+ done: "Achieved",
366
+ planning: "Making the plan",
367
+ step: "Step {done}/{total}",
368
+ wake: "Work on it now",
369
+ pause: "Pause",
370
+ resume: "Resume",
371
+ remove: "Delete the goal",
372
+ removeHint: "Its conversation stays in the list.",
373
+ minutes: "{n} min",
374
+ hours: "{n} h",
375
+ days: "{n} d",
376
+ resting: "Its time for today is used; it goes on tomorrow",
377
+ stuck: "Paused after failing {n} times in a row",
378
+ settingsTitle: "Goals",
379
+ paceLabel: "How often it works on a goal",
380
+ paceHint: "For a goal whose card does not say",
381
+ budgetLabel: "Work a day at most",
382
+ budgetHint: "Per goal; past it, it goes on the next day",
383
+ activeLabel: "Goals at once",
384
+ activeHint: "More wait until one ends or is paused"
385
+ };
386
+ var ZH = {
387
+ goal: "目标",
388
+ toStart: "待你开始",
389
+ drafting: "正在起草目标…",
390
+ doneWhen: "怎样算达成",
391
+ constraints: "约束",
392
+ askFirst: "这些步骤先问你",
393
+ pace: "每 {pace}推进一次 · 每天最多 {budget}",
394
+ start: "开始",
395
+ started: "已开始:Ta 在单独的对话里推进",
396
+ change: "想改哪里,直接告诉 Ta",
397
+ open: "打开",
398
+ result: "结果",
399
+ toAccept: "待你验收",
400
+ accept: "验收",
401
+ missing: "还差点",
402
+ accepted: "已验收",
403
+ answered: "已回复",
404
+ outputs: "在哪里看",
405
+ review: "结果等你验收",
406
+ paused: "已暂停",
407
+ done: "已达成",
408
+ planning: "正在定计划",
409
+ step: "第 {done}/{total} 步",
410
+ wake: "现在推进一次",
411
+ pause: "暂停",
412
+ resume: "继续",
413
+ remove: "删除目标",
414
+ removeHint: "对话会留在列表里。",
415
+ minutes: "{n} 分钟",
416
+ hours: "{n} 小时",
417
+ days: "{n} 天",
418
+ resting: "今天的时间用完了,明天继续",
419
+ stuck: "连续失败 {n} 次,已暂停",
420
+ settingsTitle: "目标",
421
+ paceLabel: "多久推进一次",
422
+ paceHint: "目标卡上没写时用这个",
423
+ budgetLabel: "每天最多做多久",
424
+ budgetHint: "每个目标分别算;用完了第二天接着做",
425
+ activeLabel: "同时进行的目标",
426
+ activeHint: "超出的要等一个完成或暂停"
427
+ };
428
+ var ZH_TW = {
429
+ goal: "目標",
430
+ toStart: "待你開始",
431
+ drafting: "正在起草目標…",
432
+ doneWhen: "怎樣算達成",
433
+ constraints: "約束",
434
+ askFirst: "這些步驟先問你",
435
+ pace: "每 {pace}推進一次 · 每天最多 {budget}",
436
+ start: "開始",
437
+ started: "已開始:Ta 在單獨的對話裡推進",
438
+ change: "想改哪裡,直接告訴 Ta",
439
+ open: "開啟",
440
+ result: "結果",
441
+ toAccept: "待你驗收",
442
+ accept: "驗收",
443
+ missing: "還差點",
444
+ accepted: "已驗收",
445
+ answered: "已回覆",
446
+ outputs: "在哪裡看",
447
+ review: "結果等你驗收",
448
+ paused: "已暫停",
449
+ done: "已達成",
450
+ planning: "正在定計畫",
451
+ step: "第 {done}/{total} 步",
452
+ wake: "現在推進一次",
453
+ pause: "暫停",
454
+ resume: "繼續",
455
+ remove: "刪除目標",
456
+ removeHint: "對話會留在列表裡。",
457
+ minutes: "{n} 分鐘",
458
+ hours: "{n} 小時",
459
+ days: "{n} 天",
460
+ resting: "今天的時間用完了,明天繼續",
461
+ stuck: "連續失敗 {n} 次,已暫停",
462
+ settingsTitle: "目標",
463
+ paceLabel: "多久推進一次",
464
+ paceHint: "目標卡上沒寫時用這個",
465
+ budgetLabel: "每天最多做多久",
466
+ budgetHint: "每個目標分別算;用完了第二天接著做",
467
+ activeLabel: "同時進行的目標",
468
+ activeHint: "超出的要等一個完成或暫停"
469
+ };
470
+ var JA = {
471
+ goal: "目標",
472
+ toStart: "開始待ち",
473
+ drafting: "目標を下書き中…",
474
+ doneWhen: "達成の基準",
475
+ constraints: "守ること",
476
+ askFirst: "事前に確認するステップ",
477
+ pace: "{pace}ごとに進める · 1 日最大 {budget}",
478
+ start: "開始",
479
+ started: "開始しました:Ta が専用の会話で進めます",
480
+ change: "変えたいところは Ta にそのまま伝えてください",
481
+ open: "開く",
482
+ result: "結果",
483
+ toAccept: "確認待ち",
484
+ accept: "受け入れる",
485
+ missing: "まだ足りない",
486
+ accepted: "受け入れ済み",
487
+ answered: "返信済み",
488
+ outputs: "確認する場所",
489
+ review: "結果があなたの確認を待っています",
490
+ paused: "一時停止中",
491
+ done: "達成",
492
+ planning: "計画を立てています",
493
+ step: "{done}/{total} ステップ目",
494
+ wake: "今すぐ進める",
495
+ pause: "一時停止",
496
+ resume: "再開",
497
+ remove: "目標を削除",
498
+ removeHint: "会話は一覧に残ります。",
499
+ minutes: "{n} 分",
500
+ hours: "{n} 時間",
501
+ days: "{n} 日",
502
+ resting: "今日の作業時間を使い切りました。明日続けます",
503
+ stuck: "{n} 回続けて失敗したため一時停止中",
504
+ settingsTitle: "目標",
505
+ paceLabel: "目標を進める間隔",
506
+ paceHint: "目標カードに指定がないときに使います",
507
+ budgetLabel: "1 日の最大作業時間",
508
+ budgetHint: "目標ごと。使い切ったら翌日に続けます",
509
+ activeLabel: "同時に進める目標",
510
+ activeHint: "超えた分は、どれかが終わるか一時停止するまで待ちます"
511
+ };
512
+ var WORDS = { "zh-CN": ZH, "zh-TW": ZH_TW, "en-US": EN, "ja-JP": JA };
513
+ var GoalWords;
514
+ ((GoalWords) => {
515
+ function of(language) {
516
+ return TaLanguageUtil.pick(language, WORDS);
517
+ }
518
+ GoalWords.of = of;
519
+ function format(text, values) {
520
+ return text.replace(/\{(\w+)\}/g, (all, name) => values[name] === undefined ? all : String(values[name]));
521
+ }
522
+ GoalWords.format = format;
523
+ function span(ms, words) {
524
+ const round = (value) => String(Math.round(value * 10) / 10);
525
+ if (ms < 3600000) {
526
+ return format(words.minutes, { n: Math.round(ms / 60000) });
527
+ }
528
+ if (ms < 86400000) {
529
+ return format(words.hours, { n: round(ms / 3600000) });
530
+ }
531
+ return format(words.days, { n: round(ms / 86400000) });
532
+ }
533
+ GoalWords.span = span;
534
+ })(GoalWords ||= {});
535
+
536
+ // web-src/react.ts
537
+ var React;
538
+ function bind(react) {
539
+ React = react;
540
+ }
541
+
542
+ // web-src/settings.tsx
543
+ var HOUR = 3600000;
544
+ var PACES = [HOUR, 4 * HOUR, 24 * HOUR];
545
+ var BUDGETS = [HOUR, 2 * HOUR, 4 * HOUR];
546
+ var ACTIVE = [1, 3, 5];
547
+ function useGoalSettings(pi) {
548
+ const [value, setValue] = React.useState(() => GoalUtil.settings(undefined));
549
+ React.useEffect(() => {
550
+ let live = true;
551
+ const read = () => void pi.storage.get(Keys.SETTINGS).then((stored) => live && setValue(GoalUtil.settings(stored)), () => {
552
+ return;
553
+ });
554
+ read();
555
+ const stop = pi.storage.onChange((keys) => keys.includes(Keys.SETTINGS) && read());
556
+ return () => {
557
+ live = false;
558
+ stop();
559
+ };
560
+ }, [pi]);
561
+ const set = (change) => {
562
+ const next = { ...value, ...change };
563
+ setValue(next);
564
+ pi.storage.set(Keys.SETTINGS, next).catch((error) => pi.ui.notify(error instanceof Error ? error.message : String(error), "error"));
565
+ };
566
+ return [value, set];
567
+ }
568
+ function Choices({
569
+ label,
570
+ values,
571
+ current,
572
+ word,
573
+ pick
574
+ }) {
575
+ return /* @__PURE__ */ React.createElement("fieldset", {
576
+ className: "ta-segmented",
577
+ "aria-label": label
578
+ }, values.map((value) => /* @__PURE__ */ React.createElement("button", {
579
+ key: value,
580
+ type: "button",
581
+ "aria-pressed": value === current,
582
+ className: value === current ? "ta-on" : "",
583
+ onClick: () => pick(value)
584
+ }, word(value))));
585
+ }
586
+ function goalSettings(pi) {
587
+ const words = () => GoalWords.of(pi.ui.language);
588
+ const label = (key) => () => words()[key];
589
+ function Pace() {
590
+ const [settings, set] = useGoalSettings(pi);
591
+ const w = words();
592
+ return /* @__PURE__ */ React.createElement(Choices, {
593
+ label: w.paceLabel,
594
+ values: PACES,
595
+ current: settings.paceMs,
596
+ word: (ms) => GoalWords.span(ms, w),
597
+ pick: (paceMs) => set({ paceMs })
598
+ });
599
+ }
600
+ function Budget() {
601
+ const [settings, set] = useGoalSettings(pi);
602
+ const w = words();
603
+ return /* @__PURE__ */ React.createElement(Choices, {
604
+ label: w.budgetLabel,
605
+ values: BUDGETS,
606
+ current: settings.budgetMs,
607
+ word: (ms) => GoalWords.span(ms, w),
608
+ pick: (budgetMs) => set({ budgetMs })
609
+ });
610
+ }
611
+ function Active() {
612
+ const [settings, set] = useGoalSettings(pi);
613
+ const w = words();
614
+ return /* @__PURE__ */ React.createElement(Choices, {
615
+ label: w.activeLabel,
616
+ values: ACTIVE,
617
+ current: settings.active,
618
+ word: String,
619
+ pick: (active) => set({ active })
620
+ });
621
+ }
622
+ return {
623
+ title: label("settingsTitle"),
624
+ icon: pi.ui.icons.Target,
625
+ group: "ta",
626
+ rows: [
627
+ { key: "pace", label: label("paceLabel"), description: label("paceHint"), render: Pace },
628
+ { key: "budget", label: label("budgetLabel"), description: label("budgetHint"), render: Budget },
629
+ { key: "active", label: label("activeLabel"), description: label("activeHint"), render: Active }
630
+ ]
631
+ };
632
+ }
633
+
634
+ // web-src/goal-cards.tsx
635
+ function noBusy() {
636
+ return [false, async (action) => action()];
637
+ }
638
+ function List({ items, mark: Mark }) {
639
+ return /* @__PURE__ */ React.createElement("ul", {
640
+ className: "tgl-list"
641
+ }, items.map((item) => /* @__PURE__ */ React.createElement("li", {
642
+ key: item
643
+ }, Mark ? /* @__PURE__ */ React.createElement(Mark, {
644
+ size: 14
645
+ }) : null, /* @__PURE__ */ React.createElement("span", null, item))));
646
+ }
647
+ function Answered({ text, icon: Icon }) {
648
+ return /* @__PURE__ */ React.createElement("div", {
649
+ className: "tgl-part tgl-answered"
650
+ }, Icon ? /* @__PURE__ */ React.createElement(Icon, {
651
+ size: 14
652
+ }) : null, /* @__PURE__ */ React.createElement("span", null, text));
653
+ }
654
+ function goalCard(pi) {
655
+ return function GoalCard({ code, closed, send, answer }) {
656
+ const words = GoalWords.of(pi.ui.language);
657
+ const Loading = pi.ui.Loading ?? pi.ui.Skeleton;
658
+ const draft = React.useMemo(() => GoalUtil.card(code), [code]);
659
+ const [settings] = useGoalSettings(pi);
660
+ const icons = pi.ui.icons;
661
+ const Mark = icons.Target ?? icons.Rocket;
662
+ if (!draft) {
663
+ return closed ? /* @__PURE__ */ React.createElement(pi.ui.Markdown, {
664
+ text: `\`\`\`json
665
+ ${code}
666
+ \`\`\``
667
+ }) : /* @__PURE__ */ React.createElement("div", {
668
+ className: "tgl-card"
669
+ }, /* @__PURE__ */ React.createElement(Loading, {
670
+ compact: true,
671
+ label: words.drafting
672
+ }));
673
+ }
674
+ const started = answer !== undefined && answer.trim() === words.start;
675
+ const pace = draft.paceMs ?? settings.paceMs;
676
+ const budget = draft.budgetMs ?? settings.budgetMs;
677
+ return /* @__PURE__ */ React.createElement("div", {
678
+ className: "tgl-card",
679
+ "data-kind": "goal"
680
+ }, /* @__PURE__ */ React.createElement("div", {
681
+ className: "tgl-head"
682
+ }, /* @__PURE__ */ React.createElement("span", {
683
+ className: "tgl-mark"
684
+ }, Mark ? /* @__PURE__ */ React.createElement(Mark, {
685
+ size: 16
686
+ }) : null), /* @__PURE__ */ React.createElement("div", {
687
+ className: "tgl-head-text"
688
+ }, /* @__PURE__ */ React.createElement("div", {
689
+ className: "tgl-kind"
690
+ }, words.goal, closed && answer === undefined ? /* @__PURE__ */ React.createElement("span", {
691
+ className: "tgl-status"
692
+ }, /* @__PURE__ */ React.createElement("i", null), words.toStart) : null), /* @__PURE__ */ React.createElement("div", {
693
+ className: "tgl-title"
694
+ }, draft.title))), draft.doneWhen?.length ? /* @__PURE__ */ React.createElement("div", {
695
+ className: "tgl-part"
696
+ }, /* @__PURE__ */ React.createElement("div", {
697
+ className: "tgl-section"
698
+ }, words.doneWhen), /* @__PURE__ */ React.createElement(List, {
699
+ items: draft.doneWhen,
700
+ mark: icons.Check
701
+ })) : null, draft.constraints?.length ? /* @__PURE__ */ React.createElement("div", {
702
+ className: "tgl-part"
703
+ }, /* @__PURE__ */ React.createElement("div", {
704
+ className: "tgl-section"
705
+ }, words.constraints), /* @__PURE__ */ React.createElement(List, {
706
+ items: draft.constraints,
707
+ mark: icons.Minus
708
+ })) : null, draft.askFirst?.length ? /* @__PURE__ */ React.createElement("div", {
709
+ className: "tgl-part"
710
+ }, /* @__PURE__ */ React.createElement("div", {
711
+ className: "tgl-section"
712
+ }, words.askFirst), /* @__PURE__ */ React.createElement(List, {
713
+ items: draft.askFirst,
714
+ mark: icons.CircleHelp
715
+ })) : null, /* @__PURE__ */ React.createElement("div", {
716
+ className: "tgl-part tgl-meta"
717
+ }, GoalWords.format(words.pace, { pace: GoalWords.span(pace, words), budget: GoalWords.span(budget, words) })), !closed ? null : answer !== undefined ? /* @__PURE__ */ React.createElement(Answered, {
718
+ text: started ? words.started : words.answered,
719
+ icon: icons.Check
720
+ }) : /* @__PURE__ */ React.createElement("div", {
721
+ className: "tgl-part tgl-actions"
722
+ }, /* @__PURE__ */ React.createElement(StartButton, {
723
+ pi,
724
+ label: words.start,
725
+ send: send ?? ((text) => pi.sendUserMessage(text))
726
+ }), /* @__PURE__ */ React.createElement("span", {
727
+ className: "tgl-hint"
728
+ }, words.change)));
729
+ };
730
+ }
731
+ function StartButton({ pi, label, send }) {
732
+ const [busy, run] = (pi.ui.useBusy ?? noBusy)();
733
+ return /* @__PURE__ */ React.createElement("button", {
734
+ type: "button",
735
+ className: `ta-button ta-primary${busy ? " ta-busy" : ""}`,
736
+ onClick: () => run(() => send(label))
737
+ }, label);
738
+ }
739
+ function resultCard(pi) {
740
+ return function ResultCard({ code, closed, send, answer }) {
741
+ const words = GoalWords.of(pi.ui.language);
742
+ const Loading = pi.ui.Loading ?? pi.ui.Skeleton;
743
+ const result = React.useMemo(() => GoalUtil.resultCard(code), [code]);
744
+ const icons = pi.ui.icons;
745
+ const [busy, run] = (pi.ui.useBusy ?? noBusy)();
746
+ if (!result) {
747
+ return closed ? /* @__PURE__ */ React.createElement(pi.ui.Markdown, {
748
+ text: `\`\`\`json
749
+ ${code}
750
+ \`\`\``
751
+ }) : /* @__PURE__ */ React.createElement("div", {
752
+ className: "tgl-card"
753
+ }, /* @__PURE__ */ React.createElement(Loading, {
754
+ compact: true
755
+ }));
756
+ }
757
+ const say = send ?? ((text) => pi.sendUserMessage(text));
758
+ const Mark = icons.Trophy ?? icons.Check;
759
+ return /* @__PURE__ */ React.createElement("div", {
760
+ className: "tgl-card",
761
+ "data-kind": "result"
762
+ }, /* @__PURE__ */ React.createElement("div", {
763
+ className: "tgl-head"
764
+ }, /* @__PURE__ */ React.createElement("span", {
765
+ className: "tgl-mark"
766
+ }, Mark ? /* @__PURE__ */ React.createElement(Mark, {
767
+ size: 16
768
+ }) : null), /* @__PURE__ */ React.createElement("div", {
769
+ className: "tgl-head-text"
770
+ }, /* @__PURE__ */ React.createElement("div", {
771
+ className: "tgl-kind"
772
+ }, words.result, closed && answer === undefined ? /* @__PURE__ */ React.createElement("span", {
773
+ className: "tgl-status"
774
+ }, /* @__PURE__ */ React.createElement("i", null), words.toAccept) : null), /* @__PURE__ */ React.createElement("div", {
775
+ className: "tgl-title"
776
+ }, result.summary))), result.criteria.length ? /* @__PURE__ */ React.createElement("div", {
777
+ className: "tgl-part"
778
+ }, /* @__PURE__ */ React.createElement("div", {
779
+ className: "tgl-section"
780
+ }, words.doneWhen), /* @__PURE__ */ React.createElement("ul", {
781
+ className: "tgl-list"
782
+ }, result.criteria.map((item) => {
783
+ const Icon = item.met ? icons.Check : icons.X;
784
+ return /* @__PURE__ */ React.createElement("li", {
785
+ key: item.text,
786
+ "data-met": String(item.met)
787
+ }, Icon ? /* @__PURE__ */ React.createElement(Icon, {
788
+ size: 14
789
+ }) : null, /* @__PURE__ */ React.createElement("span", null, item.text, item.evidence ? /* @__PURE__ */ React.createElement("span", {
790
+ className: "tgl-evidence"
791
+ }, item.evidence) : null));
792
+ }))) : null, result.outputs.length ? /* @__PURE__ */ React.createElement("div", {
793
+ className: "tgl-part tgl-outputs"
794
+ }, /* @__PURE__ */ React.createElement("div", {
795
+ className: "tgl-section"
796
+ }, words.outputs), /* @__PURE__ */ React.createElement(pi.ui.Markdown, {
797
+ text: result.outputs.map((item) => `- ${item}`).join(`
798
+ `)
799
+ })) : null, !closed ? null : answer !== undefined ? /* @__PURE__ */ React.createElement(Answered, {
800
+ text: answer.trim() === words.accept ? words.accepted : words.answered,
801
+ icon: icons.Check
802
+ }) : /* @__PURE__ */ React.createElement("div", {
803
+ className: "tgl-part tgl-actions"
804
+ }, /* @__PURE__ */ React.createElement("button", {
805
+ type: "button",
806
+ className: `ta-button ta-primary${busy ? " ta-busy" : ""}`,
807
+ onClick: () => run(() => say(words.accept))
808
+ }, words.accept), /* @__PURE__ */ React.createElement("button", {
809
+ type: "button",
810
+ className: "ta-button",
811
+ onClick: () => run(() => say(words.missing))
812
+ }, words.missing)));
813
+ };
814
+ }
815
+
816
+ // web-src/goal-tasks.ts
817
+ function taskStatus(goal) {
818
+ if (goal.status === "done" || goal.status === "paused") {
819
+ return goal.status === "done" ? "done" : "stopped";
820
+ }
821
+ return goal.turnAt !== undefined ? "running" : "idle";
822
+ }
823
+ function taskDetail(goal, words, now = Date.now()) {
824
+ switch (goal.status) {
825
+ case "review":
826
+ return words.review;
827
+ case "paused":
828
+ return (goal.failures ?? 0) >= Limits.FAILURES ? GoalWords.format(words.stuck, { n: goal.failures ?? 0 }) : words.paused;
829
+ case "done":
830
+ return goal.result?.summary ?? words.done;
831
+ default: {
832
+ if (GoalUtil.left(goal, now) <= 0) {
833
+ return words.resting;
834
+ }
835
+ const { done, total } = GoalUtil.progress(goal);
836
+ const last = goal.log[goal.log.length - 1];
837
+ const doing = last?.next ?? last?.did;
838
+ if (total === 0) {
839
+ return doing ?? words.planning;
840
+ }
841
+ const step = GoalWords.format(words.step, { done, total });
842
+ return doing ? `${step} · ${doing}` : step;
843
+ }
844
+ }
845
+ }
846
+
847
+ class GoalTaskSource {
848
+ pi;
849
+ goals = [];
850
+ list = [];
851
+ shown = new Map;
852
+ listeners = new Set;
853
+ files = new Set;
854
+ constructor(pi) {
855
+ this.pi = pi;
856
+ this.read();
857
+ pi.storage.onChange((keys) => keys.includes(Keys.GOALS) && void this.read());
858
+ }
859
+ tasks() {
860
+ return this.list;
861
+ }
862
+ subscribe(listener) {
863
+ this.listeners.add(listener);
864
+ return () => this.listeners.delete(listener);
865
+ }
866
+ icon(chat) {
867
+ const icon = this.pi.ui.icons.Target ?? this.pi.ui.icons.Rocket;
868
+ const folder = GoalWords.of(this.pi.ui.language).settingsTitle;
869
+ return chat.sessionFile && this.files.has(chat.sessionFile) && icon ? { icon, tint: "ta-goals", folder } : undefined;
870
+ }
871
+ refresh() {
872
+ this.shown.clear();
873
+ this.build();
874
+ }
875
+ async read() {
876
+ const kept = await this.pi.storage.get(Keys.GOALS).catch(() => {
877
+ return;
878
+ });
879
+ this.goals = Array.isArray(kept) ? kept.filter((goal) => goal && typeof goal.id === "string") : [];
880
+ this.files = new Set(this.goals.flatMap((goal) => goal.sessionFile ? [goal.sessionFile] : []));
881
+ this.build();
882
+ }
883
+ build() {
884
+ const next = this.goals.map((goal) => {
885
+ const signature = `${this.pi.ui.language}:${JSON.stringify(goal)}`;
886
+ const before = this.shown.get(goal.id);
887
+ if (before?.signature === signature) {
888
+ return before.task;
889
+ }
890
+ const task = this.task(goal);
891
+ this.shown.set(goal.id, { signature, task });
892
+ return task;
893
+ });
894
+ for (const id of [...this.shown.keys()]) {
895
+ if (!this.goals.some((goal) => goal.id === id)) {
896
+ this.shown.delete(id);
897
+ }
898
+ }
899
+ if (next.length === this.list.length && next.every((task, index) => task === this.list[index])) {
900
+ return;
901
+ }
902
+ this.list = next;
903
+ for (const listener of this.listeners) {
904
+ listener();
905
+ }
906
+ }
907
+ task(goal) {
908
+ const { pi } = this;
909
+ const words = GoalWords.of(pi.ui.language);
910
+ const status = taskStatus(goal);
911
+ const show = () => void (goal.sessionFile ? pi.openChat?.(goal.sessionFile) : undefined);
912
+ const remove = async () => {
913
+ await pi.callHost("remove", goal.id);
914
+ };
915
+ return {
916
+ id: goal.id,
917
+ title: goal.title,
918
+ status,
919
+ detail: taskDetail(goal, words),
920
+ startedAt: goal.createdAt,
921
+ ...status === "done" || status === "stopped" ? { endedAt: goal.endedAt ?? goal.updatedAt } : {},
922
+ ...goal.origin ? { origin: goal.origin } : {},
923
+ ...goal.sessionFile ? { session: goal.sessionFile } : {},
924
+ glyph: pi.ui.icons.Target ?? pi.ui.icons.Rocket,
925
+ open: show,
926
+ show,
927
+ menu: () => this.menu(goal, remove),
928
+ remove,
929
+ removeHint: words.removeHint
930
+ };
931
+ }
932
+ menu(goal, remove) {
933
+ const { pi } = this;
934
+ const words = GoalWords.of(pi.ui.language);
935
+ const icon = (name) => pi.ui.icons[name];
936
+ const call = (method) => () => void pi.callHost(method, goal.id).catch((error) => pi.ui.notify(String(error?.message ?? error), "error"));
937
+ const working = goal.status === "working";
938
+ return [
939
+ [
940
+ ...working ? [{ key: "wake", label: words.wake, icon: icon("Play"), run: call("wake") }] : [],
941
+ working || goal.status === "review" ? { key: "pause", label: words.pause, icon: icon("Square"), run: call("pause") } : { key: "resume", label: words.resume, icon: icon("RotateCcw"), run: call("resume") }
942
+ ],
943
+ [
944
+ {
945
+ key: "delete",
946
+ label: words.remove,
947
+ icon: icon("Trash2"),
948
+ danger: true,
949
+ run: () => void pi.ui.removeTasks([{ title: goal.title, remove, removeHint: words.removeHint }])
950
+ }
951
+ ]
952
+ ];
953
+ }
954
+ }
955
+
956
+ // web-src/style.ts
957
+ var STYLE = `
958
+ /* A goal to start (\`\`\`ta-goal) and a result to accept (\`\`\`ta-goal-result): parts one under another, a hairline between. */
959
+ .tgl-card {
960
+ --tgl-s: var(--ta-font-scale, 1);
961
+ --tgl-x: 14px;
962
+ --tgl-y: 12px;
963
+ container: tgl-card / inline-size;
964
+ margin: 2px 0 12px;
965
+ max-width: 560px;
966
+ border: 1px solid var(--ta-border);
967
+ border-radius: 12px;
968
+ background: var(--ta-card);
969
+ overflow: hidden;
970
+ color: var(--ta-text);
971
+ font-size: calc(13px * var(--tgl-s));
972
+ line-height: 1.5;
973
+ overflow-wrap: anywhere;
974
+ text-align: left;
975
+ }
976
+ @container tgl-card (max-width: 400px) { .tgl-card > * { --tgl-x: 12px; --tgl-y: 10px; } }
977
+ .tgl-card > * + * { border-top: 1px solid var(--ta-border-muted); }
978
+ .tgl-card ul { margin: 0; padding: 0; list-style: none; }
979
+ .tgl-part { padding: var(--tgl-y) var(--tgl-x); min-width: 0; }
980
+ .tgl-head { display: flex; align-items: flex-start; gap: 10px; padding: var(--tgl-y) var(--tgl-x); }
981
+ .tgl-mark { flex: none; display: inline-flex; align-items: center; justify-content: center; width: calc(28px * var(--tgl-s)); height: calc(28px * var(--tgl-s)); border-radius: 8px; color: var(--ta-blue); background: color-mix(in srgb, var(--ta-blue) 12%, transparent); }
982
+ .tgl-card[data-kind='result'] .tgl-mark { color: var(--ta-green); background: color-mix(in srgb, var(--ta-green) 12%, transparent); }
983
+ .tgl-head-text { flex: 1; min-width: 0; }
984
+ .tgl-kind { display: flex; align-items: center; gap: 8px; min-height: calc(20px * var(--tgl-s)); color: var(--ta-muted); font-size: calc(12px * var(--tgl-s)); line-height: 1.4; }
985
+ .tgl-title { font-weight: 600; font-size: calc(14px * var(--tgl-s)); line-height: 1.45; }
986
+ .tgl-status { flex: none; display: inline-flex; align-items: center; gap: 5px; height: calc(20px * var(--tgl-s)); padding: 0 8px; border-radius: 999px; font-size: calc(12px * var(--tgl-s)); font-weight: 600; line-height: 1; white-space: nowrap; color: var(--ta-blue); background: color-mix(in srgb, var(--ta-blue) 12%, transparent); }
987
+ .tgl-status i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
988
+ .tgl-status[data-done] { color: var(--ta-muted); background: var(--ta-hover); }
989
+ .tgl-section { color: var(--ta-muted); font-size: calc(12px * var(--tgl-s)); line-height: 1.4; margin-bottom: 6px; }
990
+ .tgl-list li { display: flex; gap: 8px; align-items: flex-start; }
991
+ .tgl-list li + li { margin-top: 4px; }
992
+ .tgl-list li > svg { flex: none; margin-top: calc(3px * var(--tgl-s)); color: var(--ta-muted); }
993
+ .tgl-list li[data-met='true'] > svg { color: var(--ta-green); }
994
+ .tgl-list li[data-met='false'] > svg { color: var(--ta-red); }
995
+ .tgl-evidence { display: block; color: var(--ta-muted); font-size: calc(12px * var(--tgl-s)); }
996
+ .tgl-summary { font-size: calc(13px * var(--tgl-s)); }
997
+ .tgl-meta { color: var(--ta-muted); font-size: calc(12px * var(--tgl-s)); }
998
+ .tgl-outputs .ta-markdown > :first-child { margin-top: 0; }
999
+ .tgl-outputs .ta-markdown > :last-child { margin-bottom: 0; }
1000
+ .tgl-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
1001
+ .tgl-hint { color: var(--ta-muted); font-size: calc(12px * var(--tgl-s)); }
1002
+ .tgl-answered { display: flex; align-items: center; gap: 6px; color: var(--ta-muted); font-size: calc(12px * var(--tgl-s)); }
1003
+ .tgl-answered > svg { color: var(--ta-green); }
1004
+ `;
1005
+ function injectStyle() {
1006
+ const element = document.createElement("style");
1007
+ element.dataset.taPackage = "ta-goals";
1008
+ element.textContent = STYLE;
1009
+ document.head.appendChild(element);
1010
+ return () => element.remove();
1011
+ }
1012
+
1013
+ // web-src/index.tsx
1014
+ function activate(pi) {
1015
+ bind(pi.React);
1016
+ const removeStyle = injectStyle();
1017
+ const source = new GoalTaskSource(pi);
1018
+ pi.registerTasks(source);
1019
+ pi.registerChatIcon?.(source);
1020
+ pi.registerSettings(goalSettings(pi));
1021
+ pi.registerCodeRenderer?.(CARD, goalCard(pi), { spoken: (code) => GoalUtil.card(code)?.title });
1022
+ pi.registerCodeRenderer?.(RESULT, resultCard(pi), { spoken: (code) => GoalUtil.resultCard(code)?.summary });
1023
+ return removeStyle;
1024
+ }
1025
+ export {
1026
+ activate as default
1027
+ };