@celljs/ta-web 4.13.1 → 4.15.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 (149) hide show
  1. package/README.en.md +3 -3
  2. package/README.md +3 -3
  3. package/esm/browser/assistant/assistant-extension.js +3 -2
  4. package/esm/browser/assistant/assistant-initiative.js +1 -1
  5. package/esm/browser/assistant/assistant-state.js +2 -2
  6. package/esm/browser/components/access-view.js +3 -2
  7. package/esm/browser/components/account-menu.js +2 -2
  8. package/esm/browser/components/app-view.js +4 -0
  9. package/esm/browser/components/auth-view.d.ts +1 -1
  10. package/esm/browser/components/auth-view.js +38 -10
  11. package/esm/browser/components/chat-asks.d.ts +8 -0
  12. package/esm/browser/components/chat-asks.js +10 -0
  13. package/esm/browser/components/chat-list.js +11 -1
  14. package/esm/browser/components/composer-box.d.ts +2 -0
  15. package/esm/browser/components/composer-box.js +2 -1
  16. package/esm/browser/components/composer.d.ts +3 -1
  17. package/esm/browser/components/composer.js +16 -4
  18. package/esm/browser/components/custom-provider-advanced.d.ts +14 -0
  19. package/esm/browser/components/custom-provider-advanced.js +50 -0
  20. package/esm/browser/components/custom-provider-util.d.ts +38 -0
  21. package/esm/browser/components/custom-provider-util.js +103 -0
  22. package/esm/browser/components/custom-provider-view.d.ts +11 -0
  23. package/esm/browser/components/custom-provider-view.js +181 -0
  24. package/esm/browser/components/face.d.ts +13 -1
  25. package/esm/browser/components/face.js +16 -1
  26. package/esm/browser/components/host-view.d.ts +1 -1
  27. package/esm/browser/components/message-list.js +20 -1
  28. package/esm/browser/components/people.d.ts +32 -0
  29. package/esm/browser/components/people.js +71 -0
  30. package/esm/browser/components/session-view.d.ts +1 -1
  31. package/esm/browser/components/session-view.js +56 -36
  32. package/esm/browser/components/settings-choices.js +2 -3
  33. package/esm/browser/components/settings-controls.d.ts +7 -1
  34. package/esm/browser/components/settings-controls.js +8 -0
  35. package/esm/browser/components/settings-parts.js +25 -8
  36. package/esm/browser/components/sign-in-setup.d.ts +16 -0
  37. package/esm/browser/components/sign-in-setup.js +118 -0
  38. package/esm/browser/components/use-seen-chats.d.ts +2 -0
  39. package/esm/browser/components/use-seen-chats.js +2 -2
  40. package/esm/browser/editor/monaco-loader.js +7 -1
  41. package/esm/browser/extension/web-api-components.d.ts +12 -0
  42. package/esm/browser/extension/web-api-contributions.d.ts +3 -0
  43. package/esm/browser/extension/web-extension-api.d.ts +9 -2
  44. package/esm/browser/extension/web-extension-context.d.ts +2 -0
  45. package/esm/browser/extension/web-extension-context.js +19 -0
  46. package/esm/browser/game/game-loader.js +22 -2
  47. package/esm/browser/game/game3d-protocol.d.ts +13 -4
  48. package/esm/browser/i18n/locales.d.ts +90 -1
  49. package/esm/browser/i18n/locales.js +25 -1
  50. package/esm/browser/i18n/messages-ja.d.ts +2 -0
  51. package/esm/browser/i18n/messages-ja.js +972 -0
  52. package/esm/browser/i18n/messages-zh-tw.d.ts +3 -0
  53. package/esm/browser/i18n/messages-zh-tw.js +973 -0
  54. package/esm/browser/i18n/messages.d.ts +85 -0
  55. package/esm/browser/i18n/messages.js +171 -1
  56. package/esm/browser/i18n/use-t.js +3 -2
  57. package/esm/browser/presence/presence-reporter.d.ts +32 -0
  58. package/esm/browser/presence/presence-reporter.js +71 -0
  59. package/esm/browser/settings/settings-protocol.d.ts +3 -2
  60. package/esm/browser/settings/settings-protocol.js +4 -3
  61. package/esm/browser/style/conversation.d.ts +1 -1
  62. package/esm/browser/style/conversation.js +24 -0
  63. package/esm/browser/style/layout.d.ts +1 -1
  64. package/esm/browser/style/layout.js +8 -0
  65. package/esm/browser/style/pages.d.ts +1 -1
  66. package/esm/browser/style/pages.js +53 -1
  67. package/esm/browser/util/desktop.d.ts +12 -1
  68. package/esm/browser/util/desktop.js +14 -0
  69. package/esm/browser/util/voice.d.ts +20 -1
  70. package/esm/browser/util/voice.js +27 -11
  71. package/esm/browser/workbench-protocol.d.ts +9 -0
  72. package/esm/browser/workbench-util.d.ts +4 -0
  73. package/esm/browser/workbench-util.js +24 -1
  74. package/esm/browser/workbench.d.ts +3 -0
  75. package/esm/browser/workbench.js +14 -4
  76. package/lib/browser/assistant/assistant-extension.js +3 -2
  77. package/lib/browser/assistant/assistant-initiative.js +1 -1
  78. package/lib/browser/assistant/assistant-state.js +1 -1
  79. package/lib/browser/components/access-view.js +3 -2
  80. package/lib/browser/components/account-menu.js +2 -2
  81. package/lib/browser/components/app-view.js +4 -0
  82. package/lib/browser/components/auth-view.d.ts +1 -1
  83. package/lib/browser/components/auth-view.js +37 -9
  84. package/lib/browser/components/chat-asks.d.ts +8 -0
  85. package/lib/browser/components/chat-asks.js +10 -0
  86. package/lib/browser/components/chat-list.js +11 -1
  87. package/lib/browser/components/composer-box.d.ts +2 -0
  88. package/lib/browser/components/composer-box.js +2 -1
  89. package/lib/browser/components/composer.d.ts +3 -1
  90. package/lib/browser/components/composer.js +16 -4
  91. package/lib/browser/components/custom-provider-advanced.d.ts +15 -0
  92. package/lib/browser/components/custom-provider-advanced.js +86 -0
  93. package/lib/browser/components/custom-provider-util.d.ts +39 -0
  94. package/lib/browser/components/custom-provider-util.js +106 -0
  95. package/lib/browser/components/custom-provider-view.d.ts +12 -0
  96. package/lib/browser/components/custom-provider-view.js +217 -0
  97. package/lib/browser/components/face.d.ts +13 -1
  98. package/lib/browser/components/face.js +16 -1
  99. package/lib/browser/components/host-view.d.ts +1 -1
  100. package/lib/browser/components/message-list.js +19 -0
  101. package/lib/browser/components/people.d.ts +33 -0
  102. package/lib/browser/components/people.js +109 -0
  103. package/lib/browser/components/session-view.d.ts +1 -1
  104. package/lib/browser/components/session-view.js +56 -36
  105. package/lib/browser/components/settings-choices.js +1 -2
  106. package/lib/browser/components/settings-controls.d.ts +7 -1
  107. package/lib/browser/components/settings-controls.js +9 -0
  108. package/lib/browser/components/settings-parts.js +24 -7
  109. package/lib/browser/components/sign-in-setup.d.ts +17 -0
  110. package/lib/browser/components/sign-in-setup.js +155 -0
  111. package/lib/browser/components/use-seen-chats.d.ts +2 -0
  112. package/lib/browser/components/use-seen-chats.js +3 -2
  113. package/lib/browser/editor/monaco-loader.js +7 -1
  114. package/lib/browser/extension/web-api-components.d.ts +12 -0
  115. package/lib/browser/extension/web-api-contributions.d.ts +3 -0
  116. package/lib/browser/extension/web-extension-api.d.ts +9 -2
  117. package/lib/browser/extension/web-extension-context.d.ts +2 -0
  118. package/lib/browser/extension/web-extension-context.js +19 -0
  119. package/lib/browser/game/game-loader.js +22 -2
  120. package/lib/browser/game/game3d-protocol.d.ts +13 -4
  121. package/lib/browser/i18n/locales.d.ts +90 -1
  122. package/lib/browser/i18n/locales.js +25 -1
  123. package/lib/browser/i18n/messages-ja.d.ts +3 -0
  124. package/lib/browser/i18n/messages-ja.js +975 -0
  125. package/lib/browser/i18n/messages-zh-tw.d.ts +4 -0
  126. package/lib/browser/i18n/messages-zh-tw.js +976 -0
  127. package/lib/browser/i18n/messages.d.ts +85 -0
  128. package/lib/browser/i18n/messages.js +174 -2
  129. package/lib/browser/i18n/use-t.js +2 -1
  130. package/lib/browser/presence/presence-reporter.d.ts +33 -0
  131. package/lib/browser/presence/presence-reporter.js +75 -0
  132. package/lib/browser/settings/settings-protocol.d.ts +3 -2
  133. package/lib/browser/settings/settings-protocol.js +4 -3
  134. package/lib/browser/style/conversation.d.ts +1 -1
  135. package/lib/browser/style/conversation.js +24 -0
  136. package/lib/browser/style/layout.d.ts +1 -1
  137. package/lib/browser/style/layout.js +8 -0
  138. package/lib/browser/style/pages.d.ts +1 -1
  139. package/lib/browser/style/pages.js +53 -1
  140. package/lib/browser/util/desktop.d.ts +12 -1
  141. package/lib/browser/util/desktop.js +14 -0
  142. package/lib/browser/util/voice.d.ts +20 -1
  143. package/lib/browser/util/voice.js +27 -11
  144. package/lib/browser/workbench-protocol.d.ts +9 -0
  145. package/lib/browser/workbench-util.d.ts +4 -0
  146. package/lib/browser/workbench-util.js +24 -1
  147. package/lib/browser/workbench.d.ts +3 -0
  148. package/lib/browser/workbench.js +14 -4
  149. package/package.json +10 -10
