@celljs/ta-web 4.46.2 → 4.47.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/esm/browser/account/account-side.d.ts +3 -3
- package/esm/browser/account/account-side.js +11 -21
- package/esm/browser/account/device-account.d.ts +8 -0
- package/esm/browser/account/device-account.js +20 -0
- package/esm/browser/chat/chat-protocol.d.ts +7 -0
- package/esm/browser/chat/chat-view.js +1 -1
- package/esm/browser/chat/chat.d.ts +1 -0
- package/esm/browser/chat/chat.js +15 -3
- package/esm/browser/chat/draft-model.d.ts +1 -1
- package/esm/browser/chat/draft-model.js +2 -2
- package/esm/browser/components/access-view.js +12 -10
- package/esm/browser/components/account-menu.d.ts +2 -0
- package/esm/browser/components/account-menu.js +11 -2
- package/esm/browser/components/account-view.js +9 -5
- package/esm/browser/components/app-nav.js +4 -1
- package/esm/browser/components/app-shell-state.d.ts +2 -0
- package/esm/browser/components/app-update-view.d.ts +2 -0
- package/esm/browser/components/app-update-view.js +37 -0
- package/esm/browser/components/app-view.js +33 -108
- package/esm/browser/components/auth-guide.d.ts +25 -0
- package/esm/browser/components/auth-guide.js +44 -0
- package/esm/browser/components/auth-view.d.ts +2 -0
- package/esm/browser/components/auth-view.js +30 -9
- package/esm/browser/components/chat-list-controls.d.ts +38 -0
- package/esm/browser/components/chat-list-controls.js +46 -0
- package/esm/browser/components/chat-list-hooks.d.ts +19 -0
- package/esm/browser/components/chat-list-hooks.js +52 -0
- package/esm/browser/components/chat-list-rows.d.ts +51 -0
- package/esm/browser/components/chat-list-rows.js +110 -0
- package/esm/browser/components/chat-list-sections.d.ts +36 -0
- package/esm/browser/components/chat-list-sections.js +72 -0
- package/esm/browser/components/chat-list.js +48 -221
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/cloud-sign-in-view.js +4 -1
- package/esm/browser/components/custom-provider-util.d.ts +2 -0
- package/esm/browser/components/custom-provider-util.js +5 -0
- package/esm/browser/components/custom-provider-view.js +33 -12
- package/esm/browser/components/device-sign-in-page.js +4 -5
- package/esm/browser/components/discover-view.d.ts +8 -1
- package/esm/browser/components/discover-view.js +28 -3
- package/esm/browser/components/environment-view.js +60 -62
- package/esm/browser/components/extension-settings.js +1 -0
- package/esm/browser/components/first-steps-util.d.ts +29 -0
- package/esm/browser/components/first-steps-util.js +41 -0
- package/esm/browser/components/first-steps.d.ts +3 -0
- package/esm/browser/components/first-steps.js +36 -0
- package/esm/browser/components/host-view.d.ts +3 -3
- package/esm/browser/components/host-view.js +11 -11
- package/esm/browser/components/me-rows.d.ts +8 -1
- package/esm/browser/components/me-rows.js +3 -3
- package/esm/browser/components/me-view.js +1 -1
- package/esm/browser/components/message-user.js +6 -3
- package/esm/browser/components/model-picker.d.ts +5 -0
- package/esm/browser/components/model-picker.js +10 -1
- package/esm/browser/components/nav-places.d.ts +14 -0
- package/esm/browser/components/nav-places.js +11 -0
- package/esm/browser/components/phone-shell.d.ts +14 -0
- package/esm/browser/components/phone-shell.js +22 -0
- package/esm/browser/components/picture-dialog.js +4 -7
- package/esm/browser/components/profile-view.js +1 -1
- package/esm/browser/components/relay-services.js +4 -7
- package/esm/browser/components/relay-view-util.d.ts +5 -0
- package/esm/browser/components/relay-view-util.js +14 -0
- package/esm/browser/components/relay-view.js +40 -37
- package/esm/browser/components/scan-screen.js +5 -8
- package/esm/browser/components/screen-navigator.d.ts +9 -0
- package/esm/browser/components/screen-navigator.js +84 -0
- package/esm/browser/components/search-page.js +9 -2
- package/esm/browser/components/serve-value.d.ts +27 -0
- package/esm/browser/components/serve-value.js +61 -0
- package/esm/browser/components/serve-watch.d.ts +23 -0
- package/esm/browser/components/serve-watch.js +36 -0
- package/esm/browser/components/settings-choices.js +2 -0
- package/esm/browser/components/settings-controls.d.ts +15 -0
- package/esm/browser/components/settings-controls.js +13 -0
- package/esm/browser/components/settings-more.js +6 -4
- package/esm/browser/components/settings-parts.d.ts +3 -1
- package/esm/browser/components/settings-parts.js +3 -0
- package/esm/browser/components/settings-view.js +37 -11
- package/esm/browser/components/share-friends.js +3 -4
- package/esm/browser/components/share-sheet.js +3 -4
- package/esm/browser/components/tool-view.js +17 -3
- package/esm/browser/device/app-update.d.ts +62 -0
- package/esm/browser/device/app-update.js +144 -0
- package/esm/browser/extension/icons.js +2 -1
- package/esm/browser/extension/web-api-contributions.d.ts +6 -1
- package/esm/browser/extension/web-api-partners.d.ts +6 -0
- package/esm/browser/extension/web-api-spec.js +1 -0
- package/esm/browser/extension/web-home.js +9 -0
- package/esm/browser/extension/web-metrics.d.ts +3 -0
- package/esm/browser/extension/web-metrics.js +33 -22
- package/esm/browser/extension/web-pages.d.ts +3 -1
- package/esm/browser/extension/web-pages.js +1 -0
- package/esm/browser/gateway/console-agents.js +11 -15
- package/esm/browser/gateway/console-parts.d.ts +7 -4
- package/esm/browser/gateway/console-parts.js +11 -20
- package/esm/browser/gateway/console-trend.js +2 -2
- package/esm/browser/gateway/console-updates.js +6 -4
- package/esm/browser/gateway/console-view.js +6 -6
- package/esm/browser/i18n/en/account.d.ts +7 -0
- package/esm/browser/i18n/en/account.js +13 -6
- package/esm/browser/i18n/en/chat.d.ts +2 -0
- package/esm/browser/i18n/en/chat.js +2 -0
- package/esm/browser/i18n/en/discover.d.ts +3 -0
- package/esm/browser/i18n/en/discover.js +3 -0
- package/esm/browser/i18n/en/service.d.ts +6 -0
- package/esm/browser/i18n/en/service.js +6 -0
- package/esm/browser/i18n/en/settings.d.ts +3 -0
- package/esm/browser/i18n/en/settings.js +3 -0
- package/esm/browser/i18n/ja/account.js +13 -6
- package/esm/browser/i18n/ja/chat.js +2 -0
- package/esm/browser/i18n/ja/discover.js +3 -0
- package/esm/browser/i18n/ja/service.js +6 -0
- package/esm/browser/i18n/ja/settings.js +3 -0
- package/esm/browser/i18n/locales.d.ts +22 -1
- package/esm/browser/i18n/messages.d.ts +21 -0
- package/esm/browser/i18n/zh/account.js +13 -6
- package/esm/browser/i18n/zh/chat.js +2 -0
- package/esm/browser/i18n/zh/discover.js +3 -0
- package/esm/browser/i18n/zh/service.js +6 -0
- package/esm/browser/i18n/zh/settings.js +3 -0
- package/esm/browser/i18n/zh-tw/account.js +13 -6
- package/esm/browser/i18n/zh-tw/chat.js +2 -0
- package/esm/browser/i18n/zh-tw/discover.js +3 -0
- package/esm/browser/i18n/zh-tw/service.js +6 -0
- package/esm/browser/i18n/zh-tw/settings.js +3 -0
- package/esm/browser/notices/notices.d.ts +2 -0
- package/esm/browser/notices/notices.js +2 -0
- package/esm/browser/partners/group-picker.js +3 -4
- package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/esm/browser/settings/settings-protocol.d.ts +5 -0
- package/esm/browser/settings/settings-protocol.js +2 -0
- package/esm/browser/style/chat-list.d.ts +1 -1
- package/esm/browser/style/chat-list.js +4 -3
- package/esm/browser/style/dialogs.d.ts +1 -1
- package/esm/browser/style/dialogs.js +7 -0
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +5 -3
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +1 -1
- package/esm/browser/util/tool.d.ts +5 -0
- package/esm/browser/util/tool.js +21 -3
- package/lib/browser/account/account-side.d.ts +3 -3
- package/lib/browser/account/account-side.js +11 -21
- package/lib/browser/account/device-account.d.ts +8 -0
- package/lib/browser/account/device-account.js +20 -0
- package/lib/browser/chat/chat-protocol.d.ts +7 -0
- package/lib/browser/chat/chat-view.js +1 -1
- package/lib/browser/chat/chat.d.ts +1 -0
- package/lib/browser/chat/chat.js +14 -2
- package/lib/browser/chat/draft-model.d.ts +1 -1
- package/lib/browser/chat/draft-model.js +2 -2
- package/lib/browser/components/access-view.js +12 -10
- package/lib/browser/components/account-menu.d.ts +2 -0
- package/lib/browser/components/account-menu.js +11 -2
- package/lib/browser/components/account-view.js +9 -5
- package/lib/browser/components/app-nav.js +3 -0
- package/lib/browser/components/app-shell-state.d.ts +2 -0
- package/lib/browser/components/app-update-view.d.ts +3 -0
- package/lib/browser/components/app-update-view.js +73 -0
- package/lib/browser/components/app-view.js +30 -105
- package/lib/browser/components/auth-guide.d.ts +26 -0
- package/lib/browser/components/auth-guide.js +47 -0
- package/lib/browser/components/auth-view.d.ts +2 -0
- package/lib/browser/components/auth-view.js +29 -8
- package/lib/browser/components/chat-list-controls.d.ts +39 -0
- package/lib/browser/components/chat-list-controls.js +86 -0
- package/lib/browser/components/chat-list-hooks.d.ts +19 -0
- package/lib/browser/components/chat-list-hooks.js +53 -0
- package/lib/browser/components/chat-list-rows.d.ts +52 -0
- package/lib/browser/components/chat-list-rows.js +147 -0
- package/lib/browser/components/chat-list-sections.d.ts +37 -0
- package/lib/browser/components/chat-list-sections.js +108 -0
- package/lib/browser/components/chat-list.js +44 -217
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/cloud-sign-in-view.js +4 -1
- package/lib/browser/components/custom-provider-util.d.ts +2 -0
- package/lib/browser/components/custom-provider-util.js +5 -0
- package/lib/browser/components/custom-provider-view.js +32 -11
- package/lib/browser/components/device-sign-in-page.js +4 -5
- package/lib/browser/components/discover-view.d.ts +8 -1
- package/lib/browser/components/discover-view.js +27 -2
- package/lib/browser/components/environment-view.js +60 -62
- package/lib/browser/components/extension-settings.js +1 -0
- package/lib/browser/components/first-steps-util.d.ts +30 -0
- package/lib/browser/components/first-steps-util.js +44 -0
- package/lib/browser/components/first-steps.d.ts +4 -0
- package/lib/browser/components/first-steps.js +72 -0
- package/lib/browser/components/host-view.d.ts +3 -3
- package/lib/browser/components/host-view.js +11 -11
- package/lib/browser/components/me-rows.d.ts +8 -1
- package/lib/browser/components/me-rows.js +3 -3
- package/lib/browser/components/me-view.js +1 -1
- package/lib/browser/components/message-user.js +5 -2
- package/lib/browser/components/model-picker.d.ts +5 -0
- package/lib/browser/components/model-picker.js +10 -1
- package/lib/browser/components/nav-places.d.ts +14 -0
- package/lib/browser/components/nav-places.js +13 -1
- package/lib/browser/components/phone-shell.d.ts +14 -0
- package/lib/browser/components/phone-shell.js +23 -0
- package/lib/browser/components/picture-dialog.js +4 -7
- package/lib/browser/components/profile-view.js +1 -1
- package/lib/browser/components/relay-services.js +4 -7
- package/lib/browser/components/relay-view-util.d.ts +6 -0
- package/lib/browser/components/relay-view-util.js +17 -0
- package/lib/browser/components/relay-view.js +38 -35
- package/lib/browser/components/scan-screen.js +5 -8
- package/lib/browser/components/screen-navigator.d.ts +9 -0
- package/lib/browser/components/screen-navigator.js +85 -0
- package/lib/browser/components/search-page.js +8 -1
- package/lib/browser/components/serve-value.d.ts +28 -0
- package/lib/browser/components/serve-value.js +97 -0
- package/lib/browser/components/serve-watch.d.ts +24 -0
- package/lib/browser/components/serve-watch.js +39 -0
- package/lib/browser/components/settings-choices.js +2 -0
- package/lib/browser/components/settings-controls.d.ts +15 -0
- package/lib/browser/components/settings-controls.js +13 -0
- package/lib/browser/components/settings-more.js +6 -4
- package/lib/browser/components/settings-parts.d.ts +3 -1
- package/lib/browser/components/settings-parts.js +3 -0
- package/lib/browser/components/settings-view.js +36 -10
- package/lib/browser/components/share-friends.js +3 -4
- package/lib/browser/components/share-sheet.js +3 -4
- package/lib/browser/components/tool-view.js +17 -3
- package/lib/browser/device/app-update.d.ts +63 -0
- package/lib/browser/device/app-update.js +182 -0
- package/lib/browser/extension/icons.js +1 -0
- package/lib/browser/extension/web-api-contributions.d.ts +6 -1
- package/lib/browser/extension/web-api-partners.d.ts +6 -0
- package/lib/browser/extension/web-api-spec.js +1 -0
- package/lib/browser/extension/web-home.js +9 -0
- package/lib/browser/extension/web-metrics.d.ts +3 -0
- package/lib/browser/extension/web-metrics.js +32 -21
- package/lib/browser/extension/web-pages.d.ts +3 -1
- package/lib/browser/extension/web-pages.js +1 -0
- package/lib/browser/gateway/console-agents.js +10 -14
- package/lib/browser/gateway/console-parts.d.ts +7 -4
- package/lib/browser/gateway/console-parts.js +12 -21
- package/lib/browser/gateway/console-trend.js +1 -1
- package/lib/browser/gateway/console-updates.js +5 -3
- package/lib/browser/gateway/console-view.js +5 -5
- package/lib/browser/i18n/en/account.d.ts +7 -0
- package/lib/browser/i18n/en/account.js +13 -6
- package/lib/browser/i18n/en/chat.d.ts +2 -0
- package/lib/browser/i18n/en/chat.js +2 -0
- package/lib/browser/i18n/en/discover.d.ts +3 -0
- package/lib/browser/i18n/en/discover.js +3 -0
- package/lib/browser/i18n/en/service.d.ts +6 -0
- package/lib/browser/i18n/en/service.js +6 -0
- package/lib/browser/i18n/en/settings.d.ts +3 -0
- package/lib/browser/i18n/en/settings.js +3 -0
- package/lib/browser/i18n/ja/account.js +13 -6
- package/lib/browser/i18n/ja/chat.js +2 -0
- package/lib/browser/i18n/ja/discover.js +3 -0
- package/lib/browser/i18n/ja/service.js +6 -0
- package/lib/browser/i18n/ja/settings.js +3 -0
- package/lib/browser/i18n/locales.d.ts +22 -1
- package/lib/browser/i18n/messages.d.ts +21 -0
- package/lib/browser/i18n/zh/account.js +13 -6
- package/lib/browser/i18n/zh/chat.js +2 -0
- package/lib/browser/i18n/zh/discover.js +3 -0
- package/lib/browser/i18n/zh/service.js +6 -0
- package/lib/browser/i18n/zh/settings.js +3 -0
- package/lib/browser/i18n/zh-tw/account.js +13 -6
- package/lib/browser/i18n/zh-tw/chat.js +2 -0
- package/lib/browser/i18n/zh-tw/discover.js +3 -0
- package/lib/browser/i18n/zh-tw/service.js +6 -0
- package/lib/browser/i18n/zh-tw/settings.js +3 -0
- package/lib/browser/notices/notices.d.ts +2 -0
- package/lib/browser/notices/notices.js +3 -1
- package/lib/browser/partners/group-picker.js +3 -4
- package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/lib/browser/settings/settings-protocol.d.ts +5 -0
- package/lib/browser/settings/settings-protocol.js +2 -0
- package/lib/browser/style/chat-list.d.ts +1 -1
- package/lib/browser/style/chat-list.js +4 -3
- package/lib/browser/style/dialogs.d.ts +1 -1
- package/lib/browser/style/dialogs.js +7 -0
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +5 -3
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +1 -1
- package/lib/browser/util/tool.d.ts +5 -0
- package/lib/browser/util/tool.js +21 -3
- package/package.json +7 -7
|
@@ -122,6 +122,10 @@ function Act({ act, results, runs }) {
|
|
|
122
122
|
return React.createElement(CodemodeView, { id: id, args: args, output: output, status: status, runs: runs, thoughts: thoughts || undefined });
|
|
123
123
|
}
|
|
124
124
|
const own = details(name, args, output, status);
|
|
125
|
+
const subagent = name === 'agent_tool' ? ToolUtil.agentSteps(id, output, runs) : [];
|
|
126
|
+
if (!act.nested.length && subagent.length) {
|
|
127
|
+
return (React.createElement(ToolRow, { name: name, args: args, status: status, count: subagent.length, details: stepsBody(subagent, own, thoughts), input: agentInput(output) }));
|
|
128
|
+
}
|
|
125
129
|
if (!act.nested.length) {
|
|
126
130
|
// The same call made more than once in a row: what each did, the earliest first.
|
|
127
131
|
const all = act.earlier.length
|
|
@@ -149,13 +153,16 @@ function Act({ act, results, runs }) {
|
|
|
149
153
|
});
|
|
150
154
|
const failed = steps.some(step => step.status === 'error');
|
|
151
155
|
const script = agentToolDetails(args, output, true);
|
|
152
|
-
|
|
156
|
+
// The steps of the subagents a call of the script ran count too, as the line said while they worked.
|
|
157
|
+
const count = steps.reduce((sum, step) => { var _a; return sum + Math.max(1, ToolUtil.agentSteps((_a = step.call.id) !== null && _a !== void 0 ? _a : '', step.output, runs).length); }, 0);
|
|
158
|
+
return (React.createElement(ToolRow, { name: name, args: args, status: status === 'done' && failed ? 'error' : status, count: count, details: React.createElement("div", { className: "ta-act-body" },
|
|
153
159
|
thoughts,
|
|
154
160
|
steps.map(step => {
|
|
155
|
-
var _a, _b, _c;
|
|
161
|
+
var _a, _b, _c, _d;
|
|
156
162
|
const nestedArgs = (_a = step.call.arguments) !== null && _a !== void 0 ? _a : {};
|
|
157
163
|
const shown = details((_b = step.call.name) !== null && _b !== void 0 ? _b : '', nestedArgs, step.output, step.status);
|
|
158
|
-
|
|
164
|
+
const stepSubagent = ToolUtil.agentSteps((_c = step.call.id) !== null && _c !== void 0 ? _c : '', step.output, runs);
|
|
165
|
+
return (React.createElement(ToolRow, { key: step.call.id, name: (_d = step.call.name) !== null && _d !== void 0 ? _d : '', args: nestedArgs, status: step.status, count: stepSubagent.length, details: stepSubagent.length ? stepsBody(stepSubagent, shown) : shown || undefined, input: agentInput(step.output) }));
|
|
159
166
|
}),
|
|
160
167
|
script && React.createElement(ScriptLine, { script: script })) }));
|
|
161
168
|
}
|
|
@@ -178,6 +185,13 @@ function CodemodeView({ id, args, output, status, runs, thoughts }) {
|
|
|
178
185
|
calls.map(call => (React.createElement(ToolRow, { key: call.key, ...nestedRow(call) }))),
|
|
179
186
|
React.createElement(ScriptLine, { script: script })) }));
|
|
180
187
|
}
|
|
188
|
+
/** A call of another agent that ran subagents: its line opens to the calls they made, then to what it returned. */
|
|
189
|
+
function stepsBody(steps, own, thoughts) {
|
|
190
|
+
return (React.createElement("div", { className: "ta-act-body" },
|
|
191
|
+
thoughts,
|
|
192
|
+
steps.map(step => (React.createElement(ToolRow, { key: step.key, ...nestedRow(step) }))),
|
|
193
|
+
own));
|
|
194
|
+
}
|
|
181
195
|
/** The script itself and what it returned, behind one quiet line at the end of its calls. */
|
|
182
196
|
function ScriptLine({ script }) {
|
|
183
197
|
const t = useT();
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a build of the phone app says of where its new versions are: `ta-app.json` beside its page. The iPhone app
|
|
3
|
+
* signed for the company has it, written in as it is signed (apps/ta-mobile/scripts/package.ts), and installs its new
|
|
4
|
+
* versions from the internal download page with a tap; the other builds (signed by whoever installs them, Android, a
|
|
5
|
+
* browser) have none, and are told of nothing.
|
|
6
|
+
*/
|
|
7
|
+
export interface AppUpdateSource {
|
|
8
|
+
/** The manifest of the download page, latest.json: version, build and the files of each system. */
|
|
9
|
+
updates: string;
|
|
10
|
+
/** This build's system as the manifest names it: `ios-arm64`. */
|
|
11
|
+
target: string;
|
|
12
|
+
version: string;
|
|
13
|
+
build: number;
|
|
14
|
+
}
|
|
15
|
+
/** A newer build of the app: its version, and the link that installs it. */
|
|
16
|
+
export interface AppUpdateOffer {
|
|
17
|
+
version: string;
|
|
18
|
+
build: number;
|
|
19
|
+
link: string;
|
|
20
|
+
}
|
|
21
|
+
/** What the updates read of the app; tests give their own. */
|
|
22
|
+
export interface AppUpdateEnvironment {
|
|
23
|
+
/** ta-app.json of the app, parsed; undefined where there is none. */
|
|
24
|
+
own(): Promise<unknown>;
|
|
25
|
+
/** The manifest at the address, parsed; throws when it cannot be read (offline, outside the company's network). */
|
|
26
|
+
get(url: string): Promise<unknown>;
|
|
27
|
+
/** Calls the listener each time the app comes back to the front. */
|
|
28
|
+
onForeground(listener: () => void): void;
|
|
29
|
+
/** Opens the link: the system asks the user to install. */
|
|
30
|
+
open(link: string): void;
|
|
31
|
+
}
|
|
32
|
+
export declare namespace AppUpdateUtil {
|
|
33
|
+
const FILE = "ta-app.json";
|
|
34
|
+
function source(value: unknown): AppUpdateSource | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* The build of the manifest when it is newer than the app's, with the link that installs it: the itms-services link
|
|
37
|
+
* the manifest gives (iOS), else the address of its file; either only of the site of the manifest.
|
|
38
|
+
*/
|
|
39
|
+
function offer(source: AppUpdateSource, manifest: unknown): AppUpdateOffer | undefined;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Newer versions of the phone app that does not update itself (the iPhone app signed for the company): read from the
|
|
43
|
+
* manifest of its download page as the app starts and each time it comes back to the front, and installed with a tap
|
|
44
|
+
* (the system asks, then puts the new version in its place, nothing lost). Nothing where the app does not say where its
|
|
45
|
+
* new versions are (AppUpdateSource); one not read (offline, outside the company's network) leaves what was known.
|
|
46
|
+
*/
|
|
47
|
+
export declare class AppUpdates {
|
|
48
|
+
protected readonly environment: () => AppUpdateEnvironment | undefined;
|
|
49
|
+
protected current?: AppUpdateOffer;
|
|
50
|
+
protected started: boolean;
|
|
51
|
+
protected source?: Promise<AppUpdateSource | undefined>;
|
|
52
|
+
protected readonly listeners: Set<() => void>;
|
|
53
|
+
constructor(environment?: () => AppUpdateEnvironment | undefined);
|
|
54
|
+
get offer(): AppUpdateOffer | undefined;
|
|
55
|
+
subscribe(listener: () => void): () => void;
|
|
56
|
+
start(): void;
|
|
57
|
+
install(): void;
|
|
58
|
+
protected check(env: AppUpdateEnvironment): Promise<void>;
|
|
59
|
+
}
|
|
60
|
+
export declare const AppUpdate: AppUpdates;
|
|
61
|
+
/** The newer version of the phone app to install, while there is one. */
|
|
62
|
+
export declare function useAppUpdate(): AppUpdateOffer | undefined;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { nativePlugin } from './device.js';
|
|
3
|
+
export var AppUpdateUtil;
|
|
4
|
+
(function (AppUpdateUtil) {
|
|
5
|
+
AppUpdateUtil.FILE = 'ta-app.json';
|
|
6
|
+
function source(value) {
|
|
7
|
+
const one = value;
|
|
8
|
+
if (!one || typeof one !== 'object' || typeof one.updates !== 'string' || !one.updates.startsWith('https://')) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
if (typeof one.target !== 'string' || typeof one.version !== 'string' || !Number.isFinite(one.build)) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
return { updates: one.updates, target: one.target, version: one.version, build: Number(one.build) };
|
|
15
|
+
}
|
|
16
|
+
AppUpdateUtil.source = source;
|
|
17
|
+
/**
|
|
18
|
+
* The build of the manifest when it is newer than the app's, with the link that installs it: the itms-services link
|
|
19
|
+
* the manifest gives (iOS), else the address of its file; either only of the site of the manifest.
|
|
20
|
+
*/
|
|
21
|
+
function offer(source, manifest) {
|
|
22
|
+
var _a;
|
|
23
|
+
const one = manifest;
|
|
24
|
+
const file = (_a = one === null || one === void 0 ? void 0 : one.files) === null || _a === void 0 ? void 0 : _a[source.target];
|
|
25
|
+
if (typeof (one === null || one === void 0 ? void 0 : one.version) !== 'string' || typeof one.build !== 'number' || !(one.build > source.build) || !file) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
const link = linkOf(source.updates, file);
|
|
29
|
+
return link ? { version: one.version, build: one.build, link } : undefined;
|
|
30
|
+
}
|
|
31
|
+
AppUpdateUtil.offer = offer;
|
|
32
|
+
function linkOf(updates, file) {
|
|
33
|
+
var _a;
|
|
34
|
+
const site = new URL(updates).origin;
|
|
35
|
+
if (typeof file.install === 'string') {
|
|
36
|
+
const install = parse(file.install);
|
|
37
|
+
const manifest = (install === null || install === void 0 ? void 0 : install.protocol) === 'itms-services:' ? parse((_a = install.searchParams.get('url')) !== null && _a !== void 0 ? _a : '') : undefined;
|
|
38
|
+
return (manifest === null || manifest === void 0 ? void 0 : manifest.origin) === site ? file.install : undefined;
|
|
39
|
+
}
|
|
40
|
+
const at = typeof file.path === 'string' ? parse(file.path, updates) : undefined;
|
|
41
|
+
return (at === null || at === void 0 ? void 0 : at.origin) === site ? at.href : undefined;
|
|
42
|
+
}
|
|
43
|
+
function parse(url, base) {
|
|
44
|
+
try {
|
|
45
|
+
return new URL(url, base);
|
|
46
|
+
}
|
|
47
|
+
catch (_a) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
})(AppUpdateUtil || (AppUpdateUtil = {}));
|
|
52
|
+
/**
|
|
53
|
+
* Newer versions of the phone app that does not update itself (the iPhone app signed for the company): read from the
|
|
54
|
+
* manifest of its download page as the app starts and each time it comes back to the front, and installed with a tap
|
|
55
|
+
* (the system asks, then puts the new version in its place, nothing lost). Nothing where the app does not say where its
|
|
56
|
+
* new versions are (AppUpdateSource); one not read (offline, outside the company's network) leaves what was known.
|
|
57
|
+
*/
|
|
58
|
+
export class AppUpdates {
|
|
59
|
+
constructor(environment = browser) {
|
|
60
|
+
this.environment = environment;
|
|
61
|
+
this.started = false;
|
|
62
|
+
this.listeners = new Set();
|
|
63
|
+
}
|
|
64
|
+
get offer() {
|
|
65
|
+
this.start();
|
|
66
|
+
return this.current;
|
|
67
|
+
}
|
|
68
|
+
subscribe(listener) {
|
|
69
|
+
this.listeners.add(listener);
|
|
70
|
+
return () => this.listeners.delete(listener);
|
|
71
|
+
}
|
|
72
|
+
start() {
|
|
73
|
+
if (this.started) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
this.started = true;
|
|
77
|
+
const env = this.environment();
|
|
78
|
+
if (!env) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
void this.check(env);
|
|
82
|
+
env.onForeground(() => void this.check(env));
|
|
83
|
+
}
|
|
84
|
+
install() {
|
|
85
|
+
var _a;
|
|
86
|
+
if (this.current) {
|
|
87
|
+
(_a = this.environment()) === null || _a === void 0 ? void 0 : _a.open(this.current.link);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
async check(env) {
|
|
91
|
+
var _a;
|
|
92
|
+
var _b;
|
|
93
|
+
(_b = this.source) !== null && _b !== void 0 ? _b : (this.source = env.own().then(AppUpdateUtil.source, () => undefined));
|
|
94
|
+
const source = await this.source;
|
|
95
|
+
if (!source) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const manifest = await env.get(source.updates).catch(() => undefined);
|
|
99
|
+
if (manifest === undefined) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const offer = AppUpdateUtil.offer(source, manifest);
|
|
103
|
+
if ((offer === null || offer === void 0 ? void 0 : offer.build) !== ((_a = this.current) === null || _a === void 0 ? void 0 : _a.build)) {
|
|
104
|
+
this.current = offer;
|
|
105
|
+
for (const listener of this.listeners) {
|
|
106
|
+
listener();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/** The Ta app (Capacitor): its own file read from its page, the manifest by its HTTP plugin (no CORS there); none in a browser. */
|
|
112
|
+
function browser() {
|
|
113
|
+
const http = typeof window === 'undefined' ? undefined : nativePlugin('CapacitorHttp');
|
|
114
|
+
if (!http) {
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
own: async () => {
|
|
119
|
+
const response = await fetch(new URL(AppUpdateUtil.FILE, document.baseURI), { cache: 'no-store' });
|
|
120
|
+
return response.ok ? response.json() : undefined;
|
|
121
|
+
},
|
|
122
|
+
get: async (url) => {
|
|
123
|
+
const response = (await http('get', { url, responseType: 'json', headers: { 'Cache-Control': 'no-cache' } }));
|
|
124
|
+
if (!response || !(Number(response.status) < 400)) {
|
|
125
|
+
throw new Error(`${url}: ${response === null || response === void 0 ? void 0 : response.status}`);
|
|
126
|
+
}
|
|
127
|
+
return typeof response.data === 'string' ? JSON.parse(response.data) : response.data;
|
|
128
|
+
},
|
|
129
|
+
onForeground: listener => document.addEventListener('visibilitychange', () => {
|
|
130
|
+
if (document.visibilityState === 'visible') {
|
|
131
|
+
listener();
|
|
132
|
+
}
|
|
133
|
+
}),
|
|
134
|
+
open: link => {
|
|
135
|
+
window.location.href = link;
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
export const AppUpdate = new AppUpdates();
|
|
140
|
+
/** The newer version of the phone app to install, while there is one. */
|
|
141
|
+
export function useAppUpdate() {
|
|
142
|
+
return React.useSyncExternalStore(listener => AppUpdate.subscribe(listener), () => AppUpdate.offer, () => undefined);
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=app-update.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AlarmClock, AlignCenter, AlignLeft, AlignRight, Aperture, AppWindow, Archive, ArrowDown, ArrowDownToLine, ArrowDownWideNarrow, ArrowLeft, ArrowRight, ArrowUp, ArrowUpDown, ArrowUpNarrowWide, Bell, BellOff, BetweenHorizontalStart, BetweenVerticalStart, Bold, BookOpen, Bot, Box, Bug, Building2, Calendar, Camera, CaseSensitive, ChartColumn, ChartSpline, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronsDownUp, ChevronsUpDown, ChevronUp, Circle, CircleAlert, CircleArrowRight, CircleHelp, Clipboard, ClipboardPaste, Clock, Cloud, CloudUpload, Code, Coins, Columns2, Contact, Copy, CopyMinus, CornerDownRight, CornerUpLeft, Cpu, Crown, Database, Download, Ellipsis, Eraser, ExternalLink, Eye, File, FileArchive, FileDiff, FilePlus, Files, FileText, Film, FlaskConical, Folder, FolderInput, FolderLock, FolderOpen, FolderPlus, FolderSearch, FolderTree, Forward, Gamepad2, Gauge, GitBranch, GitCommitHorizontal, Globe, Grip, Hand, HardDrive, Hash, Headphones, Heart, House, Image, ImagePlus, Info, Keyboard, KeyRound, Laptop, LayoutDashboard, Lightbulb, Link, List, ListChecks, ListTodo, ListTree, ListX, LoaderCircle, LocateFixed, Lock, MapIcon, Maximize, Maximize2, Megaphone, MemoryStick, MessageCircle, MessageSquareDot, MessageSquareText, MessagesSquare, Mic, Minimize2, Minus, Monitor, MonitorSmartphone, MousePointer2, MousePointerClick, Navigation, Package, PackageOpen, PaintBucket, Paperclip, Pencil, Phone, Pin, PinOff, Play, Plus, Pointer, Power, Presentation, Puzzle, QrCode, Quote, Radar, RefreshCw, Regex, Replace, ReplaceAll, Rocket, RotateCcw, Rows2, Save, Scan, ScanLine, ScrollText, Search, Send, Server, Share2, Sheet, Shield, ShieldAlert, ShieldCheck, Shuffle, Sigma, SlidersHorizontal, Smartphone, Snowflake, Sparkles, Square, SquareMinus, SquarePlus, SquareTerminal, Star, StarOff, Store, TableCellsMerge, Target, Text, ThumbsDown, ThumbsUp, Timer, Trash2, TrendingDown, TrendingUp, Trophy, Undo2, Unplug, Upload, User, UserPlus, Users, Volume2, WholeWord, Wrench, X, Zap, } from 'lucide-react';
|
|
1
|
+
import { AlarmClock, AlignCenter, AlignLeft, AlignRight, Aperture, AppWindow, Archive, ArrowDown, ArrowDownToLine, ArrowDownWideNarrow, ArrowLeft, ArrowRight, ArrowUp, ArrowUpDown, ArrowUpNarrowWide, Bell, BellOff, BetweenHorizontalStart, BetweenVerticalStart, Bold, BookOpen, Bot, Box, Bug, Building2, Calendar, Camera, CaseSensitive, ChartColumn, ChartSpline, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronsDownUp, ChevronsUpDown, ChevronUp, Circle, CircleAlert, CircleArrowRight, CircleHelp, Clipboard, ClipboardPaste, Clock, Cloud, CloudUpload, Code, Coins, Columns2, Contact, Copy, CopyMinus, CornerDownRight, CornerUpLeft, Cpu, Crown, Database, Download, Ellipsis, Eraser, ExternalLink, Eye, EyeOff, File, FileArchive, FileDiff, FilePlus, Files, FileText, Film, FlaskConical, Folder, FolderInput, FolderLock, FolderOpen, FolderPlus, FolderSearch, FolderTree, Forward, Gamepad2, Gauge, GitBranch, GitCommitHorizontal, Globe, Grip, Hand, HardDrive, Hash, Headphones, Heart, House, Image, ImagePlus, Info, Keyboard, KeyRound, Laptop, LayoutDashboard, Lightbulb, Link, List, ListChecks, ListTodo, ListTree, ListX, LoaderCircle, LocateFixed, Lock, MapIcon, Maximize, Maximize2, Megaphone, MemoryStick, MessageCircle, MessageSquareDot, MessageSquareText, MessagesSquare, Mic, Minimize2, Minus, Monitor, MonitorSmartphone, MousePointer2, MousePointerClick, Navigation, Package, PackageOpen, PaintBucket, Paperclip, Pencil, Phone, Pin, PinOff, Play, Plus, Pointer, Power, Presentation, Puzzle, QrCode, Quote, Radar, RefreshCw, Regex, Replace, ReplaceAll, Rocket, RotateCcw, Rows2, Save, Scan, ScanLine, ScrollText, Search, Send, Server, Share2, Sheet, Shield, ShieldAlert, ShieldCheck, Shuffle, Sigma, SlidersHorizontal, Smartphone, Snowflake, Sparkles, Square, SquareMinus, SquarePlus, SquareTerminal, Star, StarOff, Store, TableCellsMerge, Target, Text, ThumbsDown, ThumbsUp, Timer, Trash2, TrendingDown, TrendingUp, Trophy, Undo2, Unplug, Upload, User, UserPlus, Users, Volume2, WholeWord, Wrench, X, Zap, } from 'lucide-react';
|
|
2
2
|
/** The icons a web extension gets as `pi.ui.icons`; names are lucide's. Only add: removing one breaks extensions. */
|
|
3
3
|
export const WEB_ICONS = Object.freeze({
|
|
4
4
|
AlignCenter,
|
|
@@ -67,6 +67,7 @@ export const WEB_ICONS = Object.freeze({
|
|
|
67
67
|
Ellipsis,
|
|
68
68
|
ExternalLink,
|
|
69
69
|
Eye,
|
|
70
|
+
EyeOff,
|
|
70
71
|
File,
|
|
71
72
|
FileArchive,
|
|
72
73
|
FileDiff,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Part of the web extension API (web-extension-api.ts, which exports it all): what an extension registers, and what the page tells it of them. */
|
|
2
|
-
import type { TaRoomInfo } from '@celljs/ta-protocol';
|
|
2
|
+
import type { TaRoomInfo, TaTier } from '@celljs/ta-protocol';
|
|
3
3
|
import type * as React from 'react';
|
|
4
4
|
import type { WebIcon } from './web-extension-api.js';
|
|
5
5
|
export type * from './web-api-call.js';
|
|
@@ -23,6 +23,11 @@ export interface WebSettingsSection {
|
|
|
23
23
|
group?: WebSettingsGroup;
|
|
24
24
|
/** Smaller first among those of extensions in its group, then as registered; default 100 (negative: before Ta's). */
|
|
25
25
|
order?: number;
|
|
26
|
+
/**
|
|
27
|
+
* `common` for a section most people look for (docs/design/ta-simple.md 4.2), shown from the start; the others (the
|
|
28
|
+
* default) a row away, under More settings, and found by the search. Newer than some Ta apps, which show all.
|
|
29
|
+
*/
|
|
30
|
+
tier?: TaTier;
|
|
26
31
|
rows: WebSettingRow[];
|
|
27
32
|
/** A store of Settings → Storage (TaStorageInfo.id): its rows show under it there; older Ta apps list it as a section. */
|
|
28
33
|
storage?: string;
|
|
@@ -169,6 +169,12 @@ export interface WebPartnersUI {
|
|
|
169
169
|
* Ta apps: `pi.ui.openPartner?.(…)`.
|
|
170
170
|
*/
|
|
171
171
|
openPartner(id: string, kind?: WebPartnerKind): Promise<boolean>;
|
|
172
|
+
/**
|
|
173
|
+
* The partners of every extension as the page lists them, now and each time they change, until the function it
|
|
174
|
+
* returns is called: for what follows who the user works with (Screenshot mask hides the names of friends). Newer
|
|
175
|
+
* than some Ta apps: `pi.ui.onPartners?.(…)`.
|
|
176
|
+
*/
|
|
177
|
+
onPartners(listener: (partners: readonly WebPartnerEntry[]) => void): () => void;
|
|
172
178
|
/**
|
|
173
179
|
* Picks people as every picker of Ta does (WebPeoplePickerProps): never a `<select>` or checkboxes of one's own.
|
|
174
180
|
* Newer than some Ta apps: `pi.ui.PeoplePicker` may be missing.
|
|
@@ -154,6 +154,7 @@ export const WEB_UI_SPEC = {
|
|
|
154
154
|
openHome: page,
|
|
155
155
|
startGroup: page,
|
|
156
156
|
openPartner: page,
|
|
157
|
+
onPartners: page,
|
|
157
158
|
};
|
|
158
159
|
/** What each member of `pi` needs and how it crosses: one entry each, the only place it is said (3.2). */
|
|
159
160
|
export const WEB_API_SPEC = {
|
|
@@ -35,6 +35,15 @@ export var WebHomeUtil;
|
|
|
35
35
|
await partner.open();
|
|
36
36
|
return true;
|
|
37
37
|
},
|
|
38
|
+
onPartners: listener => {
|
|
39
|
+
const tell = () => {
|
|
40
|
+
if (!stopped()) {
|
|
41
|
+
listener(extensions.partners.partners());
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
tell();
|
|
45
|
+
return extensions.partners.subscribe(tell);
|
|
46
|
+
},
|
|
38
47
|
PeoplePicker,
|
|
39
48
|
};
|
|
40
49
|
}
|
|
@@ -23,6 +23,9 @@ export declare class WebMetrics {
|
|
|
23
23
|
dispose(): void;
|
|
24
24
|
/** One of `item` (`page:main`, `web:load`) of the package of `extension`. */
|
|
25
25
|
record(extension: string | undefined, item: string, err?: boolean, ms?: number): void;
|
|
26
|
+
/** One of `item` of Ta's own pages (`page:settings`, `step:first-reply`), in TA_METRICS_OWN. */
|
|
27
|
+
own(item: string, ms?: number): void;
|
|
28
|
+
protected add(pkg: string, item: string, err: boolean, ms: number | undefined): void;
|
|
26
29
|
/** What threw where an extension drew (ExtensionBoundary). */
|
|
27
30
|
renderError(extension: string | undefined): void;
|
|
28
31
|
/** What was counted, told when it may be; dropped when the service does not take it. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TA_METRICS_BATCH, TA_METRICS_BATCH_MS, TA_METRICS_BOUNDS, TaMetricsUtil } from '@celljs/ta-protocol';
|
|
1
|
+
import { TA_METRICS_BATCH, TA_METRICS_BATCH_MS, TA_METRICS_BOUNDS, TA_METRICS_OWN, TaMetricsUtil } from '@celljs/ta-protocol';
|
|
2
2
|
/** How often the page tells what it counted, when it changed; and when it is hidden, if it may by then. */
|
|
3
3
|
const FLUSH_MS = 60000;
|
|
4
4
|
/**
|
|
@@ -42,34 +42,45 @@ export class WebMetrics {
|
|
|
42
42
|
}
|
|
43
43
|
/** One of `item` (`page:main`, `web:load`) of the package of `extension`. */
|
|
44
44
|
record(extension, item, err = false, ms) {
|
|
45
|
-
var _a, _b;
|
|
46
45
|
try {
|
|
47
46
|
const pkg = extension === undefined ? undefined : this.packageOf(extension);
|
|
48
|
-
if (
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
const key = `${pkg}\u0000${item}`;
|
|
52
|
-
let one = this.counts.get(key);
|
|
53
|
-
if (!one) {
|
|
54
|
-
if (this.counts.size >= TA_METRICS_BATCH) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
one = { pkg, item, n: 0 };
|
|
58
|
-
this.counts.set(key, one);
|
|
59
|
-
}
|
|
60
|
-
one.n++;
|
|
61
|
-
if (err) {
|
|
62
|
-
one.err = ((_a = one.err) !== null && _a !== void 0 ? _a : 0) + 1;
|
|
63
|
-
}
|
|
64
|
-
if (ms !== undefined && Number.isFinite(ms) && ms >= 0) {
|
|
65
|
-
(_b = one.ms) !== null && _b !== void 0 ? _b : (one.ms = new Array(TA_METRICS_BOUNDS.length + 1).fill(0));
|
|
66
|
-
one.ms[TaMetricsUtil.bucket(ms)]++;
|
|
47
|
+
if (pkg) {
|
|
48
|
+
this.add(pkg, item, err, ms);
|
|
67
49
|
}
|
|
68
50
|
}
|
|
69
|
-
catch (
|
|
51
|
+
catch (_a) {
|
|
70
52
|
// Never to what it counts.
|
|
71
53
|
}
|
|
72
54
|
}
|
|
55
|
+
/** One of `item` of Ta's own pages (`page:settings`, `step:first-reply`), in TA_METRICS_OWN. */
|
|
56
|
+
own(item, ms) {
|
|
57
|
+
try {
|
|
58
|
+
this.add(TA_METRICS_OWN, item, false, ms);
|
|
59
|
+
}
|
|
60
|
+
catch (_a) {
|
|
61
|
+
// Never to what it counts.
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
add(pkg, item, err, ms) {
|
|
65
|
+
var _a, _b;
|
|
66
|
+
const key = `${pkg}\u0000${item}`;
|
|
67
|
+
let one = this.counts.get(key);
|
|
68
|
+
if (!one) {
|
|
69
|
+
if (this.counts.size >= TA_METRICS_BATCH) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
one = { pkg, item, n: 0 };
|
|
73
|
+
this.counts.set(key, one);
|
|
74
|
+
}
|
|
75
|
+
one.n++;
|
|
76
|
+
if (err) {
|
|
77
|
+
one.err = ((_a = one.err) !== null && _a !== void 0 ? _a : 0) + 1;
|
|
78
|
+
}
|
|
79
|
+
if (ms !== undefined && Number.isFinite(ms) && ms >= 0) {
|
|
80
|
+
(_b = one.ms) !== null && _b !== void 0 ? _b : (one.ms = new Array(TA_METRICS_BOUNDS.length + 1).fill(0));
|
|
81
|
+
one.ms[TaMetricsUtil.bucket(ms)]++;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
73
84
|
/** What threw where an extension drew (ExtensionBoundary). */
|
|
74
85
|
renderError(extension) {
|
|
75
86
|
this.record(extension, 'render:view', true);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TaTemporaryInfo, TaWebExtensionInfo } from '@celljs/ta-protocol';
|
|
1
|
+
import type { TaTemporaryInfo, TaTier, TaWebExtensionInfo } from '@celljs/ta-protocol';
|
|
2
2
|
import type { StateSpec } from '../state/state-protocol.js';
|
|
3
3
|
import type { WebIcon } from './web-extension-api.js';
|
|
4
4
|
import { type WebViewEntry } from './web-extension-protocol.js';
|
|
@@ -42,6 +42,8 @@ export interface WebPageInfo {
|
|
|
42
42
|
category?: string;
|
|
43
43
|
/** Its group under Discover: WebView.group, or `pi.group` of its package for one started on open (TaWebExtensionInfo.group). */
|
|
44
44
|
group?: string;
|
|
45
|
+
/** `pi.tier` of its package (TaWebExtensionInfo.tier): who it is for, as Discover lists it (DiscoverUtil.split). */
|
|
46
|
+
tier?: TaTier;
|
|
45
47
|
/** For a page of a temporary package: `id` is that of its web extension, for `packages.updateTemporaryPackage` and the rest. */
|
|
46
48
|
temporary?: TaTemporaryInfo & {
|
|
47
49
|
id: string;
|
|
@@ -60,6 +60,7 @@ export var WebPagesUtil;
|
|
|
60
60
|
const own = (info) => ({
|
|
61
61
|
...(info && info.origin !== 'builtin' ? { extensionId: info.id, source: info.source } : {}),
|
|
62
62
|
...((info === null || info === void 0 ? void 0 : info.category) ? { category: info.category } : {}),
|
|
63
|
+
...((info === null || info === void 0 ? void 0 : info.tier) ? { tier: info.tier } : {}),
|
|
63
64
|
});
|
|
64
65
|
const lazy = new Set(onOpen.map(entry => entry.info.id));
|
|
65
66
|
const pages = views
|
|
@@ -2,12 +2,13 @@ import { ChevronRight, RefreshCw } from 'lucide-react';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useBusy } from '../components/busy.js';
|
|
4
4
|
import { Callout } from '../components/callout.js';
|
|
5
|
+
import { useConversationScroll } from '../components/conversation-scroll-hooks.js';
|
|
5
6
|
import { Icon, IconButton } from '../components/icon.js';
|
|
6
7
|
import { Loading } from '../components/loading.js';
|
|
7
8
|
import { useNotices, useWorkbench } from '../hooks.js';
|
|
8
9
|
import { useLanguage, useT } from '../i18n/use-t.js';
|
|
9
10
|
import { TerminalText } from '../util/terminal-text.js';
|
|
10
|
-
import { Bar, Card, Section, Stats,
|
|
11
|
+
import { Bar, Card, REFRESH_MS, Section, Stats, useConsoleValue } from './console-parts.js';
|
|
11
12
|
import { ConsoleUtil } from './console-util.js';
|
|
12
13
|
/* What a tenant's agents do (its conversations, each one's latest calls) and the log of its sandbox. */
|
|
13
14
|
const AGENT_STATUS = {
|
|
@@ -21,7 +22,7 @@ function ActivityList({ tenantId, sessionId }) {
|
|
|
21
22
|
const t = useT();
|
|
22
23
|
const language = useLanguage();
|
|
23
24
|
const [, bench] = useWorkbench();
|
|
24
|
-
const { value, error } =
|
|
25
|
+
const { value, error } = useConsoleValue(() => bench.gateway.getAgentActivity(tenantId, sessionId), `${tenantId}|${sessionId}`, REFRESH_MS);
|
|
25
26
|
if (error && !value) {
|
|
26
27
|
return React.createElement("p", { className: "ta-console-activity-empty" }, error);
|
|
27
28
|
}
|
|
@@ -85,7 +86,7 @@ export function AgentsSection({ tenant }) {
|
|
|
85
86
|
const [, bench] = useWorkbench();
|
|
86
87
|
const own = tenant.environment.provider === 'own';
|
|
87
88
|
const running = tenant.environment.status === 'running' && !own;
|
|
88
|
-
const { value: agents, error } =
|
|
89
|
+
const { value: agents, error } = useConsoleValue(() => (running ? bench.gateway.getTenantAgents(tenant.id) : Promise.resolve(undefined)), `${tenant.id}|${running}`, REFRESH_MS);
|
|
89
90
|
const totals = agents === null || agents === void 0 ? void 0 : agents.totals;
|
|
90
91
|
return (React.createElement(Section, { title: t('ta.console.agents'), hint: running && agents ? t('ta.console.agentsPrivacy') : undefined }, !running ? (React.createElement(Card, null,
|
|
91
92
|
React.createElement("p", { className: "ta-console-empty" }, own ? t('ta.console.agentsOwn') : t('ta.console.agentsStopped')))) : error && !agents ? (React.createElement(Callout, { level: "warning" }, error)) : !agents ? (React.createElement(Loading, { compact: true })) : (React.createElement(React.Fragment, null,
|
|
@@ -105,24 +106,19 @@ export function LogsSection({ tenant, info }) {
|
|
|
105
106
|
const [, notices] = useNotices();
|
|
106
107
|
const [logs, setLogs] = React.useState();
|
|
107
108
|
const [busy, run] = useBusy();
|
|
108
|
-
const box = React.useRef(null);
|
|
109
109
|
const hasLogs = tenant.environment.provider !== 'own' && info.providers.some(provider => provider.id === tenant.environment.provider && provider.logs);
|
|
110
|
-
const read =
|
|
111
|
-
// The latest lines are what one looks for: the box starts at its end.
|
|
112
|
-
|
|
113
|
-
React.useLayoutEffect(() => {
|
|
114
|
-
if (box.current) {
|
|
115
|
-
box.current.scrollTop = box.current.scrollHeight;
|
|
116
|
-
}
|
|
117
|
-
}, [logs]);
|
|
110
|
+
const read = () => bench.gateway.getTenantLogs(tenant.id, 300).then(text => setLogs(TerminalText.plain(text).trimEnd()), error => notices.error(error));
|
|
111
|
+
// The latest lines are what one looks for: the box starts at its end, again as other lines are read.
|
|
112
|
+
const box = useConversationScroll(0, { sentTo: 'bottom', key: logs });
|
|
118
113
|
if (!hasLogs) {
|
|
119
114
|
return null;
|
|
120
115
|
}
|
|
121
|
-
return (React.createElement(Section, { title: t('ta.console.logs'), action: logs !== undefined ? React.createElement(IconButton, { icon: RefreshCw, label: t('ta.console.refresh'), busy: busy, onClick: () => void read
|
|
122
|
-
React.createElement("button", { type: "button", className: `ta-console-entry ta-console-press${busy ? ' ta-busy' : ''}`, onClick: () => void read
|
|
116
|
+
return (React.createElement(Section, { title: t('ta.console.logs'), action: logs !== undefined ? React.createElement(IconButton, { icon: RefreshCw, label: t('ta.console.refresh'), busy: busy, onClick: () => void run(read) }) : undefined }, logs === undefined ? (React.createElement(Card, null,
|
|
117
|
+
React.createElement("button", { type: "button", className: `ta-console-entry ta-console-press${busy ? ' ta-busy' : ''}`, onClick: () => void run(read) },
|
|
123
118
|
React.createElement("span", { className: "ta-console-entry-text" },
|
|
124
119
|
React.createElement("span", { className: "ta-console-entry-label" }, t('ta.console.logsShow')),
|
|
125
120
|
React.createElement("span", { className: "ta-console-entry-hint" }, t('ta.console.logsAudited'))),
|
|
126
|
-
busy ? (React.createElement("span", { className: "ta-spinner ta-busy-mark", "aria-hidden": "true" })) : (React.createElement(Icon, { icon: ChevronRight, size: 15, className: "ta-console-chevron" }))))) : (React.createElement("
|
|
121
|
+
busy ? (React.createElement("span", { className: "ta-spinner ta-busy-mark", "aria-hidden": "true" })) : (React.createElement(Icon, { icon: ChevronRight, size: 15, className: "ta-console-chevron" }))))) : (React.createElement("div", { ref: box, className: "ta-console-logs" },
|
|
122
|
+
React.createElement("pre", null, logs || t('ta.console.logsEmpty'))))));
|
|
127
123
|
}
|
|
128
124
|
//# sourceMappingURL=console-agents.js.map
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type TaEnvironmentStatus, type TaQuotaState } from '@celljs/ta-protocol';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
/** How often what the console shows is read again while it is seen. */
|
|
3
|
+
/** How often what the console shows that the gateway cannot know (the agents at work in a tenant's Ta) is read again while it is seen. */
|
|
4
4
|
export declare const REFRESH_MS = 10000;
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Reads `load` now, again as the gateway tells what it keeps changed (TaServeChanges.GATEWAY) and when `key` changes;
|
|
7
|
+
* `every` ms too while seen, for what it shows that the gateway cannot know.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useConsoleValue<T>(load: () => Promise<T>, key: unknown, every?: number): {
|
|
7
10
|
value: T | undefined;
|
|
8
11
|
error: string | undefined;
|
|
9
12
|
read: () => Promise<void>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { TaServeChanges } from '@celljs/ta-protocol';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import { AccountAvatar } from '../components/access-view.js';
|
|
4
|
+
import { useServeValue } from '../components/serve-value.js';
|
|
3
5
|
import { useLanguage, useT } from '../i18n/use-t.js';
|
|
4
6
|
import { ConsoleUtil } from './console-util.js';
|
|
5
7
|
/*
|
|
@@ -7,27 +9,16 @@ import { ConsoleUtil } from './console-util.js';
|
|
|
7
9
|
* card holds rows parted by lines (`Card`), numbers side by side are one strip (`Stats`), and what is used of a
|
|
8
10
|
* limit is a row with a bar (`MeterRow`).
|
|
9
11
|
*/
|
|
10
|
-
/** How often what the console shows is read again while it is seen. */
|
|
12
|
+
/** How often what the console shows that the gateway cannot know (the agents at work in a tenant's Ta) is read again while it is seen. */
|
|
11
13
|
export const REFRESH_MS = 10000;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
setValue(next);
|
|
21
|
-
setError(undefined);
|
|
22
|
-
setReadAt(Date.now());
|
|
23
|
-
}, (cause) => setError(cause.message)), []);
|
|
24
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies: read again whenever what is read changes
|
|
25
|
-
React.useEffect(() => {
|
|
26
|
-
setValue(undefined);
|
|
27
|
-
void read();
|
|
28
|
-
const timer = setInterval(() => document.visibilityState === 'visible' && void read(), every);
|
|
29
|
-
return () => clearInterval(timer);
|
|
30
|
-
}, [key, read, every]);
|
|
14
|
+
const TOPICS = [TaServeChanges.GATEWAY];
|
|
15
|
+
/**
|
|
16
|
+
* Reads `load` now, again as the gateway tells what it keeps changed (TaServeChanges.GATEWAY) and when `key` changes;
|
|
17
|
+
* `every` ms too while seen, for what it shows that the gateway cannot know.
|
|
18
|
+
*/
|
|
19
|
+
export function useConsoleValue(load, key, every) {
|
|
20
|
+
const { value, failed, read, readAt } = useServeValue(load, { key, topics: TOPICS, every });
|
|
21
|
+
const error = failed === undefined ? undefined : failed instanceof Error ? failed.message : String(failed);
|
|
31
22
|
return { value, error, read, readAt };
|
|
32
23
|
}
|
|
33
24
|
/** A title over what it is the title of; `action` on the right of the title, `hint` under the content. */
|
|
@@ -4,7 +4,7 @@ import { Loading } from '../components/loading.js';
|
|
|
4
4
|
import { Segmented } from '../components/settings-controls.js';
|
|
5
5
|
import { useWorkbench } from '../hooks.js';
|
|
6
6
|
import { useLanguage, useT } from '../i18n/use-t.js';
|
|
7
|
-
import { Bar,
|
|
7
|
+
import { Bar, useConsoleValue } from './console-parts.js';
|
|
8
8
|
import { ConsoleUtil } from './console-util.js';
|
|
9
9
|
const RANGES = [
|
|
10
10
|
{ value: '1', label: 'ta.console.range1' },
|
|
@@ -69,7 +69,7 @@ export function TrendCard({ tenantId, tenants, onTenant }) {
|
|
|
69
69
|
const [, bench] = useWorkbench();
|
|
70
70
|
const [range, setRange] = React.useState(7);
|
|
71
71
|
const [metric, setMetric] = React.useState('tokens');
|
|
72
|
-
const { value: trend, error } =
|
|
72
|
+
const { value: trend, error } = useConsoleValue(() => bench.gateway.getUsageTrend(range === 1 ? 2 : range, tenantId), `${range}|${tenantId}`);
|
|
73
73
|
const points = trend ? ConsoleUtil.points(trend, range) : undefined;
|
|
74
74
|
const totals = points === null || points === void 0 ? void 0 : points.reduce((sum, point) => ({ tokens: sum.tokens + point.tokens, cost: sum.cost + point.cost, turns: sum.turns + point.turns }), {
|
|
75
75
|
tokens: 0,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RefreshCw } from 'lucide-react';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { useBusy } from '../components/busy.js';
|
|
3
|
+
import { BusyMark, useBusy } from '../components/busy.js';
|
|
4
4
|
import { Callout } from '../components/callout.js';
|
|
5
5
|
import { Icon } from '../components/icon.js';
|
|
6
6
|
import { useNotices, useWorkbench } from '../hooks.js';
|
|
@@ -38,13 +38,15 @@ export function UpdatesCallout({ info, onChanged }) {
|
|
|
38
38
|
confirmLabel: t('ta.console.updateAll'),
|
|
39
39
|
});
|
|
40
40
|
if (confirmed) {
|
|
41
|
-
await
|
|
41
|
+
await bench.gateway
|
|
42
42
|
.updateTenants()
|
|
43
43
|
.then(onChanged)
|
|
44
|
-
.catch(error => notices.error(error))
|
|
44
|
+
.catch(error => notices.error(error));
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
|
-
return (React.createElement(Callout, { level: "info", action: React.createElement("button", { type: "button", className: `ta-link-button${busy ? ' ta-busy' : ''}`, disabled: busy, onClick: () => void
|
|
47
|
+
return (React.createElement(Callout, { level: "info", action: React.createElement("button", { type: "button", className: `ta-link-button${busy ? ' ta-busy' : ''}`, disabled: busy, onClick: () => void run(updateAll) },
|
|
48
|
+
React.createElement(BusyMark, { busy: busy }),
|
|
49
|
+
t('ta.console.updateAll')) }, t('ta.console.updatesAvailable', { count: behind.length, version })));
|
|
48
50
|
}
|
|
49
51
|
/** When running Ta move to a newer version, picked as a limit is; and a look for a newer one now. */
|
|
50
52
|
export function UpdatesSection({ info, onChanged }) {
|