@celljs/ta-web 4.34.0 → 4.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/esm/browser/apps/app-icon.d.ts +23 -0
- package/esm/browser/apps/app-icon.js +98 -0
- package/esm/browser/apps/app-settings.d.ts +6 -0
- package/esm/browser/apps/app-settings.js +67 -0
- package/esm/browser/apps/app-window-util.d.ts +23 -0
- package/esm/browser/apps/app-window-util.js +27 -0
- package/esm/browser/apps/app-window.d.ts +9 -0
- package/esm/browser/apps/app-window.js +90 -0
- package/esm/browser/apps/web-apps.d.ts +29 -0
- package/esm/browser/apps/web-apps.js +57 -0
- package/esm/browser/assistant/call-keeper.d.ts +2 -5
- package/esm/browser/assistant/call-keeper.js +7 -11
- package/esm/browser/components/access-settings.d.ts +6 -0
- package/esm/browser/components/access-settings.js +52 -0
- package/esm/browser/components/app-root.d.ts +6 -0
- package/esm/browser/components/app-root.js +34 -0
- package/esm/browser/components/app-view.d.ts +8 -2
- package/esm/browser/components/app-view.js +1 -25
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/settings-more.js +6 -0
- package/esm/browser/device/screen-awake.d.ts +16 -0
- package/esm/browser/device/screen-awake.js +37 -0
- package/esm/browser/device/sheet-swipe.js +4 -0
- package/esm/browser/extension/icons.js +2 -1
- package/esm/browser/extension/web-access.d.ts +16 -0
- package/esm/browser/extension/web-access.js +75 -0
- package/esm/browser/extension/web-api-desktop.d.ts +23 -0
- package/esm/browser/extension/web-api-spec.d.ts +70 -0
- package/esm/browser/extension/web-api-spec.js +223 -0
- package/esm/browser/extension/web-extension-api.d.ts +6 -0
- package/esm/browser/extension/web-extension-context.js +11 -2
- package/esm/browser/extension/web-extension-run.d.ts +6 -1
- package/esm/browser/extension/web-extension-run.js +25 -0
- package/esm/browser/extension/web-extensions-running.d.ts +18 -1
- package/esm/browser/extension/web-extensions-running.js +102 -9
- package/esm/browser/extension/web-pages.d.ts +5 -0
- package/esm/browser/extension/web-pages.js +3 -0
- package/esm/browser/i18n/en/common.d.ts +1 -0
- package/esm/browser/i18n/en/common.js +1 -0
- package/esm/browser/i18n/en/discover.d.ts +11 -0
- package/esm/browser/i18n/en/discover.js +11 -0
- package/esm/browser/i18n/en/settings.d.ts +28 -0
- package/esm/browser/i18n/en/settings.js +28 -0
- package/esm/browser/i18n/ja/common.js +1 -0
- package/esm/browser/i18n/ja/discover.js +11 -0
- package/esm/browser/i18n/ja/settings.js +28 -0
- package/esm/browser/i18n/locales.d.ts +41 -3
- package/esm/browser/i18n/messages.d.ts +40 -2
- package/esm/browser/i18n/zh/common.js +1 -0
- package/esm/browser/i18n/zh/discover.js +11 -0
- package/esm/browser/i18n/zh/settings.js +28 -0
- package/esm/browser/i18n/zh-tw/common.js +1 -0
- package/esm/browser/i18n/zh-tw/discover.js +11 -0
- package/esm/browser/i18n/zh-tw/settings.js +28 -0
- package/esm/browser/index.d.ts +1 -0
- package/esm/browser/index.js +1 -0
- package/esm/browser/notices/notices.js +1 -0
- package/esm/browser/sandbox/channel/channel.d.ts +56 -0
- package/esm/browser/sandbox/channel/channel.js +124 -0
- package/esm/browser/sandbox/channel/codec.d.ts +80 -0
- package/esm/browser/sandbox/channel/codec.js +251 -0
- package/esm/browser/sandbox/hook-host.d.ts +23 -0
- package/esm/browser/sandbox/hook-host.js +61 -0
- package/esm/browser/sandbox/isolated-host.d.ts +105 -0
- package/esm/browser/sandbox/isolated-host.js +395 -0
- package/esm/browser/sandbox/remote/remote-copy.d.ts +56 -0
- package/esm/browser/sandbox/remote/remote-copy.js +302 -0
- package/esm/browser/sandbox/remote/remote-mirror.d.ts +61 -0
- package/esm/browser/sandbox/remote/remote-mirror.js +341 -0
- package/esm/browser/sandbox/remote/remote-protocol.d.ts +79 -0
- package/esm/browser/sandbox/remote/remote-protocol.js +54 -0
- package/esm/browser/sandbox/remote/remote-styles.d.ts +10 -0
- package/esm/browser/sandbox/remote/remote-styles.js +113 -0
- package/esm/browser/sandbox/remote-root.d.ts +11 -0
- package/esm/browser/sandbox/remote-root.js +81 -0
- package/esm/browser/sandbox/runtime/frame-api.d.ts +28 -0
- package/esm/browser/sandbox/runtime/frame-api.js +147 -0
- package/esm/browser/sandbox/runtime/frame-features.d.ts +6 -0
- package/esm/browser/sandbox/runtime/frame-features.js +50 -0
- package/esm/browser/sandbox/runtime/frame-parts.d.ts +36 -0
- package/esm/browser/sandbox/runtime/frame-parts.js +69 -0
- package/esm/browser/sandbox/runtime/frame-roots.d.ts +26 -0
- package/esm/browser/sandbox/runtime/frame-roots.js +76 -0
- package/esm/browser/sandbox/runtime/frame-store.d.ts +9 -0
- package/esm/browser/sandbox/runtime/frame-store.js +18 -0
- package/esm/browser/sandbox/runtime/sandbox-runtime.d.ts +11 -0
- package/esm/browser/sandbox/runtime/sandbox-runtime.js +45 -0
- package/esm/browser/sandbox/sandbox-features.d.ts +25 -0
- package/esm/browser/sandbox/sandbox-features.js +32 -0
- package/esm/browser/sandbox/sandbox-frame.d.ts +21 -0
- package/esm/browser/sandbox/sandbox-frame.js +75 -0
- package/esm/browser/sandbox/sandbox-guards.d.ts +19 -0
- package/esm/browser/sandbox/sandbox-guards.js +74 -0
- package/esm/browser/sandbox/sandbox-protocol.d.ts +57 -0
- package/esm/browser/sandbox/sandbox-protocol.js +49 -0
- package/esm/browser/sandbox/sandbox-runtime-code.d.ts +1 -0
- package/esm/browser/sandbox/sandbox-runtime-code.js +3 -0
- package/esm/browser/sandbox/web-sandbox.d.ts +28 -0
- package/esm/browser/sandbox/web-sandbox.js +44 -0
- package/esm/browser/settings/settings-protocol.d.ts +2 -0
- package/esm/browser/settings/settings-protocol.js +2 -0
- package/esm/browser/style/surfaces.d.ts +1 -1
- package/esm/browser/style/surfaces.js +5 -0
- package/esm/browser/style/tints.d.ts +2 -0
- package/esm/browser/style/tints.js +10 -0
- package/esm/browser/util/desktop.d.ts +31 -1
- package/esm/browser/util/desktop.js +20 -0
- package/esm/browser/view.js +1 -1
- package/lib/browser/apps/app-icon.d.ts +24 -0
- package/lib/browser/apps/app-icon.js +134 -0
- package/lib/browser/apps/app-settings.d.ts +7 -0
- package/lib/browser/apps/app-settings.js +103 -0
- package/lib/browser/apps/app-window-util.d.ts +24 -0
- package/lib/browser/apps/app-window-util.js +30 -0
- package/lib/browser/apps/app-window.d.ts +10 -0
- package/lib/browser/apps/app-window.js +126 -0
- package/lib/browser/apps/web-apps.d.ts +30 -0
- package/lib/browser/apps/web-apps.js +61 -0
- package/lib/browser/assistant/call-keeper.d.ts +2 -5
- package/lib/browser/assistant/call-keeper.js +6 -10
- package/lib/browser/components/access-settings.d.ts +7 -0
- package/lib/browser/components/access-settings.js +88 -0
- package/lib/browser/components/app-root.d.ts +7 -0
- package/lib/browser/components/app-root.js +70 -0
- package/lib/browser/components/app-view.d.ts +8 -2
- package/lib/browser/components/app-view.js +1 -25
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/settings-more.js +6 -0
- package/lib/browser/device/screen-awake.d.ts +16 -0
- package/lib/browser/device/screen-awake.js +39 -1
- package/lib/browser/device/sheet-swipe.js +4 -0
- package/lib/browser/extension/icons.js +1 -0
- package/lib/browser/extension/web-access.d.ts +17 -0
- package/lib/browser/extension/web-access.js +78 -0
- package/lib/browser/extension/web-api-desktop.d.ts +23 -0
- package/lib/browser/extension/web-api-spec.d.ts +71 -0
- package/lib/browser/extension/web-api-spec.js +226 -0
- package/lib/browser/extension/web-extension-api.d.ts +6 -0
- package/lib/browser/extension/web-extension-context.js +11 -2
- package/lib/browser/extension/web-extension-run.d.ts +6 -1
- package/lib/browser/extension/web-extension-run.js +25 -0
- package/lib/browser/extension/web-extensions-running.d.ts +18 -1
- package/lib/browser/extension/web-extensions-running.js +102 -9
- package/lib/browser/extension/web-pages.d.ts +5 -0
- package/lib/browser/extension/web-pages.js +3 -0
- package/lib/browser/i18n/en/common.d.ts +1 -0
- package/lib/browser/i18n/en/common.js +1 -0
- package/lib/browser/i18n/en/discover.d.ts +11 -0
- package/lib/browser/i18n/en/discover.js +11 -0
- package/lib/browser/i18n/en/settings.d.ts +28 -0
- package/lib/browser/i18n/en/settings.js +28 -0
- package/lib/browser/i18n/ja/common.js +1 -0
- package/lib/browser/i18n/ja/discover.js +11 -0
- package/lib/browser/i18n/ja/settings.js +28 -0
- package/lib/browser/i18n/locales.d.ts +41 -3
- package/lib/browser/i18n/messages.d.ts +40 -2
- package/lib/browser/i18n/zh/common.js +1 -0
- package/lib/browser/i18n/zh/discover.js +11 -0
- package/lib/browser/i18n/zh/settings.js +28 -0
- package/lib/browser/i18n/zh-tw/common.js +1 -0
- package/lib/browser/i18n/zh-tw/discover.js +11 -0
- package/lib/browser/i18n/zh-tw/settings.js +28 -0
- package/lib/browser/index.d.ts +1 -0
- package/lib/browser/index.js +1 -0
- package/lib/browser/notices/notices.js +1 -0
- package/lib/browser/sandbox/channel/channel.d.ts +57 -0
- package/lib/browser/sandbox/channel/channel.js +128 -0
- package/lib/browser/sandbox/channel/codec.d.ts +81 -0
- package/lib/browser/sandbox/channel/codec.js +256 -0
- package/lib/browser/sandbox/hook-host.d.ts +24 -0
- package/lib/browser/sandbox/hook-host.js +98 -0
- package/lib/browser/sandbox/isolated-host.d.ts +106 -0
- package/lib/browser/sandbox/isolated-host.js +432 -0
- package/lib/browser/sandbox/remote/remote-copy.d.ts +57 -0
- package/lib/browser/sandbox/remote/remote-copy.js +306 -0
- package/lib/browser/sandbox/remote/remote-mirror.d.ts +62 -0
- package/lib/browser/sandbox/remote/remote-mirror.js +345 -0
- package/lib/browser/sandbox/remote/remote-protocol.d.ts +80 -0
- package/lib/browser/sandbox/remote/remote-protocol.js +57 -0
- package/lib/browser/sandbox/remote/remote-styles.d.ts +11 -0
- package/lib/browser/sandbox/remote/remote-styles.js +116 -0
- package/lib/browser/sandbox/remote-root.d.ts +12 -0
- package/lib/browser/sandbox/remote-root.js +117 -0
- package/lib/browser/sandbox/runtime/frame-api.d.ts +29 -0
- package/lib/browser/sandbox/runtime/frame-api.js +183 -0
- package/lib/browser/sandbox/runtime/frame-features.d.ts +7 -0
- package/lib/browser/sandbox/runtime/frame-features.js +53 -0
- package/lib/browser/sandbox/runtime/frame-parts.d.ts +37 -0
- package/lib/browser/sandbox/runtime/frame-parts.js +106 -0
- package/lib/browser/sandbox/runtime/frame-roots.d.ts +27 -0
- package/lib/browser/sandbox/runtime/frame-roots.js +113 -0
- package/lib/browser/sandbox/runtime/frame-store.d.ts +10 -0
- package/lib/browser/sandbox/runtime/frame-store.js +22 -0
- package/lib/browser/sandbox/runtime/sandbox-runtime.d.ts +12 -0
- package/lib/browser/sandbox/runtime/sandbox-runtime.js +47 -0
- package/lib/browser/sandbox/sandbox-features.d.ts +26 -0
- package/lib/browser/sandbox/sandbox-features.js +35 -0
- package/lib/browser/sandbox/sandbox-frame.d.ts +22 -0
- package/lib/browser/sandbox/sandbox-frame.js +79 -0
- package/lib/browser/sandbox/sandbox-guards.d.ts +20 -0
- package/lib/browser/sandbox/sandbox-guards.js +77 -0
- package/lib/browser/sandbox/sandbox-protocol.d.ts +58 -0
- package/lib/browser/sandbox/sandbox-protocol.js +52 -0
- package/lib/browser/sandbox/sandbox-runtime-code.d.ts +2 -0
- package/lib/browser/sandbox/sandbox-runtime-code.js +6 -0
- package/lib/browser/sandbox/web-sandbox.d.ts +29 -0
- package/lib/browser/sandbox/web-sandbox.js +47 -0
- package/lib/browser/settings/settings-protocol.d.ts +2 -0
- package/lib/browser/settings/settings-protocol.js +2 -0
- package/lib/browser/style/surfaces.d.ts +1 -1
- package/lib/browser/style/surfaces.js +5 -0
- package/lib/browser/style/tints.d.ts +2 -0
- package/lib/browser/style/tints.js +10 -0
- package/lib/browser/util/desktop.d.ts +31 -1
- package/lib/browser/util/desktop.js +20 -0
- package/lib/browser/view.js +2 -2
- package/package.json +8 -8
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
const B = 'browser';
|
|
2
|
+
const A = 'app';
|
|
3
|
+
const page = { form: 'page', access: 'full' };
|
|
4
|
+
const local = (access) => ({ form: 'local', access });
|
|
5
|
+
const value = (access) => ({ form: 'value', access });
|
|
6
|
+
const read = (access) => ({ form: 'read', access });
|
|
7
|
+
const component = (access) => ({ form: 'component', access });
|
|
8
|
+
const call = (access, args) => ({ form: 'call', access, ...(args ? { args } : {}) });
|
|
9
|
+
const fire = (access, args) => ({ form: 'fire', access, ...(args ? { args } : {}) });
|
|
10
|
+
const hold = (access, args) => ({ form: 'hold', access, ...(args ? { args } : {}) });
|
|
11
|
+
const hook = (access, args) => ({ form: 'hook', access, ...(args ? { args } : {}) });
|
|
12
|
+
const peek = (access) => ({ form: 'hook', access, peek: true });
|
|
13
|
+
const group = (access, members) => ({ form: 'group', access, members });
|
|
14
|
+
/** A view, an editor tab: its components, its labels, and what the page reads of it without waiting. */
|
|
15
|
+
const VIEW = { fields: { title: 'L', render: 'C', head: 'C', mark: 'C', icon: 'C' }, live: ['menu', 'preview', 'busy'] };
|
|
16
|
+
const EDITOR = { fields: { title: 'L', tooltip: 'L', icon: 'C', render: 'C' } };
|
|
17
|
+
const SETTINGS = {
|
|
18
|
+
fields: {
|
|
19
|
+
title: 'L',
|
|
20
|
+
icon: 'C',
|
|
21
|
+
rows: { each: { fields: { label: 'L', search: 'L', description: 'L', render: 'C' } } },
|
|
22
|
+
signIn: { fields: { hint: 'L' } },
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
const STORAGE = {
|
|
26
|
+
get: call(B),
|
|
27
|
+
set: call(B),
|
|
28
|
+
onChange: hold(B),
|
|
29
|
+
directory: page,
|
|
30
|
+
};
|
|
31
|
+
const APPS = {
|
|
32
|
+
installable: value(A),
|
|
33
|
+
list: call(A),
|
|
34
|
+
install: call(A),
|
|
35
|
+
remove: call(A),
|
|
36
|
+
open: call(A),
|
|
37
|
+
};
|
|
38
|
+
const VOICE = {
|
|
39
|
+
canListen: read(A),
|
|
40
|
+
canSpeak: read(A),
|
|
41
|
+
speak: fire(A),
|
|
42
|
+
hush: fire(A),
|
|
43
|
+
transcribe: call(A),
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* What each member of `pi.ui` needs and how it crosses. `browser`: what any page draws and asks. `app`: what Ta does
|
|
47
|
+
* for the extension as an app, in sight of the user. `full`: the computer, the conversations, the people, the other
|
|
48
|
+
* extensions, and what only the page can give (a page object, an element, an engine).
|
|
49
|
+
*/
|
|
50
|
+
export const WEB_UI_SPEC = {
|
|
51
|
+
confirm: call(B),
|
|
52
|
+
input: call(B),
|
|
53
|
+
editor: call(B),
|
|
54
|
+
theme: value(B),
|
|
55
|
+
language: value(B),
|
|
56
|
+
supportsWebview: value(B),
|
|
57
|
+
doubleInChats: value(B),
|
|
58
|
+
useDevice: peek(B),
|
|
59
|
+
showView: call(B),
|
|
60
|
+
showChats: fire(B),
|
|
61
|
+
custom: hold(B, ['C']),
|
|
62
|
+
openEditor: fire(B, [EDITOR]),
|
|
63
|
+
closeEditor: fire(B),
|
|
64
|
+
pinEditor: fire(B),
|
|
65
|
+
setEditorDirty: fire(B),
|
|
66
|
+
EditorActions: component(B),
|
|
67
|
+
Avatar: component(B),
|
|
68
|
+
Face: component(B),
|
|
69
|
+
GroupFace: component(B),
|
|
70
|
+
icons: { form: 'components', access: B },
|
|
71
|
+
CodeEditor: component(B),
|
|
72
|
+
DiffEditor: component(B),
|
|
73
|
+
FullScreen: component(B),
|
|
74
|
+
Stack: component(B),
|
|
75
|
+
Markdown: component(B),
|
|
76
|
+
Empty: component(B),
|
|
77
|
+
Loading: component(B),
|
|
78
|
+
Skeleton: component(B),
|
|
79
|
+
useBusy: local(B),
|
|
80
|
+
useBackLayer: hook(B),
|
|
81
|
+
Switch: component(B),
|
|
82
|
+
HostTag: component(B),
|
|
83
|
+
SwipeRow: component(B),
|
|
84
|
+
SelectCheck: component(B),
|
|
85
|
+
SelectBar: component(B),
|
|
86
|
+
TaskIcon: component(B),
|
|
87
|
+
Picture: component(B),
|
|
88
|
+
PictureCards: component(B),
|
|
89
|
+
ImageViewer: component(B),
|
|
90
|
+
ChatImages: component(B),
|
|
91
|
+
QrCode: component(B),
|
|
92
|
+
Dialog: component(B),
|
|
93
|
+
setWidget: fire(A, [null, 'C', { fields: { title: 'L' } }]),
|
|
94
|
+
notify: fire(A),
|
|
95
|
+
notifySession: fire(A),
|
|
96
|
+
usePages: peek(A),
|
|
97
|
+
scanCode: call(A),
|
|
98
|
+
scan: call(A),
|
|
99
|
+
saveFile: call(A),
|
|
100
|
+
shareExtension: fire(A),
|
|
101
|
+
stopExtension: fire(A),
|
|
102
|
+
forgetPage: fire(A),
|
|
103
|
+
useView: hook(A),
|
|
104
|
+
useScreenPart: hook(A),
|
|
105
|
+
useHomeShown: peek(A),
|
|
106
|
+
useActiveEditor: peek(A),
|
|
107
|
+
HoldToTalk: component(A),
|
|
108
|
+
voice: group(A, VOICE),
|
|
109
|
+
keepAwake: hold(A),
|
|
110
|
+
apps: group(A, APPS),
|
|
111
|
+
// An element, a node to draw, an answer at once, an engine: only in the page.
|
|
112
|
+
useContextMenu: page,
|
|
113
|
+
attachMenu: page,
|
|
114
|
+
useChatScroll: page,
|
|
115
|
+
fileDrag: page,
|
|
116
|
+
addToComposer: page,
|
|
117
|
+
Game: page,
|
|
118
|
+
Game3D: page,
|
|
119
|
+
// The computer, the conversations, the people, the other extensions.
|
|
120
|
+
useRoomAddons: page,
|
|
121
|
+
fileMenu: page,
|
|
122
|
+
pinChat: page,
|
|
123
|
+
desktop: page,
|
|
124
|
+
debugWebview: page,
|
|
125
|
+
useCwd: page,
|
|
126
|
+
useSessionId: page,
|
|
127
|
+
useSessions: page,
|
|
128
|
+
useSavedSessions: page,
|
|
129
|
+
useAsks: page,
|
|
130
|
+
answer: page,
|
|
131
|
+
screen: page,
|
|
132
|
+
openShared: page,
|
|
133
|
+
connect: page,
|
|
134
|
+
useTasks: page,
|
|
135
|
+
removeTasks: page,
|
|
136
|
+
createTerminal: page,
|
|
137
|
+
Composer: page,
|
|
138
|
+
Conversation: page,
|
|
139
|
+
ShareSheet: page,
|
|
140
|
+
FolderPicker: page,
|
|
141
|
+
ModelPicker: page,
|
|
142
|
+
useHomeItems: page,
|
|
143
|
+
openHome: page,
|
|
144
|
+
startGroup: page,
|
|
145
|
+
openPartner: page,
|
|
146
|
+
};
|
|
147
|
+
/** What each member of `pi` needs and how it crosses: one entry each, the only place it is said (3.2). */
|
|
148
|
+
export const WEB_API_SPEC = {
|
|
149
|
+
React: local(B),
|
|
150
|
+
ui: group(B, WEB_UI_SPEC),
|
|
151
|
+
storage: group(B, STORAGE),
|
|
152
|
+
fileUrl: { form: 'call', access: B, returns: 'url' },
|
|
153
|
+
openLink: call(B),
|
|
154
|
+
registerView: fire(B, [null, VIEW]),
|
|
155
|
+
registerMessageRenderer: fire(B, [null, 'C']),
|
|
156
|
+
registerCodeRenderer: fire(A, [null, 'C', { fields: { spoken: 'X' } }]),
|
|
157
|
+
registerAvatar: fire(A, ['C']),
|
|
158
|
+
registerHomeItems: fire(A, [{ live: ['items'] }]),
|
|
159
|
+
registerTasks: fire(A, [{ live: ['tasks'] }]),
|
|
160
|
+
registerSettings: fire(A, [SETTINGS]),
|
|
161
|
+
reloadExtensions: call(A),
|
|
162
|
+
// Drawn or answered at once, frame by frame: only in the page.
|
|
163
|
+
registerCallPartner: page,
|
|
164
|
+
registerCallMouth: page,
|
|
165
|
+
registerCallMoves: page,
|
|
166
|
+
registerChatIcon: page,
|
|
167
|
+
registerChatTag: page,
|
|
168
|
+
registerInitiative: page,
|
|
169
|
+
registerTool: page,
|
|
170
|
+
registerToolRenderer: page,
|
|
171
|
+
registerComposerAddon: page,
|
|
172
|
+
registerRoomAddon: page,
|
|
173
|
+
registerOpener: page,
|
|
174
|
+
registerSearch: page,
|
|
175
|
+
registerPartners: page,
|
|
176
|
+
registerSessionMenu: page,
|
|
177
|
+
registerFileMenu: page,
|
|
178
|
+
on: page,
|
|
179
|
+
sendUserMessage: page,
|
|
180
|
+
switchSession: page,
|
|
181
|
+
openChat: page,
|
|
182
|
+
callHost: page,
|
|
183
|
+
openTemporary: page,
|
|
184
|
+
onRoomEvent: page,
|
|
185
|
+
onTerminalData: page,
|
|
186
|
+
server: page,
|
|
187
|
+
workspace: page,
|
|
188
|
+
terminals: page,
|
|
189
|
+
packages: page,
|
|
190
|
+
files: page,
|
|
191
|
+
remote: page,
|
|
192
|
+
screenShare: page,
|
|
193
|
+
onScreenShareEvent: page,
|
|
194
|
+
settings: page,
|
|
195
|
+
rooms: page,
|
|
196
|
+
};
|
|
197
|
+
/** A member of the API by its path (`ui.voice.speak`), and every member with its path. */
|
|
198
|
+
export var WebApiSpecUtil;
|
|
199
|
+
(function (WebApiSpecUtil) {
|
|
200
|
+
function find(path) {
|
|
201
|
+
let members = WEB_API_SPEC;
|
|
202
|
+
let found;
|
|
203
|
+
for (const key of path.split('.')) {
|
|
204
|
+
found = Object.keys(members).includes(key) ? members[key] : undefined;
|
|
205
|
+
if (!found) {
|
|
206
|
+
return undefined;
|
|
207
|
+
}
|
|
208
|
+
members = found.form === 'group' ? found.members : {};
|
|
209
|
+
}
|
|
210
|
+
return found;
|
|
211
|
+
}
|
|
212
|
+
WebApiSpecUtil.find = find;
|
|
213
|
+
function each(visit, members = WEB_API_SPEC, prefix = '') {
|
|
214
|
+
for (const [key, entry] of Object.entries(members)) {
|
|
215
|
+
visit(prefix + key, entry);
|
|
216
|
+
if (entry.form === 'group') {
|
|
217
|
+
each(visit, entry.members, `${prefix}${key}.`);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
WebApiSpecUtil.each = each;
|
|
222
|
+
})(WebApiSpecUtil || (WebApiSpecUtil = {}));
|
|
223
|
+
//# sourceMappingURL=web-api-spec.js.map
|
|
@@ -480,6 +480,12 @@ export interface WebExtensionUI extends WebHomeUI, WebPartnersUI, WebEditorsUI,
|
|
|
480
480
|
readonly HoldToTalk: React.ComponentType<WebHoldToTalkProps>;
|
|
481
481
|
/** Listening and reading aloud as the conversations of the page do: its recognizer, the voice of the settings. */
|
|
482
482
|
readonly voice: WebVoice;
|
|
483
|
+
/**
|
|
484
|
+
* Keeps the device awake till the function it returns is called, as a call does: the screen does not lock (locked,
|
|
485
|
+
* a phone stops hearing), and Ta Desktop keeps the display on and does not restart. For what listens long (a
|
|
486
|
+
* meeting written down); let it go when it stops. Newer than some Ta apps: `pi.ui.keepAwake?.()`.
|
|
487
|
+
*/
|
|
488
|
+
readonly keepAwake?: () => () => void;
|
|
483
489
|
/** As the conversations show it; `inline`: in a line; `send`, `answer`: a group chat's, for taps in cards (newer). */
|
|
484
490
|
readonly Markdown: React.ComponentType<{
|
|
485
491
|
text: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TaMessageSource, } from '@celljs/ta-protocol';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { TaWebApps } from '../apps/web-apps.js';
|
|
3
4
|
import { TaskIcon } from '../assistant/task-views.js';
|
|
4
5
|
import { webVoice } from '../assistant/web-voice.js';
|
|
5
6
|
import { useBusy } from '../components/busy.js';
|
|
@@ -37,6 +38,7 @@ import { useBackLayer } from '../device/back-stack.js';
|
|
|
37
38
|
import { CodeScan } from '../device/code-scan.js';
|
|
38
39
|
import { useDevice } from '../device/device.js';
|
|
39
40
|
import { FileSave } from '../device/file-save.js';
|
|
41
|
+
import { KeepAwake } from '../device/screen-awake.js';
|
|
40
42
|
import { DraftPlaces } from '../drafts/drafts-protocol.js';
|
|
41
43
|
import { Game3DView, GameView } from '../game/game-view.js';
|
|
42
44
|
import { message as messageOf } from '../i18n/messages.js';
|
|
@@ -46,6 +48,7 @@ import { DefaultWebTerminal } from '../terminal/web-terminal.js';
|
|
|
46
48
|
import { DesktopUtil } from '../util/desktop.js';
|
|
47
49
|
import { FileDragUtil } from '../util/file-drag.js';
|
|
48
50
|
import { WEB_ICONS } from './icons.js';
|
|
51
|
+
import { WebAccessUtil } from './web-access.js';
|
|
49
52
|
import { WebCwdUtil, WebLabelUtil } from './web-extension-protocol.js';
|
|
50
53
|
import { WebExtensionRunUtil } from './web-extension-run.js';
|
|
51
54
|
import { WebHomeUtil } from './web-home.js';
|
|
@@ -131,6 +134,7 @@ export class WebExtensionContext {
|
|
|
131
134
|
return props => this.composer({ ...props, draft: props.draft === undefined ? undefined : DraftPlaces.extension(name, props.draft) });
|
|
132
135
|
}
|
|
133
136
|
create(run) {
|
|
137
|
+
var _a;
|
|
134
138
|
const { host } = this;
|
|
135
139
|
const { workbench, files } = host;
|
|
136
140
|
const register = (change) => {
|
|
@@ -148,7 +152,7 @@ export class WebExtensionContext {
|
|
|
148
152
|
let server;
|
|
149
153
|
/** Listens while the extension runs, what it hears guarded as all it runs. */
|
|
150
154
|
const hear = (on, listener) => WebExtensionRunUtil.track(run, () => on((...args) => host.guard(run, () => listener(...args))));
|
|
151
|
-
|
|
155
|
+
const api = {
|
|
152
156
|
React,
|
|
153
157
|
get server() {
|
|
154
158
|
if ((server === null || server === void 0 ? void 0 : server.of) !== workbench.server) {
|
|
@@ -256,6 +260,8 @@ export class WebExtensionContext {
|
|
|
256
260
|
callHost: (method, ...params) => live(() => workbench.packages.callPackageHost(run.loaded.name, method, params)),
|
|
257
261
|
reloadExtensions: () => live(() => host.extensions.reloadPackages()),
|
|
258
262
|
};
|
|
263
|
+
// As far as the user allowed this version of its package (docs/design/ta-extension-access.md); only an allowed one starts.
|
|
264
|
+
return WebAccessUtil.limit(api, (_a = WebAccessUtil.granted(run.loaded.info)) !== null && _a !== void 0 ? _a : 'browser', run.loaded.name);
|
|
259
265
|
}
|
|
260
266
|
ui(run, register) {
|
|
261
267
|
const { host } = this;
|
|
@@ -417,7 +423,10 @@ export class WebExtensionContext {
|
|
|
417
423
|
GroupFace,
|
|
418
424
|
Composer: this.composerOf(run),
|
|
419
425
|
HoldToTalk: this.holdToTalk,
|
|
420
|
-
voice: this.voice,
|
|
426
|
+
voice: WebExtensionRunUtil.voice(run, this.voice),
|
|
427
|
+
// Let go as the extension stops, whether or not it did; nothing held once stopped.
|
|
428
|
+
keepAwake: () => WebExtensionRunUtil.track(run, () => KeepAwake.shared.hold()),
|
|
429
|
+
apps: TaWebApps.of({ pages: () => host.extensions.pages(), settings, notices, fallbackIcon: WEB_ICONS.Puzzle }),
|
|
421
430
|
Markdown,
|
|
422
431
|
Conversation: ConversationView,
|
|
423
432
|
useChatScroll: (sent, key) => useConversationScroll(sent, { sentTo: 'bottom', key }),
|
|
@@ -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, WebChatTagSource, 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, WebVoice, 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 {
|
|
@@ -60,6 +60,11 @@ export declare namespace WebExtensionRunUtil {
|
|
|
60
60
|
function clear(run: WebExtensionRun): void;
|
|
61
61
|
/** Subscribes for the extension: undone when it stops, or by the function returned. */
|
|
62
62
|
function track(run: WebExtensionRun, subscribe: () => () => void): () => void;
|
|
63
|
+
/**
|
|
64
|
+
* `ui.voice` of one extension: what it writes down ends as it stops, and once stopped it opens no microphone, as
|
|
65
|
+
* `ui.scanCode` opens no camera. Reading aloud stays: it does nothing for the user.
|
|
66
|
+
*/
|
|
67
|
+
function voice(run: WebExtensionRun, voice: WebVoice): WebVoice;
|
|
63
68
|
/** What the extensions that run registered, as the page shows it: the first of a message type or a tool name wins. */
|
|
64
69
|
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'>;
|
|
65
70
|
}
|
|
@@ -72,6 +72,31 @@ export var WebExtensionRunUtil;
|
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
WebExtensionRunUtil.track = track;
|
|
75
|
+
/**
|
|
76
|
+
* `ui.voice` of one extension: what it writes down ends as it stops, and once stopped it opens no microphone, as
|
|
77
|
+
* `ui.scanCode` opens no camera. Reading aloud stays: it does nothing for the user.
|
|
78
|
+
*/
|
|
79
|
+
function voice(run, voice) {
|
|
80
|
+
return {
|
|
81
|
+
...voice,
|
|
82
|
+
transcribe: async (listener) => {
|
|
83
|
+
const transcribing = run.stopped ? undefined : await voice.transcribe(listener);
|
|
84
|
+
if (!transcribing || run.stopped) {
|
|
85
|
+
transcribing === null || transcribing === void 0 ? void 0 : transcribing.stop();
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
let stopped = false;
|
|
89
|
+
const stop = () => {
|
|
90
|
+
if (!stopped) {
|
|
91
|
+
stopped = true;
|
|
92
|
+
transcribing.stop();
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
return { service: transcribing.service, stop: track(run, () => stop) };
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
WebExtensionRunUtil.voice = voice;
|
|
75
100
|
/** What the extensions that run registered, as the page shows it: the first of a message type or a tool name wins. */
|
|
76
101
|
function collect(runs, onOpen) {
|
|
77
102
|
var _a;
|
|
@@ -55,6 +55,9 @@ export declare abstract class WebExtensionsRunning {
|
|
|
55
55
|
protected placeholders?: WebViewEntry[];
|
|
56
56
|
protected started?: WebOnDemand;
|
|
57
57
|
protected readonly pageList: WebPageList;
|
|
58
|
+
/** Versions the user did not allow in this page (`<id>:<hash>`): not asked again until it loads again or they change. */
|
|
59
|
+
protected readonly refused: Set<string>;
|
|
60
|
+
protected readonly asking: Map<string, Promise<boolean>>;
|
|
58
61
|
get state(): WebExtensionsState;
|
|
59
62
|
protected init(): void;
|
|
60
63
|
/** The extensions started on open (ta-launcher.md). */
|
|
@@ -62,7 +65,7 @@ export declare abstract class WebExtensionsRunning {
|
|
|
62
65
|
/** The kinds the pages of the extensions there are list (TaWebExtensionInfo.lists), started or not. */
|
|
63
66
|
protected listedKinds(): Set<string>;
|
|
64
67
|
/** Loads and starts an extension started on open, as reconcile starts the others. */
|
|
65
|
-
protected launch(
|
|
68
|
+
protected launch(asked: TaWebExtensionInfo): Promise<void>;
|
|
66
69
|
/** Stops one started on open: it is still listed, to start again; its page, if shown, gives way to the conversation. */
|
|
67
70
|
protected stopOnDemand(id: string): void;
|
|
68
71
|
protected reconcile(): Promise<boolean>;
|
|
@@ -73,6 +76,14 @@ export declare abstract class WebExtensionsRunning {
|
|
|
73
76
|
* still the same and stops the others.
|
|
74
77
|
*/
|
|
75
78
|
protected startKept(host: string | undefined): Promise<boolean>;
|
|
79
|
+
/** Whether what runs is that of the list: the same code, allowed as much. */
|
|
80
|
+
protected same(run: WebExtensionRun | undefined, info: TaWebExtensionInfo): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* It as it may start: allowed already, or allowed by the user now (docs/design/ta-extension-access.md); undefined
|
|
83
|
+
* when they did not allow it. Asked once at a time, and not again in this page once refused.
|
|
84
|
+
*/
|
|
85
|
+
protected allow(info: TaWebExtensionInfo): Promise<TaWebExtensionInfo | undefined>;
|
|
86
|
+
protected askAccess(info: TaWebExtensionInfo): Promise<boolean>;
|
|
76
87
|
/** Stops and forgets the extensions running that `keep` does not keep; whether there were any. */
|
|
77
88
|
protected stopUnless(keep: (run: WebExtensionRun) => boolean): boolean;
|
|
78
89
|
protected loadPackage(info: TaWebExtensionInfo): Promise<{
|
|
@@ -81,6 +92,11 @@ export declare abstract class WebExtensionsRunning {
|
|
|
81
92
|
} | {
|
|
82
93
|
error: string;
|
|
83
94
|
}>;
|
|
95
|
+
/**
|
|
96
|
+
* What starts an extension: its module, imported into the page; or, for one the user allowed less than all, its code
|
|
97
|
+
* to run in a sandbox, never imported here (docs/design/ta-extension-access.md 3).
|
|
98
|
+
*/
|
|
99
|
+
protected factoryOf(info: TaWebExtensionInfo, code: string): Promise<WebExtensionFactory>;
|
|
84
100
|
protected startPackage(info: TaWebExtensionInfo, load: {
|
|
85
101
|
factory: WebExtensionFactory;
|
|
86
102
|
hash: string;
|
|
@@ -92,6 +108,7 @@ export declare abstract class WebExtensionsRunning {
|
|
|
92
108
|
protected guard(run: WebExtensionRun, action: () => void): void;
|
|
93
109
|
protected publish(): void;
|
|
94
110
|
protected update(change: Partial<WebExtensionsState>): void;
|
|
111
|
+
abstract refresh(): Promise<boolean>;
|
|
95
112
|
abstract openView(id: string, preserveFocus?: boolean): void;
|
|
96
113
|
abstract showView(id: string): Promise<boolean>;
|
|
97
114
|
protected abstract get context(): WebExtensionContext;
|
|
@@ -9,14 +9,18 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
};
|
|
10
10
|
import { Autowired, Optional, PostConstruct } from '@celljs/core';
|
|
11
11
|
import { TaFiles } from '../files/files-protocol.js';
|
|
12
|
+
import { message } from '../i18n/messages.js';
|
|
12
13
|
import { TaLinks } from '../links/links-protocol.js';
|
|
13
14
|
import { TaNotices } from '../notices/notices-protocol.js';
|
|
14
15
|
import { TaSessionNotices } from '../notices/session-notices.js';
|
|
15
16
|
import { deviceValues } from '../offline/device-values.js';
|
|
17
|
+
import { SandboxOptionsUtil } from '../sandbox/sandbox-protocol.js';
|
|
18
|
+
import { WebSandbox } from '../sandbox/web-sandbox.js';
|
|
16
19
|
import { TaScreen } from '../screen/screen-protocol.js';
|
|
17
20
|
import { TaSettings } from '../settings/settings-protocol.js';
|
|
18
21
|
import { TaState } from '../state/state-protocol.js';
|
|
19
22
|
import { TaWorkbench } from '../workbench-protocol.js';
|
|
23
|
+
import { WebAccessUtil } from './web-access.js';
|
|
20
24
|
import { WebEditorTabs } from './web-editor-tabs.js';
|
|
21
25
|
import { WebExtensionCode } from './web-extension-code.js';
|
|
22
26
|
import { BuiltinWebExtension, WebExtensionsStateUtil, } from './web-extension-protocol.js';
|
|
@@ -64,6 +68,9 @@ export class WebExtensionsRunning {
|
|
|
64
68
|
/** The extensions of the list of the last time have started (startKept), once. */
|
|
65
69
|
this.keptStarted = false;
|
|
66
70
|
this.pageList = new WebPageList();
|
|
71
|
+
/** Versions the user did not allow in this page (`<id>:<hash>`): not asked again until it loads again or they change. */
|
|
72
|
+
this.refused = new Set();
|
|
73
|
+
this.asking = new Map();
|
|
67
74
|
}
|
|
68
75
|
get state() {
|
|
69
76
|
return this.current;
|
|
@@ -94,13 +101,19 @@ export class WebExtensionsRunning {
|
|
|
94
101
|
return WebPagesUtil.listedKinds([...this.current.onOpen.map(entry => entry.info), ...[...this.running.values()].map(run => run.loaded.info)]);
|
|
95
102
|
}
|
|
96
103
|
/** Loads and starts an extension started on open, as reconcile starts the others. */
|
|
97
|
-
async launch(
|
|
98
|
-
var _a;
|
|
104
|
+
async launch(asked) {
|
|
105
|
+
var _a, _b;
|
|
106
|
+
const info = await this.allow(asked);
|
|
107
|
+
if (!info) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
99
110
|
const load = await this.loadPackage(info);
|
|
100
111
|
// Gone or changed meanwhile: the next refresh has it.
|
|
101
112
|
if (((_a = this.onDemand.get(info.id)) === null || _a === void 0 ? void 0 : _a.hash) === info.hash && !this.running.has(info.id)) {
|
|
102
113
|
this.startPackage(info, load);
|
|
103
114
|
this.publish();
|
|
115
|
+
// One in a sandbox registers its pages as it starts: they are there to show once it did.
|
|
116
|
+
await ('factory' in load ? (_b = load.factory.ready) === null || _b === void 0 ? void 0 : _b.catch(() => undefined) : undefined);
|
|
104
117
|
}
|
|
105
118
|
}
|
|
106
119
|
/** Stops one started on open: it is still listed, to start again; its page, if shown, gives way to the conversation. */
|
|
@@ -150,8 +163,13 @@ export class WebExtensionsRunning {
|
|
|
150
163
|
void this.code.keepOnly(infos.map(info => info.hash));
|
|
151
164
|
// Those started on open wait to be opened (ta-launcher.md).
|
|
152
165
|
this.onDemand.set(infos.filter(info => info.activation === 'open'));
|
|
153
|
-
// Fetched together, started in the order of the list: the order of their views stays the same.
|
|
154
|
-
|
|
166
|
+
// Fetched together, started in the order of the list: the order of their views stays the same. One the user
|
|
167
|
+
// has not allowed (docs/design/ta-extension-access.md) waits to be asked; allowed, the list has it next time.
|
|
168
|
+
const differ = infos.filter(info => !this.same(this.running.get(info.id), info) && info.activation !== 'open');
|
|
169
|
+
const starting = differ.filter(info => WebAccessUtil.granted(info) !== undefined);
|
|
170
|
+
for (const info of differ.filter(waiting => WebAccessUtil.granted(waiting) === undefined)) {
|
|
171
|
+
void this.allow(info).then(allowed => allowed && this.refresh());
|
|
172
|
+
}
|
|
155
173
|
const loads = await Promise.all(starting.map(info => this.loadPackage(info)));
|
|
156
174
|
// Stopped only now, just before the new code starts: the views of the old one stay drawn until the next
|
|
157
175
|
// publish, and stopped while the new code is read (after an update, over the relay) they would show
|
|
@@ -161,7 +179,7 @@ export class WebExtensionsRunning {
|
|
|
161
179
|
return true;
|
|
162
180
|
}
|
|
163
181
|
const info = fresh.get(run.loaded.id);
|
|
164
|
-
if (info &&
|
|
182
|
+
if (info && this.same(run, info)) {
|
|
165
183
|
// Started from the list of the last time: what else it says is of now.
|
|
166
184
|
run.loaded = { ...run.loaded, info };
|
|
167
185
|
return true;
|
|
@@ -190,10 +208,12 @@ export class WebExtensionsRunning {
|
|
|
190
208
|
return false;
|
|
191
209
|
}
|
|
192
210
|
this.keptStarted = true;
|
|
193
|
-
const infos = this.code
|
|
211
|
+
const infos = this.code
|
|
212
|
+
.list(host)
|
|
213
|
+
.filter(info => info.enabled !== false && info.activation !== 'open' && !this.running.has(info.id) && WebAccessUtil.granted(info) !== undefined);
|
|
194
214
|
const loads = await Promise.all(infos.map(async (info) => {
|
|
195
215
|
const code = await this.code.get(info.hash);
|
|
196
|
-
return code === undefined ? undefined :
|
|
216
|
+
return code === undefined ? undefined : this.factoryOf(info, code).catch(() => undefined);
|
|
197
217
|
}));
|
|
198
218
|
let started = false;
|
|
199
219
|
for (const [index, info] of infos.entries()) {
|
|
@@ -208,6 +228,55 @@ export class WebExtensionsRunning {
|
|
|
208
228
|
}
|
|
209
229
|
return started;
|
|
210
230
|
}
|
|
231
|
+
/** Whether what runs is that of the list: the same code, allowed as much. */
|
|
232
|
+
same(run, info) {
|
|
233
|
+
return !!run && run.hash === info.hash && WebAccessUtil.granted(run.loaded.info) === WebAccessUtil.granted(info);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* It as it may start: allowed already, or allowed by the user now (docs/design/ta-extension-access.md); undefined
|
|
237
|
+
* when they did not allow it. Asked once at a time, and not again in this page once refused.
|
|
238
|
+
*/
|
|
239
|
+
async allow(info) {
|
|
240
|
+
var _a;
|
|
241
|
+
if (WebAccessUtil.granted(info) !== undefined) {
|
|
242
|
+
return info;
|
|
243
|
+
}
|
|
244
|
+
const key = `${info.id}:${info.hash}`;
|
|
245
|
+
// Trusted only as far as a web page (3.6): not asked, its row in the list says why.
|
|
246
|
+
if (info.held || this.refused.has(key)) {
|
|
247
|
+
return undefined;
|
|
248
|
+
}
|
|
249
|
+
const asked = (_a = this.asking.get(key)) !== null && _a !== void 0 ? _a : this.askAccess(info).finally(() => this.asking.delete(key));
|
|
250
|
+
this.asking.set(key, asked);
|
|
251
|
+
return (await asked) ? { ...info, granted: info.access } : undefined;
|
|
252
|
+
}
|
|
253
|
+
async askAccess(info) {
|
|
254
|
+
var _a;
|
|
255
|
+
const language = this.settings.state.language;
|
|
256
|
+
const say = (id) => message(language, id);
|
|
257
|
+
const access = (_a = info.access) !== null && _a !== void 0 ? _a : 'full';
|
|
258
|
+
const yes = await this.notices.confirm({
|
|
259
|
+
title: say('ta.access.ask').replace('{name}', WebPagesUtil.title(info, language)),
|
|
260
|
+
message: [
|
|
261
|
+
say(info.regrant ? 'ta.access.updated' : 'ta.access.new'),
|
|
262
|
+
say(`ta.access.${access}`),
|
|
263
|
+
say('ta.access.from').replace('{source}', WebAccessUtil.source(info, say)),
|
|
264
|
+
].join('\n'),
|
|
265
|
+
confirmLabel: say('ta.access.allow'),
|
|
266
|
+
});
|
|
267
|
+
if (!yes) {
|
|
268
|
+
this.refused.add(`${info.id}:${info.hash}`);
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
try {
|
|
272
|
+
await this.workbench.packages.grantAccess(info.id, access);
|
|
273
|
+
return true;
|
|
274
|
+
}
|
|
275
|
+
catch (error) {
|
|
276
|
+
this.notices.notify(say('ta.access.failed'), { level: 'error', detail: error instanceof Error ? error.message : String(error) });
|
|
277
|
+
return false;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
211
280
|
/** Stops and forgets the extensions running that `keep` does not keep; whether there were any. */
|
|
212
281
|
stopUnless(keep) {
|
|
213
282
|
let stopped = false;
|
|
@@ -225,11 +294,11 @@ export class WebExtensionsRunning {
|
|
|
225
294
|
try {
|
|
226
295
|
const kept = await this.code.get(info.hash);
|
|
227
296
|
if (kept !== undefined) {
|
|
228
|
-
return { factory: await
|
|
297
|
+
return { factory: await this.factoryOf(info, kept), hash: info.hash };
|
|
229
298
|
}
|
|
230
299
|
const { code, hash } = await this.workbench.packages.readWebExtension(info.id);
|
|
231
300
|
void this.code.set(hash, code);
|
|
232
|
-
const factory = await
|
|
301
|
+
const factory = await this.factoryOf(info, code);
|
|
233
302
|
// Read from the computer: what the user waits for the first time (kept code is quick).
|
|
234
303
|
this.metrics.record(info.name, 'web:load', false, performance.now() - start);
|
|
235
304
|
return { factory, hash };
|
|
@@ -239,6 +308,20 @@ export class WebExtensionsRunning {
|
|
|
239
308
|
return { error: WebExtensionUtil.message(error) };
|
|
240
309
|
}
|
|
241
310
|
}
|
|
311
|
+
/**
|
|
312
|
+
* What starts an extension: its module, imported into the page; or, for one the user allowed less than all, its code
|
|
313
|
+
* to run in a sandbox, never imported here (docs/design/ta-extension-access.md 3).
|
|
314
|
+
*/
|
|
315
|
+
async factoryOf(info, code) {
|
|
316
|
+
const granted = WebAccessUtil.granted(info);
|
|
317
|
+
if (!WebSandbox.applies(info, granted)) {
|
|
318
|
+
return WebExtensionUtil.load(code);
|
|
319
|
+
}
|
|
320
|
+
return WebSandbox.factory(code, info, granted, {
|
|
321
|
+
options: this.persisted.get(SandboxOptionsUtil.SPEC),
|
|
322
|
+
changes: listener => this.settings.subscribe(() => listener()),
|
|
323
|
+
});
|
|
324
|
+
}
|
|
242
325
|
startPackage(info, load) {
|
|
243
326
|
const loaded = { id: info.id, name: info.name, info };
|
|
244
327
|
if ('error' in load) {
|
|
@@ -249,6 +332,7 @@ export class WebExtensionsRunning {
|
|
|
249
332
|
}
|
|
250
333
|
}
|
|
251
334
|
start(loaded, factory, hash) {
|
|
335
|
+
var _a;
|
|
252
336
|
const run = WebExtensionRunUtil.create(loaded, hash);
|
|
253
337
|
this.running.set(loaded.id, run);
|
|
254
338
|
try {
|
|
@@ -256,6 +340,15 @@ export class WebExtensionsRunning {
|
|
|
256
340
|
run.dispose = typeof dispose === 'function' ? dispose : undefined;
|
|
257
341
|
run.started = true;
|
|
258
342
|
this.metrics.record(loaded.id, 'web:start');
|
|
343
|
+
// One in a sandbox that could not start says why where it is listed, as one that threw (3.7).
|
|
344
|
+
(_a = factory.ready) === null || _a === void 0 ? void 0 : _a.catch(error => {
|
|
345
|
+
if (this.running.get(loaded.id) === run && !run.stopped) {
|
|
346
|
+
this.metrics.record(loaded.id, 'web:start', true);
|
|
347
|
+
this.stop(run);
|
|
348
|
+
run.loaded = { ...loaded, error: WebExtensionUtil.message(error) };
|
|
349
|
+
this.publish();
|
|
350
|
+
}
|
|
351
|
+
});
|
|
259
352
|
}
|
|
260
353
|
catch (error) {
|
|
261
354
|
this.metrics.record(loaded.id, 'web:start', true);
|
|
@@ -17,6 +17,11 @@ export interface WebPageInfo {
|
|
|
17
17
|
extension: string;
|
|
18
18
|
title: string;
|
|
19
19
|
icon?: WebIcon;
|
|
20
|
+
/**
|
|
21
|
+
* The colour of its tile, `--ta-tint-<tint>` and `--ta-tint-ink-<tint>` of the theme, the same for every page of its
|
|
22
|
+
* extension: the launcher's tile and the icon of its app (docs/design/ta-install-as-app.md). Newer than some Ta apps.
|
|
23
|
+
*/
|
|
24
|
+
tint?: number;
|
|
20
25
|
state: WebPageState;
|
|
21
26
|
/** Its extension starts when it opens (`pi.webActivation`, or temporary): it is never in the navigation. */
|
|
22
27
|
onOpen: boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TA_PAGES_USED, TaPackageTextUtil } from '@celljs/ta-protocol';
|
|
2
|
+
import { TintUtil } from '../style/tints.js';
|
|
2
3
|
import { WEB_ICONS } from './icons.js';
|
|
3
4
|
import { WebLabelUtil } from './web-extension-protocol.js';
|
|
4
5
|
export var WebPagesUtil;
|
|
@@ -68,6 +69,7 @@ export var WebPagesUtil;
|
|
|
68
69
|
extension: view.id.slice(0, view.id.lastIndexOf('/')),
|
|
69
70
|
title: WebLabelUtil.text(view.title),
|
|
70
71
|
icon: view.icon,
|
|
72
|
+
tint: TintUtil.of(view.id.slice(0, view.id.lastIndexOf('/'))),
|
|
71
73
|
state: view.id === shown ? 'shown' : 'running',
|
|
72
74
|
onOpen: false,
|
|
73
75
|
place: placeOf(view),
|
|
@@ -83,6 +85,7 @@ export var WebPagesUtil;
|
|
|
83
85
|
extension: info.name,
|
|
84
86
|
title: title(info, language, first ? WebLabelUtil.text(first.title) : undefined),
|
|
85
87
|
icon: (_a = (info.icon ? WEB_ICONS[info.icon] : undefined)) !== null && _a !== void 0 ? _a : first === null || first === void 0 ? void 0 : first.icon,
|
|
88
|
+
tint: TintUtil.of(info.name),
|
|
86
89
|
state: isShown ? 'shown' : background ? 'background' : running ? 'running' : 'stopped',
|
|
87
90
|
onOpen: true,
|
|
88
91
|
place: info.temporary ? 'launcher' : listed(info, kinds) ? 'list' : 'discover',
|
|
@@ -71,6 +71,7 @@ export declare const COMMON_EN: {
|
|
|
71
71
|
'ta.error.forbiddenHint': string;
|
|
72
72
|
'ta.error.forbiddenAsk': string;
|
|
73
73
|
'ta.error.limit': string;
|
|
74
|
+
'ta.error.deviceNotWaiting': string;
|
|
74
75
|
'ta.error.forbiddenNever': string;
|
|
75
76
|
'ta.notices': string;
|
|
76
77
|
'ta.notice.picture': string;
|
|
@@ -72,6 +72,7 @@ export const COMMON_EN = {
|
|
|
72
72
|
'ta.error.forbiddenHint': 'The owner of this Ta or an admin can let you',
|
|
73
73
|
'ta.error.forbiddenAsk': 'Ask',
|
|
74
74
|
'ta.error.limit': 'Too many people are working in this Ta at once; try again in a moment',
|
|
75
|
+
'ta.error.deviceNotWaiting': 'This device is not waiting to be let in: it may be in already, or removed',
|
|
75
76
|
'ta.error.forbiddenNever': 'This is kept out of reach of everyone let in',
|
|
76
77
|
'ta.notices': 'Notifications',
|
|
77
78
|
'ta.notice.picture': 'Picture of the extension, such as a QR code to scan',
|