@@ -1,5 +1,5 @@
1
1
  import type { SessionStore } from '@celljs/ta-client';
2
- import type { TaServer, TaSessionInfo, TaWorkspaceServer } from '@celljs/ta-protocol';
2
+ import { type TaServer, type TaSessionInfo, type TaWorkspaceServer } from '@celljs/ta-protocol';
3
3
  import * as React from 'react';
4
4
  export interface SessionViewProps {
5
5
  store: SessionStore;
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.SessionView = SessionView;
37
37
  const react_1 = require("@celljs/react");
38
+ const ta_protocol_1 = require("@celljs/ta-protocol");
38
39
  const lucide_react_1 = require("lucide-react");
39
40
  const React = __importStar(require("react"));
40
41
  const device_1 = require("../device/device");
@@ -44,6 +45,7 @@ const use_t_1 = require("../i18n/use-t");
44
45
  const code_renderers_1 = require("../markdown/code-renderers");
45
46
  const message_1 = require("../util/message");
46
47
  const terminal_text_1 = require("../util/terminal-text");
48
+ const workbench_protocol_1 = require("../workbench-protocol");
47
49
  const chat_asks_1 = require("./chat-asks");
48
50
  const composer_1 = require("./composer");
49
51
  const composer_addons_1 = require("./composer-addons");
@@ -57,6 +59,7 @@ const media_1 = require("./media");
57
59
  const message_actions_1 = require("./message-actions");
58
60
  const message_footer_1 = require("./message-footer");
59
61
  const message_list_1 = require("./message-list");
62
+ const people_1 = require("./people");
60
63
  const session_settings_1 = require("./session-settings");
61
64
  const terminal_art_1 = require("./terminal-art");
62
65
  const use_stop_times_1 = require("./use-stop-times");
@@ -107,6 +110,15 @@ function StatusChip({ text }) {
107
110
  segment.tone && React.createElement("span", { className: `ta-status ta-status-${segment.tone}` }),
108
111
  segment.text)))));
109
112
  }
