@celljs/ta-meeting 4.34.0 → 4.36.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 CHANGED
@@ -3,17 +3,17 @@
3
3
  A pi package that comes with Ta (on by default, turned off in Settings → Extensions): meetings. Tap to start when a meeting starts and Ta writes down what is said; at the end, in a conversation of its own, it gives the minutes, the key points and the to-dos (who, when), and does the to-dos it can once you pick them.
4
4
 
5
5
  - **The Meetings page** (Discover → Work): a red button starts. While recording it shows the time and the words as they come; pause, resume, end and sum up, or discard. It goes on while you look elsewhere in Ta, and a row "Recording a meeting" on the double's home leads back.
6
- - **Transcription**: with a voice service chosen in Settings → Voice (OpenAI Realtime, Qwen, Hunyuan, Doubao), that service hears, its key staying in the Ta service; without one, the recognizer of the device (Apple's in the Ta app and the desktop app, the browser's own elsewhere). When the service drops or the microphone is taken, it pauses by itself and what was written down is kept.
6
+ - **Transcription**: with a voice service chosen in Settings → Voice (OpenAI Realtime, Qwen, Hunyuan, Doubao), that service hears, its key staying in the Ta service; without one, the recognizer of the device (Apple's in the Ta app and the desktop app, the browser's own elsewhere). While recording the screen stays on (the Ta app turns off auto-lock; the desktop app keeps the display awake and does not restart for an update mid-meeting). When the service drops, the network goes or the page is put away, it reconnects by itself (after 1, 2, 5, 10, 20, then 30 seconds; at once when the page shows again or the network is back), what was written down kept; only when the microphone or speech recognition is not allowed does it pause. Saving at the end is tried twice more when it fails.
7
7
  - **Text only**: no audio is recorded or kept. The text is saved every 30 seconds and once more at the end, in `meetings/<id>.txt` of the agent directory on this computer (0600), never through the relay.
8
8
  - **Summing up**: at the end a conversation named after the meeting opens, the words of the meeting in the context of its message, and Ta answers by the `meeting-notes` skill: one line, then one card (the to-dos, the key points, a multiple choice "Which should I do?", the full minutes folded). Once you pick: what can be done at once is done there; what takes days becomes a goal card; what is to happen at a time becomes a scheduled task; what goes to other people is only drafted, sent when you say so.
9
9
  - **Earlier meetings**: a row each with its title, time, length and characters; tap to go back to its minutes (or to sum it up when it was not), swipe left to remove its text (the conversation of its minutes stays).
10
- - **Settings → Voice → Meetings**: how long the text is kept (30, 90, 180, 365 days, default 90) and the space it may take (10, 50, 200 MB, default 50); beyond them the oldest goes first, never the meeting being recorded nor the newest.
10
+ - **Settings → Storage → Meeting text**: how long the text is kept (30, 90, 180, 365 days or no limit, default 90) and the space it may take (10, 50, 200 MB or no limit, default 50), and clearing it; beyond them the oldest goes first, never the meeting being recorded nor the newest.
11
11
 
12
12
  ## Data and calls
13
13
 
14
- Package data (`@celljs/ta-meeting`, written by the server alone): `meetings` (the title, start and end, length, characters, size and conversation of the minutes of each), `settings` (`keepDays`, `maxMB`). The words of the meetings are in `meetings/` of the agent directory.
14
+ Package data (`@celljs/ta-meeting`, written by the server alone): `meetings` (the title, start and end, length, characters, size and conversation of the minutes of each). The words of the meetings are in `meetings/` of the agent directory.
15
15
 
16
- Server methods (the page calls them with `callHost`; only the user and members with `settings.manage` may): `list()`, `settings()`, `setSettings(change)`, `save(meeting, text)`, `get(id)`, `update(id, { title?, session? })`, `remove(id)`.
16
+ Server methods (the page calls them with `callHost`; only the user and members with `settings.manage` may): `list()`, `save(meeting, text)`, `get(id)`, `update(id, { title?, session? })`, `remove(id)`.
17
17
 
18
18
  The page writes down with `ui.voice.transcribe` (`WebVoice` of ta-web): through the Ta service when a voice service is chosen, else with the recognizer of the device; as a recognizer ends a stretch of speech, the next listening starts at once.
19
19
 
package/README.md CHANGED
@@ -3,17 +3,17 @@
3
3
  Ta 自带的 pi 包(默认开启,可在 设置 → 扩展 关闭):会议。开会时点一下开始,Ta 边听边记;结束后在一个单独的对话里给出纪要、重点和待办(谁、什么时候),你勾选后它把能做的待办接着做掉。
4
4
 
5
5
  - **会议页**(发现 → 工作):一个红色按钮开始记录。记录中显示时长、实时文字,可以暂停、继续、结束并整理或放弃。离开这页也会继续记,分身首页多一行「会议记录中」点回来。
6
- - **转写**:在 设置 → 语音 选了语音服务(OpenAI Realtime、通义、混元、豆包)时用它听写,Key 只在 Ta 服务里;没选就用本机的听写(Ta App 和桌面版用 Apple 的识别,浏览器用自带的)。服务断开或麦克风被占用时自动转为暂停,已记下的文字都在。
6
+ - **转写**:在 设置 → 语音 选了语音服务(OpenAI Realtime、通义、混元、豆包)时用它听写,Key 只在 Ta 服务里;没选就用本机的听写(Ta App 和桌面版用 Apple 的识别,浏览器用自带的)。记录时屏幕保持常亮(Ta App 关掉自动锁屏,桌面版不让显示器休眠、不在会中重启更新)。服务断开、断网或页面被切走时自动重连(1、2、5、10、20、30 秒递增,页面回到前台或网络恢复时立即重连),已记下的文字都在;只有麦克风或语音识别没有允许时才转为暂停。结束时保存失败会再试两次。
7
7
  - **只留文字**:不录音、不存音频。文字每 30 秒存一次,结束时再存一次,存在本机 agent 目录的 `meetings/<id>.txt`(0600),不经中继。
8
8
  - **整理**:结束后打开一个以会议命名的对话,消息的上下文里带着会议文字,Ta 按 `meeting-notes` 技能回复:一句结论,一张卡片(待办表、重点、「要我做哪些?」的多选、折叠的完整纪要)。你选了之后:一次能做完的当场做;跨天的写成目标卡;要定时的建定时任务;发给别人的只出草稿,你说发才发。
9
9
  - **记录过的会议**:每行是标题、时间、时长和字数;点开回到它的纪要对话(还没整理的就开始整理),左滑删除文字(纪要对话保留)。
