@celljs/ta-web 4.29.0 → 4.30.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.
Files changed (55) hide show
  1. package/esm/browser/chat/chat-view.js +1 -1
  2. package/esm/browser/components/app-contexts.js +6 -4
  3. package/esm/browser/components/app-nav.js +4 -4
  4. package/esm/browser/components/chat-list-row.js +7 -2
  5. package/esm/browser/components/chat-tag.d.ts +20 -0
  6. package/esm/browser/components/chat-tag.js +103 -0
  7. package/esm/browser/components/custom-host.js +1 -1
  8. package/esm/browser/components/editor-area.js +1 -1
  9. package/esm/browser/components/launcher-surface.js +1 -1
  10. package/esm/browser/components/session-view.js +6 -1
  11. package/esm/browser/extension/extension-view.d.ts +7 -0
  12. package/esm/browser/extension/extension-view.js +5 -0
  13. package/esm/browser/extension/icons.js +2 -1
  14. package/esm/browser/extension/web-api-chats.d.ts +29 -0
  15. package/esm/browser/extension/web-extension-api.d.ts +4 -5
  16. package/esm/browser/extension/web-extension-context.js +1 -0
  17. package/esm/browser/extension/web-extension-protocol.d.ts +8 -1
  18. package/esm/browser/extension/web-extension-protocol.js +1 -0
  19. package/esm/browser/extension/web-extension-run.d.ts +3 -2
  20. package/esm/browser/extension/web-extension-run.js +2 -0
  21. package/esm/browser/extension/web-extensions-running.d.ts +3 -0
  22. package/esm/browser/extension/web-extensions-running.js +13 -1
  23. package/esm/browser/extension/web-extensions.js +5 -1
  24. package/esm/browser/extension/web-metrics.d.ts +32 -0
  25. package/esm/browser/extension/web-metrics.js +98 -0
  26. package/esm/browser/style/chat-list.d.ts +1 -1
  27. package/esm/browser/style/chat-list.js +6 -0
  28. package/lib/browser/chat/chat-view.js +1 -1
  29. package/lib/browser/components/app-contexts.js +6 -4
  30. package/lib/browser/components/app-nav.js +4 -4
  31. package/lib/browser/components/chat-list-row.js +7 -2
  32. package/lib/browser/components/chat-tag.d.ts +21 -0
  33. package/lib/browser/components/chat-tag.js +142 -0
  34. package/lib/browser/components/custom-host.js +1 -1
  35. package/lib/browser/components/editor-area.js +1 -1
  36. package/lib/browser/components/launcher-surface.js +1 -1
  37. package/lib/browser/components/session-view.js +6 -1
  38. package/lib/browser/extension/extension-view.d.ts +7 -0
  39. package/lib/browser/extension/extension-view.js +6 -1
  40. package/lib/browser/extension/icons.js +1 -0
  41. package/lib/browser/extension/web-api-chats.d.ts +29 -0
  42. package/lib/browser/extension/web-extension-api.d.ts +4 -5
  43. package/lib/browser/extension/web-extension-context.js +1 -0
  44. package/lib/browser/extension/web-extension-protocol.d.ts +8 -1
  45. package/lib/browser/extension/web-extension-protocol.js +1 -0
  46. package/lib/browser/extension/web-extension-run.d.ts +3 -2
  47. package/lib/browser/extension/web-extension-run.js +2 -0
  48. package/lib/browser/extension/web-extensions-running.d.ts +3 -0
  49. package/lib/browser/extension/web-extensions-running.js +13 -1
  50. package/lib/browser/extension/web-extensions.js +5 -1
  51. package/lib/browser/extension/web-metrics.d.ts +33 -0
  52. package/lib/browser/extension/web-metrics.js +102 -0
  53. package/lib/browser/style/chat-list.d.ts +1 -1
  54. package/lib/browser/style/chat-list.js +6 -0
  55. package/package.json +7 -7
@@ -36,7 +36,7 @@ export function useChat() {
36
36
  /** What a web extension draws: in its own boundary, so that a failure stays in its place. */
37
37
  export function Widget({ widget }) {
38
38
  const Content = widget.component;
39
- return (React.createElement(ExtensionBoundary, { name: WebLabelUtil.text(widget.title) || widget.id, resetKey: Content },
39
+ return (React.createElement(ExtensionBoundary, { name: WebLabelUtil.text(widget.title) || widget.id, extension: widget.extension, resetKey: Content },
40
40
  React.createElement(Content, null)));
41
41
  }
42
42
  function Hero({ cwd, onPick }) {
@@ -3,6 +3,7 @@ import { CallGroup, LoadedExtensions, MessageRenderers, SessionAvatars, SessionM
3
3
  import { useWebExtensions } from '../hooks.js';
4
4
  import { CodeRenderers } from '../markdown/code-renderers.js';
5
5
  import { ChatIconsProvider } from './chat-icon.js';
6
+ import { ChatTagsProvider } from './chat-tag.js';
6
7
  import { OpenLink } from './link.js';
7
8
  import { FileUrls } from './media.js';
8
9
  import { useSecretPeek } from './secret-peek.js';
@@ -21,9 +22,10 @@ export function AppContexts({ fileUrl, openLink, children, }) {
21
22
  React.createElement(ToolRenderers.Provider, { value: extensions.toolRenderers },
22
23
  React.createElement(SessionAvatars.Provider, { value: extensions.avatars },
23
24
  React.createElement(ChatIconsProvider, { entries: extensions.chatIcons },
24
- React.createElement(SessionMenus.Provider, { value: extensions.sessionMenus },
25
- React.createElement(LoadedExtensions.Provider, { value: extensions.extensions },
26
- React.createElement(CallGroup.Provider, { value: extensions.callGroup },
27
- React.createElement(SecretPeeks.Provider, { value: secretPeek }, children))))))))))));
25
+ React.createElement(ChatTagsProvider, { entries: extensions.chatTags },
26
+ React.createElement(SessionMenus.Provider, { value: extensions.sessionMenus },
27
+ React.createElement(LoadedExtensions.Provider, { value: extensions.extensions },
28
+ React.createElement(CallGroup.Provider, { value: extensions.callGroup },
29
+ React.createElement(SecretPeeks.Provider, { value: secretPeek }, children)))))))))))));
28
30
  }
29
31
  //# sourceMappingURL=app-contexts.js.map