113
+ /** Who this page is, from what the computer said of it (MessagePeople). */
114
+ function useMessagePeople() {
115
+ const workbench = (0, react_1.useInject)(workbench_protocol_1.TaWorkbench);
116
+ // Only these two: the conversation is not drawn again for every change of the workbench.
117
+ const subscribe = React.useCallback((listener) => workbench.subscribe(listener), [workbench]);
118
+ const me = React.useSyncExternalStore(subscribe, () => { var _a, _b; var _c; return (_c = (_b = (_a = workbench.state.server) === null || _a === void 0 ? void 0 : _a.member) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : ta_protocol_1.TA_OWNER; });
119
+ const ownerName = React.useSyncExternalStore(subscribe, () => { var _a, _b, _c; var _d, _e; return (_e = (_d = (_b = (_a = workbench.state.server) === null || _a === void 0 ? void 0 : _a.member) === null || _b === void 0 ? void 0 : _b.owner) !== null && _d !== void 0 ? _d : (_c = workbench.state.server) === null || _c === void 0 ? void 0 : _c.user) !== null && _e !== void 0 ? _e : ''; });
120
+ return React.useMemo(() => ({ me, ownerName }), [me, ownerName]);
121
+ }
110
122
  function SessionView({ store, server, workspace, info, onClosed, onActivity, leading, trailing, empty, notice, aboveComposer, belowComposer, draftText, compact = false, }) {
111
123
  var _a;
112
124
  const t = (0, use_t_1.useT)();
@@ -168,41 +180,49 @@ function SessionView({ store, server, workspace, info, onClosed, onActivity, lea
168
180
  const images = React.useCallback((timestamp, index) => server.getMessageImage(store.sessionId, timestamp, index), [server, store]);
169
181
  // A choice in a card of a reply answers this conversation, wherever it is shown, not the one in front.
170
182
  const reply = React.useCallback((text) => store.prompt(text, { streamingBehavior: 'followUp' }).then(() => undefined), [store]);
171
- return (React.createElement("section", { className: `ta-session ${compact ? 'ta-session-compact' : ''}` },
172
- !compact && (React.createElement("header", { className: "ta-session-header" },
173
- leading,
174
- React.createElement("div", { className: "ta-session-title" },
175
- React.createElement("span", { className: "ta-title" }, title),
176
- info && (React.createElement("span", { className: "ta-muted ta-path", title: info.cwd }, message_1.MessageUtil.shortPath(info.cwd)))),
177
- trailing)),
178
- React.createElement("div", { className: "ta-scroll ta-conversation", ref: scroller },
179
- React.createElement("div", { className: "ta-thread" },
180
- state.start > 0 && (React.createElement("div", { className: "ta-earlier", role: "status", "aria-label": t('ta.session.earlier'), ...conversation_scroll_1.SCROLL_SKIP },
181
- React.createElement("span", { className: "ta-spinner" }))),
182
- state.messages.length === 0 && (empty !== null && empty !== void 0 ? empty : React.createElement("div", { className: "ta-empty" }, t('ta.session.empty', { cwd: (_a = info === null || info === void 0 ? void 0 : info.cwd) !== null && _a !== void 0 ? _a : '.' }))),
183
- React.createElement(message_list_1.ConversationSession.Provider, { value: info },
184
- React.createElement(message_footer_1.MessageActions.Provider, { value: messageActions },
185
- React.createElement(media_1.FileUrls.Provider, { value: fileUrl },
186
- React.createElement(link_1.OpenLink.Provider, { value: openLink },
187
- React.createElement(message_list_1.MessageImages.Provider, { value: images },
188
- React.createElement(code_renderers_1.CodeReply.Provider, { value: reply },
189
- React.createElement(message_list_1.MessageList, { state: state, outbox: outbox, rows: rows }))))))))),
190
- React.createElement("div", { className: "ta-bottom" },
191
- away &&
192
- (asking ? (React.createElement("button", { type: "button", className: "ta-to-bottom ta-to-ask", title: t('ta.chat.toAsk', { question: asking.question }), onClick: toBottom },
193
- React.createElement("span", { className: "ta-to-ask-mark", "aria-hidden": "true" }, "?"),
194
- React.createElement("span", null, t('ta.chat.asking')),
195
- React.createElement(lucide_react_1.ArrowDown, { size: 14 }))) : (React.createElement("button", { type: "button", className: "ta-to-bottom", "aria-label": t('ta.session.toBottom'), title: t('ta.session.toBottom'), onClick: toBottom },
196
- React.createElement(lucide_react_1.ArrowDown, { size: 18 })))),
197
- notice,
198
- React.createElement(grow_box_1.GrowBox, null,
199
- dialog && React.createElement(dialog_view_1.DialogView, { key: dialog.id, request: dialog, respond: response => store.respondUi(response).catch(fail) }),
200
- aboveComposer,
201
- widgetsAt('aboveEditor'),
202
- addons.above),
203
- React.createElement(composer_1.Composer, { ref: composer, store: store, server: server, workspace: workspace, working: state.working, commands: settings.commands, cwd: info === null || info === void 0 ? void 0 : info.cwd, actions: [actions, ...addons.actions], recentShots: recentShots, onStopTimed: stopTimed, onError: fail }),
204
- belowComposer,
205
- widgetsAt('belowEditor'),
206
- statuses.length > 0 && (React.createElement("div", { className: "ta-statusline" }, statuses.map(([key, text]) => (React.createElement(StatusChip, { key: key, text: text }))))))));
183
+ // Who else in the same Ta is here (TaSessionInfo.people): their faces on top, their typing over the box.
184
+ const people = useMessagePeople();
185
+ const presence = (0, react_1.useInject)(workbench_protocol_1.TaWorkbench).presence;
186
+ const onTyping = React.useCallback((typing) => presence.type(store.sessionId, typing), [presence, store]);
187
+ const viewing = people_1.PresenceUtil.viewing(info === null || info === void 0 ? void 0 : info.people);
188
+ return (React.createElement(people_1.MessagePeople.Provider, { value: people },
189
+ React.createElement("section", { className: `ta-session ${compact ? 'ta-session-compact' : ''}` },
190
+ !compact && (React.createElement("header", { className: "ta-session-header" },
191
+ leading,
192
+ React.createElement("div", { className: "ta-session-title" },
193
+ React.createElement("span", { className: "ta-title" }, title),
194
+ info && (React.createElement("span", { className: "ta-muted ta-path", title: info.cwd }, message_1.MessageUtil.shortPath(info.cwd)))),
195
+ React.createElement(people_1.PeopleFaces, { people: viewing, size: 24, label: t('ta.presence.viewing') }),
196
+ trailing)),
197
+ React.createElement("div", { className: "ta-scroll ta-conversation", ref: scroller },
198
+ React.createElement("div", { className: "ta-thread" },
199
+ state.start > 0 && (React.createElement("div", { className: `ta-earlier ${state.loadingEarlier ? '' : 'ta-earlier-idle'}`, role: "status", "aria-label": state.loadingEarlier ? t('ta.session.earlier') : undefined, ...conversation_scroll_1.SCROLL_SKIP },
200
+ React.createElement("span", { className: "ta-spinner" }))),
201
+ state.messages.length === 0 && (empty !== null && empty !== void 0 ? empty : React.createElement("div", { className: "ta-empty" }, t('ta.session.empty', { cwd: (_a = info === null || info === void 0 ? void 0 : info.cwd) !== null && _a !== void 0 ? _a : '.' }))),
202
+ React.createElement(message_list_1.ConversationSession.Provider, { value: info },
203
+ React.createElement(message_footer_1.MessageActions.Provider, { value: messageActions },
204
+ React.createElement(media_1.FileUrls.Provider, { value: fileUrl },
205
+ React.createElement(link_1.OpenLink.Provider, { value: openLink },
206
+ React.createElement(message_list_1.MessageImages.Provider, { value: images },
207
+ React.createElement(code_renderers_1.CodeReply.Provider, { value: reply },
208
+ React.createElement(message_list_1.MessageList, { state: state, outbox: outbox, rows: rows }))))))))),
209
+ React.createElement("div", { className: "ta-bottom" },
210
+ away &&
211
+ (asking ? (React.createElement("button", { type: "button", className: "ta-to-bottom ta-to-ask", title: t('ta.chat.toAsk', { question: asking.question }), onClick: toBottom },
212
+ React.createElement("span", { className: "ta-to-ask-mark", "aria-hidden": "true" }, "?"),
213
+ React.createElement("span", null, t('ta.chat.asking')),
214
+ React.createElement(lucide_react_1.ArrowDown, { size: 14 }))) : (React.createElement("button", { type: "button", className: "ta-to-bottom", "aria-label": t('ta.session.toBottom'), title: t('ta.session.toBottom'), onClick: toBottom },
215
+ React.createElement(lucide_react_1.ArrowDown, { size: 18 })))),
216
+ notice,
217
+ React.createElement(grow_box_1.GrowBox, null,
218
+ React.createElement(people_1.PresenceLine, { people: info === null || info === void 0 ? void 0 : info.people, working: state.working }),
219
+ dialog && React.createElement(dialog_view_1.DialogView, { key: dialog.id, request: dialog, respond: response => store.respondUi(response).catch(fail) }),
220
+ aboveComposer,
221
+ widgetsAt('aboveEditor'),
222
+ addons.above),
223
+ React.createElement(composer_1.Composer, { ref: composer, store: store, server: server, workspace: workspace, working: state.working, commands: settings.commands, cwd: info === null || info === void 0 ? void 0 : info.cwd, actions: [actions, ...addons.actions], recentShots: recentShots, onStopTimed: stopTimed, onTyping: onTyping, onError: fail }),
224
+ belowComposer,
225
+ widgetsAt('belowEditor'),
226
+ statuses.length > 0 && (React.createElement("div", { className: "ta-statusline" }, statuses.map(([key, text]) => (React.createElement(StatusChip, { key: key, text: text })))))))));
207
227
  }
208
228
  //# sourceMappingURL=session-view.js.map
@@ -59,8 +59,7 @@ exports.FONT_SIZES = [
59
59
  ];
60
60
  exports.LANGUAGES = [
61
61
  { value: 'system', icon: lucide_react_1.Globe, label: 'ta.settings.language.system' },
62
- { value: 'zh-CN', label: '简体中文' },
63
- { value: 'en-US', label: 'English' },
62
+ ...ta_protocol_1.TaLanguageUtil.ALL.map(value => ({ value, label: ta_protocol_1.TaLanguageUtil.NAMES[value] })),
64
63
  ];
65
64
  /** The model has the icon of the + menu's model (ModelPicker), the others their own. */
66
65
  exports.GROUP_ICONS = { model: lucide_react_1.Box, conversation: lucide_react_1.MessagesSquare, context: lucide_react_1.Layers, tools: lucide_react_1.Wrench };
@@ -1,4 +1,4 @@
1
- import type { LucideIcon } from 'lucide-react';
1
+ import { type LucideIcon } from 'lucide-react';
2
2
  import * as React from 'react';
3
3
  import type { MessageId } from '../i18n/messages';
4
4
  import { type Glyph } from './icon';
@@ -42,6 +42,12 @@ export interface RowProps {
42
42
  }
43
43
  /** Label and description on the left, the control on the right; stacked when the control is wide. */
44
44
  export declare function Row({ label, icon, description, stacked, modified, children }: RowProps): React.JSX.Element;
45
+ /** A choice of several as a row of its own, checked on its right: a phone's Segmented when the labels are too many to fit. */
46
+ export declare function ChoiceRow({ label, checked, onPick }: {
47
+ label: string;
48
+ checked: boolean;
49
+ onPick(): void;
50
+ }): React.JSX.Element;
45
51
  /** A list of the settings with nothing in it yet: a quiet line in the middle of the row. */
46
52
  export declare function EmptyRow({ title, hint, picture }: {
47
53
  title: string;
@@ -38,8 +38,10 @@ exports.Keys = Keys;
38
38
  exports.Segmented = Segmented;
39
39
  exports.Switch = Switch;
40
40
  exports.Row = Row;
41
+ exports.ChoiceRow = ChoiceRow;
41
42
  exports.EmptyRow = EmptyRow;
42
43
  exports.row = row;
44
+ const lucide_react_1 = require("lucide-react");
43
45
  const React = __importStar(require("react"));
44
46
  const use_t_1 = require("../i18n/use-t");
45
47
  const agent_settings_1 = require("../settings/agent-settings");
@@ -76,6 +78,13 @@ function Row({ label, icon, description, stacked, modified, children }) {
76
78
  description && React.createElement("span", { className: "ta-setting-description" }, description))),
77
79
  children && React.createElement("div", { className: "ta-setting-control" }, children)));
78
80
  }
81
+ /** A choice of several as a row of its own, checked on its right: a phone's Segmented when the labels are too many to fit. */
82
+ function ChoiceRow({ label, checked, onPick }) {
83
+ return (React.createElement("button", { type: "button", "aria-pressed": checked, className: "ta-setting-row ta-setting-choice", onClick: onPick },
84
+ React.createElement("span", { className: "ta-setting-text" },
85
+ React.createElement("span", { className: "ta-setting-label" }, label)),
86
+ checked && React.createElement(icon_1.Icon, { icon: lucide_react_1.Check, size: 18, className: "ta-setting-check" })));
87
+ }
79
88
  /** A list of the settings with nothing in it yet: a quiet line in the middle of the row. */
80
89
  function EmptyRow({ title, hint, picture }) {
81
90
  return (React.createElement("div", { className: "ta-setting-row" },
@@ -56,6 +56,7 @@ const model_picker_1 = require("./model-picker");
56
56
  const relay_services_1 = require("./relay-services");
57
57
  const remote_hosts_1 = require("./remote-hosts");
58
58
  const settings_controls_1 = require("./settings-controls");
59
+ const sign_in_setup_1 = require("./sign-in-setup");
59
60
  const trusted_domains_1 = require("./trusted-domains");
60
61
  const voice_picker_1 = require("./voice-picker");
61
62
  const settings_choices_1 = require("./settings-choices");
@@ -74,6 +75,7 @@ function useParts(scope, onScope, onClose, onDialog) {
74
75
  const agent = (0, agent_settings_view_1.useAgentSettings)(cwd !== null && cwd !== void 0 ? cwd : (_a = workbench.server) === null || _a === void 0 ? void 0 : _a.cwd);
75
76
  const [, notices] = (0, hooks_1.useNotices)();
76
77
  const access = (0, access_view_1.useAccess)();
78
+ const signInConfig = (0, sign_in_setup_1.useSignInConfig)();
77
79
  const gateway = (0, environment_view_1.useGateway)();
78
80
  // As the menu of the account (useAccountEntries): a finger has no keys to learn; a phone is not the computer
79
81
  // that pairs phones, and signs out at the foot of Me.
@@ -124,10 +126,16 @@ function useParts(scope, onScope, onClose, onDialog) {
124
126
  id: 'language',
125
127
  title: t('ta.settings.language'),
126
128
  icon: lucide_react_1.Languages,
127
- rows: [
128
- (0, settings_controls_1.row)('language', [t('ta.settings.displayLanguage'), 'language'], React.createElement(settings_controls_1.Row, { label: t('ta.settings.displayLanguage'), stacked: true },
129
- React.createElement(settings_controls_1.Segmented, { label: t('ta.settings.displayLanguage'), value: settings.language, choices: settings_choices_1.LANGUAGES, onChange: language => store.update({ language }) }))),
130
- ],
129
+ // A phone has no room for five names side by side: a row each, as its own settings have them.
130
+ rows: handheld
131
+ ? settings_choices_1.LANGUAGES.map(choice => {
132
+ const label = choice.label.startsWith('ta.') ? t(choice.label) : choice.label;
133
+ return (0, settings_controls_1.row)(`language:${choice.value}`, [t('ta.settings.displayLanguage'), 'language', label], React.createElement(settings_controls_1.ChoiceRow, { label: label, checked: settings.language === choice.value, onPick: () => store.update({ language: choice.value }) }));
134
+ })
135
+ : [
136
+ (0, settings_controls_1.row)('language', [t('ta.settings.displayLanguage'), 'language'], React.createElement(settings_controls_1.Row, { label: t('ta.settings.displayLanguage'), stacked: true },
137
+ React.createElement(settings_controls_1.Segmented, { label: t('ta.settings.displayLanguage'), value: settings.language, choices: settings_choices_1.LANGUAGES, onChange: language => store.update({ language }) }))),
138
+ ],
131
139
  },
132
140
  {
133
141
  id: 'navigation',
@@ -289,15 +297,24 @@ function useParts(scope, onScope, onClose, onDialog) {
289
297
  },
290
298
  ]
291
299
  : []),
292
- // Only where accounts can sign in, or could: a Ta of this computer has no need of it.
293
- ...(access.info && (access.info.providers.length > 0 || access.info.accounts.length > 0)
300
+ // The ways to sign in for the owner (those invited use them too); who may sign in only where accounts can, or could.
301
+ ...(signInConfig.config || (access.info && (access.info.providers.length > 0 || access.info.accounts.length > 0))
294
302
  ? [
295
303
  {
296
304
  id: 'access',
297
305
  title: t('ta.access.title'),
298
306
  icon: lucide_react_1.ShieldCheck,
299
307
  rows: [
300
- (0, settings_controls_1.row)('access', [t('ta.access.title'), t('ta.access.addHint'), 'github', 'google', 'wechat'], React.createElement(access_view_1.AccessSettings, { info: access.info, onChange: access.read })),
308
+ ...(signInConfig.config
309
+ ? [
310
+ (0, settings_controls_1.row)('sign-in', [t('ta.signInSetup.title'), t('ta.signInSetup.hint'), 'github', 'google', 'wechat', 'oidc', 'sso'], React.createElement(sign_in_setup_1.SignInSetupSettings, { config: signInConfig.config, onChange: () => Promise.all([signInConfig.read(), access.read()]) })),
311
+ ]
312
+ : []),
313
+ ...(access.info && (access.info.providers.length > 0 || access.info.accounts.length > 0)
314
+ ? [
315
+ (0, settings_controls_1.row)('access', [t('ta.access.title'), t('ta.access.addHint'), 'github', 'google', 'wechat'], React.createElement(access_view_1.AccessSettings, { info: access.info, onChange: access.read })),
316
+ ]
317
+ : []),
301
318
  ],
302
319
  },
303
320
  ]
@@ -0,0 +1,17 @@
1
+ import type { TaSignInConfig } from '@celljs/ta-protocol';
2
+ import * as React from 'react';
3
+ /** The ways to sign in as set up (TaAccessServer.getSignInConfig), for the owner alone: none for a member, nor behind a gateway. */
4
+ export declare function useSignInConfig(): {
5
+ config: TaSignInConfig | undefined;
6
+ read: () => Promise<void>;
7
+ };
8
+ /**
9
+ * Settings, Access: the ways to sign in (docs/design/ta-team.md 17), which those invited use to say who they are and, on
10
+ * a Ta with an address, accounts to sign in to it. Kept in sign-in.json of the agent directory; one the environment of
11
+ * ta serve sets is shown, not changed. The address to register with a provider comes first.
12
+ */
13
+ export declare function SignInSetupSettings({ config, onChange }: {
14
+ config: TaSignInConfig;
15
+ onChange(): Promise<unknown>;
16
+ }): React.JSX.Element;
17
+ //# sourceMappingURL=sign-in-setup.d.ts.map
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.useSignInConfig = useSignInConfig;
37
+ exports.SignInSetupSettings = SignInSetupSettings;
38
+ const lucide_react_1 = require("lucide-react");
39
+ const React = __importStar(require("react"));
40
+ const hooks_1 = require("../hooks");
41
+ const use_t_1 = require("../i18n/use-t");
42
+ const icon_1 = require("./icon");
43
+ const settings_controls_1 = require("./settings-controls");
44
+ const sign_in_marks_1 = require("./sign-in-marks");
45
+ /** The fields of each kind of provider, as TaSignInSetup.fields has them, and its secret's; the optional ones last. */
46
+ const FIELDS = {
47
+ github: { fields: [{ id: 'clientId' }, { id: 'url', optional: true }], secret: 'clientSecret' },
48
+ google: { fields: [{ id: 'clientId' }], secret: 'clientSecret' },
49
+ wechat: { fields: [{ id: 'appId' }], secret: 'appSecret' },
50
+ oidc: { fields: [{ id: 'issuer' }, { id: 'clientId' }, { id: 'name', optional: true }], secret: 'clientSecret' },
51
+ };
52
+ /** The ways to sign in as set up (TaAccessServer.getSignInConfig), for the owner alone: none for a member, nor behind a gateway. */
53
+ function useSignInConfig() {
54
+ const [workbench, bench] = (0, hooks_1.useWorkbench)();
55
+ const [config, setConfig] = React.useState();
56
+ const read = React.useCallback(() => bench.access.getSignInConfig().then(setConfig, () => {
57
+ setConfig(undefined);
58
+ }), [bench]);
59
+ React.useEffect(() => {
60
+ if (workbench.status === 'online') {
61
+ void read();
62
+ }
63
+ }, [workbench.status, read]);
64
+ return { config, read };
65
+ }
66
+ function providerName(setup, t) {
67
+ return setup.id === 'wechat' ? t('ta.signin.wechat') : setup.id === 'oidc' && setup.name === 'SSO' ? t('ta.signInSetup.oidc') : setup.name;
68
+ }
69
+ function SetupForm({ setup, onSave, onCancel }) {
70
+ var _a;
71
+ const t = (0, use_t_1.useT)();
72
+ const shape = FIELDS[setup.id];
73
+ const [values, setValues] = React.useState({ ...setup.fields });
74
+ const [busy, setBusy] = React.useState(false);
75
+ const set = (id, value) => setValues(current => ({ ...current, [id]: value }));
76
+ const missing = shape.fields.some(field => { var _a; return !field.optional && !((_a = values[field.id]) === null || _a === void 0 ? void 0 : _a.trim()); }) || (!setup.secret && !((_a = values[shape.secret]) === null || _a === void 0 ? void 0 : _a.trim()));
77
+ return (React.createElement("form", { className: "ta-sign-in-form", onSubmit: event => {
78
+ event.preventDefault();
79
+ setBusy(true);
80
+ void onSave(values).finally(() => setBusy(false));
81
+ } },
82
+ [...shape.fields, { id: shape.secret, secret: true }].map(field => { var _a; return (React.createElement("label", { key: field.id, className: "ta-sign-in-field" },
83
+ React.createElement("span", null, t(`ta.signInSetup.field.${field.id}`)),
84
+ React.createElement("input", { className: "ta-input", type: 'secret' in field ? 'password' : 'text', value: (_a = values[field.id]) !== null && _a !== void 0 ? _a : '', placeholder: 'secret' in field && setup.secret
85
+ ? t('ta.signInSetup.secretKept')
86
+ : 'optional' in field && field.optional
87
+ ? t('ta.signInSetup.optional')
88
+ : '', autoComplete: "off", spellCheck: false, autoCapitalize: "off", onChange: event => set(field.id, event.target.value) }))); }),
89
+ React.createElement("div", { className: "ta-sign-in-actions" },
90
+ React.createElement("button", { type: "button", className: "ta-button", disabled: busy, onClick: onCancel }, t('ta.cancel')),
91
+ React.createElement("button", { type: "submit", className: `ta-button ta-primary${busy ? ' ta-busy' : ''}`, disabled: busy || missing }, t('ta.signInSetup.save')))));
92
+ }
93
+ /**
94
+ * Settings, Access: the ways to sign in (docs/design/ta-team.md 17), which those invited use to say who they are and, on
95
+ * a Ta with an address, accounts to sign in to it. Kept in sign-in.json of the agent directory; one the environment of
96
+ * ta serve sets is shown, not changed. The address to register with a provider comes first.
97
+ */
98
+ function SignInSetupSettings({ config, onChange }) {
99
+ const t = (0, use_t_1.useT)();
100
+ const [, bench] = (0, hooks_1.useWorkbench)();
101
+ const [, notices] = (0, hooks_1.useNotices)();
102
+ const [editing, setEditing] = React.useState();
103
+ const save = async (id, fields) => {
104
+ try {
105
+ await bench.access.setSignInProvider(id, fields);
106
+ setEditing(undefined);
107
+ notices.notify(fields ? t('ta.signInSetup.saved') : t('ta.signInSetup.removed'), { level: 'success' });
108
+ }
109
+ catch (error) {
110
+ notices.error(error);
111
+ }
112
+ finally {
113
+ await onChange().catch(() => undefined);
114
+ }
115
+ };
116
+ const copy = (text) => { var _a; return void ((_a = navigator.clipboard) === null || _a === void 0 ? void 0 : _a.writeText(text).then(() => notices.notify(t('ta.signInSetup.copied'), { level: 'success' }))); };
117
+ const callbacks = [config.callbacks.join, config.callbacks.serve].filter((one) => !!one);
118
+ return (React.createElement(React.Fragment, null,
119
+ React.createElement(settings_controls_1.Row, { label: t('ta.signInSetup.title'), description: t('ta.signInSetup.hint'), stacked: true },
120
+ React.createElement("div", { className: "ta-sign-in-callbacks" },
121
+ React.createElement("span", { className: "ta-setting-description" }, t('ta.signInSetup.callback')),
122
+ callbacks.map(url => (React.createElement("div", { key: url, className: "ta-sign-in-callback" },
123
+ React.createElement("code", { className: "ta-ellipsis" }, url),
124
+ React.createElement(icon_1.IconButton, { icon: lucide_react_1.Copy, label: t('ta.signInSetup.copy'), onClick: () => copy(url) })))))),
125
+ config.providers.map(setup => {
126
+ var _a, _b;
127
+ const name = providerName(setup, t);
128
+ const status = setup.source === 'env'
129
+ ? t('ta.signInSetup.fromEnv')
130
+ : setup.configured
131
+ ? t('ta.signInSetup.on', { id: (_b = (_a = setup.fields.clientId) !== null && _a !== void 0 ? _a : setup.fields.appId) !== null && _b !== void 0 ? _b : '' })
132
+ : setup.source
133
+ ? t('ta.signInSetup.incomplete')
134
+ : setup.device
135
+ ? t('ta.signInSetup.device')
136
+ : t('ta.signInSetup.off');
137
+ return (React.createElement(settings_controls_1.Row, { key: setup.id, label: React.createElement("span", { className: "ta-sign-in-name" },
138
+ React.createElement(sign_in_marks_1.SignInMark, { provider: setup.id, size: 15 }),
139
+ " ",
140
+ name), description: status, stacked: editing === setup.id }, editing === setup.id ? (React.createElement(SetupForm, { setup: setup, onSave: fields => save(setup.id, fields), onCancel: () => setEditing(undefined) })) : setup.source === 'env' ? null : (React.createElement(React.Fragment, null,
141
+ setup.source === 'file' && (React.createElement(icon_1.IconButton, { icon: lucide_react_1.Trash2, label: t('ta.signInSetup.remove', { name }), onClick: () => void notices
142
+ .confirm({
143
+ title: t('ta.signInSetup.removeConfirm', { name }),
144
+ message: t('ta.signInSetup.removeDetail'),
145
+ confirmLabel: t('ta.access.remove'),
146
+ danger: true,
147
+ })
148
+ .then(yes => (yes ? save(setup.id, null) : undefined)) })),
149
+ React.createElement("button", { type: "button", className: "ta-button", onClick: () => setEditing(setup.id) },
150
+ React.createElement(icon_1.Icon, { icon: lucide_react_1.Pencil, size: 14 }),
151
+ " ",
152
+ setup.source ? t('ta.signInSetup.edit') : t('ta.signInSetup.add'))))));
153
+ })));
154
+ }
155
+ //# sourceMappingURL=sign-in-setup.js.map
@@ -1,5 +1,7 @@
1
1
  import type { TaSessionInfo } from '@celljs/ta-protocol';
2
2
  import { type ChatSeen } from './chat-seen';
3
+ /** Whether the user can see the page: what ends in a tab hidden or on a phone locked is not seen. */
4
+ export declare function usePageVisible(): boolean;
3
5
  /**
4
6
  * Which conversations the user has seen, as a messenger's unread: the one shown is seen each time it comes to
5
7
  * rest in front of them. The first time, everything of before is seen: once the computer said it keeps nothing
@@ -33,6 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.usePageVisible = usePageVisible;
36
37
  exports.useSeenChats = useSeenChats;
37
38
  const react_1 = require("@celljs/react");
38
39
  const React = __importStar(require("react"));
@@ -41,7 +42,7 @@ const state_protocol_1 = require("../state/state-protocol");
41
42
  const chat_list_1 = require("./chat-list");
42
43
  const chat_seen_1 = require("./chat-seen");
43
44
  /** Whether the user can see the page: what ends in a tab hidden or on a phone locked is not seen. */
44
- function useVisible() {
45
+ function usePageVisible() {
45
46
  const [visible, setVisible] = React.useState(() => typeof document === 'undefined' || document.visibilityState === 'visible');
46
47
  React.useEffect(() => {
47
48
  const change = () => setVisible(document.visibilityState === 'visible');
@@ -65,7 +66,7 @@ function useSeenChats(sessions, shown) {
65
66
  void state.load(chat_seen_1.SEEN_CHATS).then(kept => !kept.since && state.set(chat_seen_1.SEEN_CHATS, { since: Date.now(), at: kept.at }), () => undefined);
66
67
  }
67
68
  }, [state, online]);
68
- const visible = useVisible();
69
+ const visible = usePageVisible();
69
70
  const looked = visible && shown ? sessions.find(session => session.sessionId === shown) : undefined;
70
71
  const file = looked && chat_list_1.ChatListUtil.file(looked);
71
72
  const busy = !!(looked === null || looked === void 0 ? void 0 : looked.isStreaming);
@@ -132,10 +132,16 @@ var MonacoLoader;
132
132
  }
133
133
  MonacoLoader.load = load;
134
134
  async function start(language) {
135
+ // Sets the words Monaco reads as its modules load.
135
136
  if (language === 'zh-CN') {
136
- // Sets the words Monaco reads as its modules load.
137
137
  await import('monaco-editor/nls/lang/zh-cn.js');
138
138
  }
139
+ else if (language === 'zh-TW') {
140
+ await import('monaco-editor/nls/lang/zh-tw.js');
141
+ }
142
+ else if (language === 'ja-JP') {
143
+ await import('monaco-editor/nls/lang/ja.js');
144
+ }
139
145
  return (await import('./monaco.js')).monaco;
140
146
  }
141
147
  })(MonacoLoader || (exports.MonacoLoader = MonacoLoader = {}));
@@ -184,11 +184,23 @@ export interface WebFaceProps {
184
184
  working?: boolean;
185
185
  /** A dot at its corner: green online, grey not; none without. Its ring is `--ta-face-ring` (the page's colour). */
186
186
  online?: boolean;
187
+ /**
188
+ * The owner of this Ta: the close-up of its double, the dinosaur the user picked, which changes with it. Newer than
189
+ * some Ta apps, which draw `face` or `seed` instead.
190
+ */
191
+ double?: boolean;
192
+ /**
193
+ * Another Ta, as its double looks (`look` of TaRoomMember, TaFriend): the close-up of that dinosaur. One this page
194
+ * does not know, or a Ta app of before, draws `face` or `seed`.
195
+ */
196
+ look?: string;
187
197
  }
188
198
  export interface WebGroupFaceProps {
189
199
  members: readonly {
190
200
  face?: number;
191
201
  seed?: string;
202
+ look?: string;
203
+ double?: boolean;
192
204
  working?: boolean;
193
205
  }[];
194
206
  size: number;
@@ -144,9 +144,12 @@ export type WebInitiativeLevel = 'off' | 'digest' | 'ask' | 'act';
144
144
  export interface WebInitiativeKind {
145
145
  /** `<area>.<verb>`: `double.start-task`. */
146
146
  id: string;
147
+ /** Traditional Chinese (`tw`) falls back to `zh`, Japanese (`ja`) to `en`. */
147
148
  title: {
148
149
  en: string;
149
150
  zh: string;
151
+ tw?: string;
152
+ ja?: string;
150
153
  };
151
154
  /** What it does can be taken back: one that cannot never goes past `ask`. */
152
155
  reversible: boolean;
@@ -44,6 +44,13 @@ export interface WebExtensionAPI {
44
44
  * ta serve. `byUrl` says which way it is; the bytes come sealed, end to end, when it is not.
45
45
  */
46
46
  readonly files: TaFiles;
47
+ /**
48
+ * A URL the page can load for a file of the extension's own package, by its path there (`models/rex.glb`): a model
49
+ * of `ui.Game3D`, a picture, a sound. Where the page cannot load the files of ta serve by their URL (`files.byUrl`)
50
+ * it is a `blob:` of the bytes. Throws for a path outside the package, and in a web extension that comes with the
51
+ * page. Newer than some Ta apps: `pi.fileUrl?.(…)`.
52
+ */
53
+ fileUrl(path: string): Promise<string>;
47
54
  /** The other machines of `ssh://` directories (TaLocation): their ports, for a page served there. */
48
55
  readonly remote: TaRemoteServer;
49
56
  /** pi's settings of ta (`settings.json`): `getSettings(cwd)` also lists the models with credentials, for a model picker. */
@@ -427,8 +434,8 @@ export interface WebExtensionUI {
427
434
  }>;
428
435
  /**
429
436
  * The face of one who is not Ta, as the agents of channels have: a coloured shape with eyes that blink, one of 16,
430
- * by `face` or the same for the same `seed` (an id) on every device; `online` a dot at its corner. Newer than
431
- * some Ta apps: `pi.ui.Face ?? fallback`.
437
+ * by `face` or the same for the same `seed` (an id) on every device; `online` a dot at its corner; `double` the
438
+ * owner of this Ta, drawn as its double; `look` another Ta, as its double looks. Newer than some Ta apps: `pi.ui.Face ?? fallback`.
432
439
  */
433
440
  readonly Face: React.ComponentType<WebFaceProps>;
434
441
  /** A group, as a channel is drawn: the first of `members` in front, the next behind. Newer than some Ta apps. */
@@ -50,6 +50,8 @@ export declare class WebExtensionContext {
50
50
  static marked(server: TaServer, mark: (text: string) => string): TaServer;
51
51
  /** A renderer of code whose `send` (a choice tapped in it) says it came from the extension. */
52
52
  static replying(Renderer: React.ComponentType<WebCodeRendererProps>, mark: (text: string) => string): React.ComponentType<WebCodeRendererProps>;
53
+ /** A path of a file of a package, relative to it and inside it (`./models/rex.glb`, `models\rex.glb`: `models/rex.glb`). */
54
+ static packagePath(path: string): string;
53
55
  /** Monaco and the games in the theme and language of the settings, the same component for every extension. */
54
56
  protected readonly codeEditor: (props: CodeEditorProps) => React.FunctionComponentElement<CodeEditorProps & {
55
57
  settings: TaSettings;
@@ -137,6 +137,17 @@ class WebExtensionContext {
137
137
  return React.createElement(Renderer, { ...props, send: marked });
138
138
  };
139
139
  }
140
+ /** A path of a file of a package, relative to it and inside it (`./models/rex.glb`, `models\rex.glb`: `models/rex.glb`). */
141
+ static packagePath(path) {
142
+ const parts = path
143
+ .replace(/\\/g, '/')
144
+ .split('/')
145
+ .filter(part => part !== '' && part !== '.');
146
+ if (/^([a-z]:)?[\\/]/i.test(path) || parts.length === 0 || parts.includes('..')) {
147
+ throw new Error(`Not a file inside the package: ${path}`);
148
+ }
149
+ return parts.join('/');
150
+ }
140
151
  create(run) {
141
152
  const { host } = this;
142
153
  const { workbench, files } = host;
@@ -173,6 +184,14 @@ class WebExtensionContext {
173
184
  get files() {
174
185
  return files;
175
186
  },
187
+ fileUrl: path => live(async () => {
188
+ var _a;
189
+ const root = (_a = run.loaded.info) === null || _a === void 0 ? void 0 : _a.root;
190
+ if (!root) {
191
+ throw new Error(`The web extension ${run.loaded.name} has no files of its own here.`);
192
+ }
193
+ return files.loadable(await workbench.workspace.fileUrl(WebExtensionContext.packagePath(path), root));
194
+ }),
176
195
  get remote() {
177
196
  return workbench.remote;
178
197
  },