10
- - **设置 → 语音 → 会议**:文字保留天数(30、90、180、365 天,默认 90)和最多占用(10、50、200 MB,默认 50);超过的从最早的开始自动删除,正在记录的和最新的一场不删。
10
+ - **设置 → 存储空间 → 会议文字**:保留天数(30、90、180、365 天或不限,默认 90)和最多占用(10、50、200 MB 或不限,默认 50),也可一键清除;超过的从最早的开始自动删除,正在记录的和最新的一场不删。
11
11
 
12
12
  ## 数据与调用
13
13
 
14
- 包数据(`@celljs/ta-meeting`,只由服务端写):`meetings`(每场的标题、开始和结束时间、时长、字数、大小、纪要对话),`settings`(`keepDays`、`maxMB`)。会议文字在 agent 目录的 `meetings/`。
14
+ 包数据(`@celljs/ta-meeting`,只由服务端写):`meetings`(每场的标题、开始和结束时间、时长、字数、大小、纪要对话)。会议文字在 agent 目录的 `meetings/`。
15
15
 
16
- 服务端方法(页面经 `callHost` 调用;只有用户本人和有 `settings.manage` 的成员能调):`list()`、`settings()`、`setSettings(change)`、`save(meeting, text)`、`get(id)`、`update(id, { title?, session? })`、`remove(id)`。
16
+ 服务端方法(页面经 `callHost` 调用;只有用户本人和有 `settings.manage` 的成员能调):`list()`、`save(meeting, text)`、`get(id)`、`update(id, { title?, session? })`、`remove(id)`。
17
17
 
18
18
  页面用 `ui.voice.transcribe`(ta-web 的 `WebVoice`)连续听写:选了语音服务就由 Ta 服务转写,否则用本机的识别;识别器断句结束后立即接着听。
19
19
 
package/host/index.mjs CHANGED
@@ -8,9 +8,10 @@ var PAGE = `${NAME}/home`;
8
8
  var Keys;
9
9
  ((Keys) => {
10
10
  Keys.MEETINGS = "meetings";
11
- Keys.SETTINGS = "settings";
12
11
  })(Keys ||= {});
13
- var DEFAULT_SETTINGS = { keepDays: 90, maxMB: 50 };
12
+ var DEFAULT_LIMITS = { keepDays: 90, maxMB: 50 };
13
+ var KEEP_DAYS = [30, 90, 180, 365, 0];
14
+ var MAX_MB = [10, 50, 200, 0];
14
15
 
15
16
  // web-src/meeting-util.ts
16
17
  var DAY = 86400000;
@@ -26,15 +27,6 @@ var MeetingUtil;
26
27
  return `m${now.toString(36)}${Math.random().toString(36).slice(2, 8)}`;
27
28
  }
28
29
  MeetingUtil.newId = newId;