@@ -107,11 +107,11 @@ export function SidebarView({ view }) {
107
107
  const arrived = useArrived(view);
108
108
  return (React.createElement("section", { className: "ta-side-view", "aria-label": title, "data-arrived": arrived ? '' : undefined },
109
109
  React.createElement("header", { className: "ta-chats-head" }, Head ? (React.createElement("div", { className: "ta-side-view-head" },
110
- React.createElement(ExtensionBoundary, { key: view.id, name: title, resetKey: Head },
110
+ React.createElement(ExtensionBoundary, { key: view.id, name: title, extension: view.extension, resetKey: Head },
111
111
  React.createElement(ExtensionPart, { component: Head })))) : (React.createElement("span", { className: "ta-chats-title" }, title))),
112
112
  React.createElement(ConnectionBanner, null),
113
113
  React.createElement("div", { className: "ta-side-view-body" },
114
- React.createElement(ExtensionBoundary, { key: view.id, name: title, resetKey: View },
114
+ React.createElement(ExtensionBoundary, { key: view.id, name: title, extension: view.extension, resetKey: View },
115
115
  React.createElement(ExtensionPart, { component: View })))));
116
116
  }
117
117
  /**
@@ -127,12 +127,12 @@ export function PageView({ view, leading }) {
127
127
  React.createElement("header", { className: `ta-main-head ${view.extension.startsWith('builtin:') ? 'ta-narrow-only' : ''}` },
128
128
  pushed ? React.createElement(IconButton, { icon: ChevronLeft, label: t('ta.back'), onClick: () => pushed.close() }) : leading,
129
129
  view.head ? (React.createElement("div", { className: "ta-main-head-view" },
130
- React.createElement(ExtensionBoundary, { key: view.id, name: title, resetKey: view.head },
130
+ React.createElement(ExtensionBoundary, { key: view.id, name: title, extension: view.extension, resetKey: view.head },
131
131
  React.createElement(ExtensionPart, { component: view.head })))) : (React.createElement("div", { className: "ta-main-title" },
132
132
  React.createElement("span", null, title))),
133
133
  React.createElement(WorkbenchToggle, null)),
134
134
  React.createElement("div", { className: "ta-page-body" },
135
- React.createElement(ExtensionBoundary, { key: view.id, name: title, resetKey: View },
135
+ React.createElement(ExtensionBoundary, { key: view.id, name: title, extension: view.extension, resetKey: View },
136
136
  React.createElement(ExtensionPart, { component: View })))));
137
137
  }
138
138
  //# sourceMappingURL=app-nav.js.map
@@ -8,6 +8,7 @@ import { MessageUtil } from '../util/message.js';
8
8
  import { useBusy } from './busy.js';
9
9
  import { ChatIconTile, useChatIcon } from './chat-icon.js';
10
10
  import { ChatListUtil } from './chat-list-util.js';
11
+ import { ChatTagLabel, useChatTag } from './chat-tag.js';
11
12
  import { ContextMenuUtil, useContextMenu } from './context-menu.js';
12
13
  import { HostTag } from './host-tag.js';
13
14
  import { Icon, IconButton } from './icon.js';
@@ -130,6 +131,8 @@ export const ChatItem = React.memo(function ChatItem({ session, source, selected
130
131
  // The double's conversation is named after it; an agent's has its name (the extension named it so).
131
132
  const who = doubleName !== undefined ? { kind: 'double', name: doubleName } : session.group && avatars[session.group] ? { kind: 'agent' } : undefined;
132
133
  const title = (who === null || who === void 0 ? void 0 : who.kind) === 'double' ? who.name : ChatListUtil.title(session, t);
134
+ // What an extension says it is, after its name (Work, of a directory marked so); not the double's own.
135
+ const chatTag = useChatTag((who === null || who === void 0 ? void 0 : who.kind) === 'double' ? undefined : session);
133
136
  // Held, a row offers what its hover does (its close button shows only on the row shown, on a phone).
134
137
  const [menu, openMenu] = useContextMenu();
135
138
  const onContextMenu = (event) => openMenu(event, ContextMenuUtil.sections([{ label: t('ta.chat.open'), run: onSelect }], [
@@ -175,7 +178,8 @@ export const ChatItem = React.memo(function ChatItem({ session, source, selected
175
178
  React.createElement("span", { className: "ta-chat-line" },
176
179
  who && React.createElement(ChatAvatar, { session: session, source: source, who: who, size: 20, mood: mood }),
177
180
  tag,
178
- React.createElement("span", { className: "ta-chat-title" }, title),
181
+ React.createElement("span", { className: `ta-chat-title${chatTag ? ' ta-badged' : ''}` }, title),
182
+ React.createElement(ChatTagLabel, { tag: chatTag }),
179
183
  viewers,
180
184
  state,
181
185
  React.createElement(ChatDot, { unseen: !!unseen, asks: asks, onSee: onSee }),
@@ -186,7 +190,8 @@ export const ChatItem = React.memo(function ChatItem({ session, source, selected
186
190
  React.createElement("span", { className: "ta-chat-text" },
187
191
  React.createElement("span", { className: "ta-chat-line" },
188
192
  tag,
189
- React.createElement("span", { className: "ta-chat-title" }, title),
193
+ React.createElement("span", { className: `ta-chat-title${chatTag ? ' ta-badged' : ''}` }, title),
194
+ React.createElement(ChatTagLabel, { tag: chatTag }),
190
195
  React.createElement("span", { className: "ta-chat-time" }, removing && handheld ? React.createElement("span", { className: "ta-spinner ta-later" }) : time),
191
196
  React.createElement("span", { className: "ta-chat-place" },
192
197
  React.createElement(Icon, { icon: Folder, size: 12 }),
@@ -0,0 +1,20 @@
1
+ import * as React from 'react';
2
+ import type { WebChat, WebChatTag } from '../extension/web-extension-api.js';
3
+ import type { WebChatTagEntry } from '../extension/web-extension-protocol.js';
4
+ /** The tags web extensions give conversations (WebExtensionAPI.registerChatTag). */
5
+ export declare namespace ChatTagUtil {
6
+ function changed(): void;
7
+ /** The tag of the first extension that gives one, a few words; an extension that throws gives none. Asked once a conversation until they change. */
8
+ function find(entries: readonly WebChatTagEntry[], chat: WebChat): WebChatTag | undefined;
9
+ }
10
+ /** Gives the lists the tags of the extensions, and draws their rows again when an extension says they changed. */
11
+ export declare function ChatTagsProvider({ entries, children }: {
12
+ entries: readonly WebChatTagEntry[];
13
+ children: React.ReactNode;
14
+ }): React.JSX.Element;
15
+ /** The tag of a conversation, when an extension gives it one. */
16
+ export declare function useChatTag(chat: WebChat | undefined): WebChatTag | undefined;
17
+ /** A tag after the name of a conversation, as a messenger marks a group chat with friends. */
18
+ export declare function ChatTagLabel({ tag }: {
19
+ tag: WebChatTag | undefined;
20
+ }): React.JSX.Element | null;
@@ -0,0 +1,103 @@
1
+ import { Lock } from 'lucide-react';
2
+ import * as React from 'react';
3
+ import { ChatTags } from '../extension/extension-view.js';
4
+ import { useLanguage } from '../i18n/use-t.js';
5
+ import { Icon } from './icon.js';
6
+ /** The tags web extensions give conversations (WebExtensionAPI.registerChatTag). */
7
+ export var ChatTagUtil;
8
+ (function (ChatTagUtil) {
9
+ /** Counts what extensions said changed of their tags: what `find` remembered from before is asked again. */
10
+ let generation = 0;
11
+ const remembered = new WeakMap();
12
+ function changed() {
13
+ generation++;
14
+ }
15
+ ChatTagUtil.changed = changed;
16
+ /** The tag of the first extension that gives one, a few words; an extension that throws gives none. Asked once a conversation until they change. */
17
+ function find(entries, chat) {
18
+ var _a, _b;
19
+ if (entries.length === 0) {
20
+ return undefined;
21
+ }
22
+ let memo = remembered.get(entries);
23
+ if ((memo === null || memo === void 0 ? void 0 : memo.generation) !== generation) {
24
+ memo = { generation, found: new Map() };
25
+ remembered.set(entries, memo);
26
+ }
27
+ const key = `${(_a = chat.group) !== null && _a !== void 0 ? _a : ''}\n${chat.cwd}\n${(_b = chat.sessionFile) !== null && _b !== void 0 ? _b : ''}`;
28
+ if (memo.found.has(key)) {
29
+ return memo.found.get(key);
30
+ }
31
+ const found = ask(entries, chat);
32
+ memo.found.set(key, found);
33
+ return found;
34
+ }
35
+ ChatTagUtil.find = find;
36
+ function ask(entries, chat) {
37
+ for (const { extension, source } of entries) {
38
+ try {
39
+ const found = source.tag({ sessionFile: chat.sessionFile, cwd: chat.cwd, ...(chat.group ? { group: chat.group } : {}) });
40
+ const text = typeof (found === null || found === void 0 ? void 0 : found.text) === 'string' ? found.text.trim() : '';
41
+ if (text) {
42
+ const tone = (found === null || found === void 0 ? void 0 : found.tone) === 'blue' || (found === null || found === void 0 ? void 0 : found.tone) === 'green' ? found.tone : 'gray';
43
+ return { text: text.slice(0, 16), tone, ...(typeof (found === null || found === void 0 ? void 0 : found.title) === 'string' ? { title: found.title } : {}) };
44
+ }
45
+ }
46
+ catch (error) {
47
+ console.error(`The web extension ${extension} failed to give a tag:`, error);
48
+ }
49
+ }
50
+ return undefined;
51
+ }
52
+ })(ChatTagUtil || (ChatTagUtil = {}));
53
+ /** Gives the lists the tags of the extensions, and draws their rows again when an extension says they changed. */
54
+ export function ChatTagsProvider({ entries, children }) {
55
+ const [version, setVersion] = React.useState(0);
56
+ const language = useLanguage();
57
+ const languageShown = React.useRef(language);
58
+ if (languageShown.current !== language) {
59
+ languageShown.current = language;
60
+ ChatTagUtil.changed();
61
+ }
62
+ React.useEffect(() => {
63
+ const changed = () => {
64
+ ChatTagUtil.changed();
65
+ setVersion(count => count + 1);
66
+ };
67
+ const stops = entries.map(({ source }) => {
68
+ var _a;
69
+ try {
70
+ return (_a = source.subscribe) === null || _a === void 0 ? void 0 : _a.call(source, changed);
71
+ }
72
+ catch (_b) {
73
+ return undefined;
74
+ }
75
+ });
76
+ return () => {
77
+ for (const stop of stops) {
78
+ stop === null || stop === void 0 ? void 0 : stop();
79
+ }
80
+ };
81
+ }, [entries]);
82
+ // biome-ignore lint/correctness/useExhaustiveDependencies: a new language is a new value, what the tags say read again
83
+ const value = React.useMemo(() => ({ entries: [...entries], version }), [entries, version, language]);
84
+ return React.createElement(ChatTags.Provider, { value: value }, children);
85
+ }
86
+ /** The tag of a conversation, when an extension gives it one. */
87
+ export function useChatTag(chat) {
88
+ const { entries, version } = React.useContext(ChatTags);
89
+ const { sessionFile, cwd, group } = chat !== null && chat !== void 0 ? chat : { cwd: '' };
90
+ // biome-ignore lint/correctness/useExhaustiveDependencies: asked again when an extension said it changed
91
+ return React.useMemo(() => (chat && entries.length ? ChatTagUtil.find(entries, { sessionFile, cwd, ...(group ? { group } : {}) }) : undefined), [entries, version, sessionFile, cwd, group]);
92
+ }
93
+ /** A tag after the name of a conversation, as a messenger marks a group chat with friends. */
94
+ export function ChatTagLabel({ tag }) {
95
+ var _a;
96
+ if (!tag) {
97
+ return null;
98
+ }
99
+ return (React.createElement("span", { className: `ta-chat-badge ta-chat-tag ta-tone-${(_a = tag.tone) !== null && _a !== void 0 ? _a : 'gray'}`, title: tag.title },
100
+ tag.tone === 'gray' || !tag.tone ? React.createElement(Icon, { icon: Lock, size: 9 }) : null,
101
+ tag.text));
102
+ }
103
+ //# sourceMappingURL=chat-tag.js.map
@@ -8,7 +8,7 @@ export function CustomHost() {
8
8
  }
9
9
  function CustomEntry({ entry, close }) {
10
10
  const Component = entry.component;
11
- return (React.createElement(ExtensionBoundary, { name: entry.extension, resetKey: Component, fallback: null },
11
+ return (React.createElement(ExtensionBoundary, { name: entry.extension, extension: entry.extension, resetKey: Component, fallback: null },
12
12
  React.createElement(Component, { close: close })));
13
13
  }
14
14
  //# sourceMappingURL=custom-host.js.map
@@ -39,7 +39,7 @@ export function EditorArea(props) {
39
39
  const Content = editor.render;
40
40
  return (React.createElement("div", { key: editor.id, className: "ta-editor-body", role: "tabpanel", hidden: editor.id !== active },
41
41
  React.createElement(EditorActionsSlot.Provider, { value: editor.id === active ? slot : null },
42
- React.createElement(ExtensionBoundary, { name: WebLabelUtil.text(editor.title), resetKey: Content },
42
+ React.createElement(ExtensionBoundary, { name: WebLabelUtil.text(editor.title), extension: editor.extension, resetKey: Content },
43
43
  React.createElement(ExtensionPart, { component: Content })))));
44
44
  })));
45
45
  }
@@ -60,7 +60,7 @@ export function LauncherSurface({ active = true }) {
60
60
  const View = view.component;
61
61
  const title = WebLabelUtil.text(view.title);
62
62
  return (React.createElement("section", { key: view.id, className: "ta-launcher-section", "aria-label": title },
63
- React.createElement(ExtensionBoundary, { name: title, resetKey: View },
63
+ React.createElement(ExtensionBoundary, { name: title, extension: view.extension, resetKey: View },
64
64
  React.createElement(View, null))));
65
65
  }))), top: React.createElement(SearchPage, { input: input, query: query, onQuery: setQuery, onClose: close }) })));
66
66
  }
@@ -20,6 +20,7 @@ import { ThumbnailUtil } from '../util/thumbnail.js';
20
20
  import { Voice } from '../util/voice.js';
21
21
  import { TaWorkbench } from '../workbench-protocol.js';
22
22
  import { ChatAskUtil, LET_GO_ASKS } from './chat-asks.js';
23
+ import { ChatTagLabel, useChatTag } from './chat-tag.js';
23
24
  import { Composer } from './composer.js';
24
25
  import { useComposerAddons } from './composer-addons.js';
25
26
  import { ComposerTarget } from './composer-target.js';
@@ -215,6 +216,8 @@ export function SessionView({ store, server, workspace, info, onClosed, onActivi
215
216
  const title = (info === null || info === void 0 ? void 0 : info.sessionName) || (info ? MessageUtil.basename(info.cwd) : t('ta.session.title'));
216
217
  const conversation = React.useMemo(() => ({ sessionId: store.sessionId, sessionFile: info === null || info === void 0 ? void 0 : info.sessionFile, cwd: info === null || info === void 0 ? void 0 : info.cwd, kind: 'chat', group: info === null || info === void 0 ? void 0 : info.group, title }), [store.sessionId, info === null || info === void 0 ? void 0 : info.sessionFile, info === null || info === void 0 ? void 0 : info.cwd, info === null || info === void 0 ? void 0 : info.group, title]);
217
218
  const addons = useComposerAddons(conversation);
219
+ // What an extension says it is, after its name on top (Work, of a directory marked so).
220
+ const chatTag = useChatTag(info ? { sessionFile: info.sessionFile, cwd: info.cwd, ...(info.group ? { group: info.group } : {}) } : undefined);
218
221
  // Finding words in it (ConversationFind): 0 while it does not show, counted up each time it is asked for.
219
222
  const [finding, setFinding] = React.useState(0);
220
223
  const closeFind = React.useCallback(() => setFinding(0), []);
@@ -341,7 +344,9 @@ export function SessionView({ store, server, workspace, info, onClosed, onActivi
341
344
  !compact && (React.createElement("header", { className: "ta-session-header" },
342
345
  leading,
343
346
  React.createElement("div", { className: "ta-session-title" },
344
- React.createElement("span", { className: "ta-title" }, title),
347
+ chatTag ? (React.createElement("span", { className: "ta-title-line" },
348
+ React.createElement("span", { className: "ta-title" }, title),
349
+ React.createElement(ChatTagLabel, { tag: chatTag }))) : (React.createElement("span", { className: "ta-title" }, title)),
345
350
  info && (React.createElement("span", { className: "ta-muted ta-path", title: info.cwd }, MessageUtil.shortPath(info.cwd)))),
346
351
  React.createElement(PeopleFaces, { people: viewing, size: 24, label: t('ta.presence.viewing') }),
347
352
  trailing)),
@@ -12,6 +12,11 @@ export declare const ChatIcons: React.Context<{
12
12
  entries: WebExtensionsState['chatIcons'];
13
13
  version: number;
14
14
  }>;
15
+ /** The tags web extensions give conversations, and a count of their changes (ChatTagUtil). */
16
+ export declare const ChatTags: React.Context<{
17
+ entries: WebExtensionsState['chatTags'];
18
+ version: number;
19
+ }>;
15
20
  /** The avatars that web extensions registered for the sessions of their groups. */
16
21
  export declare const SessionAvatars: React.Context<Record<string, React.ComponentType<import("./web-extension-api.js").WebAvatarProps>>>;
17
22
  /** The group of the conversations calls are answered in (WebExtensionsState.callGroup): shown as the record of a call. */
@@ -22,6 +27,8 @@ export declare const SessionMenus: React.Context<import("./web-api-menus.js").We
22
27
  export declare const LoadedExtensions: React.Context<import("./web-extension-protocol.js").LoadedWebExtension[]>;
23
28
  interface BoundaryProps {
24
29
  name: string;
30
+ /** The extension that draws it, by id or name: what threw is counted for its package (WebMetrics). */
31
+ extension?: string;
25
32
  /** A new value (a new component) tries again after a failure. */
26
33
  resetKey?: unknown;
27
34
  /** In place of the error, where it would not fit. */
@@ -4,12 +4,15 @@ import { Callout } from '../components/callout.js';
4
4
  import { Markdown } from '../components/markdown.js';
5
5
  import { useLanguage, useT } from '../i18n/use-t.js';
6
6
  import { MessageUtil } from '../util/message.js';
7
+ import { WebMetrics } from './web-metrics.js';
7
8
  /** The renderers of custom messages that web extensions registered. */
8
9
  export const MessageRenderers = React.createContext({});
9
10
  /** How the calls of the tools of web extensions read (WebExtensionAPI.registerToolRenderer). */
10
11
  export const ToolRenderers = React.createContext([]);
11
12
  /** The icons web extensions give conversations of theirs, and a count of their changes (ChatIconUtil). */
12
13
  export const ChatIcons = React.createContext({ entries: [], version: 0 });
14
+ /** The tags web extensions give conversations, and a count of their changes (ChatTagUtil). */
15
+ export const ChatTags = React.createContext({ entries: [], version: 0 });
13
16
  /** The avatars that web extensions registered for the sessions of their groups. */
14
17
  export const SessionAvatars = React.createContext({});
15
18
  /** The group of the conversations calls are answered in (WebExtensionsState.callGroup): shown as the record of a call. */
@@ -28,6 +31,8 @@ export class ExtensionBoundary extends React.Component {
28
31
  return { error };
29
32
  }
30
33
  componentDidCatch(error) {
34
+ var _a;
35
+ (_a = WebMetrics.current) === null || _a === void 0 ? void 0 : _a.renderError(this.props.extension);
31
36
  console.error(`${this.props.name} failed:`, error);
32
37
  }
33
38
  componentDidUpdate(previous) {
@@ -1,4 +1,4 @@
1
- import { AlarmClock, Aperture, Archive, ArrowDown, ArrowLeft, ArrowRight, ArrowUp, ArrowUpDown, Bell, BellOff, BookOpen, Bot, Box, Bug, Building2, Calendar, Camera, CaseSensitive, ChartColumn, ChartSpline, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronsDownUp, ChevronsUpDown, ChevronUp, Circle, CircleAlert, CircleArrowRight, CircleHelp, Clipboard, ClipboardPaste, Clock, Cloud, Code, Coins, Columns2, Contact, Copy, CopyMinus, CornerDownRight, CornerUpLeft, Cpu, Crown, Database, Download, Ellipsis, ExternalLink, Eye, File, FileArchive, FileDiff, FilePlus, Files, FileText, Film, FlaskConical, Folder, FolderInput, FolderOpen, FolderPlus, FolderSearch, FolderTree, Forward, Gamepad2, Gauge, GitBranch, GitCommitHorizontal, Globe, Grip, HardDrive, Hash, Headphones, Heart, House, Image, ImagePlus, Info, Keyboard, KeyRound, Laptop, LayoutDashboard, Lightbulb, Link, List, ListChecks, ListTodo, ListTree, ListX, LoaderCircle, LocateFixed, Lock, MapIcon, Maximize, Maximize2, Megaphone, MemoryStick, MessageCircle, MessageSquareDot, MessageSquareText, MessagesSquare, Mic, Minimize2, Minus, Monitor, MonitorSmartphone, MousePointer2, MousePointerClick, Package, PackageOpen, Paperclip, Pencil, Phone, Pin, PinOff, Play, Plus, Pointer, Power, Puzzle, QrCode, Quote, Radar, RefreshCw, Regex, Replace, ReplaceAll, Rocket, RotateCcw, Rows2, Save, Scan, ScanLine, ScrollText, Search, Send, Server, Share2, Shield, ShieldAlert, ShieldCheck, Shuffle, SlidersHorizontal, Smartphone, Sparkles, Square, SquareMinus, SquarePlus, SquareTerminal, Star, StarOff, Store, Target, Text, ThumbsDown, ThumbsUp, Timer, Trash2, TrendingDown, TrendingUp, Trophy, Undo2, Unplug, Upload, User, UserPlus, Users, Volume2, WholeWord, Wrench, X, Zap, } from 'lucide-react';
1
+ import { AlarmClock, Aperture, Archive, ArrowDown, ArrowLeft, ArrowRight, ArrowUp, ArrowUpDown, Bell, BellOff, BookOpen, Bot, Box, Bug, Building2, Calendar, Camera, CaseSensitive, ChartColumn, ChartSpline, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronsDownUp, ChevronsUpDown, ChevronUp, Circle, CircleAlert, CircleArrowRight, CircleHelp, Clipboard, ClipboardPaste, Clock, Cloud, Code, Coins, Columns2, Contact, Copy, CopyMinus, CornerDownRight, CornerUpLeft, Cpu, Crown, Database, Download, Ellipsis, ExternalLink, Eye, File, FileArchive, FileDiff, FilePlus, Files, FileText, Film, FlaskConical, Folder, FolderInput, FolderLock, FolderOpen, FolderPlus, FolderSearch, FolderTree, Forward, Gamepad2, Gauge, GitBranch, GitCommitHorizontal, Globe, Grip, HardDrive, Hash, Headphones, Heart, House, Image, ImagePlus, Info, Keyboard, KeyRound, Laptop, LayoutDashboard, Lightbulb, Link, List, ListChecks, ListTodo, ListTree, ListX, LoaderCircle, LocateFixed, Lock, MapIcon, Maximize, Maximize2, Megaphone, MemoryStick, MessageCircle, MessageSquareDot, MessageSquareText, MessagesSquare, Mic, Minimize2, Minus, Monitor, MonitorSmartphone, MousePointer2, MousePointerClick, Package, PackageOpen, Paperclip, Pencil, Phone, Pin, PinOff, Play, Plus, Pointer, Power, Puzzle, QrCode, Quote, Radar, RefreshCw, Regex, Replace, ReplaceAll, Rocket, RotateCcw, Rows2, Save, Scan, ScanLine, ScrollText, Search, Send, Server, Share2, Shield, ShieldAlert, ShieldCheck, Shuffle, SlidersHorizontal, Smartphone, Sparkles, Square, SquareMinus, SquarePlus, SquareTerminal, Star, StarOff, Store, Target, Text, ThumbsDown, ThumbsUp, Timer, Trash2, TrendingDown, TrendingUp, Trophy, Undo2, Unplug, Upload, User, UserPlus, Users, Volume2, WholeWord, Wrench, X, Zap, } from 'lucide-react';
2
2
  /** The icons a web extension gets as `pi.ui.icons`; names are lucide's. Only add: removing one breaks extensions. */
3
3
  export const WEB_ICONS = Object.freeze({
4
4
  AlarmClock,
@@ -61,6 +61,7 @@ export const WEB_ICONS = Object.freeze({
61
61
  FlaskConical,
62
62
  Folder,
63
63
  FolderInput,
64
+ FolderLock,
64
65
  FolderOpen,
65
66
  FolderPlus,
66
67
  FolderSearch,
@@ -38,6 +38,35 @@ export interface WebChatIcon {
38
38
  */
39
39
  folder?: string;
40
40
  }
41
+ /**
42
+ * A small label a conversation has after its name, in the lists and on top of it (WebExtensionAPI.registerChatTag):
43
+ * what it is, at a glance (Work, of a directory marked so). A few words.
44
+ */
45
+ export interface WebChatTag {
46
+ text: string;
47
+ /** Its color: `blue`, `gray` (with a lock), `green`; default `gray`. */
48
+ tone?: 'blue' | 'gray' | 'green';
49
+ /** Under a pointer: what it means. */
50
+ title?: string;
51
+ }
52
+ /**
53
+ * The tags an extension gives conversations (WebExtensionAPI.registerChatTag). Asked for each row as it is drawn:
54
+ * answer at once, from what the extension holds.
55
+ */
56
+ export interface WebChatTagSource {
57
+ tag(chat: WebChat): WebChatTag | undefined;
58
+ /** What `tag` answers changed: the lists draw their rows again. */
59
+ subscribe?(listener: () => void): () => void;
60
+ }
61
+ /** What a web extension adds to the conversations of the lists (WebExtensionAPI extends it). */
62
+ export interface WebChatTagsAPI {
63
+ /**
64
+ * A small label for conversations, after their name in the lists and on top of a conversation: what they are at a
65
+ * glance (Work, of a directory marked so). The first extension that gives one for a conversation is drawn. Newer
66
+ * than some Ta apps: `pi.registerChatTag?.(…)`.
67
+ */
68
+ registerChatTag(source: WebChatTagSource): void;
69
+ }
41
70
  /**
42
71
  * The conversations an extension gives an icon of their own (WebExtensionAPI.registerChatIcon): a brief it writes,
43
72
  * the questions it asks. Asked for each row as it is drawn: answer at once, from what the extension holds.
@@ -7,7 +7,7 @@ import type { Game3DProps } from '../game/game3d-protocol.js';
7
7
  import type { ScreenPartSpec, TaScreen } from '../screen/screen-protocol.js';
8
8
  import type { Language, Theme } from '../settings/settings-protocol.js';
9
9
  import type { CodeEditorProps, DiffEditorProps, WebChatImagesProps, WebComposerProps, WebConversationViewProps, WebDialogProps, WebEmptyProps, WebFaceProps, WebFolderPickerProps, WebFullScreenProps, WebGroupFaceProps, WebHoldToTalkProps, WebImageViewerProps, WebLoadingProps, WebModelPickerProps, WebPictureCardsProps, WebPictureProps, WebSelectBarProps, WebSelectCheckProps, WebShareSheetProps, WebStackProps, WebSwipeRowProps, WebSwitchProps, WebTaskIconProps, WebVoice } from './web-api-components.js';
10
- import type { WebAsk, WebCallsAPI, WebChatIconSource, WebCodeRendererOptions, WebCodeRendererProps, WebComposerAddon, WebCustomMessage, WebHomeSource, WebInitiative, WebMenuItem, WebOpener, WebOpenerOptions, WebRoomAddon, WebRoomAddonEntry, WebSearchSource, WebSessionNotice, WebSettingsSection, WebShareTarget, WebTaskEntry, WebTaskRemoval, WebTaskSource, WebTool, WebToolRendererResolver, WebView, WebViewInfo, WidgetOptions } from './web-api-contributions.js';
10
+ import type { WebAsk, WebCallsAPI, WebChatIconSource, WebChatTagsAPI, WebCodeRendererOptions, WebCodeRendererProps, WebComposerAddon, WebCustomMessage, WebHomeSource, WebInitiative, WebMenuItem, WebOpener, WebOpenerOptions, WebRoomAddon, WebRoomAddonEntry, WebSearchSource, WebSessionNotice, WebSettingsSection, WebShareTarget, WebTaskEntry, WebTaskRemoval, WebTaskSource, WebTool, WebToolRendererResolver, WebView, WebViewInfo, WidgetOptions } from './web-api-contributions.js';
11
11
  import type { WebDesktop, WebDeviceUI, WebFileDrag } from './web-api-desktop.js';
12
12
  import type { WebEditorsUI } from './web-api-editors.js';
13
13
  import type { WebHomeUI, WebPartnersAPI, WebPartnersUI } from './web-api-home.js';
@@ -31,11 +31,10 @@ export type * from './web-api-services.js';
31
31
  export type * from './web-api-terminal.js';
32
32
  export type { WebPageInfo, WebPageState } from './web-pages.js';
33
33
  /**
34
- * What a web extension gets: the web client's side of pi's extension API, with the same names where
35
- * the two mean the same. A web extension is one ES module without imports, the `web` part of a pi
36
- * package (see TaWebExtensionInfo); it exports a {@link WebExtensionFactory}.
34
+ * What a web extension gets: the web client's side of pi's extension API, its names where they mean the same. A web
35
+ * extension is one ES module without imports, the `web` part of a pi package (TaWebExtensionInfo): a {@link WebExtensionFactory}.
37
36
  */
38
- export interface WebExtensionAPI extends WebServices, WebPartnersAPI, WebMenus, WebCallsAPI {
37
+ export interface WebExtensionAPI extends WebServices, WebPartnersAPI, WebMenus, WebCallsAPI, WebChatTagsAPI {
39
38
  /** The React of the page: an extension brings no React of its own. */
40
39
  readonly React: typeof React;
41
40
  readonly ui: WebExtensionUI;
@@ -215,6 +215,7 @@ export class WebExtensionContext {
215
215
  run.avatar = avatar;
216
216
  }),
217
217
  registerChatIcon: source => register(() => run.chatIcons.push(source)),
218
+ registerChatTag: source => register(() => run.chatTags.push(source)),
218
219
  registerTool: tool => register(() => run.tools.push(tool)),
219
220
  registerToolRenderer: resolver => register(() => run.toolRenderers.push(resolver)),
220
221
  registerTasks: source => register(() => run.taskSources.push(source)),
@@ -2,7 +2,7 @@ import type { TaEvent, TaTemporaryFrom, TaWebExtensionInfo } from '@celljs/ta-pr
2
2
  import type * as React from 'react';
3
3
  import type { MessageId } from '../i18n/messages.js';
4
4
  import type { BlockSpeech } from '../util/spoken.js';
5
- import type { WebAvatarProps, WebCallMouth, WebCallMoves, WebCallPartner, WebChatIconSource, WebCodeRendererProps, WebComposerAddon, WebCustomMessage, WebEditor, WebExtensionFactory, WebFileMenu, WebHomeEntry, WebIcon, WebImage, WebInitiative, WebLabel, WebMenuItem, WebOpener, WebPageGroup, WebRoomAddonEntry, WebSearchSource, WebSessionMenu, WebSessionOpening, WebSettingsSection, WebShareTarget, WebTool, WebToolRendererResolver, WebViewLocation, WebViewPreview, WidgetOptions } from './web-extension-api.js';
5
+ import type { WebAvatarProps, WebCallMouth, WebCallMoves, WebCallPartner, WebChatIconSource, WebChatTagSource, WebCodeRendererProps, WebComposerAddon, WebCustomMessage, WebEditor, WebExtensionFactory, WebFileMenu, WebHomeEntry, WebIcon, WebImage, WebInitiative, WebLabel, WebMenuItem, WebOpener, WebPageGroup, WebRoomAddonEntry, WebSearchSource, WebSessionMenu, WebSessionOpening, WebSettingsSection, WebShareTarget, WebTool, WebToolRendererResolver, WebViewLocation, WebViewPreview, WidgetOptions } from './web-extension-api.js';
6
6
  import type { WebHomeBoard } from './web-home.js';
7
7
  import type { PageUsage, WebPageInfo } from './web-pages.js';
8
8
  import type { WebPartnerBoard } from './web-partners.js';
@@ -104,6 +104,11 @@ export interface WebChatIconEntry {
104
104
  extension: string;
105
105
  source: WebChatIconSource;
106
106
  }
107
+ export interface WebChatTagEntry {
108
+ /** The name of the extension's package. */
109
+ extension: string;
110
+ source: WebChatTagSource;
111
+ }
107
112
  export interface WebExtensionsState {
108
113
  extensions: LoadedWebExtension[];
109
114
  views: WebViewEntry[];
@@ -136,6 +141,8 @@ export interface WebExtensionsState {
136
141
  avatars: Record<string, React.ComponentType<WebAvatarProps>>;
137
142
  /** The icons extensions give conversations of theirs (WebExtensionAPI.registerChatIcon), with the extension of each. */
138
143
  chatIcons: WebChatIconEntry[];
144
+ /** The tags extensions give conversations (WebExtensionAPI.registerChatTag), with the extension of each. */
145
+ chatTags: WebChatTagEntry[];
139
146
  /** What answers how far the page goes on its own (WebExtensionAPI.registerInitiative), in the order registered. */
140
147
  initiatives: WebInitiative[];
141
148
  /** The first tool of each name. */
@@ -17,6 +17,7 @@ export var WebExtensionsStateUtil;
17
17
  avatars: {},
18
18
  callMoves: [],
19
19
  chatIcons: [],
20
+ chatTags: [],
20
21
  initiatives: [],
21
22
  tools: [],
22
23
  toolRenderers: [],
@@ -1,6 +1,6 @@
1
1
  import type { TaEvent } from '@celljs/ta-protocol';
2
2
  import type * as React from 'react';
3
- import type { WebCallMouth, WebCallMoves, WebCallPartner, WebChatIconSource, WebComposerAddon, WebFileMenu, WebHomeSource, WebInitiative, WebMenuItem, WebOpener, WebPartnerSource, WebRoomAddon, WebSearchSource, WebSessionMenu, WebSettingsSection, WebTaskSource, WebTool, WebToolRendererResolver, WebView, WidgetOptions } from './web-extension-api.js';
3
+ import type { WebCallMouth, WebCallMoves, WebCallPartner, WebChatIconSource, WebChatTagSource, WebComposerAddon, WebFileMenu, WebHomeSource, WebInitiative, WebMenuItem, WebOpener, WebPartnerSource, WebRoomAddon, WebSearchSource, WebSessionMenu, WebSettingsSection, WebTaskSource, WebTool, WebToolRendererResolver, WebView, WidgetOptions } from './web-extension-api.js';
4
4
  import type { LoadedWebExtension, WebExtensionsState } from './web-extension-protocol.js';
5
5
  /** What an extension registered through its API: all of it goes when it stops. */
6
6
  export interface WebRegistrations {
@@ -17,6 +17,7 @@ export interface WebRegistrations {
17
17
  callMoves: WebCallMoves[];
18
18
  avatar?: WebExtensionsState['avatars'][string];
19
19
  chatIcons: WebChatIconSource[];
20
+ chatTags: WebChatTagSource[];
20
21
  homeSources: WebHomeSource[];
21
22
  partnerSources: WebPartnerSource[];
22
23
  initiatives: WebInitiative[];
@@ -60,5 +61,5 @@ export declare namespace WebExtensionRunUtil {
60
61
  /** Subscribes for the extension: undone when it stops, or by the function returned. */
61
62
  function track(run: WebExtensionRun, subscribe: () => () => void): () => void;
62
63
  /** What the extensions that run registered, as the page shows it: the first of a message type or a tool name wins. */
63
- function collect(runs: readonly WebExtensionRun[], onOpen: (id: string) => boolean): Pick<WebExtensionsState, 'openers' | 'specificOpeners' | 'sessionMenus' | 'fileMenus' | 'extensions' | 'views' | 'widgets' | 'composerAddons' | 'roomAddons' | 'settingsSections' | 'renderers' | 'codeRenderers' | 'codeSpeech' | 'callPartner' | 'callGroup' | 'callMouth' | 'callMoves' | 'avatars' | 'chatIcons' | 'initiatives' | 'tools' | 'toolRenderers' | 'searches'>;
64
+ function collect(runs: readonly WebExtensionRun[], onOpen: (id: string) => boolean): Pick<WebExtensionsState, 'openers' | 'specificOpeners' | 'sessionMenus' | 'fileMenus' | 'extensions' | 'views' | 'widgets' | 'composerAddons' | 'roomAddons' | 'settingsSections' | 'renderers' | 'codeRenderers' | 'codeSpeech' | 'callPartner' | 'callGroup' | 'callMouth' | 'callMoves' | 'avatars' | 'chatIcons' | 'chatTags' | 'initiatives' | 'tools' | 'toolRenderers' | 'searches'>;
64
65
  }
@@ -27,6 +27,7 @@ export var WebExtensionRunUtil;
27
27
  callMoves: [],
28
28
  avatar: undefined,
29
29
  chatIcons: [],
30
+ chatTags: [],
30
31
  homeSources: [],
31
32
  partnerSources: [],
32
33
  initiatives: [],
@@ -145,6 +146,7 @@ export var WebExtensionRunUtil;
145
146
  callMoves: runs.flatMap(run => run.callMoves),
146
147
  avatars,
147
148
  chatIcons: runs.flatMap(run => run.chatIcons.map(source => ({ extension: run.loaded.name, source }))),
149
+ chatTags: runs.flatMap(run => run.chatTags.map(source => ({ extension: run.loaded.name, source }))),
148
150
  initiatives: runs.flatMap(run => run.initiatives),
149
151
  tools,
150
152
  toolRenderers: runs.flatMap(run => run.toolRenderers),
@@ -14,6 +14,7 @@ import type { WebExtensionContext } from './web-extension-context.js';
14
14
  import { BuiltinWebExtension, type LoadedWebExtension, type WebExtensionConversation, type WebExtensionsState, type WebSessionSwitcher, type WebViewEntry } from './web-extension-protocol.js';
15
15
  import { type WebExtensionRun } from './web-extension-run.js';
16
16
  import { WebHomeBoard } from './web-home.js';
17
+ import { WebMetrics } from './web-metrics.js';
17
18
  import { WebOnDemand } from './web-on-demand.js';
18
19
  import { WebPageList } from './web-page-list.js';
19
20
  import { WebPartnerBoard } from './web-partners.js';
@@ -41,6 +42,8 @@ export declare abstract class WebExtensionsRunning {
41
42
  protected readonly code: WebExtensionCode;
42
43
  protected current: WebExtensionsState;
43
44
  protected readonly running: Map<string, WebExtensionRun>;
45
+ /** What the page counts of the packages (docs/design/ta-metrics.md 4.1). */
46
+ protected readonly metrics: WebMetrics;
44
47
  protected readonly listeners: Set<(state: WebExtensionsState) => void>;
45
48
  protected conversation?: WebExtensionConversation;
46
49
  protected switcher?: WebSessionSwitcher;
@@ -22,6 +22,7 @@ import { WebExtensionCode } from './web-extension-code.js';
22
22
  import { BuiltinWebExtension, WebExtensionsStateUtil, } from './web-extension-protocol.js';
23
23
  import { WebExtensionRunUtil } from './web-extension-run.js';
24
24
  import { WebHomeBoard } from './web-home.js';
25
+ import { WebMetrics } from './web-metrics.js';
25
26
  import { WebOnDemand } from './web-on-demand.js';
26
27
  import { WebPageList } from './web-page-list.js';
27
28
  import { WebPagesUtil } from './web-pages.js';
@@ -56,6 +57,8 @@ export class WebExtensionsRunning {
56
57
  this.code = new WebExtensionCode(deviceValues(), () => (typeof localStorage === 'undefined' ? undefined : localStorage));
57
58
  this.current = WebExtensionsStateUtil.empty();
58
59
  this.running = new Map();
60
+ /** What the page counts of the packages (docs/design/ta-metrics.md 4.1). */
61
+ this.metrics = new WebMetrics(batch => this.workbench.packages.reportMetrics(batch), extension => { var _a; var _b; return (_b = (_a = this.running.get(extension)) === null || _a === void 0 ? void 0 : _a.loaded.name) !== null && _b !== void 0 ? _b : ([...this.running.values()].some(run => run.loaded.name === extension) ? extension : undefined); });
59
62
  this.listeners = new Set();
60
63
  this.refreshing = Promise.resolve(false);
61
64
  /** The extensions of the list of the last time have started (startKept), once. */
@@ -66,6 +69,7 @@ export class WebExtensionsRunning {
66
69
  return this.current;
67
70
  }
68
71
  init() {
72
+ this.metrics.start();
69
73
  this.placeholders = WebViewUtil.placeholders(this.persisted.get(WebViewUtil.KEPT));
70
74
  this.current = { ...this.current, page: this.persisted.get(WebViewUtil.PAGE), views: this.placeholders, usage: this.onDemand.used };
71
75
  }
@@ -217,6 +221,7 @@ export class WebExtensionsRunning {
217
221
  return stopped;
218
222
  }
219
223
  async loadPackage(info) {
224
+ const start = performance.now();
220
225
  try {
221
226
  const kept = await this.code.get(info.hash);
222
227
  if (kept !== undefined) {
@@ -224,9 +229,13 @@ export class WebExtensionsRunning {
224
229
  }
225
230
  const { code, hash } = await this.workbench.packages.readWebExtension(info.id);
226
231
  void this.code.set(hash, code);
227
- return { factory: await WebExtensionUtil.load(code), hash };
232
+ const factory = await WebExtensionUtil.load(code);
233
+ // Read from the computer: what the user waits for the first time (kept code is quick).
234
+ this.metrics.record(info.name, 'web:load', false, performance.now() - start);
235
+ return { factory, hash };
228
236
  }
229
237
  catch (error) {
238
+ this.metrics.record(info.name, 'web:load', true, performance.now() - start);
230
239
  return { error: WebExtensionUtil.message(error) };
231
240
  }
232
241
  }
@@ -246,8 +255,10 @@ export class WebExtensionsRunning {
246
255
  const dispose = factory(this.context.create(run));
247
256
  run.dispose = typeof dispose === 'function' ? dispose : undefined;
248
257
  run.started = true;
258
+ this.metrics.record(loaded.id, 'web:start');
249
259
  }
250
260
  catch (error) {
261
+ this.metrics.record(loaded.id, 'web:start', true);
251
262
  this.stop(run);
252
263
  run.loaded = { ...loaded, error: WebExtensionUtil.message(error) };
253
264
  }
@@ -265,6 +276,7 @@ export class WebExtensionsRunning {
265
276
  action();
266
277
  }
267
278
  catch (error) {
279
+ this.metrics.record(run.loaded.id, 'web:error', true);
268
280
  console.error(`The web extension ${run.loaded.name} failed:`, error);
269
281
  }
270
282
  }
@@ -81,7 +81,11 @@ let TaWebExtensionsImpl = class TaWebExtensionsImpl extends WebExtensionsRunning
81
81
  }
82
82
  showPage(id) {
83
83
  this.persisted.set(WebViewUtil.PAGE, id);
84
- this.onDemand.shown(this.current.views.find(view => view.id === id));
84
+ const view = this.current.views.find(candidate => candidate.id === id);
85
+ this.onDemand.shown(view);
86
+ if ((view === null || view === void 0 ? void 0 : view.location) === 'page' && !view.pending) {
87
+ this.metrics.record(view.extension, `page:${view.id.slice(view.id.lastIndexOf('/') + 1)}`);
88
+ }
85
89
  this.update({
86
90
  page: id,
87
91
  pageShown: this.current.pageShown + 1,