29
- function settings(raw) {
30
- const value = raw ?? {};
31
- const number = (n, min, max, fallback) => typeof n === "number" && Number.isFinite(n) ? Math.min(max, Math.max(min, Math.round(n))) : fallback;
32
- return {
33
- keepDays: number(value.keepDays, 1, 3650, DEFAULT_SETTINGS.keepDays),
34
- maxMB: number(value.maxMB, 1, 1024, DEFAULT_SETTINGS.maxMB)
35
- };
36
- }
37
- MeetingUtil.settings = settings;
38
30
  function meetings(raw) {
39
31
  if (!Array.isArray(raw)) {
40
32
  return [];
@@ -42,17 +34,17 @@ var MeetingUtil;
42
34
  return raw.filter((one) => !!one && validId(one.id) && typeof one.title === "string" && typeof one.startedAt === "number").sort((a, b) => b.startedAt - a.startedAt);
43
35
  }
44
36
  MeetingUtil.meetings = meetings;
45
- function prune(meetings2, settings2, now) {
37
+ function prune(meetings2, limits, now) {
46
38
  const removed = new Set;
47
39
  const oldFirst = [...meetings2].sort((a, b) => a.startedAt - b.startedAt);
48
40
  for (const one of oldFirst) {
49
- if (!one.recording && now - (one.endedAt ?? one.startedAt) > settings2.keepDays * DAY) {
41
+ if (limits.keepDays && !one.recording && now - (one.endedAt ?? one.startedAt) > limits.keepDays * DAY) {
50
42
  removed.add(one.id);
51
43
  }
52
44
  }
53
45
  let bytes = meetings2.filter((one) => !removed.has(one.id)).reduce((sum, one) => sum + (one.bytes || 0), 0);
54
46
  for (const one of oldFirst.slice(0, -1)) {
55
- if (bytes <= settings2.maxMB * MB) {
47
+ if (!limits.maxMB || bytes <= limits.maxMB * MB) {
56
48
  break;
57
49
  }
58
50
  if (!one.recording && !removed.has(one.id)) {
@@ -103,28 +95,48 @@ class MeetingHost {
103
95
  host;
104
96
  now;
105
97
  queue = Promise.resolve();
98
+ stored;
106
99
  constructor(host, now = Date.now) {
107
100
  this.host = host;
108
101
  this.now = now;
109
102
  }
110
- dispose() {}
103
+ dispose() {
104
+ this.stored?.dispose();
105
+ }
111
106
  begin() {
107
+ this.stored = this.host.storage?.register({
108
+ name: "meetings",
109
+ title: { "zh-CN": "会议文字", "zh-TW": "會議文字", "en-US": "Meeting text", "ja-JP": "会議の文字" },
110
+ hint: {
111
+ "zh-CN": "会议记下的文字;正在记录的和最近一场不会删,整理纪要的对话保留。",
112
+ "zh-TW": "會議記下的文字;正在記錄的和最近一場不會刪,整理紀要的對話保留。",
113
+ "en-US": "What meetings wrote down; never the one being recorded nor the newest. Conversations of the minutes stay.",
114
+ "ja-JP": "会議で書き取った文字。記録中と最新のものは消えません。議事録の会話は残ります。"
115
+ },
116
+ defaults: DEFAULT_LIMITS,
117
+ choices: { days: KEEP_DAYS, mb: MAX_MB },
118
+ order: 40
119
+ }, {
120
+ dir: this.dir(),
121
+ prune: (limits) => this.serial(async () => this.prune(await this.meetings(), limits)),
122
+ clear: () => this.clear()
123
+ });
112
124
  return this.serial(async () => {
113
- await this.prune(await this.meetings(), await this.settings());
125
+ await this.prune(await this.meetings(), this.limits());
114
126
  });
115
127
  }
116
128
  list() {
117
129
  return this.meetings();
118
130
  }
119
- async settings() {
120
- return MeetingUtil.settings(await this.data(Keys.SETTINGS));
121
- }
122
- setSettings(change) {
131
+ clear() {
123
132
  return this.serial(async () => {
124
- const settings = MeetingUtil.settings({ ...await this.settings(), ...change ?? {} });
125
- await this.host.setExtensionData(NAME, Keys.SETTINGS, settings);
126
- await this.prune(await this.meetings(), settings);
127
- return settings;
133
+ const meetings = await this.meetings();
134
+ const gone = meetings.filter((one) => !one.recording);
135
+ for (const one of gone) {
136
+ rmSync(this.file(one.id), { force: true });
137
+ }
138
+ await this.host.setExtensionData(NAME, Keys.MEETINGS, meetings.filter((one) => one.recording));
139
+ return gone.reduce((sum, one) => sum + (one.bytes || 0), 0);
128
140
  });
129
141
  }
130
142
  save(change, text) {
@@ -145,7 +157,7 @@ class MeetingHost {
145
157
  ...before?.session ? { session: before.session } : {}
146
158
  };
147
159
  const all = [meeting, ...meetings.filter((one) => one.id !== id)];
148
- await this.prune(all, await this.settings());
160
+ await this.prune(all, this.limits());
149
161
  return meeting;
150
162
  });
151
163
  }
@@ -185,8 +197,11 @@ class MeetingHost {
185
197
  await this.host.setExtensionData(NAME, Keys.MEETINGS, meetings.filter((one) => one.id !== checked));
186
198
  });
187
199
  }
188
- async prune(meetings, settings) {
189
- const removed = new Set(MeetingUtil.prune(meetings, settings, this.now()));
200
+ limits() {
201
+ return this.stored?.limits() ?? DEFAULT_LIMITS;
202
+ }
203
+ async prune(meetings, limits) {
204
+ const removed = new Set(MeetingUtil.prune(meetings, limits, this.now()));
190
205
  for (const id of removed) {
191
206
  rmSync(this.file(id), { force: true });
192
207
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celljs/ta-meeting",
3
- "version": "4.34.0",
3
+ "version": "4.36.0",
4
4
  "description": "A pi package for Ta: meetings written down as they are said, then minutes, key points and to-dos, and the to-dos Ta can do done once the user picks them",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -27,8 +27,8 @@
27
27
  "watch": "tsc -b -w --preserveWatchOutput"
28
28
  },
29
29
  "devDependencies": {
30
- "@celljs/ta-protocol": "4.34.0",
31
- "@celljs/ta-web": "4.34.0",
30
+ "@celljs/ta-protocol": "4.36.0",
31
+ "@celljs/ta-web": "4.36.0",
32
32
  "@types/react": "^19.3.0"
33
33
  },
34
34
  "publishConfig": {
package/web/index.js CHANGED
@@ -47,6 +47,7 @@ var EN = {
47
47
  starting: "Starting…",
48
48
  recording: "Recording",
49
49
  paused: "Paused",
50
+ reconnecting: "Reconnecting…",
50
51
  viaService: "Heard by the service of Settings → Voice",
51
52
  viaDevice: "Heard by this device",
52
53
  listening: "Listening… what is said shows here",
@@ -66,18 +67,14 @@ var EN = {
66
67
  duration: "{n} min",
67
68
  chars: "{n} chars",
68
69
  cannotListen: "This device cannot listen. Add a voice service in Settings → Voice, or use the Ta app.",
70
+ retrying: "Listening broke off ({error}); reconnecting by itself (attempt {n}). What was written down is kept.",
69
71
  stopped: "Listening stopped ({error}); what was written down is kept. Resume or end it.",
70
72
  denied: "The microphone or speech recognition is not allowed; what was written down is kept. Allow it, then resume.",
73
+ micBusy: "The microphone is in use (a call?); it goes on by itself once it is free. What was written down is kept.",
71
74
  failed: "Failed: {error}",
72
75
  prompt: "Sum up this meeting: the minutes, the key points and the to-dos, and let me pick what you can do.",
73
76
  homeRecording: "Recording a meeting",
74
- homeSince: "Since {time}",
75
- keepDays: "Keep meeting text",
76
- keepDaysHint: "Older text is removed by itself; the conversations of the minutes stay.",
77
- keepDaysValue: "{n} days",
78
- maxMB: "Space for meeting text",
79
- maxMBHint: "Beyond it, the oldest text goes first.",
80
- maxMBValue: "{n} MB"
77
+ homeSince: "Since {time}"
81
78
  };
82
79
  var ZH = {
83
80
  title: "会议",
@@ -88,6 +85,7 @@ var ZH = {
88
85
  starting: "正在开始…",
89
86
  recording: "记录中",
90
87
  paused: "已暂停",
88
+ reconnecting: "正在重新连接…",
91
89
  viaService: "用 设置 → 语音 里的服务转写",
92
90
  viaDevice: "用本机的听写",
93
91
  listening: "正在听…说的话会出现在这里",
@@ -107,18 +105,14 @@ var ZH = {
107
105
  duration: "{n} 分钟",
108
106
  chars: "{n} 字",
109
107
  cannotListen: "这台设备不能听写。在 设置 → 语音 添加一个语音服务,或用 Ta App。",
108
+ retrying: "听写断了({error}),正在自动重连(第 {n} 次),已记下的文字都在。",
110
109
  stopped: "听写停了({error}),已记下的文字都在。可以继续或结束。",
111
110
  denied: "麦克风或语音识别没有允许,已记下的文字都在。允许后点继续。",
111
+ micBusy: "麦克风被占用(可能在通话),空出来后自动接着记,已记下的文字都在。",
112
112
  failed: "出错了:{error}",
113
113
  prompt: "整理这场会议:纪要、重点和待办,能替我做的列出来让我选。",
114
114
  homeRecording: "会议记录中",
115
- homeSince: "{time} 开始",
116
- keepDays: "会议文字保留",
117
- keepDaysHint: "超过天数的文字自动删除,整理纪要的对话保留。",
118
- keepDaysValue: "{n} 天",
119
- maxMB: "会议文字最多占用",
120
- maxMBHint: "超过后先删最早的。",
121
- maxMBValue: "{n} MB"
115
+ homeSince: "{time} 开始"
122
116
  };
123
117
  var ZH_TW = {
124
118
  title: "會議",
@@ -129,6 +123,7 @@ var ZH_TW = {
129
123
  starting: "正在開始…",
130
124
  recording: "記錄中",
131
125
  paused: "已暫停",
126
+ reconnecting: "正在重新連線…",
132
127
  viaService: "用 設定 → 語音 裡的服務轉寫",
133
128
  viaDevice: "用本機的聽寫",
134
129
  listening: "正在聽…說的話會出現在這裡",
@@ -148,18 +143,14 @@ var ZH_TW = {
148
143
  duration: "{n} 分鐘",
149
144
  chars: "{n} 字",
150
145
  cannotListen: "這台裝置不能聽寫。在 設定 → 語音 新增一個語音服務,或用 Ta App。",
146
+ retrying: "聽寫斷了({error}),正在自動重連(第 {n} 次),已記下的文字都在。",
151
147
  stopped: "聽寫停了({error}),已記下的文字都在。可以繼續或結束。",
152
148
  denied: "麥克風或語音辨識沒有允許,已記下的文字都在。允許後點繼續。",
149
+ micBusy: "麥克風被佔用(可能在通話),空出來後自動接著記,已記下的文字都在。",
153
150
  failed: "出錯了:{error}",
154
151
  prompt: "整理這場會議:紀要、重點和待辦,能替我做的列出來讓我選。",
155
152
  homeRecording: "會議記錄中",
156
- homeSince: "{time} 開始",
157
- keepDays: "會議文字保留",
158
- keepDaysHint: "超過天數的文字自動刪除,整理紀要的對話保留。",
159
- keepDaysValue: "{n} 天",
160
- maxMB: "會議文字最多佔用",
161
- maxMBHint: "超過後先刪最早的。",
162
- maxMBValue: "{n} MB"
153
+ homeSince: "{time} 開始"
163
154
  };
164
155
  var JA = {
165
156
  title: "会議",
@@ -170,6 +161,7 @@ var JA = {
170
161
  starting: "開始中…",
171
162
  recording: "記録中",
172
163
  paused: "一時停止中",
164
+ reconnecting: "再接続中…",
173
165
  viaService: "設定 → 音声 のサービスで書き取り",
174
166
  viaDevice: "この端末の音声入力で書き取り",
175
167
  listening: "聞いています…話した内容がここに出ます",
@@ -189,18 +181,14 @@ var JA = {
189
181
  duration: "{n} 分",
190
182
  chars: "{n} 文字",
191
183
  cannotListen: "この端末は音声入力できません。設定 → 音声 でサービスを追加するか、Ta アプリを使ってください。",
184
+ retrying: "書き取りが途切れました({error})。自動で再接続しています({n} 回目)。書き取った文字は残っています。",
192
185
  stopped: "書き取りが止まりました({error})。書き取った文字は残っています。再開か終了を選んでください。",
193
186
  denied: "マイクまたは音声認識が許可されていません。書き取った文字は残っています。許可してから再開してください。",
187
+ micBusy: "マイクが使用中です(通話中かもしれません)。空いたら自動で続けます。書き取った文字は残っています。",
194
188
  failed: "失敗しました:{error}",
195
189
  prompt: "この会議をまとめて:議事録・要点・ToDo。あなたができるものは選べるようにして。",
196
190
  homeRecording: "会議を記録中",
197
- homeSince: "{time} から",
198
- keepDays: "会議の文字の保存期間",
199
- keepDaysHint: "過ぎた文字は自動で削除されます。議事録の会話は残ります。",
200
- keepDaysValue: "{n} 日",
201
- maxMB: "会議の文字の上限",
202
- maxMBHint: "超えたら古いものから削除します。",
203
- maxMBValue: "{n} MB"
191
+ homeSince: "{time} から"
204
192
  };
205
193
  var WORDS = { "zh-CN": ZH, "zh-TW": ZH_TW, "en-US": EN, "ja-JP": JA };
206
194
  var MeetingWords;
@@ -221,11 +209,7 @@ var PAGE = `${NAME}/home`;
221
209
  var Keys;
222
210
  ((Keys) => {
223
211
  Keys.MEETINGS = "meetings";
224
- Keys.SETTINGS = "settings";
225
212
  })(Keys ||= {});
226
- var DEFAULT_SETTINGS = { keepDays: 90, maxMB: 50 };
227
- var KEEP_DAYS = [30, 90, 180, 365];
228
- var MAX_MB = [10, 50, 200];
229
213
 
230
214
  // web-src/meeting-util.ts
231
215
  var DAY = 86400000;
@@ -241,15 +225,6 @@ var MeetingUtil;
241
225
  return `m${now.toString(36)}${Math.random().toString(36).slice(2, 8)}`;
242
226
  }
243
227
  MeetingUtil.newId = newId;
244
- function settings(raw) {
245
- const value = raw ?? {};
246
- const number = (n, min, max, fallback) => typeof n === "number" && Number.isFinite(n) ? Math.min(max, Math.max(min, Math.round(n))) : fallback;
247
- return {
248
- keepDays: number(value.keepDays, 1, 3650, DEFAULT_SETTINGS.keepDays),
249
- maxMB: number(value.maxMB, 1, 1024, DEFAULT_SETTINGS.maxMB)
250
- };
251
- }
252
- MeetingUtil.settings = settings;
253
228
  function meetings(raw) {
254
229
  if (!Array.isArray(raw)) {
255
230
  return [];
@@ -257,17 +232,17 @@ var MeetingUtil;
257
232
  return raw.filter((one) => !!one && validId(one.id) && typeof one.title === "string" && typeof one.startedAt === "number").sort((a, b) => b.startedAt - a.startedAt);
258
233
  }
259
234
  MeetingUtil.meetings = meetings;
260
- function prune(meetings2, settings2, now) {
235
+ function prune(meetings2, limits, now) {
261
236
  const removed = new Set;
262
237
  const oldFirst = [...meetings2].sort((a, b) => a.startedAt - b.startedAt);
263
238
  for (const one of oldFirst) {
264
- if (!one.recording && now - (one.endedAt ?? one.startedAt) > settings2.keepDays * DAY) {
239
+ if (limits.keepDays && !one.recording && now - (one.endedAt ?? one.startedAt) > limits.keepDays * DAY) {
265
240
  removed.add(one.id);
266
241
  }
267
242
  }
268
243
  let bytes = meetings2.filter((one) => !removed.has(one.id)).reduce((sum, one) => sum + (one.bytes || 0), 0);
269
244
  for (const one of oldFirst.slice(0, -1)) {
270
- if (bytes <= settings2.maxMB * MB) {
245
+ if (!limits.maxMB || bytes <= limits.maxMB * MB) {
271
246
  break;
272
247
  }
273
248
  if (!one.recording && !removed.has(one.id)) {
@@ -315,7 +290,6 @@ var MeetingUtil;
315
290
  class MeetingStore {
316
291
  pi;
317
292
  meetings = [];
318
- settings = DEFAULT_SETTINGS;
319
293
  loaded = false;
320
294
  listeners = new Set;
321
295
  offChange;
@@ -326,7 +300,7 @@ class MeetingStore {
326
300
  this.listeners.add(listener);
327
301
  if (!this.offChange) {
328
302
  this.offChange = this.pi.storage.onChange((keys) => {
329
- if (keys.includes(Keys.MEETINGS) || keys.includes(Keys.SETTINGS)) {
303
+ if (keys.includes(Keys.MEETINGS)) {
330
304
  this.load();
331
305
  }
332
306
  });
@@ -335,16 +309,9 @@ class MeetingStore {
335
309
  return () => this.listeners.delete(listener);
336
310
  }
337
311
  async load() {
338
- const [meetings, settings] = await Promise.all([
339
- this.pi.storage.get(Keys.MEETINGS).catch(() => {
340
- return;
341
- }),
342
- this.pi.storage.get(Keys.SETTINGS).catch(() => {
343
- return;
344
- })
345
- ]);
346
- this.meetings = MeetingUtil.meetings(meetings);
347
- this.settings = MeetingUtil.settings(settings);
312
+ this.meetings = MeetingUtil.meetings(await this.pi.storage.get(Keys.MEETINGS).catch(() => {
313
+ return;
314
+ }));
348
315
  this.loaded = true;
349
316
  this.emit();
350
317
  }
@@ -367,6 +334,332 @@ function bind(react) {
367
334
  React = react;
368
335
  }
369
336
 
337
+ // web-src/recorder.ts
338
+ var SAVE_MS = 30000;
339
+ var RETRY_MS = [1000, 2000, 5000, 1e4, 20000, 30000];
340
+ var STEADY_MS = 60000;
341
+ var AWAY_MS = 3000;
342
+ var SILENT_MS = 30000;
343
+ var WATCH_MS = 5000;
344
+ var BUSY_RETRY_MS = 2000;
345
+ var SAVE_RETRY_MS = [1000, 3000];
346
+
347
+ class Recorder {
348
+ host;
349
+ status = "idle";
350
+ meeting;
351
+ segments = [];
352
+ interim = "";
353
+ service = false;
354
+ error;
355
+ retries = 0;
356
+ interimAt = 0;
357
+ activeMs = 0;
358
+ resumedAt;
359
+ transcribing;
360
+ runs = 0;
361
+ dirty = false;
362
+ timer;
363
+ watching;
364
+ listenedAt = 0;
365
+ heardAt = 0;
366
+ awayAt;
367
+ connecting = false;
368
+ cancelRetry;
369
+ unwatch;
370
+ letAwakeGo;
371
+ listeners = new Set;
372
+ constructor(host) {
373
+ this.host = host;
374
+ }
375
+ subscribe(listener) {
376
+ this.listeners.add(listener);
377
+ return () => this.listeners.delete(listener);
378
+ }
379
+ elapsed() {
380
+ return this.activeMs + (this.resumedAt === undefined ? 0 : this.host.now() - this.resumedAt);
381
+ }
382
+ async start(title) {
383
+ if (this.status !== "idle") {
384
+ return false;
385
+ }
386
+ const now = this.host.now();
387
+ this.meeting = { id: MeetingUtil.newId(now), title, startedAt: now };
388
+ this.segments = [];
389
+ this.interim = "";
390
+ this.activeMs = 0;
391
+ this.error = undefined;
392
+ this.status = "starting";
393
+ this.emit();
394
+ if (!await this.listen()) {
395
+ this.reset();
396
+ return false;
397
+ }
398
+ this.timer = setInterval(() => void this.autosave(), SAVE_MS);
399
+ this.watching = setInterval(() => this.watchdog(), WATCH_MS);
400
+ this.unwatch = this.host.watch?.(() => this.again(), () => {
401
+ this.awayAt = this.host.now();
402
+ });
403
+ return true;
404
+ }
405
+ pause() {
406
+ if (this.status !== "recording" && this.status !== "reconnecting") {
407
+ return;
408
+ }
409
+ this.stopRetrying();
410
+ this.halt();
411
+ this.status = "paused";
412
+ this.emit();
413
+ this.autosave(true);
414
+ }
415
+ async resume() {
416
+ if (this.status !== "paused") {
417
+ return false;
418
+ }
419
+ this.error = undefined;
420
+ this.retries = 0;
421
+ this.status = "starting";
422
+ this.emit();
423
+ if (await this.listen()) {
424
+ return true;
425
+ }
426
+ this.status = "paused";
427
+ this.emit();
428
+ return false;
429
+ }
430
+ async finish() {
431
+ if (!this.meeting || this.status === "idle" || this.status === "saving") {
432
+ return;
433
+ }
434
+ this.stopRetrying();
435
+ this.halt();
436
+ this.status = "saving";
437
+ this.emit();
438
+ const text = MeetingUtil.transcript(this.segments);
439
+ try {
440
+ const meeting = await this.saveEnd({ ...this.meeting, ms: this.elapsed() }, text);
441
+ this.reset();
442
+ return { meeting, text };
443
+ } catch (error) {
444
+ this.status = "paused";
445
+ this.emit();
446
+ throw error;
447
+ }
448
+ }
449
+ async discard() {
450
+ const meeting = this.meeting;
451
+ this.halt();
452
+ this.reset();
453
+ if (meeting) {
454
+ await this.host.remove(meeting.id).catch(() => {
455
+ return;
456
+ });
457
+ }
458
+ }
459
+ dispose() {
460
+ if (this.meeting && this.status !== "idle" && this.status !== "saving") {
461
+ this.finish().catch(() => {
462
+ return;
463
+ });
464
+ }
465
+ }
466
+ async saveEnd(meeting, text) {
467
+ for (let attempt = 0;; attempt++) {
468
+ try {
469
+ return await this.host.save(meeting, text);
470
+ } catch (error) {
471
+ if (attempt >= SAVE_RETRY_MS.length) {
472
+ throw error;
473
+ }
474
+ await new Promise((resolve) => this.later(resolve, SAVE_RETRY_MS[attempt]));
475
+ }
476
+ }
477
+ }
478
+ async listen() {
479
+ const run = ++this.runs;
480
+ let endedFirst;
481
+ const transcribing = await Promise.resolve(this.host.transcribe({
482
+ onText: (text, final) => {
483
+ if (run === this.runs) {
484
+ this.heard(text, final);
485
+ }
486
+ },
487
+ onEnd: (error) => {
488
+ if (run !== this.runs) {
489
+ return;
490
+ }
491
+ if (this.transcribing && this.status === "recording") {
492
+ this.broke(error ?? "ended");
493
+ } else if (!this.transcribing) {
494
+ endedFirst = error ?? "ended";
495
+ }
496
+ }
497
+ })).catch(() => {
498
+ return;
499
+ });
500
+ if (run !== this.runs || this.status !== "starting" && this.status !== "reconnecting") {
501
+ transcribing?.stop();
502
+ return false;
503
+ }
504
+ if (!transcribing) {
505
+ return false;
506
+ }
507
+ this.transcribing = transcribing;
508
+ this.service = transcribing.service;
509
+ this.resumedAt = this.listenedAt = this.host.now();
510
+ this.awayAt = undefined;
511
+ this.error = undefined;
512
+ this.status = "recording";
513
+ this.emit();
514
+ if (endedFirst !== undefined) {
515
+ this.broke(endedFirst);
516
+ }
517
+ return true;
518
+ }
519
+ broke(error) {
520
+ this.transcribing = undefined;
521
+ if (this.host.now() - this.listenedAt >= STEADY_MS) {
522
+ this.retries = 0;
523
+ }
524
+ this.halt();
525
+ this.error = error;
526
+ this.status = Recorder.denied(error) ? "paused" : "reconnecting";
527
+ this.emit();
528
+ this.autosave(true);
529
+ if (this.status === "reconnecting") {
530
+ this.retryLater();
531
+ }
532
+ }
533
+ again() {
534
+ if (this.status === "reconnecting") {
535
+ this.reconnect();
536
+ } else if (this.status === "recording" && this.awayAt !== undefined && this.heardAt < this.awayAt && this.host.now() - this.awayAt >= AWAY_MS) {
537
+ this.restart();
538
+ }
539
+ }
540
+ watchdog() {
541
+ if (this.status === "recording" && !this.connecting && this.host.now() - Math.max(this.heardAt, this.listenedAt) >= SILENT_MS) {
542
+ this.restart();
543
+ }
544
+ }
545
+ restart() {
546
+ this.awayAt = undefined;
547
+ this.halt();
548
+ this.retries = 0;
549
+ this.error = undefined;
550
+ this.status = "reconnecting";
551
+ this.emit();
552
+ this.reconnect();
553
+ }
554
+ static denied(error) {
555
+ return /not-allowed|denied|permission/i.test(error);
556
+ }
557
+ static busy(error) {
558
+ return /interrupted|audio-capture/i.test(error);
559
+ }
560
+ retryLater() {
561
+ this.cancelRetry?.();
562
+ const ms = this.error && Recorder.busy(this.error) ? BUSY_RETRY_MS : RETRY_MS[Math.min(this.retries, RETRY_MS.length - 1)];
563
+ this.cancelRetry = this.later(() => void this.reconnect(), ms);
564
+ }
565
+ async reconnect() {
566
+ if (this.status !== "reconnecting" || this.connecting) {
567
+ return;
568
+ }
569
+ this.cancelRetry?.();
570
+ this.cancelRetry = undefined;
571
+ this.retries++;
572
+ this.connecting = true;
573
+ this.emit();
574
+ let listening = false;
575
+ try {
576
+ listening = await this.listen();
577
+ } finally {
578
+ this.connecting = false;
579
+ }
580
+ if (!listening && this.status === "reconnecting") {
581
+ this.retryLater();
582
+ }
583
+ }
584
+ stopRetrying() {
585
+ this.cancelRetry?.();
586
+ this.cancelRetry = undefined;
587
+ }
588
+ later(run, ms) {
589
+ if (this.host.later) {
590
+ return this.host.later(run, ms);
591
+ }
592
+ const timer = setTimeout(run, ms);
593
+ return () => clearTimeout(timer);
594
+ }
595
+ heard(text, final) {
596
+ this.heardAt = this.host.now();
597
+ if (!this.interim) {
598
+ this.interimAt = this.elapsed();
599
+ }
600
+ if (final) {
601
+ this.segments.push({ at: this.interimAt, text });
602
+ this.interim = "";
603
+ this.dirty = true;
604
+ } else {
605
+ this.interim = text;
606
+ }
607
+ this.emit();
608
+ }
609
+ halt() {
610
+ const transcribing = this.transcribing;
611
+ this.transcribing = undefined;
612
+ transcribing?.stop();
613
+ if (this.resumedAt !== undefined) {
614
+ this.activeMs += this.host.now() - this.resumedAt;
615
+ this.resumedAt = undefined;
616
+ }
617
+ this.interim = "";
618
+ }
619
+ async autosave(force = false) {
620
+ if (!this.meeting || !this.dirty && !force) {
621
+ return;
622
+ }
623
+ this.dirty = false;
624
+ await this.host.save({ ...this.meeting, ms: this.elapsed(), recording: true }, MeetingUtil.transcript(this.segments)).catch(() => {
625
+ this.dirty = true;
626
+ });
627
+ }
628
+ reset() {
629
+ clearInterval(this.timer);
630
+ clearInterval(this.watching);
631
+ this.timer = this.watching = undefined;
632
+ this.stopRetrying();
633
+ this.unwatch?.();
634
+ this.unwatch = undefined;
635
+ this.runs++;
636
+ this.status = "idle";
637
+ this.meeting = undefined;
638
+ this.segments = [];
639
+ this.interim = "";
640
+ this.activeMs = 0;
641
+ this.resumedAt = undefined;
642
+ this.dirty = false;
643
+ this.error = undefined;
644
+ this.retries = 0;
645
+ this.awayAt = undefined;
646
+ this.service = false;
647
+ this.emit();
648
+ }
649
+ emit() {
650
+ const awake = this.status === "starting" || this.status === "recording" || this.status === "reconnecting";
651
+ if (awake && !this.letAwakeGo) {
652
+ this.letAwakeGo = this.host.keepAwake?.();
653
+ } else if (!awake && this.letAwakeGo) {
654
+ this.letAwakeGo();
655
+ this.letAwakeGo = undefined;
656
+ }
657
+ for (const listener of this.listeners) {
658
+ listener();
659
+ }
660
+ }
661
+ }
662
+
370
663
  // ../ta-protocol/esm/common/message-protocol.js
371
664
  var TaMessageContext;
372
665
  (function(TaMessageContext2) {
@@ -795,7 +1088,13 @@ function Now({ context, words }) {
795
1088
  await recorder.discard();
796
1089
  }
797
1090
  };
798
- const label = status === "starting" ? words.starting : status === "saving" ? words.saving : status === "paused" ? words.paused : words.recording;
1091
+ const label = {
1092
+ starting: words.starting,
1093
+ saving: words.saving,
1094
+ paused: words.paused,
1095
+ reconnecting: words.reconnecting,
1096
+ recording: words.recording
1097
+ }[status];
799
1098
  return /* @__PURE__ */ React.createElement("section", {
800
1099
  className: "tmtg-now",
801
1100
  "data-status": status
@@ -813,16 +1112,18 @@ function Now({ context, words }) {
813
1112
  className: "tmtg-now-meta"
814
1113
  }, recorder.meeting?.title, status === "recording" ? ` · ${recorder.service ? words.viaService : words.viaDevice}` : ""), recorder.error && /* @__PURE__ */ React.createElement("div", {
815
1114
  className: "tmtg-now-error"
816
- }, /not-allowed/.test(recorder.error) ? words.denied : MeetingWords.format(words.stopped, { error: recorder.error })), /* @__PURE__ */ React.createElement("div", {
1115
+ }, status === "reconnecting" ? Recorder.busy(recorder.error) ? words.micBusy : MeetingWords.format(words.retrying, { error: recorder.error, n: recorder.retries }) : Recorder.denied(recorder.error) ? words.denied : MeetingWords.format(words.stopped, { error: recorder.error })), /* @__PURE__ */ React.createElement("div", {
817
1116
  className: "tmtg-lines",
818
1117
  ref: lines
1118
+ }, /* @__PURE__ */ React.createElement("div", {
1119
+ className: "tmtg-thread"
819
1120
  }, recorder.segments.length || recorder.interim ? /* @__PURE__ */ React.createElement(React.Fragment, null, recorder.segments.map((segment, index) => /* @__PURE__ */ React.createElement("p", {
820
1121
  key: index
821
1122
  }, /* @__PURE__ */ React.createElement("time", null, MeetingUtil.clock(segment.at)), segment.text)), recorder.interim && /* @__PURE__ */ React.createElement("p", {
822
1123
  className: "tmtg-interim"
823
1124
  }, recorder.interim)) : /* @__PURE__ */ React.createElement("p", {
824
1125
  className: "tmtg-placeholder"
825
- }, words.listening)), /* @__PURE__ */ React.createElement("div", {
1126
+ }, words.listening))), /* @__PURE__ */ React.createElement("div", {
826
1127
  className: "tmtg-actions"
827
1128
  }, /* @__PURE__ */ React.createElement("button", {
828
1129
  type: "button",
@@ -839,7 +1140,7 @@ function Now({ context, words }) {
839
1140
  }, words.resume) : /* @__PURE__ */ React.createElement("button", {
840
1141
  type: "button",
841
1142
  className: "ta-button",
842
- disabled: busy || status !== "recording",
1143
+ disabled: busy || status !== "recording" && status !== "reconnecting",
843
1144
  onClick: () => recorder.pause()
844
1145
  }, words.pause), /* @__PURE__ */ React.createElement("button", {
845
1146
  type: "button",
@@ -891,199 +1192,6 @@ function MicIcon({ pi }) {
891
1192
  }) : null;
892
1193
  }
893
1194
 
894
- // web-src/recorder.ts
895
- var SAVE_MS = 30000;
896
-
897
- class Recorder {
898
- host;
899
- status = "idle";
900
- meeting;
901
- segments = [];
902
- interim = "";
903
- service = false;
904
- error;
905
- interimAt = 0;
906
- activeMs = 0;
907
- resumedAt;
908
- transcribing;
909
- runs = 0;
910
- dirty = false;
911
- timer;
912
- listeners = new Set;
913
- constructor(host) {
914
- this.host = host;
915
- }
916
- subscribe(listener) {
917
- this.listeners.add(listener);
918
- return () => this.listeners.delete(listener);
919
- }
920
- elapsed() {
921
- return this.activeMs + (this.resumedAt === undefined ? 0 : this.host.now() - this.resumedAt);
922
- }
923
- async start(title) {
924
- if (this.status !== "idle") {
925
- return false;
926
- }
927
- const now = this.host.now();
928
- this.meeting = { id: MeetingUtil.newId(now), title, startedAt: now };
929
- this.segments = [];
930
- this.interim = "";
931
- this.activeMs = 0;
932
- this.error = undefined;
933
- this.status = "starting";
934
- this.emit();
935
- if (!await this.listen()) {
936
- this.reset();
937
- return false;
938
- }
939
- this.timer = setInterval(() => void this.autosave(), SAVE_MS);
940
- return true;
941
- }
942
- pause() {
943
- if (this.status !== "recording") {
944
- return;
945
- }
946
- this.halt();
947
- this.status = "paused";
948
- this.emit();
949
- this.autosave(true);
950
- }
951
- async resume() {
952
- if (this.status !== "paused") {
953
- return false;
954
- }
955
- this.error = undefined;
956
- this.status = "starting";
957
- this.emit();
958
- if (await this.listen()) {
959
- return true;
960
- }
961
- this.status = "paused";
962
- this.emit();
963
- return false;
964
- }
965
- async finish() {
966
- if (!this.meeting || this.status === "idle" || this.status === "saving") {
967
- return;
968
- }
969
- this.halt();
970
- this.status = "saving";
971
- this.emit();
972
- const text = MeetingUtil.transcript(this.segments);
973
- try {
974
- const meeting = await this.host.save({ ...this.meeting, ms: this.elapsed() }, text);
975
- this.reset();
976
- return { meeting, text };
977
- } catch (error) {
978
- this.status = "paused";
979
- this.emit();
980
- throw error;
981
- }
982
- }
983
- async discard() {
984
- const meeting = this.meeting;
985
- this.halt();
986
- this.reset();
987
- if (meeting) {
988
- await this.host.remove(meeting.id).catch(() => {
989
- return;
990
- });
991
- }
992
- }
993
- dispose() {
994
- if (this.meeting && this.status !== "idle" && this.status !== "saving") {
995
- this.finish().catch(() => {
996
- return;
997
- });
998
- }
999
- }
1000
- async listen() {
1001
- const run = ++this.runs;
1002
- const transcribing = await this.host.transcribe({
1003
- onText: (text, final) => {
1004
- if (run === this.runs) {
1005
- this.heard(text, final);
1006
- }
1007
- },
1008
- onEnd: (error) => {
1009
- if (run === this.runs && this.transcribing && this.status === "recording") {
1010
- this.transcribing = undefined;
1011
- this.halt();
1012
- this.error = error ?? "ended";
1013
- this.status = "paused";
1014
- this.emit();
1015
- this.autosave(true);
1016
- }
1017
- }
1018
- });
1019
- if (run !== this.runs || this.status !== "starting") {
1020
- transcribing?.stop();
1021
- return false;
1022
- }
1023
- if (!transcribing) {
1024
- return false;
1025
- }
1026
- this.transcribing = transcribing;
1027
- this.service = transcribing.service;
1028
- this.resumedAt = this.host.now();
1029
- this.status = "recording";
1030
- this.emit();
1031
- return true;
1032
- }
1033
- heard(text, final) {
1034
- if (!this.interim) {
1035
- this.interimAt = this.elapsed();
1036
- }
1037
- if (final) {
1038
- this.segments.push({ at: this.interimAt, text });
1039
- this.interim = "";
1040
- this.dirty = true;
1041
- } else {
1042
- this.interim = text;
1043
- }
1044
- this.emit();
1045
- }
1046
- halt() {
1047
- const transcribing = this.transcribing;
1048
- this.transcribing = undefined;
1049
- transcribing?.stop();
1050
- if (this.resumedAt !== undefined) {
1051
- this.activeMs += this.host.now() - this.resumedAt;
1052
- this.resumedAt = undefined;
1053
- }
1054
- this.interim = "";
1055
- }
1056
- async autosave(force = false) {
1057
- if (!this.meeting || !this.dirty && !force) {
1058
- return;
1059
- }
1060
- this.dirty = false;
1061
- await this.host.save({ ...this.meeting, ms: this.elapsed(), recording: true }, MeetingUtil.transcript(this.segments)).catch(() => {
1062
- this.dirty = true;
1063
- });
1064
- }
1065
- reset() {
1066
- clearInterval(this.timer);
1067
- this.timer = undefined;
1068
- this.runs++;
1069
- this.status = "idle";
1070
- this.meeting = undefined;
1071
- this.segments = [];
1072
- this.interim = "";
1073
- this.activeMs = 0;
1074
- this.resumedAt = undefined;
1075
- this.dirty = false;
1076
- this.error = undefined;
1077
- this.service = false;
1078
- this.emit();
1079
- }
1080
- emit() {
1081
- for (const listener of this.listeners) {
1082
- listener();
1083
- }
1084
- }
1085
- }
1086
-
1087
1195
  // web-src/style.ts
1088
1196
  var STYLE = `
1089
1197
  .tmtg-page { height: 100%; overflow-y: auto; box-sizing: border-box; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); background: var(--ta-side); color: var(--ta-text); font-size: calc(14px * var(--ta-font-scale)); line-height: 1.5; }
@@ -1106,8 +1214,9 @@ var STYLE = `
1106
1214
  .tmtg-now-head { display: flex; align-items: center; gap: 8px; }
1107
1215
  .tmtg-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ta-muted); }
1108
1216
  .tmtg-now[data-status='recording'] .tmtg-dot { background: var(--tmtg-rec); animation: tmtg-pulse 1.4s ease-in-out infinite; }
1217
+ .tmtg-now[data-status='reconnecting'] .tmtg-dot { background: #f59e0b; animation: tmtg-pulse 0.9s ease-in-out infinite; }
1109
1218
  @keyframes tmtg-pulse { 50% { opacity: 0.35; } }
1110
- @media (prefers-reduced-motion: reduce) { .tmtg-now[data-status='recording'] .tmtg-dot { animation: none; } }
1219
+ @media (prefers-reduced-motion: reduce) { .tmtg-now .tmtg-dot { animation: none !important; } }
1111
1220
  .tmtg-now-label { font-weight: 600; }
1112
1221
  .tmtg-clock { font-size: calc(22px * var(--ta-font-scale)); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.3px; }
1113
1222
  .tmtg-now-meta { margin-top: 2px; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@@ -1148,7 +1257,21 @@ function activate(pi) {
1148
1257
  transcribe: (listener) => pi.ui.voice.transcribe?.(listener),
1149
1258
  save: (meeting, text) => store.call("save", meeting, text),
1150
1259
  remove: (id) => store.call("remove", id),
1151
- now: Date.now
1260
+ now: Date.now,
1261
+ keepAwake: () => pi.ui.keepAwake?.() ?? (() => {
1262
+ return;
1263
+ }),
1264
+ watch: (again, away) => {
1265
+ const shown = () => document.visibilityState === "visible" ? again() : away?.();
1266
+ document.addEventListener("visibilitychange", shown);
1267
+ window.addEventListener("online", again);
1268
+ document.addEventListener("pointerdown", again, true);
1269
+ return () => {
1270
+ document.removeEventListener("visibilitychange", shown);
1271
+ window.removeEventListener("online", again);
1272
+ document.removeEventListener("pointerdown", again, true);
1273
+ };
1274
+ }
1152
1275
  });
1153
1276
  const context = { pi, store, recorder };
1154
1277
  pi.registerView("home", {
@@ -1182,38 +1305,12 @@ function activate(pi) {
1182
1305
  },
1183
1306
  subscribe: (listener) => recorder.subscribe(listener)
1184
1307
  });
1185
- pi.registerSettings(settings(pi, store));
1186
1308
  return () => {
1187
1309
  recorder.dispose();
1188
1310
  store.dispose();
1189
1311
  removeStyle();
1190
1312
  };
1191
1313
  }
1192
- function settings(pi, store) {
1193
- const words = () => MeetingWords.of(pi.ui.language);
1194
- const picker = (key, values, label) => function Picker() {
1195
- useSubscribed(store);
1196
- const value = store.settings[key];
1197
- const choices = values.includes(value) ? values : [...values, value].sort((a, b) => a - b);
1198
- return /* @__PURE__ */ React.createElement("select", {
1199
- className: "ta-select",
1200
- value,
1201
- onChange: (event) => void store.call("setSettings", { [key]: Number(event.target.value) }).catch((error) => failed(pi, error))
1202
- }, choices.map((n) => /* @__PURE__ */ React.createElement("option", {
1203
- key: n,
1204
- value: n
1205
- }, MeetingWords.format(words()[label], { n }))));
1206
- };
1207
- return {
1208
- title: () => words().title,
1209
- icon: pi.ui.icons.Mic,
1210
- group: "voice",
1211
- rows: [
1212
- { key: "keepDays", label: () => words().keepDays, description: () => words().keepDaysHint, render: picker("keepDays", KEEP_DAYS, "keepDaysValue") },
1213
- { key: "maxMB", label: () => words().maxMB, description: () => words().maxMBHint, render: picker("maxMB", MAX_MB, "maxMBValue") }
1214
- ]
1215
- };
1216
- }
1217
1314
  export {
1218
1315
  activate as default
1219
1316
  };